@softistx/janus 0.0.0-stage → 0.73.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2928 -2
- package/dist/auth/api-keys/authenticate-key.d.ts +21 -0
- package/dist/auth/api-keys/authenticate-key.d.ts.map +1 -0
- package/dist/auth/api-keys/bound.d.ts +11 -0
- package/dist/auth/api-keys/bound.d.ts.map +1 -0
- package/dist/auth/api-keys/count.d.ts +8 -0
- package/dist/auth/api-keys/count.d.ts.map +1 -0
- package/dist/auth/api-keys/create/checks.d.ts +42 -0
- package/dist/auth/api-keys/create/checks.d.ts.map +1 -0
- package/dist/auth/api-keys/create/index.d.ts +10 -0
- package/dist/auth/api-keys/create/index.d.ts.map +1 -0
- package/dist/auth/api-keys/events.d.ts +22 -0
- package/dist/auth/api-keys/events.d.ts.map +1 -0
- package/dist/auth/api-keys/expiry.d.ts +11 -0
- package/dist/auth/api-keys/expiry.d.ts.map +1 -0
- package/dist/auth/api-keys/flows.d.ts +13 -0
- package/dist/auth/api-keys/flows.d.ts.map +1 -0
- package/dist/auth/api-keys/index.d.ts +11 -0
- package/dist/auth/api-keys/index.d.ts.map +1 -0
- package/dist/auth/api-keys/read.d.ts +10 -0
- package/dist/auth/api-keys/read.d.ts.map +1 -0
- package/dist/auth/api-keys/shape.d.ts +24 -0
- package/dist/auth/api-keys/shape.d.ts.map +1 -0
- package/dist/auth/api-keys/to-api-key.d.ts +8 -0
- package/dist/auth/api-keys/to-api-key.d.ts.map +1 -0
- package/dist/auth/api-keys/token.d.ts +23 -0
- package/dist/auth/api-keys/token.d.ts.map +1 -0
- package/dist/auth/api-keys/user-bound.d.ts +10 -0
- package/dist/auth/api-keys/user-bound.d.ts.map +1 -0
- package/dist/auth/at.d.ts +9 -0
- package/dist/auth/at.d.ts.map +1 -0
- package/dist/auth/avatar/any-type.d.ts +13 -0
- package/dist/auth/avatar/any-type.d.ts.map +1 -0
- package/dist/auth/avatar/flows.d.ts +7 -0
- package/dist/auth/avatar/flows.d.ts.map +1 -0
- package/dist/auth/avatar/id.d.ts +10 -0
- package/dist/auth/avatar/id.d.ts.map +1 -0
- package/dist/auth/avatar/index.d.ts +7 -0
- package/dist/auth/avatar/index.d.ts.map +1 -0
- package/dist/auth/avatar/remove.d.ts +10 -0
- package/dist/auth/avatar/remove.d.ts.map +1 -0
- package/dist/auth/avatar/set.d.ts +12 -0
- package/dist/auth/avatar/set.d.ts.map +1 -0
- package/dist/auth/concurrency-limit.d.ts +13 -0
- package/dist/auth/concurrency-limit.d.ts.map +1 -0
- package/dist/auth/config/api-keys-config.d.ts +33 -0
- package/dist/auth/config/api-keys-config.d.ts.map +1 -0
- package/dist/auth/config/hasher.d.ts +22 -0
- package/dist/auth/config/hasher.d.ts.map +1 -0
- package/dist/auth/config/index.d.ts +24 -0
- package/dist/auth/config/index.d.ts.map +1 -0
- package/dist/auth/config/invitations-config.d.ts +74 -0
- package/dist/auth/config/invitations-config.d.ts.map +1 -0
- package/dist/auth/config/janus-config.d.ts +233 -0
- package/dist/auth/config/janus-config.d.ts.map +1 -0
- package/dist/auth/config/magic-link-config.d.ts +6 -0
- package/dist/auth/config/magic-link-config.d.ts.map +1 -0
- package/dist/auth/config/names.d.ts +9 -0
- package/dist/auth/config/names.d.ts.map +1 -0
- package/dist/auth/config/normalize.d.ts +26 -0
- package/dist/auth/config/normalize.d.ts.map +1 -0
- package/dist/auth/config/passkeys-config.d.ts +49 -0
- package/dist/auth/config/passkeys-config.d.ts.map +1 -0
- package/dist/auth/config/password-config.d.ts +22 -0
- package/dist/auth/config/password-config.d.ts.map +1 -0
- package/dist/auth/config/reserved.d.ts +14 -0
- package/dist/auth/config/reserved.d.ts.map +1 -0
- package/dist/auth/config/resolve-api-keys.d.ts +5 -0
- package/dist/auth/config/resolve-api-keys.d.ts.map +1 -0
- package/dist/auth/config/resolve-config.d.ts +9 -0
- package/dist/auth/config/resolve-config.d.ts.map +1 -0
- package/dist/auth/config/resolve-cookie.d.ts +5 -0
- package/dist/auth/config/resolve-cookie.d.ts.map +1 -0
- package/dist/auth/config/resolve-devices.d.ts +5 -0
- package/dist/auth/config/resolve-devices.d.ts.map +1 -0
- package/dist/auth/config/resolve-invitation-types.d.ts +5 -0
- package/dist/auth/config/resolve-invitation-types.d.ts.map +1 -0
- package/dist/auth/config/resolve-invitations.d.ts +5 -0
- package/dist/auth/config/resolve-invitations.d.ts.map +1 -0
- package/dist/auth/config/resolve-magic-link.d.ts +4 -0
- package/dist/auth/config/resolve-magic-link.d.ts.map +1 -0
- package/dist/auth/config/resolve-passkeys.d.ts +5 -0
- package/dist/auth/config/resolve-passkeys.d.ts.map +1 -0
- package/dist/auth/config/resolve-second-factor.d.ts +5 -0
- package/dist/auth/config/resolve-second-factor.d.ts.map +1 -0
- package/dist/auth/config/resolve-social.d.ts +17 -0
- package/dist/auth/config/resolve-social.d.ts.map +1 -0
- package/dist/auth/config/resolve-throttle.d.ts +37 -0
- package/dist/auth/config/resolve-throttle.d.ts.map +1 -0
- package/dist/auth/config/resolve-type.d.ts +6 -0
- package/dist/auth/config/resolve-type.d.ts.map +1 -0
- package/dist/auth/config/resolved-config.d.ts +126 -0
- package/dist/auth/config/resolved-config.d.ts.map +1 -0
- package/dist/auth/config/social-config.d.ts +154 -0
- package/dist/auth/config/social-config.d.ts.map +1 -0
- package/dist/auth/config/user-type.d.ts +79 -0
- package/dist/auth/config/user-type.d.ts.map +1 -0
- package/dist/auth/config/warn-throttle-window.d.ts +14 -0
- package/dist/auth/config/warn-throttle-window.d.ts.map +1 -0
- package/dist/auth/context/create-context.d.ts +31 -0
- package/dist/auth/context/create-context.d.ts.map +1 -0
- package/dist/auth/context/index.d.ts +17 -0
- package/dist/auth/context/index.d.ts.map +1 -0
- package/dist/auth/context/logins.d.ts +28 -0
- package/dist/auth/context/logins.d.ts.map +1 -0
- package/dist/auth/context/password.d.ts +34 -0
- package/dist/auth/context/password.d.ts.map +1 -0
- package/dist/auth/context/records.d.ts +27 -0
- package/dist/auth/context/records.d.ts.map +1 -0
- package/dist/auth/context/user.d.ts +21 -0
- package/dist/auth/context/user.d.ts.map +1 -0
- package/dist/auth/context/validate-fields.d.ts +12 -0
- package/dist/auth/context/validate-fields.d.ts.map +1 -0
- package/dist/auth/counter-key.d.ts +20 -0
- package/dist/auth/counter-key.d.ts.map +1 -0
- package/dist/auth/derived-keys.d.ts +9 -0
- package/dist/auth/derived-keys.d.ts.map +1 -0
- package/dist/auth/devices/cookie.d.ts +56 -0
- package/dist/auth/devices/cookie.d.ts.map +1 -0
- package/dist/auth/devices/hint.d.ts +42 -0
- package/dist/auth/devices/hint.d.ts.map +1 -0
- package/dist/auth/devices/index.d.ts +11 -0
- package/dist/auth/devices/index.d.ts.map +1 -0
- package/dist/auth/devices/report.d.ts +11 -0
- package/dist/auth/devices/report.d.ts.map +1 -0
- package/dist/auth/devices/token.d.ts +13 -0
- package/dist/auth/devices/token.d.ts.map +1 -0
- package/dist/auth/email-flows/any-type-change-email.d.ts +18 -0
- package/dist/auth/email-flows/any-type-change-email.d.ts.map +1 -0
- package/dist/auth/email-flows/any-type-reset-password.d.ts +19 -0
- package/dist/auth/email-flows/any-type-reset-password.d.ts.map +1 -0
- package/dist/auth/email-flows/any-type-verify-email.d.ts +18 -0
- package/dist/auth/email-flows/any-type-verify-email.d.ts.map +1 -0
- package/dist/auth/email-flows/change-email-token.d.ts +47 -0
- package/dist/auth/email-flows/change-email-token.d.ts.map +1 -0
- package/dist/auth/email-flows/change-email.d.ts +17 -0
- package/dist/auth/email-flows/change-email.d.ts.map +1 -0
- package/dist/auth/email-flows/confirm-reset.d.ts +16 -0
- package/dist/auth/email-flows/confirm-reset.d.ts.map +1 -0
- package/dist/auth/email-flows/email-token.d.ts +30 -0
- package/dist/auth/email-flows/email-token.d.ts.map +1 -0
- package/dist/auth/email-flows/flows.d.ts +13 -0
- package/dist/auth/email-flows/flows.d.ts.map +1 -0
- package/dist/auth/email-flows/index.d.ts +10 -0
- package/dist/auth/email-flows/index.d.ts.map +1 -0
- package/dist/auth/email-flows/owner-of.d.ts +17 -0
- package/dist/auth/email-flows/owner-of.d.ts.map +1 -0
- package/dist/auth/email-flows/prove-first.d.ts +45 -0
- package/dist/auth/email-flows/prove-first.d.ts.map +1 -0
- package/dist/auth/email-flows/reset-password.d.ts +17 -0
- package/dist/auth/email-flows/reset-password.d.ts.map +1 -0
- package/dist/auth/email-flows/set-email-verified.d.ts +19 -0
- package/dist/auth/email-flows/set-email-verified.d.ts.map +1 -0
- package/dist/auth/email-flows/verify-email.d.ts +25 -0
- package/dist/auth/email-flows/verify-email.d.ts.map +1 -0
- package/dist/auth/email-sign-in.d.ts +51 -0
- package/dist/auth/email-sign-in.d.ts.map +1 -0
- package/dist/auth/events.d.ts +166 -0
- package/dist/auth/events.d.ts.map +1 -0
- package/dist/auth/first-proof.d.ts +43 -0
- package/dist/auth/first-proof.d.ts.map +1 -0
- package/dist/auth/hashers.d.ts +52 -0
- package/dist/auth/hashers.d.ts.map +1 -0
- package/dist/auth/index.d.ts +22 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/invitations/accept.d.ts +10 -0
- package/dist/auth/invitations/accept.d.ts.map +1 -0
- package/dist/auth/invitations/change-pending.d.ts +17 -0
- package/dist/auth/invitations/change-pending.d.ts.map +1 -0
- package/dist/auth/invitations/claim.d.ts +31 -0
- package/dist/auth/invitations/claim.d.ts.map +1 -0
- package/dist/auth/invitations/events.d.ts +46 -0
- package/dist/auth/invitations/events.d.ts.map +1 -0
- package/dist/auth/invitations/find-invitee.d.ts +20 -0
- package/dist/auth/invitations/find-invitee.d.ts.map +1 -0
- package/dist/auth/invitations/find-pending.d.ts +5 -0
- package/dist/auth/invitations/find-pending.d.ts.map +1 -0
- package/dist/auth/invitations/flows.d.ts +7 -0
- package/dist/auth/invitations/flows.d.ts.map +1 -0
- package/dist/auth/invitations/history-input.d.ts +29 -0
- package/dist/auth/invitations/history-input.d.ts.map +1 -0
- package/dist/auth/invitations/history.d.ts +10 -0
- package/dist/auth/invitations/history.d.ts.map +1 -0
- package/dist/auth/invitations/index.d.ts +11 -0
- package/dist/auth/invitations/index.d.ts.map +1 -0
- package/dist/auth/invitations/input.d.ts +30 -0
- package/dist/auth/invitations/input.d.ts.map +1 -0
- package/dist/auth/invitations/invited-type.d.ts +22 -0
- package/dist/auth/invitations/invited-type.d.ts.map +1 -0
- package/dist/auth/invitations/invitee.d.ts +11 -0
- package/dist/auth/invitations/invitee.d.ts.map +1 -0
- package/dist/auth/invitations/issue.d.ts +9 -0
- package/dist/auth/invitations/issue.d.ts.map +1 -0
- package/dist/auth/invitations/limit.d.ts +7 -0
- package/dist/auth/invitations/limit.d.ts.map +1 -0
- package/dist/auth/invitations/password-invitee.d.ts +18 -0
- package/dist/auth/invitations/password-invitee.d.ts.map +1 -0
- package/dist/auth/invitations/passwordless-invitee.d.ts +13 -0
- package/dist/auth/invitations/passwordless-invitee.d.ts.map +1 -0
- package/dist/auth/invitations/preview.d.ts +8 -0
- package/dist/auth/invitations/preview.d.ts.map +1 -0
- package/dist/auth/invitations/read.d.ts +10 -0
- package/dist/auth/invitations/read.d.ts.map +1 -0
- package/dist/auth/invitations/resend.d.ts +12 -0
- package/dist/auth/invitations/resend.d.ts.map +1 -0
- package/dist/auth/invitations/to-invitation.d.ts +11 -0
- package/dist/auth/invitations/to-invitation.d.ts.map +1 -0
- package/dist/auth/invitations/write.d.ts +17 -0
- package/dist/auth/invitations/write.d.ts.map +1 -0
- package/dist/auth/issuers/cache.d.ts +21 -0
- package/dist/auth/issuers/cache.d.ts.map +1 -0
- package/dist/auth/issuers/create.d.ts +18 -0
- package/dist/auth/issuers/create.d.ts.map +1 -0
- package/dist/auth/issuers/index.d.ts +3 -0
- package/dist/auth/issuers/index.d.ts.map +1 -0
- package/dist/auth/issuers/types.d.ts +45 -0
- package/dist/auth/issuers/types.d.ts.map +1 -0
- package/dist/auth/janus.d.ts +39 -0
- package/dist/auth/janus.d.ts.map +1 -0
- package/dist/auth/magic-link.d.ts +25 -0
- package/dist/auth/magic-link.d.ts.map +1 -0
- package/dist/auth/mail-requests.d.ts +55 -0
- package/dist/auth/mail-requests.d.ts.map +1 -0
- package/dist/auth/one-time/codes.d.ts +46 -0
- package/dist/auth/one-time/codes.d.ts.map +1 -0
- package/dist/auth/one-time/index.d.ts +15 -0
- package/dist/auth/one-time/index.d.ts.map +1 -0
- package/dist/auth/one-time/issue.d.ts +45 -0
- package/dist/auth/one-time/issue.d.ts.map +1 -0
- package/dist/auth/one-time/refusals.d.ts +26 -0
- package/dist/auth/one-time/refusals.d.ts.map +1 -0
- package/dist/auth/one-time/spend.d.ts +24 -0
- package/dist/auth/one-time/spend.d.ts.map +1 -0
- package/dist/auth/one-time/window.d.ts +50 -0
- package/dist/auth/one-time/window.d.ts.map +1 -0
- package/dist/auth/outage.d.ts +66 -0
- package/dist/auth/outage.d.ts.map +1 -0
- package/dist/auth/parse-sealing-keys.d.ts +26 -0
- package/dist/auth/parse-sealing-keys.d.ts.map +1 -0
- package/dist/auth/passkeys/assert.d.ts +51 -0
- package/dist/auth/passkeys/assert.d.ts.map +1 -0
- package/dist/auth/passkeys/assertion-options.d.ts +9 -0
- package/dist/auth/passkeys/assertion-options.d.ts.map +1 -0
- package/dist/auth/passkeys/challenge.d.ts +19 -0
- package/dist/auth/passkeys/challenge.d.ts.map +1 -0
- package/dist/auth/passkeys/commit.d.ts +33 -0
- package/dist/auth/passkeys/commit.d.ts.map +1 -0
- package/dist/auth/passkeys/flows.d.ts +13 -0
- package/dist/auth/passkeys/flows.d.ts.map +1 -0
- package/dist/auth/passkeys/index.d.ts +12 -0
- package/dist/auth/passkeys/index.d.ts.map +1 -0
- package/dist/auth/passkeys/manage.d.ts +11 -0
- package/dist/auth/passkeys/manage.d.ts.map +1 -0
- package/dist/auth/passkeys/name.d.ts +4 -0
- package/dist/auth/passkeys/name.d.ts.map +1 -0
- package/dist/auth/passkeys/register.d.ts +20 -0
- package/dist/auth/passkeys/register.d.ts.map +1 -0
- package/dist/auth/passkeys/registration-options.d.ts +22 -0
- package/dist/auth/passkeys/registration-options.d.ts.map +1 -0
- package/dist/auth/passkeys/remove-all.d.ts +26 -0
- package/dist/auth/passkeys/remove-all.d.ts.map +1 -0
- package/dist/auth/passkeys/sign-in-options.d.ts +12 -0
- package/dist/auth/passkeys/sign-in-options.d.ts.map +1 -0
- package/dist/auth/passkeys/sign-in.d.ts +21 -0
- package/dist/auth/passkeys/sign-in.d.ts.map +1 -0
- package/dist/auth/passkeys/verifier.d.ts +113 -0
- package/dist/auth/passkeys/verifier.d.ts.map +1 -0
- package/dist/auth/passkeys/view.d.ts +5 -0
- package/dist/auth/passkeys/view.d.ts.map +1 -0
- package/dist/auth/passkeys/wiring.d.ts +24 -0
- package/dist/auth/passkeys/wiring.d.ts.map +1 -0
- package/dist/auth/password-written.d.ts +55 -0
- package/dist/auth/password-written.d.ts.map +1 -0
- package/dist/auth/port/assert-api-keys.d.ts +21 -0
- package/dist/auth/port/assert-api-keys.d.ts.map +1 -0
- package/dist/auth/port/assert-invitations.d.ts +15 -0
- package/dist/auth/port/assert-invitations.d.ts.map +1 -0
- package/dist/auth/port/assert-stores.d.ts +16 -0
- package/dist/auth/port/assert-stores.d.ts.map +1 -0
- package/dist/auth/port/memory/api-keys/capabilities.d.ts +8 -0
- package/dist/auth/port/memory/api-keys/capabilities.d.ts.map +1 -0
- package/dist/auth/port/memory/api-keys/index.d.ts +13 -0
- package/dist/auth/port/memory/api-keys/index.d.ts.map +1 -0
- package/dist/auth/port/memory/api-keys/pages.d.ts +7 -0
- package/dist/auth/port/memory/api-keys/pages.d.ts.map +1 -0
- package/dist/auth/port/memory/copy.d.ts +6 -0
- package/dist/auth/port/memory/copy.d.ts.map +1 -0
- package/dist/auth/port/memory/index.d.ts +10 -0
- package/dist/auth/port/memory/index.d.ts.map +1 -0
- package/dist/auth/port/memory/invitations-pending.d.ts +6 -0
- package/dist/auth/port/memory/invitations-pending.d.ts.map +1 -0
- package/dist/auth/port/memory/invitations.d.ts +12 -0
- package/dist/auth/port/memory/invitations.d.ts.map +1 -0
- package/dist/auth/port/memory/passkeys.d.ts +9 -0
- package/dist/auth/port/memory/passkeys.d.ts.map +1 -0
- package/dist/auth/port/memory/sessions.d.ts +4 -0
- package/dist/auth/port/memory/sessions.d.ts.map +1 -0
- package/dist/auth/port/memory/social-links.d.ts +10 -0
- package/dist/auth/port/memory/social-links.d.ts.map +1 -0
- package/dist/auth/port/memory/stores.d.ts +26 -0
- package/dist/auth/port/memory/stores.d.ts.map +1 -0
- package/dist/auth/port/memory/tokens.d.ts +4 -0
- package/dist/auth/port/memory/tokens.d.ts.map +1 -0
- package/dist/auth/port/memory/user-index.d.ts +20 -0
- package/dist/auth/port/memory/user-index.d.ts.map +1 -0
- package/dist/auth/port/memory/user-update.d.ts +10 -0
- package/dist/auth/port/memory/user-update.d.ts.map +1 -0
- package/dist/auth/port/memory/users.d.ts +4 -0
- package/dist/auth/port/memory/users.d.ts.map +1 -0
- package/dist/auth/port/types/api-keys.d.ts +199 -0
- package/dist/auth/port/types/api-keys.d.ts.map +1 -0
- package/dist/auth/port/types/credentials.d.ts +46 -0
- package/dist/auth/port/types/credentials.d.ts.map +1 -0
- package/dist/auth/port/types/index.d.ts +75 -0
- package/dist/auth/port/types/index.d.ts.map +1 -0
- package/dist/auth/port/types/invitations/index.d.ts +15 -0
- package/dist/auth/port/types/invitations/index.d.ts.map +1 -0
- package/dist/auth/port/types/invitations/page.d.ts +52 -0
- package/dist/auth/port/types/invitations/page.d.ts.map +1 -0
- package/dist/auth/port/types/invitations/records.d.ts +101 -0
- package/dist/auth/port/types/invitations/records.d.ts.map +1 -0
- package/dist/auth/port/types/invitations/store.d.ts +82 -0
- package/dist/auth/port/types/invitations/store.d.ts.map +1 -0
- package/dist/auth/port/types/json.d.ts +27 -0
- package/dist/auth/port/types/json.d.ts.map +1 -0
- package/dist/auth/port/types/passkeys.d.ts +94 -0
- package/dist/auth/port/types/passkeys.d.ts.map +1 -0
- package/dist/auth/port/types/sessions.d.ts +142 -0
- package/dist/auth/port/types/sessions.d.ts.map +1 -0
- package/dist/auth/port/types/social-links.d.ts +64 -0
- package/dist/auth/port/types/social-links.d.ts.map +1 -0
- package/dist/auth/port/types/stores.d.ts +48 -0
- package/dist/auth/port/types/stores.d.ts.map +1 -0
- package/dist/auth/port/types/tokens.d.ts +168 -0
- package/dist/auth/port/types/tokens.d.ts.map +1 -0
- package/dist/auth/port/types/users.d.ts +260 -0
- package/dist/auth/port/types/users.d.ts.map +1 -0
- package/dist/auth/prepared.d.ts +21 -0
- package/dist/auth/prepared.d.ts.map +1 -0
- package/dist/auth/proven-sign-in.d.ts +22 -0
- package/dist/auth/proven-sign-in.d.ts.map +1 -0
- package/dist/auth/sealer-for.d.ts +44 -0
- package/dist/auth/sealer-for.d.ts.map +1 -0
- package/dist/auth/sealing.d.ts +36 -0
- package/dist/auth/sealing.d.ts.map +1 -0
- package/dist/auth/second-factor/activate.d.ts +9 -0
- package/dist/auth/second-factor/activate.d.ts.map +1 -0
- package/dist/auth/second-factor/app-code-attempts.d.ts +47 -0
- package/dist/auth/second-factor/app-code-attempts.d.ts.map +1 -0
- package/dist/auth/second-factor/challenge.d.ts +15 -0
- package/dist/auth/second-factor/challenge.d.ts.map +1 -0
- package/dist/auth/second-factor/codes-left.d.ts +14 -0
- package/dist/auth/second-factor/codes-left.d.ts.map +1 -0
- package/dist/auth/second-factor/disable.d.ts +10 -0
- package/dist/auth/second-factor/disable.d.ts.map +1 -0
- package/dist/auth/second-factor/enroll.d.ts +6 -0
- package/dist/auth/second-factor/enroll.d.ts.map +1 -0
- package/dist/auth/second-factor/factor.d.ts +33 -0
- package/dist/auth/second-factor/factor.d.ts.map +1 -0
- package/dist/auth/second-factor/flows.d.ts +36 -0
- package/dist/auth/second-factor/flows.d.ts.map +1 -0
- package/dist/auth/second-factor/lifecycle.d.ts +14 -0
- package/dist/auth/second-factor/lifecycle.d.ts.map +1 -0
- package/dist/auth/second-factor/passkey-confirm.d.ts +21 -0
- package/dist/auth/second-factor/passkey-confirm.d.ts.map +1 -0
- package/dist/auth/second-factor/recovery-codes.d.ts +36 -0
- package/dist/auth/second-factor/recovery-codes.d.ts.map +1 -0
- package/dist/auth/second-factor/recovery.d.ts +20 -0
- package/dist/auth/second-factor/recovery.d.ts.map +1 -0
- package/dist/auth/second-factor/redeem.d.ts +42 -0
- package/dist/auth/second-factor/redeem.d.ts.map +1 -0
- package/dist/auth/second-factor/refusal.d.ts +6 -0
- package/dist/auth/second-factor/refusal.d.ts.map +1 -0
- package/dist/auth/second-factor/regenerate.d.ts +12 -0
- package/dist/auth/second-factor/regenerate.d.ts.map +1 -0
- package/dist/auth/second-factor/reseal.d.ts +17 -0
- package/dist/auth/second-factor/reseal.d.ts.map +1 -0
- package/dist/auth/second-factor/spend-recovery-code.d.ts +15 -0
- package/dist/auth/second-factor/spend-recovery-code.d.ts.map +1 -0
- package/dist/auth/secrets.d.ts +17 -0
- package/dist/auth/secrets.d.ts.map +1 -0
- package/dist/auth/sessions/amr.d.ts +36 -0
- package/dist/auth/sessions/amr.d.ts.map +1 -0
- package/dist/auth/sessions/authenticate.d.ts +12 -0
- package/dist/auth/sessions/authenticate.d.ts.map +1 -0
- package/dist/auth/sessions/collect-expired.d.ts +15 -0
- package/dist/auth/sessions/collect-expired.d.ts.map +1 -0
- package/dist/auth/sessions/cookie.d.ts +9 -0
- package/dist/auth/sessions/cookie.d.ts.map +1 -0
- package/dist/auth/sessions/fresh.d.ts +35 -0
- package/dist/auth/sessions/fresh.d.ts.map +1 -0
- package/dist/auth/sessions/index.d.ts +12 -0
- package/dist/auth/sessions/index.d.ts.map +1 -0
- package/dist/auth/sessions/open-session.d.ts +22 -0
- package/dist/auth/sessions/open-session.d.ts.map +1 -0
- package/dist/auth/sessions/presented-token.d.ts +25 -0
- package/dist/auth/sessions/presented-token.d.ts.map +1 -0
- package/dist/auth/sessions/shared-api.d.ts +17 -0
- package/dist/auth/sessions/shared-api.d.ts.map +1 -0
- package/dist/auth/sessions/standing.d.ts +32 -0
- package/dist/auth/sessions/standing.d.ts.map +1 -0
- package/dist/auth/shared-api.d.ts +139 -0
- package/dist/auth/shared-api.d.ts.map +1 -0
- package/dist/auth/sign-in-attempts.d.ts +45 -0
- package/dist/auth/sign-in-attempts.d.ts.map +1 -0
- package/dist/auth/sign-in-code.d.ts +26 -0
- package/dist/auth/sign-in-code.d.ts.map +1 -0
- package/dist/auth/social/attach.d.ts +31 -0
- package/dist/auth/social/attach.d.ts.map +1 -0
- package/dist/auth/social/begin.d.ts +30 -0
- package/dist/auth/social/begin.d.ts.map +1 -0
- package/dist/auth/social/complete-link.d.ts +17 -0
- package/dist/auth/social/complete-link.d.ts.map +1 -0
- package/dist/auth/social/complete.d.ts +54 -0
- package/dist/auth/social/complete.d.ts.map +1 -0
- package/dist/auth/social/cookie.d.ts +16 -0
- package/dist/auth/social/cookie.d.ts.map +1 -0
- package/dist/auth/social/find-provider.d.ts +23 -0
- package/dist/auth/social/find-provider.d.ts.map +1 -0
- package/dist/auth/social/finish.d.ts +60 -0
- package/dist/auth/social/finish.d.ts.map +1 -0
- package/dist/auth/social/flow-cookie-value.d.ts +26 -0
- package/dist/auth/social/flow-cookie-value.d.ts.map +1 -0
- package/dist/auth/social/flow-secret.d.ts +40 -0
- package/dist/auth/social/flow-secret.d.ts.map +1 -0
- package/dist/auth/social/index.d.ts +19 -0
- package/dist/auth/social/index.d.ts.map +1 -0
- package/dist/auth/social/link-holder.d.ts +33 -0
- package/dist/auth/social/link-holder.d.ts.map +1 -0
- package/dist/auth/social/provider-call.d.ts +31 -0
- package/dist/auth/social/provider-call.d.ts.map +1 -0
- package/dist/auth/social/redeem.d.ts +45 -0
- package/dist/auth/social/redeem.d.ts.map +1 -0
- package/dist/auth/social/return-to.d.ts +18 -0
- package/dist/auth/social/return-to.d.ts.map +1 -0
- package/dist/auth/social/sign-in.d.ts +41 -0
- package/dist/auth/social/sign-in.d.ts.map +1 -0
- package/dist/auth/social/sign-up.d.ts +37 -0
- package/dist/auth/social/sign-up.d.ts.map +1 -0
- package/dist/auth/social/start.d.ts +21 -0
- package/dist/auth/social/start.d.ts.map +1 -0
- package/dist/auth/social/step-up-proof.d.ts +26 -0
- package/dist/auth/social/step-up-proof.d.ts.map +1 -0
- package/dist/auth/social/step-up-request.d.ts +28 -0
- package/dist/auth/social/step-up-request.d.ts.map +1 -0
- package/dist/auth/social/step-up.d.ts +19 -0
- package/dist/auth/social/step-up.d.ts.map +1 -0
- package/dist/auth/social/types-of.d.ts +12 -0
- package/dist/auth/social/types-of.d.ts.map +1 -0
- package/dist/auth/social/unlink.d.ts +16 -0
- package/dist/auth/social/unlink.d.ts.map +1 -0
- package/dist/auth/social/wiring.d.ts +10 -0
- package/dist/auth/social/wiring.d.ts.map +1 -0
- package/dist/auth/standard-schema.d.ts +41 -0
- package/dist/auth/standard-schema.d.ts.map +1 -0
- package/dist/auth/step-up/codes.d.ts +35 -0
- package/dist/auth/step-up/codes.d.ts.map +1 -0
- package/dist/auth/step-up/flows.d.ts +18 -0
- package/dist/auth/step-up/flows.d.ts.map +1 -0
- package/dist/auth/step-up/open.d.ts +23 -0
- package/dist/auth/step-up/open.d.ts.map +1 -0
- package/dist/auth/step-up/passkey.d.ts +31 -0
- package/dist/auth/step-up/passkey.d.ts.map +1 -0
- package/dist/auth/step-up/request.d.ts +15 -0
- package/dist/auth/step-up/request.d.ts.map +1 -0
- package/dist/auth/step-up/spend.d.ts +4 -0
- package/dist/auth/step-up/spend.d.ts.map +1 -0
- package/dist/auth/totp.d.ts +36 -0
- package/dist/auth/totp.d.ts.map +1 -0
- package/dist/auth/types/api-keys-of.d.ts +19 -0
- package/dist/auth/types/api-keys-of.d.ts.map +1 -0
- package/dist/auth/types/api-keys.d.ts +164 -0
- package/dist/auth/types/api-keys.d.ts.map +1 -0
- package/dist/auth/types/avatar.d.ts +72 -0
- package/dist/auth/types/avatar.d.ts.map +1 -0
- package/dist/auth/types/change-email.d.ts +82 -0
- package/dist/auth/types/change-email.d.ts.map +1 -0
- package/dist/auth/types/checks.d.ts +147 -0
- package/dist/auth/types/checks.d.ts.map +1 -0
- package/dist/auth/types/email-flows.d.ts +117 -0
- package/dist/auth/types/email-flows.d.ts.map +1 -0
- package/dist/auth/types/find-by-email.d.ts +31 -0
- package/dist/auth/types/find-by-email.d.ts.map +1 -0
- package/dist/auth/types/find-or-create.d.ts +59 -0
- package/dist/auth/types/find-or-create.d.ts.map +1 -0
- package/dist/auth/types/index.d.ts +38 -0
- package/dist/auth/types/index.d.ts.map +1 -0
- package/dist/auth/types/inference.d.ts +62 -0
- package/dist/auth/types/inference.d.ts.map +1 -0
- package/dist/auth/types/invitations/api.d.ts +203 -0
- package/dist/auth/types/invitations/api.d.ts.map +1 -0
- package/dist/auth/types/invitations/history.d.ts +87 -0
- package/dist/auth/types/invitations/history.d.ts.map +1 -0
- package/dist/auth/types/invitations/index.d.ts +10 -0
- package/dist/auth/types/invitations/index.d.ts.map +1 -0
- package/dist/auth/types/invitations/invitation.d.ts +76 -0
- package/dist/auth/types/invitations/invitation.d.ts.map +1 -0
- package/dist/auth/types/invitations/issue-type.d.ts +15 -0
- package/dist/auth/types/invitations/issue-type.d.ts.map +1 -0
- package/dist/auth/types/invitations-of.d.ts +26 -0
- package/dist/auth/types/invitations-of.d.ts.map +1 -0
- package/dist/auth/types/janus.d.ts +51 -0
- package/dist/auth/types/janus.d.ts.map +1 -0
- package/dist/auth/types/magic-link.d.ts +69 -0
- package/dist/auth/types/magic-link.d.ts.map +1 -0
- package/dist/auth/types/passkeys.d.ts +183 -0
- package/dist/auth/types/passkeys.d.ts.map +1 -0
- package/dist/auth/types/password.d.ts +113 -0
- package/dist/auth/types/password.d.ts.map +1 -0
- package/dist/auth/types/prepared.d.ts +68 -0
- package/dist/auth/types/prepared.d.ts.map +1 -0
- package/dist/auth/types/proven-sign-in.d.ts +43 -0
- package/dist/auth/types/proven-sign-in.d.ts.map +1 -0
- package/dist/auth/types/reset-password.d.ts +46 -0
- package/dist/auth/types/reset-password.d.ts.map +1 -0
- package/dist/auth/types/second-factor.d.ts +164 -0
- package/dist/auth/types/second-factor.d.ts.map +1 -0
- package/dist/auth/types/session.d.ts +68 -0
- package/dist/auth/types/session.d.ts.map +1 -0
- package/dist/auth/types/shared-api.d.ts +96 -0
- package/dist/auth/types/shared-api.d.ts.map +1 -0
- package/dist/auth/types/sign-in.d.ts +102 -0
- package/dist/auth/types/sign-in.d.ts.map +1 -0
- package/dist/auth/types/social-flow.d.ts +28 -0
- package/dist/auth/types/social-flow.d.ts.map +1 -0
- package/dist/auth/types/social-step-up.d.ts +38 -0
- package/dist/auth/types/social-step-up.d.ts.map +1 -0
- package/dist/auth/types/social.d.ts +193 -0
- package/dist/auth/types/social.d.ts.map +1 -0
- package/dist/auth/types/step-up.d.ts +133 -0
- package/dist/auth/types/step-up.d.ts.map +1 -0
- package/dist/auth/types/type-api.d.ts +29 -0
- package/dist/auth/types/type-api.d.ts.map +1 -0
- package/dist/auth/types/user-type.d.ts +106 -0
- package/dist/auth/types/user-type.d.ts.map +1 -0
- package/dist/auth/types/user.d.ts +62 -0
- package/dist/auth/types/user.d.ts.map +1 -0
- package/dist/auth/types/verify-email.d.ts +190 -0
- package/dist/auth/types/verify-email.d.ts.map +1 -0
- package/dist/auth/users/any-type-api.d.ts +6 -0
- package/dist/auth/users/any-type-api.d.ts.map +1 -0
- package/dist/auth/users/by-login.d.ts +10 -0
- package/dist/auth/users/by-login.d.ts.map +1 -0
- package/dist/auth/users/change-password.d.ts +26 -0
- package/dist/auth/users/change-password.d.ts.map +1 -0
- package/dist/auth/users/delete.d.ts +10 -0
- package/dist/auth/users/delete.d.ts.map +1 -0
- package/dist/auth/users/email-move-guard.d.ts +20 -0
- package/dist/auth/users/email-move-guard.d.ts.map +1 -0
- package/dist/auth/users/email-prefix.d.ts +23 -0
- package/dist/auth/users/email-prefix.d.ts.map +1 -0
- package/dist/auth/users/fields-patch.d.ts +21 -0
- package/dist/auth/users/fields-patch.d.ts.map +1 -0
- package/dist/auth/users/find-by-email.d.ts +11 -0
- package/dist/auth/users/find-by-email.d.ts.map +1 -0
- package/dist/auth/users/find-many.d.ts +29 -0
- package/dist/auth/users/find-many.d.ts.map +1 -0
- package/dist/auth/users/find-or-create.d.ts +12 -0
- package/dist/auth/users/find-or-create.d.ts.map +1 -0
- package/dist/auth/users/flow-types.d.ts +15 -0
- package/dist/auth/users/flow-types.d.ts.map +1 -0
- package/dist/auth/users/index.d.ts +9 -0
- package/dist/auth/users/index.d.ts.map +1 -0
- package/dist/auth/users/insert.d.ts +15 -0
- package/dist/auth/users/insert.d.ts.map +1 -0
- package/dist/auth/users/name-prefix.d.ts +19 -0
- package/dist/auth/users/name-prefix.d.ts.map +1 -0
- package/dist/auth/users/password-flows.d.ts +11 -0
- package/dist/auth/users/password-flows.d.ts.map +1 -0
- package/dist/auth/users/record-flows.d.ts +11 -0
- package/dist/auth/users/record-flows.d.ts.map +1 -0
- package/dist/auth/users/sign-in.d.ts +24 -0
- package/dist/auth/users/sign-in.d.ts.map +1 -0
- package/dist/auth/users/sign-up.d.ts +13 -0
- package/dist/auth/users/sign-up.d.ts.map +1 -0
- package/dist/auth/users/type-api.d.ts +10 -0
- package/dist/auth/users/type-api.d.ts.map +1 -0
- package/dist/auth/users/update.d.ts +16 -0
- package/dist/auth/users/update.d.ts.map +1 -0
- package/dist/background/background.d.ts +22 -0
- package/dist/background/background.d.ts.map +1 -0
- package/dist/chunks/index-2ttdcz7n.js +354 -0
- package/dist/chunks/index-2ttdcz7n.js.map +16 -0
- package/dist/chunks/index-5dxynm32.js +85 -0
- package/dist/chunks/index-5dxynm32.js.map +10 -0
- package/dist/chunks/index-ftz0ne6j.js +127 -0
- package/dist/chunks/index-ftz0ne6j.js.map +11 -0
- package/dist/chunks/index-k6y18nx9.js +724 -0
- package/dist/chunks/index-k6y18nx9.js.map +24 -0
- package/dist/chunks/index-n8jxmxeg.js +64 -0
- package/dist/chunks/index-n8jxmxeg.js.map +11 -0
- package/dist/conformance/api-keys/cases/bound.d.ts +3 -0
- package/dist/conformance/api-keys/cases/bound.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/expiry.d.ts +3 -0
- package/dist/conformance/api-keys/cases/expiry.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/index.d.ts +4 -0
- package/dist/conformance/api-keys/cases/index.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/insert.d.ts +3 -0
- package/dist/conformance/api-keys/cases/insert.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/outage.d.ts +3 -0
- package/dist/conformance/api-keys/cases/outage.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/revoke.d.ts +3 -0
- package/dist/conformance/api-keys/cases/revoke.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/touch.d.ts +3 -0
- package/dist/conformance/api-keys/cases/touch.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/user-bound.d.ts +3 -0
- package/dist/conformance/api-keys/cases/user-bound.d.ts.map +1 -0
- package/dist/conformance/api-keys/describe.d.ts +20 -0
- package/dist/conformance/api-keys/describe.d.ts.map +1 -0
- package/dist/conformance/api-keys/fixtures.d.ts +4 -0
- package/dist/conformance/api-keys/fixtures.d.ts.map +1 -0
- package/dist/conformance/api-keys/index.d.ts +18 -0
- package/dist/conformance/api-keys/index.d.ts.map +1 -0
- package/dist/conformance/api-keys/reference.d.ts +4 -0
- package/dist/conformance/api-keys/reference.d.ts.map +1 -0
- package/dist/conformance/api-keys/types.d.ts +42 -0
- package/dist/conformance/api-keys/types.d.ts.map +1 -0
- package/dist/conformance/assert.d.ts +40 -0
- package/dist/conformance/assert.d.ts.map +1 -0
- package/dist/conformance/cases/outage.d.ts +3 -0
- package/dist/conformance/cases/outage.d.ts.map +1 -0
- package/dist/conformance/cases/outage.passkeys.d.ts +12 -0
- package/dist/conformance/cases/outage.passkeys.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/deletion.d.ts +4 -0
- package/dist/conformance/cases/passkeys/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/index.d.ts +8 -0
- package/dist/conformance/cases/passkeys/index.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/inserts.d.ts +4 -0
- package/dist/conformance/cases/passkeys/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/reads.d.ts +4 -0
- package/dist/conformance/cases/passkeys/reads.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/uses.d.ts +4 -0
- package/dist/conformance/cases/passkeys/uses.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/deletion.d.ts +4 -0
- package/dist/conformance/cases/sessions/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/extension.d.ts +4 -0
- package/dist/conformance/cases/sessions/extension.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/index.d.ts +4 -0
- package/dist/conformance/cases/sessions/index.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/inserts.d.ts +4 -0
- package/dist/conformance/cases/sessions/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/list.d.ts +4 -0
- package/dist/conformance/cases/sessions/list.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/reads.d.ts +4 -0
- package/dist/conformance/cases/sessions/reads.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/reauthentication.d.ts +4 -0
- package/dist/conformance/cases/sessions/reauthentication.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/revocation.d.ts +4 -0
- package/dist/conformance/cases/sessions/revocation.d.ts.map +1 -0
- package/dist/conformance/cases/social-links/deletion.d.ts +4 -0
- package/dist/conformance/cases/social-links/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/social-links/index.d.ts +8 -0
- package/dist/conformance/cases/social-links/index.d.ts.map +1 -0
- package/dist/conformance/cases/social-links/inserts.d.ts +4 -0
- package/dist/conformance/cases/social-links/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/social-links/reads.d.ts +4 -0
- package/dist/conformance/cases/social-links/reads.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/attempts.d.ts +7 -0
- package/dist/conformance/cases/tokens/attempts.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/change-email.d.ts +8 -0
- package/dist/conformance/cases/tokens/change-email.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/deletion.d.ts +4 -0
- package/dist/conformance/cases/tokens/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/index.d.ts +4 -0
- package/dist/conformance/cases/tokens/index.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/inserts.d.ts +7 -0
- package/dist/conformance/cases/tokens/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/kinds.d.ts +7 -0
- package/dist/conformance/cases/tokens/kinds.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/redemption.d.ts +7 -0
- package/dist/conformance/cases/tokens/redemption.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/social-flow.d.ts +8 -0
- package/dist/conformance/cases/tokens/social-flow.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/spending.d.ts +7 -0
- package/dist/conformance/cases/tokens/spending.d.ts.map +1 -0
- package/dist/conformance/cases/users/avatar.d.ts +8 -0
- package/dist/conformance/cases/users/avatar.d.ts.map +1 -0
- package/dist/conformance/cases/users/batch.d.ts +8 -0
- package/dist/conformance/cases/users/batch.d.ts.map +1 -0
- package/dist/conformance/cases/users/deletion.d.ts +4 -0
- package/dist/conformance/cases/users/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/users/index.d.ts +4 -0
- package/dist/conformance/cases/users/index.d.ts.map +1 -0
- package/dist/conformance/cases/users/inserts.d.ts +4 -0
- package/dist/conformance/cases/users/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/users/listing.d.ts +4 -0
- package/dist/conformance/cases/users/listing.d.ts.map +1 -0
- package/dist/conformance/cases/users/patches.d.ts +7 -0
- package/dist/conformance/cases/users/patches.d.ts.map +1 -0
- package/dist/conformance/cases/users/reads.d.ts +7 -0
- package/dist/conformance/cases/users/reads.d.ts.map +1 -0
- package/dist/conformance/cases/users/second-factor.d.ts +16 -0
- package/dist/conformance/cases/users/second-factor.d.ts.map +1 -0
- package/dist/conformance/cases/users/versions.d.ts +7 -0
- package/dist/conformance/cases/users/versions.d.ts.map +1 -0
- package/dist/conformance/describe.d.ts +82 -0
- package/dist/conformance/describe.d.ts.map +1 -0
- package/dist/conformance/fixtures.d.ts +31 -0
- package/dist/conformance/fixtures.d.ts.map +1 -0
- package/dist/conformance/index.d.ts +46 -0
- package/dist/conformance/index.d.ts.map +1 -0
- package/dist/conformance/index.js +4411 -0
- package/dist/conformance/index.js.map +86 -0
- package/dist/conformance/invitations/cases/actors.d.ts +3 -0
- package/dist/conformance/invitations/cases/actors.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/find-pending.d.ts +3 -0
- package/dist/conformance/invitations/cases/find-pending.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/imported.d.ts +3 -0
- package/dist/conformance/invitations/cases/imported.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/index.d.ts +4 -0
- package/dist/conformance/invitations/cases/index.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/insert.d.ts +3 -0
- package/dist/conformance/invitations/cases/insert.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/list-lapsed.d.ts +3 -0
- package/dist/conformance/invitations/cases/list-lapsed.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/list-status.d.ts +3 -0
- package/dist/conformance/invitations/cases/list-status.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/list.d.ts +3 -0
- package/dist/conformance/invitations/cases/list.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/outage.d.ts +3 -0
- package/dist/conformance/invitations/cases/outage.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/scope.d.ts +3 -0
- package/dist/conformance/invitations/cases/scope.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/update.d.ts +3 -0
- package/dist/conformance/invitations/cases/update.d.ts.map +1 -0
- package/dist/conformance/invitations/describe.d.ts +20 -0
- package/dist/conformance/invitations/describe.d.ts.map +1 -0
- package/dist/conformance/invitations/fixtures.d.ts +4 -0
- package/dist/conformance/invitations/fixtures.d.ts.map +1 -0
- package/dist/conformance/invitations/index.d.ts +18 -0
- package/dist/conformance/invitations/index.d.ts.map +1 -0
- package/dist/conformance/invitations/reference.d.ts +4 -0
- package/dist/conformance/invitations/reference.d.ts.map +1 -0
- package/dist/conformance/invitations/types.d.ts +34 -0
- package/dist/conformance/invitations/types.d.ts.map +1 -0
- package/dist/conformance/reference.d.ts +13 -0
- package/dist/conformance/reference.d.ts.map +1 -0
- package/dist/conformance/relations/cases/deletion.d.ts +4 -0
- package/dist/conformance/relations/cases/deletion.d.ts.map +1 -0
- package/dist/conformance/relations/cases/holders.d.ts +9 -0
- package/dist/conformance/relations/cases/holders.d.ts.map +1 -0
- package/dist/conformance/relations/cases/index.d.ts +4 -0
- package/dist/conformance/relations/cases/index.d.ts.map +1 -0
- package/dist/conformance/relations/cases/outage.d.ts +3 -0
- package/dist/conformance/relations/cases/outage.d.ts.map +1 -0
- package/dist/conformance/relations/cases/reads.d.ts +8 -0
- package/dist/conformance/relations/cases/reads.d.ts.map +1 -0
- package/dist/conformance/relations/cases/traversal.d.ts +7 -0
- package/dist/conformance/relations/cases/traversal.d.ts.map +1 -0
- package/dist/conformance/relations/cases/writes.d.ts +4 -0
- package/dist/conformance/relations/cases/writes.d.ts.map +1 -0
- package/dist/conformance/relations/describe.d.ts +20 -0
- package/dist/conformance/relations/describe.d.ts.map +1 -0
- package/dist/conformance/relations/fixtures.d.ts +8 -0
- package/dist/conformance/relations/fixtures.d.ts.map +1 -0
- package/dist/conformance/relations/index.d.ts +18 -0
- package/dist/conformance/relations/index.d.ts.map +1 -0
- package/dist/conformance/relations/reference.d.ts +4 -0
- package/dist/conformance/relations/reference.d.ts.map +1 -0
- package/dist/conformance/relations/types.d.ts +34 -0
- package/dist/conformance/relations/types.d.ts.map +1 -0
- package/dist/conformance/types.d.ts +79 -0
- package/dist/conformance/types.d.ts.map +1 -0
- package/dist/errors/janus-error/base.d.ts +47 -0
- package/dist/errors/janus-error/base.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.credentials.d.ts +36 -0
- package/dist/errors/janus-error/codes.credentials.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.d.ts +23 -0
- package/dist/errors/janus-error/codes.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.invitations.d.ts +52 -0
- package/dist/errors/janus-error/codes.invitations.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.one-time.d.ts +63 -0
- package/dist/errors/janus-error/codes.one-time.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.records.d.ts +86 -0
- package/dist/errors/janus-error/codes.records.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.social.d.ts +88 -0
- package/dist/errors/janus-error/codes.social.d.ts.map +1 -0
- package/dist/errors/janus-error/index.d.ts +17 -0
- package/dist/errors/janus-error/index.d.ts.map +1 -0
- package/dist/errors/janus-error/options.d.ts +105 -0
- package/dist/errors/janus-error/options.d.ts.map +1 -0
- package/dist/errors/janus-error/refusals.d.ts +151 -0
- package/dist/errors/janus-error/refusals.d.ts.map +1 -0
- package/dist/errors/janus-error/status.d.ts +21 -0
- package/dist/errors/janus-error/status.d.ts.map +1 -0
- package/dist/errors/janus-error/store.d.ts +36 -0
- package/dist/errors/janus-error/store.d.ts.map +1 -0
- package/dist/ids/derived.d.ts +25 -0
- package/dist/ids/derived.d.ts.map +1 -0
- package/dist/ids/id.d.ts +55 -0
- package/dist/ids/id.d.ts.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6933 -0
- package/dist/index.js.map +208 -0
- package/dist/pagination/cursor-page.d.ts +53 -0
- package/dist/pagination/cursor-page.d.ts.map +1 -0
- package/dist/permissions/bound-model.d.ts +10 -0
- package/dist/permissions/bound-model.d.ts.map +1 -0
- package/dist/permissions/can.d.ts +13 -0
- package/dist/permissions/can.d.ts.map +1 -0
- package/dist/permissions/engine.d.ts +49 -0
- package/dist/permissions/engine.d.ts.map +1 -0
- package/dist/permissions/holders.d.ts +12 -0
- package/dist/permissions/holders.d.ts.map +1 -0
- package/dist/permissions/index.d.ts +36 -0
- package/dist/permissions/index.d.ts.map +1 -0
- package/dist/permissions/index.js +924 -0
- package/dist/permissions/index.js.map +28 -0
- package/dist/permissions/input.d.ts +43 -0
- package/dist/permissions/input.d.ts.map +1 -0
- package/dist/permissions/list.d.ts +16 -0
- package/dist/permissions/list.d.ts.map +1 -0
- package/dist/permissions/model/can.d.ts +41 -0
- package/dist/permissions/model/can.d.ts.map +1 -0
- package/dist/permissions/model/config.d.ts +36 -0
- package/dist/permissions/model/config.d.ts.map +1 -0
- package/dist/permissions/model/constraint.d.ts +37 -0
- package/dist/permissions/model/constraint.d.ts.map +1 -0
- package/dist/permissions/model/ctx.d.ts +23 -0
- package/dist/permissions/model/ctx.d.ts.map +1 -0
- package/dist/permissions/model/define.d.ts +78 -0
- package/dist/permissions/model/define.d.ts.map +1 -0
- package/dist/permissions/model/from-field.d.ts +31 -0
- package/dist/permissions/model/from-field.d.ts.map +1 -0
- package/dist/permissions/model/grant.d.ts +81 -0
- package/dist/permissions/model/grant.d.ts.map +1 -0
- package/dist/permissions/model/list.d.ts +48 -0
- package/dist/permissions/model/list.d.ts.map +1 -0
- package/dist/permissions/model/names.d.ts +51 -0
- package/dist/permissions/model/names.d.ts.map +1 -0
- package/dist/permissions/model/permissions.d.ts +48 -0
- package/dist/permissions/model/permissions.d.ts.map +1 -0
- package/dist/permissions/model/refs.d.ts +36 -0
- package/dist/permissions/model/refs.d.ts.map +1 -0
- package/dist/permissions/model/refusal.d.ts +13 -0
- package/dist/permissions/model/refusal.d.ts.map +1 -0
- package/dist/permissions/model/unions.d.ts +3 -0
- package/dist/permissions/model/unions.d.ts.map +1 -0
- package/dist/permissions/model/when.d.ts +16 -0
- package/dist/permissions/model/when.d.ts.map +1 -0
- package/dist/permissions/port/holders.d.ts +38 -0
- package/dist/permissions/port/holders.d.ts.map +1 -0
- package/dist/permissions/port/memory.d.ts +17 -0
- package/dist/permissions/port/memory.d.ts.map +1 -0
- package/dist/permissions/port/types.d.ts +101 -0
- package/dist/permissions/port/types.d.ts.map +1 -0
- package/dist/permissions/replace.d.ts +25 -0
- package/dist/permissions/replace.d.ts.map +1 -0
- package/dist/permissions/resolve/declared-names.d.ts +24 -0
- package/dist/permissions/resolve/declared-names.d.ts.map +1 -0
- package/dist/permissions/resolve/refuse-data-beyond-root.d.ts +11 -0
- package/dist/permissions/resolve/refuse-data-beyond-root.d.ts.map +1 -0
- package/dist/permissions/resolve/refuse-loops.d.ts +10 -0
- package/dist/permissions/resolve/refuse-loops.d.ts.map +1 -0
- package/dist/permissions/resolve/resolve-model.d.ts +13 -0
- package/dist/permissions/resolve/resolve-model.d.ts.map +1 -0
- package/dist/permissions/resolve/resolve-relation.d.ts +9 -0
- package/dist/permissions/resolve/resolve-relation.d.ts.map +1 -0
- package/dist/permissions/resolve/resolve-rule.d.ts +12 -0
- package/dist/permissions/resolve/resolve-rule.d.ts.map +1 -0
- package/dist/permissions/resolve/resolved.d.ts +52 -0
- package/dist/permissions/resolve/resolved.d.ts.map +1 -0
- package/dist/permissions/resolve/step.d.ts +4 -0
- package/dist/permissions/resolve/step.d.ts.map +1 -0
- package/dist/permissions/reverse.d.ts +53 -0
- package/dist/permissions/reverse.d.ts.map +1 -0
- package/dist/permissions/walk.d.ts +29 -0
- package/dist/permissions/walk.d.ts.map +1 -0
- package/dist/stores/guard.d.ts +24 -0
- package/dist/stores/guard.d.ts.map +1 -0
- package/dist/stores/storable.d.ts +15 -0
- package/dist/stores/storable.d.ts.map +1 -0
- package/dist/subjects/notation.d.ts +39 -0
- package/dist/subjects/notation.d.ts.map +1 -0
- package/dist/subjects/subject.d.ts +128 -0
- package/dist/subjects/subject.d.ts.map +1 -0
- package/dist/testing/index.d.ts +12 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +26 -0
- package/dist/testing/index.js.map +10 -0
- package/dist/time/clock.d.ts +31 -0
- package/dist/time/clock.d.ts.map +1 -0
- package/dist/time/duration.d.ts +23 -0
- package/dist/time/duration.d.ts.map +1 -0
- package/docs/README.md +46 -0
- package/docs/guide/adapters.md +858 -0
- package/docs/guide/api-keys.md +316 -0
- package/docs/guide/avatars.md +334 -0
- package/docs/guide/devices.md +441 -0
- package/docs/guide/email-flows.md +880 -0
- package/docs/guide/errors.md +180 -0
- package/docs/guide/events.md +467 -0
- package/docs/guide/invitations.md +465 -0
- package/docs/guide/issuers.md +107 -0
- package/docs/guide/magic-link.md +580 -0
- package/docs/guide/migrating-invitations.md +142 -0
- package/docs/guide/passkeys.md +425 -0
- package/docs/guide/passwords.md +325 -0
- package/docs/guide/permissions.md +719 -0
- package/docs/guide/second-factor.md +1124 -0
- package/docs/guide/sessions.md +521 -0
- package/docs/guide/sign-in-code.md +631 -0
- package/docs/guide/social.md +639 -0
- package/docs/guide/step-up.md +262 -0
- package/docs/guide/users.md +557 -0
- package/docs/guide/vocabulary.md +316 -0
- package/docs/roadmap.md +101 -0
- package/docs/troubleshooting.md +3305 -0
- package/package.json +77 -5
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
# Signing in with an e-mailed code
|
|
2
|
+
|
|
3
|
+
This page is for signing a user in with a six-digit code sent to their
|
|
4
|
+
e-mail: no password needed, and the code proves the address. `janus` issues
|
|
5
|
+
and checks the code; **sending the e-mail is yours**.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { createMemoryStores, janus, scryptHasher } from '@softistx/janus';
|
|
10
|
+
|
|
11
|
+
async function sendMail(to: string, subject: string, text: string): Promise<void> {
|
|
12
|
+
// your mailer
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const auth = janus({
|
|
16
|
+
user: z.object({ email: z.email() }),
|
|
17
|
+
password: { login: 'email' },
|
|
18
|
+
store: createMemoryStores(),
|
|
19
|
+
hasher: scryptHasher(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const issued = await auth.signInCode.request('ada@example.com'); // IssuedCode | null
|
|
23
|
+
if (issued !== null) {
|
|
24
|
+
await sendMail(issued.email, 'Your sign-in code', `${issued.code} signs you in. It expires in 10 minutes.`);
|
|
25
|
+
|
|
26
|
+
// keep issued.challenge with the visitor; on their next request, with the code they typed:
|
|
27
|
+
const signedIn = await auth.signInCode.confirm(issued.challenge, issued.code);
|
|
28
|
+
signedIn.token; // a session, as signIn opens one
|
|
29
|
+
signedIn.user.emailVerified; // true: the code reached the inbox
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
A sign-in by code is two requests: one asks for a code and answers the same
|
|
34
|
+
page whoever asked, the other takes the code and opens the session. The
|
|
35
|
+
words — **one-time code**, **challenge**, **attempt** — are defined in
|
|
36
|
+
[the vocabulary](vocabulary.md#identities).
|
|
37
|
+
|
|
38
|
+
## Which types have it
|
|
39
|
+
|
|
40
|
+
`signInCode` exists on every user type with an e-mail — the field `email`
|
|
41
|
+
names, or a required string field called `email` — **with or without a
|
|
42
|
+
password**. A type with no e-mail has no `signInCode`: it is absent from its
|
|
43
|
+
type, not failing at run time.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const clinic = janus({
|
|
47
|
+
users: {
|
|
48
|
+
patient: { schema: z.object({ email: z.email() }), password: { login: 'email' } },
|
|
49
|
+
staff: { schema: z.object({ username: z.string() }), password: { login: 'username' } },
|
|
50
|
+
member: { schema: z.object({ email: z.email() }) }, // no password: signs in by code only
|
|
51
|
+
},
|
|
52
|
+
store: createMemoryStores(),
|
|
53
|
+
hasher: scryptHasher(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
clinic.patient.signInCode.request; // exists
|
|
57
|
+
clinic.member.signInCode.request; // exists: see Passwordless types, below
|
|
58
|
+
// @ts-expect-error — staff have no e-mail to send a code to
|
|
59
|
+
clinic.staff.signInCode;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Requesting a code
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
const issued = await auth.signInCode.request(email);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`request` looks up the user of this type holding that e-mail — trimmed and
|
|
69
|
+
lowercased first, so `' ADA@example.com '` finds `ada@example.com` — and
|
|
70
|
+
issues a code for them:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
interface IssuedCode<U> {
|
|
74
|
+
readonly code: string; // six digits, '042817': for the e-mail, and nowhere else
|
|
75
|
+
readonly challenge: string; // the secret the code is checked against: for the visitor, never the e-mail
|
|
76
|
+
readonly email: string; // the address to send the code to, as the user's field holds it
|
|
77
|
+
readonly expiresAt: Date; // ten minutes from now, by default
|
|
78
|
+
readonly user: U;
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
It answers **`null`** when nobody of this type holds that e-mail, when the
|
|
83
|
+
user is inactive, and when the value matches a login that only looks like an
|
|
84
|
+
e-mail — a username `ada@example.com` on a type whose e-mail is another
|
|
85
|
+
field. Nothing is issued, nothing is written.
|
|
86
|
+
|
|
87
|
+
**Never tell the visitor which.** Answer the same page, with the same
|
|
88
|
+
headers, whether `request` issued a code or not — "if an account uses that
|
|
89
|
+
address, we sent it a code". A different status, body or cookie is an
|
|
90
|
+
account-enumeration oracle: it tells anyone who types an address whether it
|
|
91
|
+
has an account. When the challenge travels in a cookie, set one on the
|
|
92
|
+
`null` path too, with a random value of the same shape, so the headers match
|
|
93
|
+
— confirming it is `TOKEN_UNKNOWN`, like any wrong challenge:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { randomBytes } from 'node:crypto';
|
|
97
|
+
|
|
98
|
+
const issued = await auth.signInCode.request(email);
|
|
99
|
+
// 32 random bytes, base64url — the shape of a real challenge, which nothing will ever accept
|
|
100
|
+
const challenge = issued?.challenge ?? randomBytes(32).toString('base64url');
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The decoy makes **the request** answer the same; **the confirmation** still
|
|
104
|
+
tells, if it answers each refusal as it comes. Anyone can ask a code for an
|
|
105
|
+
address, then send a wrong one: a decoy's challenge is `TOKEN_UNKNOWN`, a
|
|
106
|
+
real one's is `CODE_INVALID` with `attemptsLeft`. When the addresses of your
|
|
107
|
+
users must stay secret, answer every refusal of the code route alike, and
|
|
108
|
+
give up `attemptsLeft`:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { JanusError } from '@softistx/janus';
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
const signedIn = await auth.signInCode.confirm(challenge, code);
|
|
115
|
+
// … set the session cookie, as below
|
|
116
|
+
} catch (error) {
|
|
117
|
+
if (error instanceof JanusError && error.code !== 'STORE_FAILED') {
|
|
118
|
+
// one answer for a wrong code, a spent or unknown challenge — a decoy's included
|
|
119
|
+
return Response.json({ code: 'CODE_INVALID' }, { status: 401 });
|
|
120
|
+
}
|
|
121
|
+
throw error; // STORE_FAILED: your 503
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Send the e-mail **after** answering, from a queue or a promise you do not
|
|
126
|
+
await: a request that sends an e-mail takes longer than one that does not,
|
|
127
|
+
and the time the answer takes would tell what its body does not. The store's
|
|
128
|
+
own latency — one write for a code issued, none for `null` — still tells a
|
|
129
|
+
patient observer; that limit is stated rather than denied.
|
|
130
|
+
|
|
131
|
+
Every `request` issues a **new** code with its own challenge, and spends the
|
|
132
|
+
earlier ones: only the last code sent works — see
|
|
133
|
+
[attempts](#attempts). How often a code is asked for is limited per address by [the mail
|
|
134
|
+
throttle](email-flows.md#requests-that-send-e-mail-are-throttled); limit the
|
|
135
|
+
route per client yourself too.
|
|
136
|
+
|
|
137
|
+
## Requesting a code in two steps
|
|
138
|
+
|
|
139
|
+
Sending the e-mail after answering hides the mailer's time, not the store's:
|
|
140
|
+
`request` looks the address up and writes a code for an account, and stops
|
|
141
|
+
at the lookup for nobody. Running all of `request` off the visitor's request
|
|
142
|
+
hides that too — but then its `MAIL_THROTTLED` reaches nobody, and the
|
|
143
|
+
challenge, which the visitor must keep, is not there to set in a cookie.
|
|
144
|
+
`prepare` answers both:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
// in the visitor's request: validated and counted, nobody looked up, a challenge minted
|
|
148
|
+
const pending = await auth.signInCode.prepare(email); // MAIL_THROTTLED past the limit: answer 429
|
|
149
|
+
|
|
150
|
+
// off it — a queue, or a promise you do not await
|
|
151
|
+
void pending
|
|
152
|
+
.send() // what request answers: IssuedCode | null, its challenge pending.challenge — and it counts nothing
|
|
153
|
+
.then((issued) => {
|
|
154
|
+
if (issued !== null) return sendMail(issued.email, 'Your sign-in code', `Your code is ${issued.code}.`);
|
|
155
|
+
})
|
|
156
|
+
.catch(reportError);
|
|
157
|
+
|
|
158
|
+
// the same answer either way, the challenge with it: no decoy to make
|
|
159
|
+
// (CHALLENGE and scope as in [As routes](#as-routes), below)
|
|
160
|
+
return Response.json(
|
|
161
|
+
{ next: 'code' },
|
|
162
|
+
{ status: 202, headers: { 'Set-Cookie': `${CHALLENGE}=${pending.challenge}; Max-Age=600; ${scope}` } },
|
|
163
|
+
);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**The challenge is minted before the lookup**, so every visitor gets one,
|
|
167
|
+
whoever holds the address. For an address nobody holds, `send()` answers
|
|
168
|
+
`null` and the challenge confirms as `TOKEN_UNKNOWN`, exactly as the decoy
|
|
169
|
+
did; for an account, the code `send()` issues is checked against it. Until
|
|
170
|
+
`send()` has run, the challenge is `TOKEN_UNKNOWN` for an account too — a
|
|
171
|
+
visitor who types a code first reads the e-mail first.
|
|
172
|
+
|
|
173
|
+
`prepare` makes the same store calls whoever holds the address — the
|
|
174
|
+
count's, none with the throttle off. `send()` runs **once**: a second call,
|
|
175
|
+
or one after a `send()` that failed, is a `TypeError`
|
|
176
|
+
(`signInCode.prepare(…).send: already called — …`); prepare again, which
|
|
177
|
+
counts again and mints another challenge. The confirmation still tells a
|
|
178
|
+
real challenge from a decoy by `attemptsLeft`: answer every refusal alike
|
|
179
|
+
where that matters, as [above](#requesting-a-code). The details, shared
|
|
180
|
+
with links and password resets, are in
|
|
181
|
+
[the e-mail flows guide](email-flows.md#requests-in-two-steps).
|
|
182
|
+
|
|
183
|
+
## Sending the code by e-mail
|
|
184
|
+
|
|
185
|
+
Put **the code, and only the code**, in the e-mail — with its lifetime, so
|
|
186
|
+
the visitor knows how long they have:
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
if (issued !== null) {
|
|
190
|
+
const minutes = Math.round((issued.expiresAt.getTime() - Date.now()) / 60_000);
|
|
191
|
+
void sendMail(
|
|
192
|
+
issued.email,
|
|
193
|
+
'Your sign-in code',
|
|
194
|
+
`Your code is ${issued.code}. It expires in ${minutes} minutes.\n` +
|
|
195
|
+
'If you did not ask for it, ignore this e-mail: nobody can sign in without it.',
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**No link, and no challenge.** A link carrying the challenge would put it in
|
|
201
|
+
the mailbox beside the code — whoever reads the e-mail would hold both
|
|
202
|
+
halves — and in every server log and proxy the link crosses. A [sign-in link](magic-link.md)
|
|
203
|
+
is another flow, with a token of its own: here the code is typed into the
|
|
204
|
+
page that asked for it, so the sign-in completes in the browser that started
|
|
205
|
+
it.
|
|
206
|
+
|
|
207
|
+
Send it to `issued.email`, not to what the visitor typed: it is the address
|
|
208
|
+
the user's field holds, as they registered it.
|
|
209
|
+
|
|
210
|
+
[`@softistx/janus-mail`](https://github.com/softistx/nxgt-janus/tree/develop/packages/janus-mail)
|
|
211
|
+
sends this e-mail ready-made, in English and French, over any `@softistx/mail`
|
|
212
|
+
transport. It takes the whole `IssuedCode` and reads only `code` and
|
|
213
|
+
`email`: the challenge never reaches the e-mail, nor a template of yours.
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
if (issued !== null) await mail.signInCode(issued, { locale: 'fr-CA' }); // the recipient's locale: sent in fr
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Its send rejects with the mailer's `MailFailure` when the transport fails, so the `void sendMail(…)` above
|
|
220
|
+
does not carry over: to send after the answer, hand `mail.signInCode` to a
|
|
221
|
+
queue that awaits it and retries a `MailFailure` — a promise nobody awaits
|
|
222
|
+
turns an outage into an unhandled rejection.
|
|
223
|
+
|
|
224
|
+
## Keeping the challenge with the visitor
|
|
225
|
+
|
|
226
|
+
**The challenge is a secret.** The code alone signs nobody in: it is checked
|
|
227
|
+
against the challenge, and only its hash is stored, keyed by the challenge.
|
|
228
|
+
Whoever holds the challenge needs only the six digits, so keep it where the
|
|
229
|
+
visitor's next request presents it, and nowhere else:
|
|
230
|
+
|
|
231
|
+
- **a short-lived cookie** — `HttpOnly`, `Secure`, `SameSite=Strict`, a
|
|
232
|
+
`Path` covering only the code route, and a `Max-Age` ending at `expiresAt`;
|
|
233
|
+
- or **the body of the code form** — a hidden field of the page that asks
|
|
234
|
+
for the code;
|
|
235
|
+
- or, for a bearer client, the body of the answer, which it sends back with
|
|
236
|
+
the code.
|
|
237
|
+
|
|
238
|
+
**Never in the e-mail, never in a URL** — a query string reaches server logs,
|
|
239
|
+
proxies, the browser's history and the `Referer` header — **and never in a
|
|
240
|
+
log**. Log the user's id if you need to. The challenge is stored only as its
|
|
241
|
+
hash, like a session token, so the store cannot give it back either.
|
|
242
|
+
|
|
243
|
+
A challenge belongs to the user type that issued it: confirm a patient's
|
|
244
|
+
challenge with `clinic.patient.signInCode.confirm`. Another type's `confirm`
|
|
245
|
+
answers `TOKEN_UNKNOWN` and compares no code — but it has already cost one of
|
|
246
|
+
the challenge's five attempts, because the attempt is counted before the type
|
|
247
|
+
is known. The challenge is left for its own type, with one attempt fewer, and
|
|
248
|
+
the fifth such call spends it, as a fifth wrong code would.
|
|
249
|
+
|
|
250
|
+
## Confirming the code
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
const signedIn = await auth.signInCode.confirm(challenge, code);
|
|
254
|
+
// { status: 'signedIn', user, session, token }: the session is open
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
`confirm` checks the code against its challenge, spends the challenge, marks
|
|
258
|
+
the user's e-mail verified — the code reached the inbox — and opens a
|
|
259
|
+
session: the same `SignedIn` that `signIn` answers.
|
|
260
|
+
|
|
261
|
+
### Attempts
|
|
262
|
+
|
|
263
|
+
A challenge takes **five attempts**. Every call to `confirm` counts one, in
|
|
264
|
+
one write to the store, **before the code is compared** — a code that is not
|
|
265
|
+
six digits, a code that races another: each costs an attempt. `attemptsLeft`
|
|
266
|
+
counts down `4, 3, 2, 1, 0`; the fifth wrong code spends the challenge, and
|
|
267
|
+
the next call is `TOKEN_SPENT`, even with the right code.
|
|
268
|
+
|
|
269
|
+
```ts
|
|
270
|
+
import { TokenError } from '@softistx/janus';
|
|
271
|
+
|
|
272
|
+
try {
|
|
273
|
+
await auth.signInCode.confirm(challenge, code);
|
|
274
|
+
} catch (error) {
|
|
275
|
+
if (error instanceof TokenError && error.code === 'CODE_INVALID') {
|
|
276
|
+
error.attemptsLeft; // 4 after the first wrong code; 0 once the challenge is spent
|
|
277
|
+
}
|
|
278
|
+
throw error;
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Five attempts at a million values is a one-in-200,000 chance per challenge.
|
|
283
|
+
Codes sent at once past the fifth attempt are all refused, the right one
|
|
284
|
+
included: the store counts, and nothing reads the count before writing it.
|
|
285
|
+
|
|
286
|
+
**At most one code is live per user.** A `request` issues its code, then
|
|
287
|
+
spends every other challenge of the user, so the code in an earlier e-mail
|
|
288
|
+
answers `TOKEN_SPENT` — only the last one works:
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
const first = await auth.signInCode.request(email);
|
|
292
|
+
const second = await auth.signInCode.request(email); // the visitor asked again
|
|
293
|
+
await auth.signInCode.confirm(first.challenge, first.code); // TOKEN_SPENT
|
|
294
|
+
await auth.signInCode.confirm(second.challenge, second.code); // signed in
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Requests that arrive at once cannot each keep a code: each spends the others'
|
|
298
|
+
once it issued its own, so at most one survives — sometimes none, and the
|
|
299
|
+
visitor asks again. Guesses therefore never run against two live challenges.
|
|
300
|
+
|
|
301
|
+
**`request` is throttled per address.** A new challenge takes only a new
|
|
302
|
+
`request`, and each one sends an e-mail and cancels the code before it, so
|
|
303
|
+
past five requests for one address in a 10-minute window `request` throws
|
|
304
|
+
`MailThrottledError` (`MAIL_THROTTLED`) and issues nothing — no challenge is
|
|
305
|
+
minted, a refused request spends and rotates nothing, and the code last sent
|
|
306
|
+
still works until it expires, even when somebody else's request caused it. The address is counted before
|
|
307
|
+
anything is looked up, so an address nobody holds is counted and refused
|
|
308
|
+
alike; under the limit it still answers `null`. This flow counts on its own:
|
|
309
|
+
a loop on `magicLink.request` never shuts it. Answer it with a 429 and
|
|
310
|
+
`Retry-After`:
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
import { MailThrottledError } from '@softistx/janus';
|
|
314
|
+
|
|
315
|
+
try {
|
|
316
|
+
const issued = await auth.signInCode.request(email);
|
|
317
|
+
// …send the e-mail from `issued`, whether or not there is one to send
|
|
318
|
+
} catch (error) {
|
|
319
|
+
if (error instanceof MailThrottledError) {
|
|
320
|
+
return Response.json(
|
|
321
|
+
{
|
|
322
|
+
error: 'too many e-mails — the last one we sent still works; use it, or wait',
|
|
323
|
+
retryAfter: error.retryAfter,
|
|
324
|
+
},
|
|
325
|
+
{ status: 429, headers: { 'retry-after': String(error.retryAfter) } },
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
throw error;
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
With several user types the message is prefixed with the type, as in
|
|
333
|
+
`patient.signInCode.request: too many e-mails asked for this address — the last
|
|
334
|
+
one sent still works; use it, or wait for the next window`. Somebody who knows
|
|
335
|
+
an address cannot shut its e-mailed sign-in: the last code they caused to be
|
|
336
|
+
sent still works, and they can only fill the inbox, five per window. Tell the
|
|
337
|
+
visitor to use the last e-mail they received, or to wait `retryAfter` seconds.
|
|
338
|
+
`janus` never sees IP addresses, so one client asking for many addresses is
|
|
339
|
+
not counted: add a per-IP ceiling with `@softistx/redis` rate limits
|
|
340
|
+
([example](email-flows.md#requests-that-send-e-mail-are-throttled)).
|
|
341
|
+
|
|
342
|
+
### Lifetime
|
|
343
|
+
|
|
344
|
+
A challenge lives **ten minutes** unless `tokens.signInCode` says otherwise,
|
|
345
|
+
and is `TOKEN_EXPIRED` after that. Ten minutes is time for an e-mail to
|
|
346
|
+
arrive and be read; a longer window is a longer life for a stolen challenge.
|
|
347
|
+
|
|
348
|
+
```ts
|
|
349
|
+
janus({ ..., tokens: { signInCode: '15m' } });
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Keep the mail window (`mail.throttle.window`, `'10m'` by default) no longer
|
|
353
|
+
than the lifetime: with `tokens.signInCode: '5m'` the last code can expire
|
|
354
|
+
before the window ends, and the visitor has none live until it does.
|
|
355
|
+
### The e-mail is verified
|
|
356
|
+
|
|
357
|
+
A user whose `emailVerified` was `false` has it `true` once `confirm`
|
|
358
|
+
succeeds, and their `version` moves: the code proves the address as a
|
|
359
|
+
verification link would, and a [`user.emailVerified` event](events.md) is
|
|
360
|
+
sent. A user already verified is not written, and nothing is sent.
|
|
361
|
+
|
|
362
|
+
**An e-mail proved for the first time drops the password and the second
|
|
363
|
+
factor, signs out every session and revokes every API key** before the new one opens: the proof
|
|
364
|
+
can land on an account someone else registered, with a password — and maybe
|
|
365
|
+
a second factor — of theirs. `user.passwordChanged` follows
|
|
366
|
+
`user.emailVerified` when a password was dropped, then
|
|
367
|
+
`user.secondFactorDisabled` when an active factor was; an e-mail already
|
|
368
|
+
verified changes nothing. The details are in
|
|
369
|
+
[the sign-in link guide](magic-link.md#an-account-someone-else-registered):
|
|
370
|
+
the same holds for a code.
|
|
371
|
+
|
|
372
|
+
### A second factor is still asked for
|
|
373
|
+
|
|
374
|
+
The code proves the e-mail, not the second factor. With `janus({ secondFactor })`,
|
|
375
|
+
a user whose e-mail was already verified and whose factor is active gets
|
|
376
|
+
**no session from the code**: `confirm`
|
|
377
|
+
answers a challenge, exactly as `signIn` does with a password, and
|
|
378
|
+
[`secondFactor.confirm`](second-factor.md#confirming-the-code-at-sign-in)
|
|
379
|
+
redeems it with the code of their authenticator app — or
|
|
380
|
+
[`secondFactor.recover`](second-factor.md#signing-in-with-one) with a
|
|
381
|
+
recovery code, when their phone is gone.
|
|
382
|
+
|
|
383
|
+
```ts
|
|
384
|
+
const result = await auth.signInCode.confirm(challenge, code);
|
|
385
|
+
switch (result.status) {
|
|
386
|
+
case 'signedIn':
|
|
387
|
+
// result.token, result.session: set the cookie
|
|
388
|
+
break;
|
|
389
|
+
case 'secondFactor':
|
|
390
|
+
// result.challenge: a new challenge, for secondFactor.confirm — keep it as you kept this one
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
`confirm` answers `SignInResult` on a type whose `signIn` does — a type with
|
|
396
|
+
a password, in an instance given a `secondFactor` — and reading `token`
|
|
397
|
+
before narrowing on `status` is a compile error there. Anywhere else it
|
|
398
|
+
answers `SignedIn`.
|
|
399
|
+
|
|
400
|
+
### The device
|
|
401
|
+
|
|
402
|
+
With [`janus({ devices })`](devices.md), `confirm` takes the device token
|
|
403
|
+
the client holds as its third argument, and tells a sign-in from a new
|
|
404
|
+
device as `signIn` does:
|
|
405
|
+
|
|
406
|
+
```ts
|
|
407
|
+
const signedIn = await auth.signInCode.confirm(challenge, code, { device: cookie ?? null });
|
|
408
|
+
// { status: 'signedIn', …, newDevice, deviceToken }: keep deviceToken in the device cookie
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
A new device sends `user.newDeviceSignedIn` — last, after the events a first
|
|
412
|
+
proof of the e-mail sends. When `confirm` answers a second factor's
|
|
413
|
+
challenge, the challenge carries no device: give it again to
|
|
414
|
+
`secondFactor.confirm`. Without `{ device }`, nothing is tracked.
|
|
415
|
+
|
|
416
|
+
### What `confirm` refuses
|
|
417
|
+
|
|
418
|
+
| Rejects with | When | What to do |
|
|
419
|
+
| --- | --- | --- |
|
|
420
|
+
| `CODE_INVALID`, with `attemptsLeft` | the code does not match, or is not six digits. Message: `signInCode.confirm: the code does not match, or was already used` | ask again while `attemptsLeft > 0`; at `0` the challenge is spent: request a new code |
|
|
421
|
+
| `TOKEN_UNKNOWN` | no such challenge — a typo, another user type's, one whose user was deleted, or one a store's TTL already dropped. Another type's challenge still loses one of its attempts, and its fifth spends it | request a new code |
|
|
422
|
+
| `TOKEN_SPENT` | the challenge already signed someone in, its attempts ran out, or a newer `request` for the same user spent it — only the last code sent works | request a new code, and use the latest e-mail |
|
|
423
|
+
| `TOKEN_EXPIRED` | `expiresAt` has passed | request a new code |
|
|
424
|
+
| `TOKEN_STALE` | the user changed their e-mail since the code was sent. Message: `signInCode.confirm: the code was sent to an e-mail the user no longer has`. The challenge is spent | request a new code, to the current address |
|
|
425
|
+
| `USER_INACTIVE` | the user was deactivated since the code was sent. The challenge is spent | answer 403 |
|
|
426
|
+
| `VERSION_CONFLICT` | rare: another write to the user landed while `confirm` marked the e-mail verified. The challenge is spent | request a new code |
|
|
427
|
+
|
|
428
|
+
Every refusal is a `TokenError` but `USER_INACTIVE`, a `UserInactiveError`;
|
|
429
|
+
with several user types the message starts with the type:
|
|
430
|
+
`patient.signInCode.confirm: …`. The `TOKEN_*` messages name the challenge —
|
|
431
|
+
`no such challenge`, `the challenge was already used`, `the challenge has
|
|
432
|
+
expired`. Every call may also reject with `STORE_FAILED`: your 503, never a
|
|
433
|
+
401. [Troubleshooting](../troubleshooting.md#sign-in-codes) has each message
|
|
434
|
+
with its cause.
|
|
435
|
+
|
|
436
|
+
## Passwordless types
|
|
437
|
+
|
|
438
|
+
A user type with an e-mail and **no `password`** signs in by code alone.
|
|
439
|
+
Create its users with `create` — `signUp` and `signIn` need a password, and
|
|
440
|
+
do not exist on it:
|
|
441
|
+
|
|
442
|
+
```ts
|
|
443
|
+
import { z } from 'zod';
|
|
444
|
+
import { createMemoryStores, janus } from '@softistx/janus';
|
|
445
|
+
|
|
446
|
+
const auth = janus({
|
|
447
|
+
user: z.object({ email: z.email(), name: z.string() }),
|
|
448
|
+
store: createMemoryStores(), // no password: no hasher needed
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
await auth.create({ email: 'ada@example.com', name: 'Ada' });
|
|
452
|
+
|
|
453
|
+
const issued = await auth.signInCode.request('ada@example.com');
|
|
454
|
+
if (issued !== null) {
|
|
455
|
+
const signedIn = await auth.signInCode.confirm(issued.challenge, issued.code);
|
|
456
|
+
signedIn.user.hasPassword; // false
|
|
457
|
+
}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
A passwordless type with an e-mail has a second factor too (its e-mail names
|
|
461
|
+
the entry in the authenticator app), so in an instance given a `secondFactor`
|
|
462
|
+
its `confirm` answers `SignInResult` like a password type's: narrow on
|
|
463
|
+
`status`:
|
|
464
|
+
|
|
465
|
+
```ts
|
|
466
|
+
const clinic = janus({
|
|
467
|
+
users: {
|
|
468
|
+
patient: { schema: z.object({ email: z.email() }), password: { login: 'email' } },
|
|
469
|
+
member: { schema: z.object({ email: z.email() }) },
|
|
470
|
+
},
|
|
471
|
+
store: createMemoryStores(),
|
|
472
|
+
hasher: scryptHasher(),
|
|
473
|
+
secondFactor: { issuer: 'Clinic', keys: [{ id: '2026-09', key: process.env.TOTP_KEY ?? '' }] },
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
const member = await clinic.member.signInCode.confirm(challenge, code);
|
|
477
|
+
if (member.status === 'signedIn') member.token; // SignInResult: narrow first
|
|
478
|
+
const patient = await clinic.patient.signInCode.confirm(challenge, code);
|
|
479
|
+
if (patient.status === 'signedIn') patient.token; // the same for a password type
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
A user of a type **with** a password can sign in by code too, whether or not
|
|
483
|
+
they ever set one: `create` a user with no password, and the code is how
|
|
484
|
+
they get in until `setPassword`.
|
|
485
|
+
|
|
486
|
+
## Options
|
|
487
|
+
|
|
488
|
+
| Option | Type | Default | Effect |
|
|
489
|
+
| --- | --- | --- | --- |
|
|
490
|
+
| `tokens.signInCode` | `Duration` | `'10m'` | How long a challenge — and so its code — can be confirmed |
|
|
491
|
+
| `email` | a field name | `'email'` | The field the code is sent to, and looked up by, per type |
|
|
492
|
+
|
|
493
|
+
```ts
|
|
494
|
+
janus({
|
|
495
|
+
user: z.object({ contact: z.email() }),
|
|
496
|
+
email: 'contact', // request() looks up, and answers, this field
|
|
497
|
+
store: createMemoryStores(),
|
|
498
|
+
tokens: { signInCode: '5m' },
|
|
499
|
+
});
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
A `tokens.signInCode` that is not a duration is refused when `janus()` is
|
|
503
|
+
called, with a `TypeError`: `janus: tokens.signInCode: "<value>" is not a
|
|
504
|
+
duration; …`. The code is always six digits and a challenge always takes
|
|
505
|
+
five attempts; neither is configurable.
|
|
506
|
+
|
|
507
|
+
## As routes
|
|
508
|
+
|
|
509
|
+
A fetch-style pair of handlers — the shape Bun and most frameworks hand
|
|
510
|
+
you. The challenge travels in a cookie scoped to the code route;
|
|
511
|
+
[`@softistx/janus-hono`](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus-hono/docs/guide/routes.md#a-code-sent-by-e-mail)
|
|
512
|
+
has the same in Hono.
|
|
513
|
+
|
|
514
|
+
```ts
|
|
515
|
+
import { randomBytes } from 'node:crypto';
|
|
516
|
+
import { JanusError, TokenError } from '@softistx/janus';
|
|
517
|
+
|
|
518
|
+
const CHALLENGE = 'sign-in-code';
|
|
519
|
+
const scope = 'Path=/sign-in/email; HttpOnly; Secure; SameSite=Strict';
|
|
520
|
+
|
|
521
|
+
export async function requestCode(request: Request): Promise<Response> {
|
|
522
|
+
const { email } = (await request.json()) as { email: string };
|
|
523
|
+
const issued = await auth.signInCode.request(email);
|
|
524
|
+
if (issued !== null) {
|
|
525
|
+
void sendMail(issued.email, 'Your sign-in code', `Your code is ${issued.code}.`); // not awaited
|
|
526
|
+
}
|
|
527
|
+
// the same answer either way: a decoy challenge when nobody holds the e-mail
|
|
528
|
+
const challenge = issued?.challenge ?? randomBytes(32).toString('base64url');
|
|
529
|
+
return Response.json(
|
|
530
|
+
{ next: 'code' },
|
|
531
|
+
{ status: 202, headers: { 'Set-Cookie': `${CHALLENGE}=${challenge}; Max-Age=600; ${scope}` } },
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export async function confirmCode(request: Request): Promise<Response> {
|
|
536
|
+
const { code } = (await request.json()) as { code: string };
|
|
537
|
+
const challenge = request.headers
|
|
538
|
+
.get('cookie')
|
|
539
|
+
?.match(new RegExp(`(?:^|;\\s*)${CHALLENGE}=([^;]+)`))?.[1];
|
|
540
|
+
if (challenge === undefined) return Response.json({ code: 'TOKEN_UNKNOWN' }, { status: 400 });
|
|
541
|
+
|
|
542
|
+
try {
|
|
543
|
+
const signedIn = await auth.signInCode.confirm(challenge, code);
|
|
544
|
+
const headers = new Headers();
|
|
545
|
+
headers.append('Set-Cookie', auth.cookie.serialize(signedIn.token, signedIn.session));
|
|
546
|
+
headers.append('Set-Cookie', `${CHALLENGE}=; Max-Age=0; ${scope}`);
|
|
547
|
+
return Response.json({ id: signedIn.user.id }, { headers });
|
|
548
|
+
} catch (error) {
|
|
549
|
+
if (error instanceof TokenError && error.code === 'CODE_INVALID') {
|
|
550
|
+
return Response.json({ code: error.code, attemptsLeft: error.attemptsLeft }, { status: 401 });
|
|
551
|
+
}
|
|
552
|
+
if (error instanceof JanusError && error.code === 'USER_INACTIVE') {
|
|
553
|
+
return Response.json({ code: error.code }, { status: 403 });
|
|
554
|
+
}
|
|
555
|
+
if (error instanceof JanusError && error.code !== 'STORE_FAILED') {
|
|
556
|
+
return Response.json({ code: error.code }, { status: 400 }); // TOKEN_*: request a new code
|
|
557
|
+
}
|
|
558
|
+
throw error; // STORE_FAILED: your 503
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
`Max-Age=600` is the default ten minutes, written out so the decoy and the
|
|
564
|
+
real cookie are the same header; derive it from `tokens.signInCode` if you
|
|
565
|
+
change that. A wrong code leaves the cookie in place, so the visitor types
|
|
566
|
+
it again. These routes answer `attemptsLeft`, so the code route tells a
|
|
567
|
+
decoy from a real challenge; where that matters, use
|
|
568
|
+
[one answer for every refusal](#requesting-a-code) instead. With a `secondFactor` configured, narrow `confirm`'s answer on
|
|
569
|
+
`status` before reading `token`, and hand the new challenge on to
|
|
570
|
+
[the second factor's route](second-factor.md#a-sign-in-with-a-code-as-routes).
|
|
571
|
+
|
|
572
|
+
## In a test
|
|
573
|
+
|
|
574
|
+
No mailbox needed: `request` answers the code it would have sent.
|
|
575
|
+
|
|
576
|
+
```ts
|
|
577
|
+
import { expect, it } from 'bun:test';
|
|
578
|
+
import { z } from 'zod';
|
|
579
|
+
import { createMemoryStores, fixedClock, janus } from '@softistx/janus';
|
|
580
|
+
|
|
581
|
+
it('signs in with the e-mailed code, and not after ten minutes', async () => {
|
|
582
|
+
const clock = fixedClock(Date.UTC(2026, 0, 1));
|
|
583
|
+
const auth = janus({ user: z.object({ email: z.email() }), store: createMemoryStores(), clock });
|
|
584
|
+
await auth.create({ email: 'ada@example.com' });
|
|
585
|
+
|
|
586
|
+
const issued = await auth.signInCode.request('ada@example.com');
|
|
587
|
+
if (issued === null) throw new Error('expected a code');
|
|
588
|
+
expect((await auth.signInCode.confirm(issued.challenge, issued.code)).user.emailVerified).toBe(true);
|
|
589
|
+
|
|
590
|
+
const late = await auth.signInCode.request('ada@example.com');
|
|
591
|
+
if (late === null) throw new Error('expected a code');
|
|
592
|
+
clock.advance(10 * 60_000);
|
|
593
|
+
await expect(auth.signInCode.confirm(late.challenge, late.code)).rejects.toMatchObject({
|
|
594
|
+
code: 'TOKEN_EXPIRED',
|
|
595
|
+
});
|
|
596
|
+
});
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
## Signatures
|
|
600
|
+
|
|
601
|
+
```ts
|
|
602
|
+
interface SignInCodeApi<U, Answer = SignedIn<U>> {
|
|
603
|
+
readonly signInCode: {
|
|
604
|
+
request(email: string): Promise<IssuedCode<U> | null>;
|
|
605
|
+
prepare(email: string): Promise<PreparedCode<U>>;
|
|
606
|
+
confirm(challenge: string, code: string, options?: SignInOptions): Promise<Answer>;
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
interface PreparedCode<U> {
|
|
611
|
+
readonly challenge: string; // for the visitor, now: the one send() issues the code under
|
|
612
|
+
send(): Promise<IssuedCode<U> | null>; // once: a second call is a TypeError
|
|
613
|
+
}
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
`Answer` is `SignInResult<U>` on a type with a password or an e-mail in an
|
|
617
|
+
instance given a `secondFactor`, and `SignedIn<U>` everywhere else. `IssuedCode`,
|
|
618
|
+
`PreparedCode`, `SignInCodeApi` and `SignInOptions` are exported from
|
|
619
|
+
`@softistx/janus`, as types; `SignInOptions` is `{ device?: string | null }` — see
|
|
620
|
+
[devices](devices.md#giving-a-sign-in-the-device).
|
|
621
|
+
|
|
622
|
+
## See also
|
|
623
|
+
|
|
624
|
+
- [The second factor](second-factor.md) — the challenge `confirm` answers for a user whose factor is active
|
|
625
|
+
- [Sign-in links](magic-link.md) — the same sign-in with a link instead of a code: nothing to type, on whichever device opens it
|
|
626
|
+
- [E-mail verification and password reset](email-flows.md) — the other flows that send an e-mail, and `TOKEN_STALE`
|
|
627
|
+
- [Sessions](sessions.md) — the cookie the session is sent in
|
|
628
|
+
- [Devices](devices.md) — the `device` `confirm` takes, and the notice of a new one
|
|
629
|
+
- [Errors](errors.md) — every code and its status
|
|
630
|
+
- [`@softistx/janus-telemetry`](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus-telemetry/docs/guide/tracing.md#a-code-sent-by-e-mail) — the events a sign-in by code writes
|
|
631
|
+
- [Troubleshooting](../troubleshooting.md#sign-in-codes) — by the message you see
|