balena-sdk
Version:
The Balena JavaScript SDK
40 lines (39 loc) • 1.44 kB
TypeScript
import type { InjectedDependenciesParam, InjectedOptionsParam } from '.';
import type { UserInfo, WhoamiResult } from './types/auth';
declare const getAuth: (deps: InjectedDependenciesParam, opts: InjectedOptionsParam) => {
twoFactor: {
isEnabled: () => Promise<boolean>;
isPassed: () => Promise<boolean>;
getSetupKey: () => Promise<string>;
enable: (code: string) => Promise<string>;
verify: (code: string) => Promise<string>;
challenge: (code: string) => Promise<void>;
disable: (password: string) => Promise<string>;
};
whoami: () => Promise<WhoamiResult | undefined>;
authenticate: (credentials: {
email: string;
password: string;
}) => Promise<string>;
login: (credentials: {
email: string;
password: string;
}) => Promise<void>;
loginWithToken: (authToken: string) => Promise<void>;
isLoggedIn: () => Promise<boolean>;
getToken: () => Promise<string>;
getActorId: () => Promise<number>;
getUserInfo: () => Promise<UserInfo>;
logout: () => Promise<void>;
register: (credentials: {
email: string;
password: string;
"g-recaptcha-response"?: string;
}) => Promise<string>;
verifyEmail: (verificationPayload: {
email: string;
token: string;
}) => Promise<string>;
requestVerificationEmail: () => Promise<void>;
};
export default getAuth;