Created
January 20, 2018 15:44
-
-
Save davidbarral/6678d895b82207128ab024c9d160e947 to your computer and use it in GitHub Desktop.
Promisify: initial code
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
const jwt = require("jsonwebtoken"); | |
const verifyToken = token => new Promise((resolve, reject) => { | |
jwt.verify(token, CERTIFICATE, { algorithms: ["RS256"] }, (error, payload) => { | |
if (error) { | |
reject(error); | |
} else { | |
resolve(payload); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment