@softr/sdk
Version:
The SDK for building Softr apps on TanStack Start. It lets an app interact with Softr: auth, datasources, workflows and integrations.
34 lines (32 loc) • 1.1 kB
TypeScript
import { User } from "../user.js";
import { AuthError, Result } from "./utils.js";
//#region src/auth/methods/emailCode2fa.d.ts
/**
* Finishes a sign-in that answered `emailCodeRequired`, with the code emailed
* to the visitor.
*
* A `signedIn` result means the visitor is signed in. An app that also asks for
* an authenticator app answers `authenticatorRequired` instead, naming the step
* to send them to next.
*/
declare function verifyEmailCode(details: {
code: string;
}): Promise<Result<{
status: "signedIn";
user: User;
} | {
status: "authenticatorRequired";
/**
* `verify`: they have an authenticator app and owe a code.
* `setup`: the app requires one and they have none yet.
* `setupOptional`: same, except they may skip it instead.
*/
step: "verify" | "setup" | "setupOptional";
}, AuthError>>;
/**
* Emails the code for {@link verifyEmailCode} again. Asking again within a
* short wait sends nothing and still succeeds.
*/
declare function resendEmailCode(): Promise<Result<null, AuthError>>;
//#endregion
export { resendEmailCode, verifyEmailCode };