Skip to content

Commit

Permalink
fix: Update comments in index files (#1414)
Browse files Browse the repository at this point in the history
* add comments in index files

* change signature in firebase-admin-node

* small fixes

* small fixes

* fixes
  • Loading branch information
xil222 committed Aug 19, 2021
1 parent 973e68b commit e7ab2f0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion etc/firebase-admin.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export namespace auth {
updateProviderConfig(providerId: string, updatedConfig: UpdateAuthProviderRequest): Promise<AuthProviderConfig>;
updateUser(uid: string, properties: UpdateRequest): Promise<UserRecord>;
verifyIdToken(idToken: string, checkRevoked?: boolean): Promise<DecodedIdToken>;
verifySessionCookie(sessionCookie: string, checkForRevocation?: boolean): Promise<DecodedIdToken>;
verifySessionCookie(sessionCookie: string, checkRevoked?: boolean): Promise<DecodedIdToken>;
}
export interface BaseAuthProviderConfig {
displayName?: string;
Expand Down
16 changes: 8 additions & 8 deletions src/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ export class BaseAuth<T extends AbstractAuthRequestHandler> implements BaseAuthI
}

/**
* Verifies a JWT auth token. Returns a promise with the tokens claims.
* Verifies a JWT auth token. Returns a promise with the token‘s claims.
* Rejects the promise if the token cannot be verified.
* If `checkRevoked` is set to true, first verifies whether the corresponding
* user is disabled.
* If yes, an auth/user-disabled error is thrown.
* If yes, an `auth/user-disabled` error is thrown.
* If no, verifies if the session corresponding to the ID token was revoked.
* If the corresponding user's session was invalidated, an
* auth/id-token-revoked error is thrown.
* `auth/id-token-revoked` error is thrown.
* If not specified the check is not applied.
*
* @param {string} idToken The JWT to verify.
Expand Down Expand Up @@ -510,15 +510,15 @@ export class BaseAuth<T extends AbstractAuthRequestHandler> implements BaseAuthI
}

/**
* Verifies a Firebase session cookie. Returns a promise with the tokens claims.
* Verifies a Firebase session cookie. Returns a promise with the token’s claims.
* Rejects the promise if the cookie could not be verified.
* If `checkRevoked` is set to true, first verifies whether the corresponding
* user is disabled:
* If yes, an auth/user-disabled error is thrown.
* If yes, an `auth/user-disabled` error is thrown.
* If no, verifies if the session corresponding to the session cookie was
* revoked.
* If the corresponding user's session was invalidated, an
* auth/session-cookie-revoked error is thrown.
* `auth/session-cookie-revoked` error is thrown.
* If not specified the check is not performed.
*
* @param {string} sessionCookie The session cookie to verify.
Expand Down Expand Up @@ -797,7 +797,7 @@ export class TenantAwareAuth
* Verifies a JWT auth token. Returns a promise with the tokens claims. Rejects
* the promise if the token could not be verified. If checkRevoked is set to true,
* verifies if the session corresponding to the ID token was revoked. If the corresponding
* user's session was invalidated, an auth/id-token-revoked error is thrown. If not specified
* user's session was invalidated, an `auth/id-token-revoked` error is thrown. If not specified
* the check is not applied.
*
* @param {string} idToken The JWT to verify.
Expand Down Expand Up @@ -848,7 +848,7 @@ export class TenantAwareAuth
* Verifies a Firebase session cookie. Returns a promise with the tokens claims. Rejects
* the promise if the token could not be verified. If checkRevoked is set to true,
* verifies if the session corresponding to the session cookie was revoked. If the corresponding
* user's session was invalidated, an auth/session-cookie-revoked error is thrown. If not
* user's session was invalidated, an `auth/session-cookie-revoked` error is thrown. If not
* specified the check is not performed.
*
* @param {string} sessionCookie The session cookie to verify.
Expand Down
34 changes: 21 additions & 13 deletions src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1707,11 +1707,15 @@ export namespace auth {
updateUser(uid: string, properties: UpdateRequest): Promise<UserRecord>;

/**
* Verifies a Firebase ID token (JWT). If the token is valid, the promise is
* fulfilled with the token's decoded claims; otherwise, the promise is
* rejected.
* An optional flag can be passed to additionally check whether the ID token
* was revoked.
* Verifies a JWT auth token. Returns a promise with the token‘s claims.
* Rejects the promise if the token cannot be verified.
* If `checkRevoked` is set to true, first verifies whether the corresponding
* user is disabled.
* If yes, an `auth/user-disabled` error is thrown.
* If no, verifies if the session corresponding to the ID token was revoked.
* If the corresponding user's session was invalidated, an
* `auth/id-token-revoked` error is thrown.
* If not specified the check is not applied.
*
* See [Verify ID Tokens](/docs/auth/admin/verify-id-tokens) for code samples
* and detailed documentation.
Expand Down Expand Up @@ -1821,18 +1825,22 @@ export namespace auth {
): Promise<string>;

/**
* Verifies a Firebase session cookie. Returns a Promise with the cookie claims.
* Rejects the promise if the cookie could not be verified. If `checkRevoked` is
* set to true, verifies if the session corresponding to the session cookie was
* revoked. If the corresponding user's session was revoked, an
* `auth/session-cookie-revoked` error is thrown. If not specified the check is
* not performed.
* Verifies a Firebase session cookie. Returns a promise with the token’s claims.
* Rejects the promise if the cookie could not be verified.
* If `checkRevoked` is set to true, first verifies whether the corresponding
* user is disabled:
* If yes, an `auth/user-disabled` error is thrown.
* If no, verifies if the session corresponding to the session cookie was
* revoked.
* If the corresponding user's session was invalidated, an
* `auth/session-cookie-revoked` error is thrown.
* If not specified the check is not performed.
*
* See [Verify Session Cookies](/docs/auth/admin/manage-cookies#verify_session_cookie_and_check_permissions)
* for code samples and detailed documentation
*
* @param sessionCookie The session cookie to verify.
* @param checkForRevocation Whether to check if the session cookie was
* @param checkRevoked Whether to check if the session cookie was
* revoked. This requires an extra request to the Firebase Auth backend to
* check the `tokensValidAfterTime` time for the corresponding user.
* When not specified, this additional check is not performed.
Expand All @@ -1843,7 +1851,7 @@ export namespace auth {
*/
verifySessionCookie(
sessionCookie: string,
checkForRevocation?: boolean,
checkRevoked?: boolean,
): Promise<DecodedIdToken>;

/**
Expand Down

0 comments on commit e7ab2f0

Please sign in to comment.