import { FingerprintAPI } from '../base/types'; import { StorageManagerInterface } from '../storage/types'; import { RequestData, RequestOptions, OktaAuthHttpInterface, OktaAuthHttpOptions } from '../http/types'; export interface AuthnTransactionLink { name?: string; type: string; href: string; hints?: { allow?: string[]; }; } export interface AuthnTransactionState { status: string; stateToken?: string; type?: string; expiresAt?: string; relayState?: string; factorResult?: string; factorType?: string; recoveryToken?: string; recoveryType?: string; autoPush?: boolean | (() => boolean); rememberDevice?: boolean | (() => boolean); profile?: { updatePhone?: boolean; }; _links?: Record; } export declare type AuthnTransactionFunction = (obj?: any) => Promise; export interface AuthnTransactionFunctions { next?: AuthnTransactionFunction; cancel?: AuthnTransactionFunction; skip?: AuthnTransactionFunction; unlock?: AuthnTransactionFunction; changePassword?: AuthnTransactionFunction; resetPassword?: AuthnTransactionFunction; answer?: AuthnTransactionFunction; recovery?: AuthnTransactionFunction; verify?: AuthnTransactionFunction; resend?: AuthnTransactionFunction; activate?: AuthnTransactionFunction; poll?: AuthnTransactionFunction; prev?: AuthnTransactionFunction; } export interface AuthnTransaction extends AuthnTransactionState, AuthnTransactionFunctions { sessionToken?: string; user?: Record; factor?: Record; factors?: Array>; policy?: Record; scopes?: Array>; target?: Record; authentication?: Record; } export interface AuthnTransactionAPI { exists: () => boolean; status: (args?: object) => Promise; resume: (args?: object) => Promise; introspect: (args?: object) => Promise; createTransaction: (res?: AuthnTransactionState) => AuthnTransaction; postToTransaction: (url: string, args?: RequestData, options?: RequestOptions) => Promise; } export interface SigninOptions { relayState?: string; context?: { deviceToken?: string; }; sendFingerprint?: boolean; stateToken?: string; username?: string; password?: string; } export interface SigninWithCredentialsOptions extends SigninOptions { username: string; password: string; } export interface SigninAPI { signIn(opts: SigninOptions): Promise; signInWithCredentials(opts: SigninWithCredentialsOptions): Promise; } export interface ForgotPasswordOptions { username: string; factorType: 'SMS' | 'EMAIL' | 'CALL'; relayState?: string; } export interface VerifyRecoveryTokenOptions { recoveryToken: string; multiOptionalFactorEnroll?: boolean; } export interface AuthnAPI extends SigninAPI { forgotPassword(opts: any): Promise; unlockAccount(opts: ForgotPasswordOptions): Promise; verifyRecoveryToken(opts: VerifyRecoveryTokenOptions): Promise; } export interface OktaAuthTxInterface extends OktaAuthHttpInterface, AuthnAPI { tx: AuthnTransactionAPI; authn: AuthnTransactionAPI; fingerprint: FingerprintAPI; }