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.18 kB
import { User } from "../user.js"; import { AuthError, Result } from "./utils.js"; //#region src/auth/methods/password.d.ts /** * Signs a visitor in with an email and password. * * 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. An app that also asks for an emailed code answers * `emailCodeRequired`; `verifyEmailCode` finishes it. */ declare function signIn(credentials: { email: string; password: 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"; } | { status: "emailCodeRequired"; }, AuthError>>; /** * Signs the visitor out. * * This ends **every** session that user has in this app, on every device. There * is no per-device sign-out. */ declare function signOut(): Promise<void>; //#endregion export { signIn, signOut };