The type definition for jsonwebtoken
.
typings install --save jsonwebtoken
import {sign, verify, TokenExpiredError} from 'jsonwebtoken';
const token = sign({ foo: 'bar' }, 'shhhhh');
try {
const decoded = verify(token, 'shhhhh');
} catch (err) {
if (err instanceof TokenExpiredError) {
// do something
}
}
MIT