From 3281689142837b5d9d07384e1ab7eb0ecf3d6125 Mon Sep 17 00:00:00 2001 From: Josh Woodcock Date: Tue, 13 Feb 2018 10:54:48 -0600 Subject: [PATCH] Add and update MFA typescript interface for CognitoUser (#279) * add and update missing and inconsistent typescript interfaces for CognitoUser * ignore intellij settings --- .gitignore | 1 + packages/amazon-cognito-identity-js/index.d.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9ba75118832..dbdc991810b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ node_modules/** packages/*/node_modules/** .DS_Store .vscode +.idea *.log \ No newline at end of file diff --git a/packages/amazon-cognito-identity-js/index.d.ts b/packages/amazon-cognito-identity-js/index.d.ts index 3bb86faa4f8..a07bdbb5dfd 100644 --- a/packages/amazon-cognito-identity-js/index.d.ts +++ b/packages/amazon-cognito-identity-js/index.d.ts @@ -48,7 +48,10 @@ declare module "amazon-cognito-identity-js" { onFailure: (err: any) => void, newPasswordRequired?: (userAttributes: any, requiredAttributes: any) => void, mfaRequired?: (challengeName: any, challengeParameters: any) => void, - customChallenge?: (challengeParameters: any) => void + totpRequired?: (challengeName: any, challengeParameters: any) => void, + customChallenge?: (challengeParameters: any) => void, + mfaSetup?: (challengeName: any, challengeParameters: any) => void, + selectMFAType?: (challengeName: any, challengeParameters: any) => void }): void; public confirmRegistration(code: string, forceAliasCreation: boolean, callback: NodeCallback): void; public sendCustomChallengeAnswer(answerChallenge: any, callback:NodeCallback):void; @@ -59,8 +62,8 @@ declare module "amazon-cognito-identity-js" { public setDeviceStatusRemembered(callbacks: { onSuccess: (success: string) => void, onFailure: (err: any) => void }): void; public setDeviceStatusNotRemembered(callbacks: { onSuccess: (success: string) => void, onFailure: (err: any) => void }): void; public getDevice(callbacks: {onSuccess: (success: string) => void, onFailure: (err: Error) => void}): any; + public sendMFACode(confirmationCode: string, callbacks: { onSuccess: (session: CognitoUserSession) => void, onFailure: (err: any) => void }, mfaType: string): void; public listDevices(limit: number, paginationToken: string, callbacks: {onSuccess: (data: any) => void, onFailure: (err: Error) => void}): void; - public sendMFACode(confirmationCode: string, callbacks: { onSuccess: (session: CognitoUserSession) => void, onFailure: (err: any) => void }): void; public completeNewPasswordChallenge(newPassword: string, requiredAttributeData: any, callbacks: { @@ -80,6 +83,12 @@ declare module "amazon-cognito-identity-js" { public enableMFA(callback: NodeCallback): void; public disableMFA(callback: NodeCallback): void; public getMFAOptions(callback: NodeCallback): void; + public associateSoftwareToken( + callbacks: { + associateSecretCode: (secretCode: string) => void, + onFailure: (err: any) => void + }); + public verifySoftwareToken(totpCode, friendlyDeviceName, callbacks: {onSuccess: (session: CognitoUserSession) => void, onFailure: (err: Error) => void}): any; } export interface MFAOption {