@softr/sdk
Version:
The SDK for building Softr apps on TanStack Start. It lets an app interact with Softr: auth, datasources, workflows and integrations.
40 lines (38 loc) • 1.26 kB
TypeScript
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.
*
* It succeeds whether or not the address has an account, so nobody can use the
* form it backs to find out who is registered. Say "check your email" either
* way.
*/
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 };