import { AuthenticationTokenProvider } from './AuthenticationTokenProvider'; import { AuthenticationClientOptions, IMfaAssociation, IMfaAuthenticators, IMfaConfirmAssociation, IMfaDeleteAssociation, TotpSource } from './types'; import { HttpClient } from '../common/HttpClient'; import { User } from '../..'; import { BaseAuthenticationClient } from './BaseAuthenticationClient'; /** * @class MfaAuthenticationClient * @description This client is used for binding TOTP MFA authenticator, unbinding TOTP MFA authenticator, binding user face, unbinding face, and user secondary authentication. * * binding TOTP MFA authenticator: * * \`\`\`javascript * import { AuthenticationClient } from "approw-js-sdk" * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * await authenticationClient.mfa.assosicateMfaAuthenticator({authenticatorType: 'totp'}) * \`\`\` * * Verify MFA secondary password: * * \`\`\`javascript * import { AuthenticationClient } from "approw-js-sdk" * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * await authenticationClient.mfa.verifyTotpMfa({totp: '112233', mfaToken: 'xxx'}) * \`\`\` * * @name MfaAuthenticationClient */ export declare class MfaAuthenticationClient { options: AuthenticationClientOptions; tokenProvider: AuthenticationTokenProvider; httpClient: HttpClient; baseClient: BaseAuthenticationClient; constructor(options: AuthenticationClientOptions, tokenProvider: AuthenticationTokenProvider, httpClient: HttpClient); /** * @name getMfaAuthenticators * @name_zh Get an MFA authenticator * @description Get an MFA authenticator * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const authenticators = await authenticationClient.mfa.getMfaAuthenticators({ type: 'totp' }) * * @returns {Promise} * @memberof MfaAuthenticationClient */ getMfaAuthenticators(options?: { type: string; mfaToken?: string; source?: TotpSource; }): Promise; /** * @name assosicateMfaAuthenticator * @name_zh Request MFA QR code and key information * @description Request MFA QR code and key information * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const authenticators = await authenticationClient.mfa.assosicateMfaAuthenticator({ authenticatorType: 'totp' }) * * @returns {Promise} * @memberof MfaAuthenticationClient */ assosicateMfaAuthenticator(options?: { authenticatorType: string; mfaToken?: string; source?: TotpSource; }): Promise; /** * @name deleteMfaAuthenticator * @name_zh Unbind MFA * @description Unbind MFA * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const authenticators = await authenticationClient.mfa.deleteMfaAuthenticator() * * @returns {Promise} * @memberof MfaAuthenticationClient */ deleteMfaAuthenticator(): Promise; /** * @name confirmAssosicateMfaAuthenticator * @name_zh Confirm binding MFA * @description Confirm binding MFA * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const authenticators = await authenticationClient.mfa.confirmAssosicateMfaAuthenticator({ authenticatorType: 'totp', totp: '112233' }) * * @returns {Promise} * @memberof MfaAuthenticationClient */ confirmAssosicateMfaAuthenticator(options?: { authenticatorType: string; totp?: string; source?: TotpSource; mfaToken?: string; }): Promise; /** * @name verifyTotpMfa * @name_zh Verify the MFA password for the second verification * @description Verify the MFA password for the second verification * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const authenticators = await authenticationClient.mfa.verifyTotpMfa({ authenticatorType: 'totp', totp: '112233' }) * * @returns {Promise} * @memberof MfaAuthenticationClient */ verifyTotpMfa(options: { totp: string; mfaToken: string; }): Promise; /** * @name verifyAppSmsMfa * @name_zh Verify the secondary verification MFA SMS verification code * @description Verify the secondary verification MFA SMS verification code * * @param {object} options * @param {string} options.phone User phone number * @param {string} options.code SMS verification code * @param {string} options.token MfaToken returned by the login interface * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const authenticators = await authenticationClient.mfa.verifySmsMfa({ mfaToken: 'xxxxxx', phone: '173xxxxxxxx' }) * * @returns {Promise} * @memberof MfaAuthenticationClient */ verifyAppSmsMfa(options: { phone: string; code: string; mfaToken: string; }): Promise; /** * @name verifyAppEmailMfa * @name_zh Check the second verification MFA email verification code * @description Check the second verification MFA email verification code * * @param {object} options * @param {string} options.email user email * @param {string} options.code email verification code * @param {string} options.token MfaToken returned by the login interface * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const authenticators = await authenticationClient.mfa.verifyAppEmailMfa({ mfaToken: 'xxxx', email: 'example@approw.com' }) * * @returns {Promise} * @memberof MfaAuthenticationClient */ verifyAppEmailMfa(options: { email: string; mfaToken: string; code: string; }): Promise; /** * @name phoneOrEmailBindable * @name_zh Check whether the phone number or email has been bound * @description When the phone or email MFA login is required, and the user has not bound the phone or email address, the user can first enter the phone number or email address, use this interface to first check whether the phone or email address can be bound, and then perform MFA verification. * * @param {object} options * @param {string} [options.mfaToken] MfaToken returned by the backend * @param {string} [options.phone] Phone number to be detected * @param {string} [options.email] Email address to be detected * * @example * * authenticationClient.phoneOrEmailBindable({ * phone: '173xxxxxxxx', * mfaToken: 'xxxxx' * }) * * @returns {Promise} * @memberof MfaAuthenticationClient */ phoneOrEmailBindable({ phone, email, mfaToken }: { phone?: string; email?: string; mfaToken: string; }): Promise; /** * @name verifyTotpRecoveryCode * @name_zh Verify the second verification MFA recovery code * @description Verify the second verification MFA recovery code * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const authenticators = await authenticationClient.mfa.verifyTotpRecoveryCode({ authenticatorType: 'totp', totp: '112233' }) * * @returns {Promise} * @memberof MfaAuthenticationClient */ verifyTotpRecoveryCode(options: { recoveryCode: string; mfaToken: string; }): Promise; /** * @name associateFaceByUrl * @name_zh Binding face with picture URL * @description Binding face with picture URL * * @param {object} options * @param {string} options.baseFace Basic face photo * @param {string} options.compareFace Face photo address for comparison * @param {string} [options.mfaToken] If you bind the face during secondary authentication, you need to pass in mfaToken * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const user = await authenticationClient.mfa.associateFace({ photoA: 'http://example.com/photo/imgA.jpg', photoB: 'http://example.com/photo/imgB.jpg', mfaToken: 'xxxxxxxxxxxx' }) * * @returns {Promise} * @memberof MfaAuthenticationClient */ associateFaceByUrl(options: { baseFace: string; compareFace: string; mfaToken?: string; }): Promise; /** * @name associateFaceByLocalFile * @name_zh Bind faces by uploading local files * @description Bind faces by uploading local files * * @param {string} [mfaToken] If you bind the face during secondary authentication, you need to pass in mfaToken * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const user = await authenticationClient.mfa.associateFaceByLocalFile('xxxxxxxxxxx') * * @returns {Promise} * @memberof MfaAuthenticationClient */ associateFaceByLocalFile(mfaToken?: string): Promise; /** * @name associateFaceByBlob * @name_zh Bind the face by passing in the Blob object * @description Bind the face by passing in the Blob object * * @param {object} options * @param {string} options.baseFace Basic face data Blob object * @param {string} options.compareFace Face data Blob object for comparison * @param {string} [options.mfaToken] If you bind the face during secondary authentication, you need to pass in mfaToken * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const user = await authenticationClient.mfa.associateFaceByBlob({blobA: Blob, blobB: Blob, mfaToken: 'xxx'}) * * @returns {Promise} * @memberof MfaAuthenticationClient */ associateFaceByBlob(opts: { mfaToken?: string; baseFace: Blob; compareFace: Blob; }): Promise; /** * @name verifyFaceMfa * @name_zh Detect secondary login face verification * @description Detect secondary login face verification * * @param {string} photo Face photo address * @param {string} mfaToken MfaToken returned by Approw during the second verification * * @example * const authenticationClient = new AuthenticationClient({ * appId: "YOUR_APP_ID", * }) * const user = await authenticationClient.mfa.verifyFaceMfa('http://example.com/photo/photo.jpg') * * @returns {Promise} * @memberof MfaAuthenticationClient */ verifyFaceMfa(photo: string, mfaToken: string): Promise; }