diff --git a/packages/amazon-cognito-identity-js/index.d.ts b/packages/amazon-cognito-identity-js/index.d.ts index e5d6e99d12f..f3b90b2893b 100644 --- a/packages/amazon-cognito-identity-js/index.d.ts +++ b/packages/amazon-cognito-identity-js/index.d.ts @@ -76,6 +76,12 @@ declare module 'amazon-cognito-identity-js' { clientMetadata: Record; } + export enum AuthenticationFlowType { + USER_SRP_AUTH = 'USER_SRP_AUTH', + USER_PASSWORD_AUTH = 'USER_PASSWORD_AUTH', + CUSTOM_AUTH = 'CUSTOM_AUTH', + } + export type ChallengeName = | 'CUSTOM_CHALLENGE' | 'MFA_SETUP' @@ -324,7 +330,13 @@ declare module 'amazon-cognito-identity-js' { AdvancedSecurityDataCollectionFlag?: boolean; } - export class CognitoUserPool { + export interface CognitoUserPool { + advancedSecurityDataCollectionFlag: boolean; + clientId: string; + userPoolId: string; + } + + export class CognitoUserPool implements CognitoUserPool { constructor( data: ICognitoUserPoolData, wrapRefreshSessionCallback?: ( @@ -332,6 +344,10 @@ declare module 'amazon-cognito-identity-js' { ) => NodeCallback.Any ); + public clientId: string; + public userPoolId: string; + public advancedSecurityDataCollectionFlag: boolean; + public getUserPoolId(): string; public getClientId(): string; @@ -366,31 +382,50 @@ declare module 'amazon-cognito-identity-js' { public config: AWS.CognitoIdentityServiceProvider.Types.ClientConfiguration; } */ - export class CognitoAccessToken { + + export interface CognitoAccessToken { + jwtToken: string; payload: { [key: string]: any }; + } + export class CognitoAccessToken implements CognitoAccessToken { constructor({ AccessToken }: { AccessToken: string }); + public jwtToken: string; + public payload: CognitoAccessToken['payload']; + public getJwtToken(): string; public getExpiration(): number; public getIssuedAt(): number; public decodePayload(): { [id: string]: any }; } - export class CognitoIdToken { + export interface CognitoIdToken { + jwtToken: string; payload: { [key: string]: any }; + } + export class CognitoIdToken implements CognitoIdToken { constructor({ IdToken }: { IdToken: string }); + public jwtToken: string; + public payload: CognitoIdToken['payload']; + public getJwtToken(): string; public getExpiration(): number; public getIssuedAt(): number; public decodePayload(): { [id: string]: any }; } - export class CognitoRefreshToken { + export interface CognitoRefreshToken { + token: string; + } + + export class CognitoRefreshToken implements CognitoRefreshToken { constructor({ RefreshToken }: { RefreshToken: string }); + public token: string; + public getToken(): string; }