diff --git a/package.json b/package.json index e35aafc..7645473 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "scripts": { "start": "gulp dev", "prebuild": "rm -rf build", - "build": "microbundle --target web --external none", + "build": "microbundle --target web --external none --generateTypes false", "postbuild": "node scripts/print-bundle-size", "test": "cross-env NODE_ENV=test mocha --require @babel/register test/**/*.test.js --exit", "test:watch": "cross-env NODE_ENV=test mocha --require @babel/register --watch --reporter min test/*.test.js", diff --git a/types/index.d.ts b/types/index.d.ts index 910cffb..71c1d5e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -74,11 +74,13 @@ declare class IdTokenVerifier { jwksURI: any; maxAge: any; __clock: any; + /** * @callback verifyCallback * @param {?Error} err error returned if the verify cannot be performed * @param {?object} payload payload returned if the token is valid */ + /** * Verifies an id_token * @@ -90,10 +92,25 @@ declare class IdTokenVerifier { * * @method verify * @param {string} token id_token to verify - * @param {string} [requestedNonce] nonce value that should match the one in the id_token claims + * @param {string} requestedNonce nonce value that should match the one in the id_token claims * @param {verifyCallback} cb callback used to notify the results of the validation */ - verify(token: string, requestedNonce?: string, cb: verifyCallback): any; + verify(token: string, requestedNonce: string, cb: verifyCallback): any; + + /** + * Verifies an id_token + * + * It will validate: + * - signature according to the algorithm configured in the verifier. + * - if `iss` and `aud` claims matches the configured issuer and audience + * - if token is not expired and valid (if the `nbf` claim is in the past) + * + * @method verify + * @param {string} token id_token to verify + * @param {verifyCallback} cb callback used to notify the results of the validation + */ + verify(token: string, cb: verifyCallback): any; + getRsaVerifier(iss: any, kid: any, cb: any): void; /** * @typedef DecodedToken