Include complete API and frontend sources for unified deployment
This commit is contained in:
1 parent
627b0ae60e
commit
d8fcae32b0
93 files changed
+53270
-3
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import jwt from 'jsonwebtoken';
|
||||
|
||||
const issuer = 'HackathonApp';
|
||||
const audience = process.env.WEB_SERVICE;
|
||||
|
||||
export default {
|
||||
generate(payload = {}, options = {}) {
|
||||
if (!payload.iat) payload.iat = Math.round(+new Date() / 1000);
|
||||
|
||||
return {
|
||||
jwt: jwt.sign(payload, process.env.JWT_KEY, { issuer, audience, ...options }),
|
||||
iat: payload.iat,
|
||||
};
|
||||
},
|
||||
|
||||
verify(key) {
|
||||
return jwt.verify(key, process.env.JWT_KEY, { issuer, audience });
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user