@softr/sdk
Version:
The SDK for building Softr apps on TanStack Start. It lets an app interact with Softr: auth, datasources, workflows and integrations.
47 lines (45 loc) • 1.36 kB
TypeScript
import { User } from "../user.js";
import { AuthError, Result } from "./utils.js";
//#region src/auth/methods/passwordLink.d.ts
/**
* Emails a link to set a new password.
*
* Succeeds whether or not the address has an account, and sends nothing when
* it has none.
*/
declare function requestPasswordReset(details: {
email: string;
}): Promise<Result<null, AuthError>>;
/**
* Checks a password reset or invitation link, and returns the address it was
* mailed to. The link stays usable.
*/
declare function checkPasswordLink(details: {
token: string;
}): Promise<Result<{
email: string;
}, AuthError>>;
/**
* Sets a new password with a password reset or invitation link, and signs the
* visitor in.
*
* Any success uses up the link, `authenticatorRequired` included, and ends
* the visitor's other sessions.
*/
declare function setPasswordWithLink(details: {
token: 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";
}, AuthError>>;
//#endregion
export { checkPasswordLink, requestPasswordReset, setPasswordWithLink };