Skip to main content

TypeAlias.AuthContext

type AuthContext = BaseAuth & {
isLoading: boolean;
sendOtp: (args: AuthSendOtpArgs) => Promise<void>;
signIn: (args: AuthSignInArgs) => Promise<KeybanUser>;
signOut: () => Promise<void>;
signUp: (args: AuthSignUpArgs) => Promise<KeybanUser>;
};

Represents the authentication context, extending the base authentication state with loading status and methods for various login/logout flows.

Type Declaration

NameTypeDescription
isLoadingbooleanIndicates whether an authentication operation is currently in progress. True while any login, logout or passwordless flow is pending.
sendOtp()(args: AuthSendOtpArgs) => Promise<void>Initiates the passwordless login flow by sending an OTP. Throws If sending OTP fails (invalid username or rate limit).
signIn()(args: AuthSignInArgs) => Promise<KeybanUser>Initiates login using username and password. Throws If credentials are invalid or login fails.
signOut()() => Promise<void>Sign out the current user. Throws If sign-out fails.
signUp()(args: AuthSignUpArgs) => Promise<KeybanUser>Initiates login using username and password. Throws If credentials are invalid or login fails.