UNPKG

@softr/sdk

Version:

The SDK for building Softr apps on TanStack Start. It lets an app interact with Softr: auth, datasources, workflows and integrations.

39 lines (37 loc) • 1.25 kB
import { User } from "../user.js"; import { AuthError, Result } from "./utils.js"; //#region src/auth/methods/code.d.ts /** * Emails a one-time sign-in code, for an app that signs people in with a code * rather than a password. * * An address with no account fails as `noAccount`, and a deactivated one as * `accountDeactivated`, so the visitor is not left waiting for an email. */ declare function sendSignInCode(details: { email: string; }): Promise<Result<null, AuthError>>; /** * Signs a visitor in with the code {@link sendSignInCode} emailed them. * * 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 signInWithCode(credentials: { email: string; 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>>; //#endregion export { sendSignInCode, signInWithCode };