import { FirstFactorAttestation, RecoveryFactorAttestation, SecondFactorAttestation, UserRegistrationChallenge } from './store'; import { CredentialKind, FirstFactorAssertion, RecoveryKeyAssertion, SecondFactorAssertion, UserActionChallenge } from './signer'; import { HttpMethod } from './utils/fetch'; import { DfnsBaseApiOptions } from './types/generic'; export type CreateUserActionChallengeRequest = { userActionPayload: string; userActionHttpMethod: HttpMethod; userActionHttpPath: string; userActionServerKind: 'Api'; }; export type UserActionChallengeResponse = UserActionChallenge; export type SignUserActionChallengeRequest = { challengeIdentifier: string; firstFactor: FirstFactorAssertion; secondFactor?: SecondFactorAssertion; }; export type UserActionResponse = { userAction: string; }; export type CreateUserLoginChallengeRequest = { username: string; orgId: string; }; export type UserLoginChallengeResponse = UserActionChallengeResponse; export type CreateUserLoginRequest = SignUserActionChallengeRequest; export type UserLoginResponse = { token: string; }; export type CreateUserRegistrationChallengeRequest = { orgId: string; username: string; registrationCode: string; }; export type UserRegistrationChallengeResponse = UserRegistrationChallenge; export type CreateUserRegistrationRequest = { firstFactorCredential: FirstFactorAttestation; secondFactorCredential?: SecondFactorAttestation; recoveryCredential?: RecoveryFactorAttestation; }; export type UserRegistrationResponse = { credential: { uuid: string; kind: CredentialKind; name: string; }; user: { id: string; username: string; orgId: string; }; }; export type CreateUserRecoveryRequest = { recovery: RecoveryKeyAssertion; newCredentials: { firstFactorCredential: FirstFactorAttestation; secondFactorCredential?: SecondFactorAttestation; recoveryCredential?: RecoveryFactorAttestation; }; }; export type UserRecoveryResponse = UserRegistrationResponse; export declare class BaseAuthApi { /** * Creates a user action challenge */ static createUserActionChallenge(request: CreateUserActionChallengeRequest, options: DfnsBaseApiOptions): Promise; /** * Sign a user action challenge */ static signUserActionChallenge(request: SignUserActionChallengeRequest, options: DfnsBaseApiOptions): Promise; /** * Initiates user login, by creating a challenge that will need to be signed by the user Credentials. */ static createUserLoginChallenge(request: CreateUserLoginChallengeRequest, options: DfnsBaseApiOptions): Promise; /** * Completes user login by sending the signed login challenge. */ static createUserLogin(request: CreateUserLoginRequest, options: DfnsBaseApiOptions): Promise; /** * Completes user logout by sending the user auth token. */ static userLogout(options: DfnsBaseApiOptions): Promise; /** * Initiates Registration by creating a challenge that will need to be signed by a new set of Credentials. */ static createUserRegistrationChallenge(request: CreateUserRegistrationChallengeRequest, options: DfnsBaseApiOptions): Promise; /** * Completes Registration by sending the signed registration challenge, containing the new Credential identity created. */ static createUserRegistration(request: CreateUserRegistrationRequest, options: DfnsBaseApiOptions): Promise; /** * Completes Recovery by sending the signed recovery challenge, containing the new Credential identity created. */ createUserRecovery(request: CreateUserRecoveryRequest, options: DfnsBaseApiOptions): Promise; }