@nhost/hasura-auth-js
Version:
Hasura-auth client
215 lines (214 loc) • 6.08 kB
TypeScript
import { InterpreterFrom } from 'xstate';
import { AuthOptions, DeanonymizeResponse, NhostSession, NhostSessionResponse, PasswordlessEmailResponse, PasswordlessSmsOtpResponse, PasswordlessSmsResponse, SignInAnonymousResponse, SignInEmailOTPResponse, SignInMfaTotpResponse, SignInPATResponse, SignInResponse, SignOutResponse, SignUpResponse, VerifyEmailOTPResponse } from '../../types';
import { AuthContext } from './context';
export interface AuthMachineOptions extends AuthOptions {
backendUrl: string;
clientUrl: string;
}
export type AuthMachine = ReturnType<typeof createAuthMachine>;
export type AuthInterpreter = InterpreterFrom<AuthMachine>;
type AuthServices = {
signInPassword: {
data: SignInResponse;
};
passwordlessSms: {
data: PasswordlessSmsResponse | DeanonymizeResponse;
};
passwordlessSmsOtp: {
data: PasswordlessSmsOtpResponse;
};
signInEmailOTP: {
data: SignInEmailOTPResponse;
};
verifyEmailOTP: {
data: VerifyEmailOTPResponse;
};
passwordlessEmail: {
data: PasswordlessEmailResponse | DeanonymizeResponse;
};
signInAnonymous: {
data: SignInAnonymousResponse;
};
signInPAT: {
data: SignInPATResponse;
};
signInIdToken: {
data: SignInResponse;
};
signInMfaTotp: {
data: SignInMfaTotpResponse;
};
signInSecurityKeyEmail: {
data: SignInResponse;
};
signInSecurityKey: {
data: SignInResponse;
};
refreshToken: {
data: NhostSessionResponse;
};
signout: {
data: SignOutResponse;
};
signUpEmailPassword: {
data: SignUpResponse;
};
signUpSecurityKey: {
data: SignUpResponse;
};
importRefreshToken: {
data: NhostSessionResponse;
};
};
export declare const createAuthMachine: ({ backendUrl, clientUrl, broadcastKey, clientStorageType, clientStorage, refreshIntervalTime, autoRefreshToken, autoSignIn }: AuthMachineOptions) => import('xstate').StateMachine<AuthContext, any, {
type: "SESSION_UPDATE";
data: {
session: NhostSession;
};
} | {
type: "TRY_TOKEN";
token: string;
} | {
type: "SIGNIN_ANONYMOUS";
} | {
type: "SIGNIN_PAT";
pat: string;
} | {
type: "SIGNIN_SECURITY_KEY_EMAIL";
email?: string | undefined;
} | {
type: "SIGNIN_SECURITY_KEY";
} | {
type: "SIGNIN_PASSWORD";
email?: string | undefined;
password?: string | undefined;
} | {
type: "PASSWORDLESS_EMAIL";
email?: string | undefined;
options?: import('../../types').PasswordlessOptions | undefined;
} | {
type: "PASSWORDLESS_SMS";
phoneNumber?: string | undefined;
options?: import('../../types').PasswordlessOptions | undefined;
} | {
type: "PASSWORDLESS_SMS_OTP";
phoneNumber?: string | undefined;
otp?: string | undefined;
} | {
type: "SIGNIN_EMAIL_OTP";
email: string;
options?: import('../../types').EmailOTPOptions | undefined;
} | {
type: "VERIFY_EMAIL_OTP";
email: string;
otp: string;
} | {
type: "SIGNUP_EMAIL_PASSWORD";
email?: string | undefined;
password?: string | undefined;
options?: import('../../types').SignUpOptions | undefined;
requestOptions?: import('../../types').RequestOptions | undefined;
} | {
type: "SIGNUP_SECURITY_KEY";
email?: string | undefined;
options?: import('../../types').SignUpSecurityKeyOptions | undefined;
requestOptions?: import('../../types').RequestOptions | undefined;
} | {
type: "SIGNOUT";
all?: boolean | undefined;
} | {
type: "SIGNIN_MFA_TOTP";
ticket?: string | undefined;
otp?: string | undefined;
} | {
type: "SIGNED_IN";
} | {
type: "SIGNED_OUT";
} | {
type: "TOKEN_CHANGED";
} | {
type: "AWAIT_EMAIL_VERIFICATION";
} | {
type: "SIGNIN_ID_TOKEN";
provider: string;
idToken: string;
nonce?: string | undefined;
}, {
value: any;
context: AuthContext;
}, import('xstate').BaseActionObject, AuthServices, import('xstate').ResolveTypegenMeta<import('./machine.typegen').Typegen0, {
type: "SESSION_UPDATE";
data: {
session: NhostSession;
};
} | {
type: "TRY_TOKEN";
token: string;
} | {
type: "SIGNIN_ANONYMOUS";
} | {
type: "SIGNIN_PAT";
pat: string;
} | {
type: "SIGNIN_SECURITY_KEY_EMAIL";
email?: string | undefined;
} | {
type: "SIGNIN_SECURITY_KEY";
} | {
type: "SIGNIN_PASSWORD";
email?: string | undefined;
password?: string | undefined;
} | {
type: "PASSWORDLESS_EMAIL";
email?: string | undefined;
options?: import('../../types').PasswordlessOptions | undefined;
} | {
type: "PASSWORDLESS_SMS";
phoneNumber?: string | undefined;
options?: import('../../types').PasswordlessOptions | undefined;
} | {
type: "PASSWORDLESS_SMS_OTP";
phoneNumber?: string | undefined;
otp?: string | undefined;
} | {
type: "SIGNIN_EMAIL_OTP";
email: string;
options?: import('../../types').EmailOTPOptions | undefined;
} | {
type: "VERIFY_EMAIL_OTP";
email: string;
otp: string;
} | {
type: "SIGNUP_EMAIL_PASSWORD";
email?: string | undefined;
password?: string | undefined;
options?: import('../../types').SignUpOptions | undefined;
requestOptions?: import('../../types').RequestOptions | undefined;
} | {
type: "SIGNUP_SECURITY_KEY";
email?: string | undefined;
options?: import('../../types').SignUpSecurityKeyOptions | undefined;
requestOptions?: import('../../types').RequestOptions | undefined;
} | {
type: "SIGNOUT";
all?: boolean | undefined;
} | {
type: "SIGNIN_MFA_TOTP";
ticket?: string | undefined;
otp?: string | undefined;
} | {
type: "SIGNED_IN";
} | {
type: "SIGNED_OUT";
} | {
type: "TOKEN_CHANGED";
} | {
type: "AWAIT_EMAIL_VERIFICATION";
} | {
type: "SIGNIN_ID_TOKEN";
provider: string;
idToken: string;
nonce?: string | undefined;
}, import('xstate').BaseActionObject, AuthServices>>;
export {};
//# sourceMappingURL=machine.d.ts.map