@vonage/jwt
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -8,1 +8,2 @@ /// <reference types="node" /> | ||
export declare function tokenGenerate(applicationId: string, privateKey: string | Buffer, opts?: GeneratorOptions): string; | ||
export declare function verifySignature(token: string, privateKey: string | Buffer): boolean; |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.tokenGenerate = exports.JWT = void 0; | ||
exports.verifySignature = exports.tokenGenerate = exports.JWT = void 0; | ||
const jwt_1 = require("./jwt"); | ||
@@ -28,2 +28,6 @@ Object.defineProperty(exports, "JWT", { enumerable: true, get: function () { return jwt_1.JWT; } }); | ||
exports.tokenGenerate = tokenGenerate; | ||
function verifySignature(token, privateKey) { | ||
return instance.verifySignature(token, privateKey); | ||
} | ||
exports.verifySignature = verifySignature; | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,4 @@ /// <reference types="node" /> | ||
tokenGenerate(applicationId: string, privateKey: string | Buffer, opts?: GeneratorOptions): string; | ||
verifySignature(jwt: string, privateKey: string | Buffer): boolean; | ||
private validateOptions; | ||
} |
@@ -36,2 +36,14 @@ "use strict"; | ||
} | ||
verifySignature(jwt, privateKey) { | ||
try { | ||
(0, jsonwebtoken_1.verify)(jwt, privateKey, { | ||
algorithms: ['RS256'], | ||
}); | ||
return true; | ||
} | ||
catch (error) { | ||
log('Error when verifying token', error); | ||
} | ||
return false; | ||
} | ||
validateOptions(opts) { | ||
@@ -38,0 +50,0 @@ const now = parseInt((Date.now() / 1000).toString(), 10); |
{ | ||
"name": "@vonage/jwt", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Vonage JWT package. Creates JWT tokens for Vonage API's", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/vonage/vonage-node-sdk/tree/master/packages/jwt#readme", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15294
223