mirror of
https://github.com/bitbaum/accountkit.git
synced 2026-12-05 02:57:32 +01:00
Products that created people before they had a password (an invitation, a login code) can now hand the credential lifecycle to AccountKit: POST /api/auth/provision/claim gives that identity its first password under its existing user id. A second identity joins an existing account only on that account's own password; an invited account without one must recover through its mailbox first. Verified addresses are never moved, .invalid addresses are refused, single-use proofs are given back on failure, and with mail configured an unverified address gets a link, not a session. A completed password reset now verifies the address it was sent to when that address is unchanged, so an imported or invited account with an unverified address is not refused at sign-in after recovering. Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9 Co-authored-by: Claude <noreply@anthropic.com>
25 lines
921 B
TypeScript
25 lines
921 B
TypeScript
/**
|
|
* Why a claim (./provisioning) was refused, as stable codes a product's screen
|
|
* turns into its own words. Safe to import in the browser.
|
|
*/
|
|
export declare const CLAIM_ERRORS: {
|
|
readonly invalid: "CLAIM_INVALID";
|
|
readonly alreadyClaimed: "CLAIM_ALREADY_CLAIMED";
|
|
readonly emailTaken: "CLAIM_EMAIL_TAKEN";
|
|
readonly emailNeedsRecovery: "CLAIM_EMAIL_NEEDS_RECOVERY";
|
|
readonly linkPasswordMismatch: "CLAIM_LINK_PASSWORD_MISMATCH";
|
|
readonly verifiedEmailMismatch: "CLAIM_VERIFIED_EMAIL_MISMATCH";
|
|
};
|
|
export type ClaimError = (typeof CLAIM_ERRORS)[keyof typeof CLAIM_ERRORS];
|
|
/** What a successful claim did: a session, a verification mail, or a sign-in still owed (2FA). */
|
|
export type ClaimResult = {
|
|
status: "signed_in";
|
|
userId: string;
|
|
} | {
|
|
status: "verify_email";
|
|
userId: string;
|
|
} | {
|
|
status: "sign_in";
|
|
userId: string;
|
|
};
|
|
//# sourceMappingURL=claim-errors.d.ts.map
|