This repository has been archived by the owner on Aug 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
95 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,7 @@ db/ | |
*.toc | ||
|
||
# ignoring the DS store | ||
.DS_Store | ||
.DS_Store | ||
|
||
# ignoring the certificates!! | ||
certs/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem | ||
openssl x509 -text -noout -in certificate.pem | ||
openssl pkcs12 -inkey key.pem -in certificate.pem -export -out certificate.p12 # gyroscope: subject to change | ||
openssl pkcs12 -in certificate.p12 -noout -info | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { JWTsignOptions, JWTverifyOptions, JWTsecret } = require('../config'); | ||
const jwt = require('jsonwebtoken'); | ||
|
||
/** | ||
* Signs a token using JWT. | ||
* @param {string} username Username as subject of payload. | ||
* @param {object} payload The other session information stored in payload. | ||
*/ | ||
const sign = (payload) => { | ||
return jwt.sign(payload, JWTsecret.private, { | ||
...JWTsignOptions, | ||
}); | ||
}; | ||
|
||
/** | ||
* Verifies and returns the payload of the JWT token. | ||
* @param {string} token The JWT token to verify. | ||
*/ | ||
const verify = (token) => { | ||
return jwt.verify(token, JWTsecret.public, { | ||
...JWTverifyOptions, | ||
}); | ||
}; | ||
|
||
module.exports = { sign, verify } |