Created
August 10, 2020 05:55
-
-
Save harveyconnor/eaadcb5e465a96e4211aa562541231a8 to your computer and use it in GitHub Desktop.
Async JWT Verify for TypeScript/JS
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
export async function jwtVerify(token: string, secret: string): Promise<any> { | |
return new Promise((resolve, reject) => { | |
verify(token, secret, (err, decoded) => { | |
if (err) return reject(err); | |
resolve(decoded); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good ! usefull.