@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,557 @@
|
|
|
1
|
+
# Users — `janus()`
|
|
2
|
+
|
|
3
|
+
This page is for wiring `janus()` and managing users with it: the
|
|
4
|
+
configuration, one or several user types, and every method a user type
|
|
5
|
+
answers. It is the **identities** side, usable alone: nothing here needs
|
|
6
|
+
[permissions](permissions.md), and `@softistx/janus` loads none of their code. Sessions have [their own page](sessions.md), and so do the
|
|
7
|
+
[e-mail flows](email-flows.md) and [password hashing](passwords.md).
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { createMemoryStores, janus, scryptHasher } from '@softistx/janus';
|
|
12
|
+
|
|
13
|
+
const User = z.object({ email: z.email(), name: z.string() });
|
|
14
|
+
|
|
15
|
+
export const auth = janus({
|
|
16
|
+
user: User,
|
|
17
|
+
password: { login: 'email' },
|
|
18
|
+
store: createMemoryStores(),
|
|
19
|
+
hasher: scryptHasher(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const { user, session, token } = await auth.signUp({
|
|
23
|
+
email: 'ada@example.com',
|
|
24
|
+
name: 'Ada Lovelace',
|
|
25
|
+
password: 'correct horse',
|
|
26
|
+
});
|
|
27
|
+
user.email; // the schema's own field, at the top level
|
|
28
|
+
user.type; // 'user'
|
|
29
|
+
session.expiresAt; // Date
|
|
30
|
+
token; // handed back once: the store holds only its sha256
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`createMemoryStores()` is the reference store, for tests and for trying the
|
|
34
|
+
package. In production, pass an adapter's stores, such as
|
|
35
|
+
`createMongoStores(db)` from `@softistx/janus-mongo`.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
function janus<const C extends JanusConfig>(config: C & Checked<C>): Janus<C>;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`janus()` is **synchronous and does no I/O**. It checks that every store
|
|
42
|
+
answers every method of the port, and connects to nothing. A configuration it
|
|
43
|
+
cannot use is refused with a bare `TypeError` at that call, before any request
|
|
44
|
+
arrives.
|
|
45
|
+
|
|
46
|
+
## What a user is
|
|
47
|
+
|
|
48
|
+
A user is **your schema's fields at the top level**, plus what `janus` sets:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
interface UserBase<Type extends string = string> {
|
|
52
|
+
readonly id: Id; // a UUIDv7 the core minted
|
|
53
|
+
readonly type: Type; // 'user', or the name you gave the type
|
|
54
|
+
readonly emailVerified: boolean;
|
|
55
|
+
readonly active: boolean;
|
|
56
|
+
readonly hasPassword: boolean; // the hash itself never reaches a user
|
|
57
|
+
readonly hasSecondFactor: boolean; // an active second factor: signIn asks for a code
|
|
58
|
+
readonly avatar: { id: string; updatedAt: Date } | null; // null until the application sets one
|
|
59
|
+
readonly version: number; // one more on every write
|
|
60
|
+
readonly createdAt: Date;
|
|
61
|
+
readonly updatedAt: Date;
|
|
62
|
+
}
|
|
63
|
+
type User<Type extends string = string, Fields = object> = Readonly<Fields> & UserBase<Type>;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
A schema that declares one of those keys, or `password`, is refused at compile
|
|
67
|
+
time. `avatar` is `{ id, updatedAt } | null`: janus keeps only the opaque `id`
|
|
68
|
+
the application chose, and the image lives in the application's own storage — see [account avatars](avatars.md). A schema is any [Standard Schema](https://standardschema.dev) (Zod 4,
|
|
69
|
+
Valibot, ArkType), and its output must be JSON: a schema that produces a
|
|
70
|
+
`Date` is refused at compile time, because a `Date` round-trips through one
|
|
71
|
+
database and not the next. An optional field left `undefined` is dropped
|
|
72
|
+
before the store sees it. A string or a key holding a NUL character (`\u0000`)
|
|
73
|
+
or a lone surrogate is refused with `USER_INVALID`, on every adapter: PostgreSQL
|
|
74
|
+
keeps neither, so janus refuses them everywhere rather than fail on one. So is
|
|
75
|
+
a login your own `password.normalize` function turns into one — a `slice`
|
|
76
|
+
that cuts an emoji in half, say.
|
|
77
|
+
|
|
78
|
+
## Options
|
|
79
|
+
|
|
80
|
+
| Option | Type | Default | Effect |
|
|
81
|
+
| --- | --- | --- | --- |
|
|
82
|
+
| `user` | Standard Schema | — | One user type, named `'user'`. Exactly one of `user` and `users` |
|
|
83
|
+
| `users` | `{ [type]: UserTypeConfig }` | — | Several user types. See [Several user types](#several-user-types) |
|
|
84
|
+
| `password.login` | a field name | — | The field users sign in with: a **top-level, required string** field. A typo is a compile error |
|
|
85
|
+
| `password.normalize` | `'none' \| 'lowercase' \| 'lowercaseTrim' \| 'nfkcLowercaseTrim' \| (value) => string` | `'lowercaseTrim'` | Applied to the login before any store sees it, at sign-up and at sign-in alike |
|
|
86
|
+
| `password.minLength` | integer ≥ 1 | `8` | Below it: `PASSWORD_TOO_SHORT` |
|
|
87
|
+
| `email` | a field name | `'email'` | The field `verifyEmail`, `resetPassword`, `signInCode` and `magicLink` send to. Without one, those flows are absent from the type |
|
|
88
|
+
| `displayName` | a field name | `'name'` | The string field `list({ namePrefix })` and `count({ namePrefix })` search, kept as a folded, indexed `nameKey`. In a several-types config it sits in each type's config. See [searching by display name](#searching-by-display-name) |
|
|
89
|
+
| `session.lifespan` | `Duration` | `'7d'` | How long a session lives |
|
|
90
|
+
| `session.renewAfter` | `Duration \| false` | `'1d'` | When `authenticate` slides the session. `false` for a fixed lifespan |
|
|
91
|
+
| `session.absolute` | `Duration` | none | An absolute cap on a session's life from its sign-in, whatever its use. See [sessions](sessions.md) |
|
|
92
|
+
| `schemaVersion` | string | `'1'` | Recorded on every user written. Bump it when the schema tightens |
|
|
93
|
+
| `store` | `JanusStores` | — | Required. `createMemoryStores()` or an adapter's |
|
|
94
|
+
| `relations` | `RelationStore` | — | The permission store. Wired here, deleting a user deletes every tuple naming them |
|
|
95
|
+
| `hasher` | `PasswordHasher` | — | Required as soon as a type has a password. No silent fallback |
|
|
96
|
+
| `verifiers` | `PasswordHasher[]` | `[]` | Hashers that only verify: those older hashes were written with |
|
|
97
|
+
| `clock` | `Clock` | `systemClock` | `fixedClock()` in tests |
|
|
98
|
+
| `cookie` | `CookieConfig` | strict | See [sessions](sessions.md#the-cookie) |
|
|
99
|
+
| `tokens.verifyEmail` | `Duration` | `'24h'` | How long a verification token lives |
|
|
100
|
+
| `tokens.resetPassword` | `Duration` | `'1h'` | How long a reset token lives |
|
|
101
|
+
| `tokens.signInCode` | `Duration` | `'10m'` | How long an e-mailed sign-in code and its challenge live. See [sign-in codes](sign-in-code.md) |
|
|
102
|
+
| `tokens.magicLink` | `Duration` | `'15m'` | How long an e-mailed sign-in link lives. See [sign-in links](magic-link.md) |
|
|
103
|
+
| `tokens.stepUp` | `Duration` | `'10m'` | How long a step-up's challenge — and its e-mailed code — lives. See [step-up](step-up.md) |
|
|
104
|
+
| `signIn.throttle` | `{ attempts?, window? }` or `false` | `{ attempts: 10, window: '15m' }` | Passwords one login may try per window, the right one included, before `signIn` answers `CREDENTIALS_INVALID` with `retryAfter` until the window ends; `changePassword`'s wrong current passwords count in the same budget. `false` counts nothing. See [passwords](passwords.md#password-guessing-is-throttled) |
|
|
105
|
+
| `mail.throttle` | `{ attempts?, window? }` or `false` | `{ attempts: 5, window: '10m' }` | E-mails one address (`magicLink`, `signInCode`, `resetPassword` requests) or one user (`verifyEmail.send`, an e-mailed `stepUp.request`, and `changeEmail.send`, which counts the new address too) may ask for per flow and window, before the request throws `MAIL_THROTTLED` with `retryAfter` and issues nothing (the last link or code sent still works). Keep `window` no longer than the shortest `tokens.*` lifetime you use. `false` counts nothing. See [e-mail flows](email-flows.md#requests-that-send-e-mail-are-throttled) |
|
|
106
|
+
| `secondFactor` | `{ issuer, keys, challenge? }` | none | A TOTP second factor for every type with a password, and every passwordless type with an e-mail. Changes what `signIn` answers — see [the second factor](second-factor.md#configuration) |
|
|
107
|
+
| `devices` | `{ keys }` | none | The keys device tokens are signed with, to tell a sign-in from a new device. Without it, no sign-in may be given a `device` — see [devices](devices.md#wiring) |
|
|
108
|
+
| `events` | `UserEventListener` | none | Called with every user event — `user.created`, `user.deleted`, … — after the write, awaited. See [user events](events.md) |
|
|
109
|
+
|
|
110
|
+
A `Duration` is `'500ms'`, `'30s'`, `'15m'`, `'8h'`, `'7d'`, or a number of
|
|
111
|
+
milliseconds.
|
|
112
|
+
|
|
113
|
+
### `password.login` is checked at compile time
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
janus({
|
|
117
|
+
user: z.object({ email: z.email(), nickname: z.string().optional() }),
|
|
118
|
+
// @ts-expect-error — on login: '"emial" is not a required string field; name one of' 'email'
|
|
119
|
+
password: { login: 'emial' },
|
|
120
|
+
store: createMemoryStores(),
|
|
121
|
+
hasher: scryptHasher(),
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`nickname` is not offered either: a login read from an optional field is a user
|
|
126
|
+
who may have no way to sign in.
|
|
127
|
+
|
|
128
|
+
### `password.normalize`
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
janus({
|
|
132
|
+
user: z.object({ username: z.string() }),
|
|
133
|
+
password: { login: 'username', normalize: 'none' }, // 'Grace' and 'grace' are two users
|
|
134
|
+
store: createMemoryStores(),
|
|
135
|
+
hasher: scryptHasher(),
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
A function is accepted, and must be deterministic: the same rule normalises
|
|
140
|
+
at sign-up and at sign-in. An e-mail used by the e-mail flows is always
|
|
141
|
+
compared lower-cased and trimmed, whatever the login's rule.
|
|
142
|
+
|
|
143
|
+
## Several user types
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
const Patient = z.object({ email: z.email(), birthDate: z.string() });
|
|
147
|
+
const Staff = z.object({ username: z.string(), service: z.string() });
|
|
148
|
+
|
|
149
|
+
export const clinic = janus({
|
|
150
|
+
users: {
|
|
151
|
+
patient: { schema: Patient, password: { login: 'email' } },
|
|
152
|
+
staff: {
|
|
153
|
+
schema: Staff,
|
|
154
|
+
password: { login: 'username', normalize: 'none', minLength: 12 },
|
|
155
|
+
session: { lifespan: '8h', renewAfter: false },
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
store: createMemoryStores(),
|
|
159
|
+
hasher: scryptHasher(),
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
await clinic.patient.signUp({ email: 'p@example.com', birthDate: '1990-01-01', password: 'correct horse' });
|
|
163
|
+
await clinic.staff.signIn({ username: 'grace', password: 'a long passphrase' });
|
|
164
|
+
clinic.types; // readonly ('patient' | 'staff')[]
|
|
165
|
+
|
|
166
|
+
const current = await clinic.authenticate(request);
|
|
167
|
+
if (current?.user.type === 'staff') current.user.service; // narrowed by type
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Each type carries `schema` and, optionally, `password`, `email`, `session`
|
|
171
|
+
and `schemaVersion`, with the defaults above. A login is unique **per type**:
|
|
172
|
+
the same e-mail may hold a patient user and a staff user. A type name is
|
|
173
|
+
camelCase, and may not be one of `janus()`'s own methods (`authenticate`,
|
|
174
|
+
`signOut`, `signOutEverywhere`, `findUser`, `getUser`, `cookie`,
|
|
175
|
+
`collectExpired`, `types`, `avatar`, `changeEmail`, `verifyEmail`, `resetPassword`) — a compile error, and a `TypeError` for a
|
|
176
|
+
JavaScript caller.
|
|
177
|
+
|
|
178
|
+
## What each user type answers
|
|
179
|
+
|
|
180
|
+
In the one-type form these are on `auth` itself; with several types, on
|
|
181
|
+
`clinic.patient`, `clinic.staff`.
|
|
182
|
+
|
|
183
|
+
| Method | Answers | Rejects with |
|
|
184
|
+
| --- | --- | --- |
|
|
185
|
+
| `create(fields & { password?, active? })` | the user; no session | `USER_INVALID`, `PASSWORD_TOO_SHORT`, `LOGIN_TAKEN` |
|
|
186
|
+
| `find(id)` | the user, or `null` — for a malformed id, an unknown one, or one of another type | |
|
|
187
|
+
| `findMany(ids)` | the users, in the order of `ids`, each once; an id `find` answers `null` for is left out — see [below](#several-users-at-once--findmany) | |
|
|
188
|
+
| `get(id)` | the user | `NOT_FOUND` |
|
|
189
|
+
| `list({ after?, limit?, emailPrefix?, namePrefix? })` | `CursorPage<User>`, in creation order; with `emailPrefix`, only the users whose e-mail starts with it — see [below](#searching-by-e-mail-prefix); with `namePrefix`, only those whose display name does — see [searching by name](#searching-by-display-name) | `INVALID_CURSOR` |
|
|
190
|
+
| `count({ emailPrefix?, namePrefix? })` | how many users the type has, or how many `list` would walk with the same filters, as a number | |
|
|
191
|
+
| `update(user, patch, { ifVersion? })` | the user as written; sends `user.emailChanged` when the e-mail changed; to move a user to a proved address, use [`changeEmail`](email-flows.md#changeemail) | `USER_INVALID`, `LOGIN_TAKEN`, `EMAIL_CHANGE_NEEDS_PROOF`, `VERSION_CONFLICT`, `NOT_FOUND` |
|
|
192
|
+
| `setActive(user, active, { ifVersion? })` | the user as written | `VERSION_CONFLICT`, `NOT_FOUND` |
|
|
193
|
+
| `avatar.set(user, { id }, { ifVersion? })` | the user as written, with `avatar: { id, updatedAt }`; the id the user already has writes and sends nothing; else sends `user.avatarChanged` with `formerAvatarId`. Janus keeps the id, never the image: store the bytes first, under a fresh id (`crypto.randomUUID()`) — see [the README](../../README.md#avatars--avatar) | `AVATAR_ID_INVALID` (not a non-empty string of at most 512 characters that every store can keep, before anything is read), `VERSION_CONFLICT`, `NOT_FOUND` |
|
|
194
|
+
| `avatar.remove(user, { ifVersion? })` | the user as written, with `avatar: null`; a user with none writes and sends nothing; else sends `user.avatarRemoved` with `formerAvatarId` | `VERSION_CONFLICT`, `NOT_FOUND` |
|
|
195
|
+
| `delete(user)` | `true`, or `false` for an unknown id or one of another type | |
|
|
196
|
+
| `signInProven(user, { device? })` | **privileged** — after a proof your server verified, such as an invitation token: what `signIn` answers, a session or a second-factor challenge; no credential checked, nothing sent, counted or spent — see [sessions](sessions.md#signing-in-on-your-own-proof--signinproven) | `NOT_FOUND`, `USER_INACTIVE` |
|
|
197
|
+
|
|
198
|
+
With a `password`, besides:
|
|
199
|
+
|
|
200
|
+
| Method | Answers | Rejects with |
|
|
201
|
+
| --- | --- | --- |
|
|
202
|
+
| `signUp(fields & { password }, { device? })` | `{ status: 'signedIn', user, session, token, newDevice, deviceToken }` — `newDevice` always `false`; a first `deviceToken` when given a `device` ([devices](devices.md)) | `USER_INVALID`, `PASSWORD_TOO_SHORT`, `LOGIN_TAKEN` |
|
|
203
|
+
| `signIn({ [login]: string, password }, { device? })` | `{ status: 'signedIn', user, session, token, newDevice, deviceToken }` — or, with `secondFactor` configured and the user's factor active, `{ status: 'secondFactor', challenge, expiresAt, userId }`: switch on `status` | `CREDENTIALS_INVALID` — with `retryAfter` once the login is throttled — `USER_INACTIVE`, `HASH_UNSUPPORTED` |
|
|
204
|
+
| `findByLogin(login)` | the user, or `null`; the login is normalised first, and one holding a NUL or a lone surrogate is nobody's | |
|
|
205
|
+
| `setPassword(user, password, { ifVersion? })` | the user — an admin's call; spends the user's reset links and second-factor challenges still waiting, and signs nobody out; sends `user.passwordChanged` | `PASSWORD_TOO_SHORT` |
|
|
206
|
+
| `changePassword(user, { current, next }, { ifVersion? })` | the user — the user's own call; spends the user's reset links and second-factor challenges still waiting; sends `user.passwordChanged` | `CREDENTIALS_INVALID` (`throttled` past the [sign-in throttle](passwords.md#password-guessing-is-throttled), which it counts in), `PASSWORD_TOO_SHORT` |
|
|
207
|
+
|
|
208
|
+
With an e-mail — the field `email` names, password or not — besides:
|
|
209
|
+
|
|
210
|
+
| Method | Answers | Rejects with |
|
|
211
|
+
| --- | --- | --- |
|
|
212
|
+
| `findByEmail(email)` | the user, or `null`; the address trimmed and lowercased as the e-mail flows do, whatever the login; a value that is no address is nobody's — **server-side only**, see [below](#finding-a-user-by-e-mail--findbyemail) | `STORE_FAILED` only |
|
|
213
|
+
| `findOrCreate(key, input)` | `{ user, created }`: the holder of `key`, or the user `input()` describes, created; every type with a login or an e-mail — **server-side only**, see [below](#finding-a-user-or-creating-them--findorcreate) | `USER_INVALID`, `PASSWORD_TOO_SHORT`, `LOGIN_TAKEN`, `STORE_FAILED`, and what `input` throws |
|
|
214
|
+
|
|
215
|
+
With `secondFactor` configured, a type with a password, or with an e-mail and no password, also answers
|
|
216
|
+
`secondFactor.enroll`, `activate`, `disable` and `confirm` — see
|
|
217
|
+
[the second factor](second-factor.md).
|
|
218
|
+
|
|
219
|
+
Every method may also reject with `STORE_FAILED`. `update` (when it moves
|
|
220
|
+
the e-mail: it spends the user's pending change links), `setPassword` and
|
|
221
|
+
`changePassword` (they spend the user's reset links and second-factor
|
|
222
|
+
challenges) do that after the write, so a `STORE_FAILED` there may come with
|
|
223
|
+
the write already landed — the e-mail moved, or the password changed: a
|
|
224
|
+
retried `changePassword` with the old `current` then answers
|
|
225
|
+
`CREDENTIALS_INVALID`. A `user` argument is a user or its id
|
|
226
|
+
(`UserRef = string | { id: string }`).
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
const grace = await auth.create({ email: 'grace@example.com', name: 'Grace', active: false });
|
|
230
|
+
await auth.find(grace.id); // User | null
|
|
231
|
+
await auth.get(grace.id); // User, or NOT_FOUND
|
|
232
|
+
const renamed = await auth.update(grace, { name: 'Grace Hopper' }, { ifVersion: grace.version });
|
|
233
|
+
await auth.setActive(renamed, true);
|
|
234
|
+
await auth.findByLogin(' GRACE@example.com '); // found: normalised as sign-up normalised it
|
|
235
|
+
await auth.findByEmail(' GRACE@example.com '); // found: normalised as the e-mail flows normalise it
|
|
236
|
+
await auth.setPassword(renamed, 'a new password');
|
|
237
|
+
await auth.changePassword(renamed, { current: 'a new password', next: 'another password' });
|
|
238
|
+
await auth.delete(renamed); // true
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### `update` merges, then validates the whole
|
|
242
|
+
|
|
243
|
+
The patch is spread over the stored fields and the result is checked against
|
|
244
|
+
the schema, so a patch can never leave a user the schema would refuse.
|
|
245
|
+
Changing the e-mail sets `emailVerified` back to `false`, and moves the login
|
|
246
|
+
with it when the e-mail is the login — so the next sign-in by code or link
|
|
247
|
+
proves it anew, and [drops the password, the second factor and the avatar, and signs out
|
|
248
|
+
every session](magic-link.md#an-account-someone-else-registered). It also
|
|
249
|
+
sends a [`user.emailChanged`
|
|
250
|
+
event](events.md#telling-the-user-their-password-or-e-mail-changed) carrying
|
|
251
|
+
`formerEmail`, the address before — so the notice goes to the inbox the
|
|
252
|
+
account just left. A change of case only (`Ada@…` for `ada@…`) is no change,
|
|
253
|
+
and sends nothing. A user who holds a factor or a passkey is refused
|
|
254
|
+
(`EMAIL_CHANGE_NEEDS_PROOF`, below). To set or clear `emailVerified` alone, as an administrator who checked the address, see [`setEmailVerified`](email-flows.md#marking-an-e-mail-verified-as-an-administrator--setemailverified).
|
|
255
|
+
|
|
256
|
+
A patch that moves the e-mail of a user who holds a second factor (active or
|
|
257
|
+
waiting) or a passkey is refused with `EMAIL_CHANGE_NEEDS_PROOF` and nothing is
|
|
258
|
+
written: the new address would be unproved, and its first proof would drop the
|
|
259
|
+
factor and the passkeys. Move it with
|
|
260
|
+
[`changeEmail`](email-flows.md#changeemail), which proves the new address and
|
|
261
|
+
keeps them. A patch that keeps the e-mail, or a user with neither, is
|
|
262
|
+
unchanged.
|
|
263
|
+
|
|
264
|
+
### `ifVersion`
|
|
265
|
+
|
|
266
|
+
Every write but `delete` takes `{ ifVersion }`. A user who changed since you
|
|
267
|
+
read them is `VERSION_CONFLICT`, and nothing is written: read again and retry.
|
|
268
|
+
A sign-in that rewrites a stale password hash moves `version` too, so an object
|
|
269
|
+
read before that sign-in conflicts — see [passwords](passwords.md#rehash-on-sign-in).
|
|
270
|
+
|
|
271
|
+
### `delete`
|
|
272
|
+
|
|
273
|
+
Deletes the user **with every session and one-time token they had**, and
|
|
274
|
+
every tuple naming them when `relations` is wired. The user goes first, so an
|
|
275
|
+
outage half-way leaves only sessions and tokens that authenticate nobody. It is
|
|
276
|
+
idempotent: calling it again finishes the job. When it deleted the user, it
|
|
277
|
+
sends a [`user.deleted` event](events.md) — once, after the sessions, tokens and relation tuples are gone, and even when an outage interrupts removing them;
|
|
278
|
+
`create` and `signUp` send `user.created`.
|
|
279
|
+
|
|
280
|
+
### Several users at once — `findMany`
|
|
281
|
+
|
|
282
|
+
A list of rows that each name a user — a staff list showing every member's
|
|
283
|
+
account state — reads them in one call, not one `find` per row:
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
const rows = await db.staffRows(); // your own table, 100 rows
|
|
287
|
+
const members = await clinic.staff.findMany(rows.map((row) => row.staffId));
|
|
288
|
+
const byId = new Map(members.map((member) => [member.id, member]));
|
|
289
|
+
|
|
290
|
+
const shown = rows.map((row) => {
|
|
291
|
+
const member = byId.get(row.staffId); // undefined: nobody holds this id
|
|
292
|
+
return { ...row, active: member?.active ?? false, verified: member?.emailVerified ?? false };
|
|
293
|
+
});
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
- **Order**: the order of `ids`. A repeated id is answered once, at its first
|
|
297
|
+
place.
|
|
298
|
+
- **Absence**: an id `find` would answer `null` for — malformed, unknown, or
|
|
299
|
+
held by a user of another type — is **left out**, never an error. The answer
|
|
300
|
+
may be shorter than `ids`, so match by `user.id`, never by position.
|
|
301
|
+
- **Empty**: `[]`, or a list with no well-formed id, answers `[]` without
|
|
302
|
+
reaching the store.
|
|
303
|
+
- **Size**: any length. The store is asked 100 ids at a time, one batch after
|
|
304
|
+
another, so no query grows with your list.
|
|
305
|
+
- **Failure**: `STORE_FAILED`, never a shorter list. Something other than an
|
|
306
|
+
array is a bare `TypeError`: only your code passes one.
|
|
307
|
+
- **Cost**: one query per 100 ids when the users store implements the
|
|
308
|
+
optional `findUsers` — the reference store, `@softistx/janus-drizzle` and
|
|
309
|
+
`@softistx/janus-mongo` do. A store that does not is read with `findUser`,
|
|
310
|
+
**ten at a time**, so a third-party adapter keeps working and never opens
|
|
311
|
+
more than ten reads at once for one call; see
|
|
312
|
+
[writing an adapter](adapters.md#userstorefindusers-optional).
|
|
313
|
+
|
|
314
|
+
**A GraphQL resolver per row** can batch through a DataLoader of your own —
|
|
315
|
+
`@softistx/janus-graphql` loads no users itself:
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
import DataLoader from 'dataloader';
|
|
319
|
+
|
|
320
|
+
// One per request, so nothing is cached across users' requests.
|
|
321
|
+
const staffById = new DataLoader(async (ids: readonly string[]) => {
|
|
322
|
+
const found = new Map((await clinic.staff.findMany(ids)).map((u) => [u.id, u]));
|
|
323
|
+
return ids.map((id) => found.get(id) ?? null);
|
|
324
|
+
});
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Finding a user by e-mail — `findByEmail`
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
findByEmail(email: string): Promise<User | null>
|
|
331
|
+
// typed by FindByEmailApi<User>, exported from @softistx/janus
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Every type with an e-mail has it, **with or without a password** — and a
|
|
335
|
+
type with no password has no `findByLogin`. It is the lookup an invitation
|
|
336
|
+
needs: the person was invited at an address, may already hold an account of
|
|
337
|
+
a passwordless type, and is signed in with `signInProven` once your server
|
|
338
|
+
verified the invitation and `verifyEmail.proveFirst` proved the address
|
|
339
|
+
([sessions](sessions.md#accepting-an-invitation)):
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
const clinic = janus({
|
|
343
|
+
users: {
|
|
344
|
+
patient: { schema: Patient, password: { login: 'email' } },
|
|
345
|
+
member: { schema: z.object({ email: z.email(), name: z.string() }) }, // no password, by design
|
|
346
|
+
},
|
|
347
|
+
store,
|
|
348
|
+
hasher,
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
const invitation = await invitations.spend(hash(token), new Date()); // your proof, verified first
|
|
352
|
+
if (invitation === null) return notFound();
|
|
353
|
+
const member =
|
|
354
|
+
(await clinic.member.findByEmail(invitation.email)) ??
|
|
355
|
+
(await clinic.member.create({ email: invitation.email, name: '' }));
|
|
356
|
+
await clinic.member.verifyEmail.proveFirst(member); // before signInProven: it revokes every session
|
|
357
|
+
await clinic.member.signInProven(member);
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Do not declare a `password` on such a type to get `findByLogin`: it would
|
|
361
|
+
open `signIn`, `resetPassword` and the password changes on a type that has
|
|
362
|
+
none by design.
|
|
363
|
+
|
|
364
|
+
- **The holder the e-mail flows find.** The address is trimmed and
|
|
365
|
+
lowercased — the rule every e-mail follows, whatever the type's
|
|
366
|
+
`password.normalize` — and compared with the stored e-mail. On a type that
|
|
367
|
+
signs in with a username, the user is found by their e-mail, and a
|
|
368
|
+
username that only looks like an address is nobody's:
|
|
369
|
+
`magicLink.request`, `signInCode.request` and `resetPassword.request`
|
|
370
|
+
would find the same user, or nobody.
|
|
371
|
+
- **Per type.** The same address may hold a patient and a member; each
|
|
372
|
+
type answers its own, and `null` for the other's.
|
|
373
|
+
- **Inactive users are answered**, as by `find`. `signInProven` then
|
|
374
|
+
refuses them with `USER_INACTIVE`.
|
|
375
|
+
- **Nothing counted, issued or written.** Neither the mail throttle nor the
|
|
376
|
+
sign-in throttle counts it, so it answers past both, and leaves both as
|
|
377
|
+
they were. The store is read once, by `findUserByLogin`.
|
|
378
|
+
- **A value that is no address is nobody's.** Not a string, empty once
|
|
379
|
+
trimmed, or holding a NUL or a lone surrogate: `null` without asking the
|
|
380
|
+
store — as `find` answers a malformed id, never a throw, since the value
|
|
381
|
+
may come from a request.
|
|
382
|
+
- **An outage is `STORE_FAILED`**, never `null`: a lookup that could not
|
|
383
|
+
ask is not an absence.
|
|
384
|
+
- **Server-side only.** It answers whether an account exists, at once and
|
|
385
|
+
with no throttle. Never call it on an address a visitor typed into an
|
|
386
|
+
anonymous route; call it on the address your own proof holds.
|
|
387
|
+
`@softistx/janus-telemetry` traces it as `janus.<type>.findByEmail`, with the
|
|
388
|
+
`user.id` it found and never the address.
|
|
389
|
+
|
|
390
|
+
### Finding a user, or creating them — `findOrCreate`
|
|
391
|
+
|
|
392
|
+
```ts
|
|
393
|
+
findOrCreate(
|
|
394
|
+
key: string,
|
|
395
|
+
input: () => Fields | Promise<Fields>, // what create takes
|
|
396
|
+
): Promise<{ user: User; created: boolean }>
|
|
397
|
+
// typed by FindOrCreateApi<User, Fields>, exported from @softistx/janus
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
The accept step of an invitation, without the race between `findByEmail`
|
|
401
|
+
and `create`. The `key` is looked up as the type's own lookup would: the
|
|
402
|
+
login on a type with a password, the e-mail on a type without one — so a
|
|
403
|
+
type with neither has no `findOrCreate`. A user found, inactive or not, is
|
|
404
|
+
answered `{ user, created: false }` and `input` is never called:
|
|
405
|
+
|
|
406
|
+
```ts
|
|
407
|
+
const invitation = await invitations.spend(hash(token), new Date()); // your proof, verified first
|
|
408
|
+
if (invitation === null) return notFound();
|
|
409
|
+
const { user, created } = await clinic.patient.findOrCreate(invitation.email, () => {
|
|
410
|
+
if (body.password === undefined) throw new Error('a password is required'); // refused before any write
|
|
411
|
+
return { email: invitation.email, birthDate: body.birthDate }; // no password: proveFirst would drop it
|
|
412
|
+
});
|
|
413
|
+
await clinic.patient.verifyEmail.proveFirst(user); // drops what a squatter left
|
|
414
|
+
if (typeof body.password === 'string') await clinic.patient.setPassword(user, body.password); // set once, here
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
- **`input` runs only on an absence, and may refuse.** What it throws
|
|
418
|
+
propagates, and nothing is written.
|
|
419
|
+
- **The key is a string.** Any other value is `USER_INVALID` before `input`
|
|
420
|
+
is called.
|
|
421
|
+
- **The input names the key.** After validation its login (its e-mail, on a
|
|
422
|
+
type with no password), normalised, must equal the normalised `key`; if it
|
|
423
|
+
does not, the call rejects with `USER_INVALID` before the write.
|
|
424
|
+
- **Created exactly as `create` creates**: validation, hashing, the password
|
|
425
|
+
policy, `user.created`. The event is sent only when this call created.
|
|
426
|
+
- **A lost race answers the winner.** If the write meets `LOGIN_TAKEN`, the
|
|
427
|
+
key is read once more: found, it is `{ user, created: false }`; still
|
|
428
|
+
absent, the `LOGIN_TAKEN` is rethrown.
|
|
429
|
+
- **A key that is no storable string** is nobody's, as for `findByLogin`, and
|
|
430
|
+
goes through `input` and the creation, which refuses it with `USER_INVALID`.
|
|
431
|
+
- **Server-side only**, an account-existence oracle like `findByEmail`.
|
|
432
|
+
|
|
433
|
+
### Paging every user
|
|
434
|
+
|
|
435
|
+
```ts
|
|
436
|
+
let cursor: string | null = null;
|
|
437
|
+
do {
|
|
438
|
+
const page = await auth.list({ after: cursor, limit: 100 });
|
|
439
|
+
for (const user of page.items) console.log(user.email);
|
|
440
|
+
cursor = page.nextCursor;
|
|
441
|
+
} while (cursor);
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
`limit` defaults to 20 and is capped at 100. A page carries no `total`; ask
|
|
445
|
+
[`count`](#searching-by-e-mail-prefix) for one where you show it.
|
|
446
|
+
|
|
447
|
+
### Searching by e-mail prefix
|
|
448
|
+
|
|
449
|
+
An admin list that searches as one types passes the start of an address.
|
|
450
|
+
|
|
451
|
+
```ts
|
|
452
|
+
const page = await auth.list({ emailPrefix: 'Ad', limit: 20 }); // ada@…, adam@…
|
|
453
|
+
const total = await auth.count({ emailPrefix: 'Ad' }); // the pager's total
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
- **Case-insensitive.** The prefix is lowercased and trimmed like every e-mail
|
|
457
|
+
before a store sees it, so `'AD'`, `' ad '` and `'ad'` ask the same thing.
|
|
458
|
+
- **A prefix, not a pattern.** `.`, `+`, `%`, `_` and `*` match themselves:
|
|
459
|
+
`emailPrefix: 'a.b+'` finds `a.b+tag@example.test` and nothing else.
|
|
460
|
+
- **Index-backed in every official users store.** The stores compare the prefix
|
|
461
|
+
with the type's logins, which are already normalised: MongoDB reads the
|
|
462
|
+
`{ type, logins }` index as a range, PostgreSQL the `logins` primary key
|
|
463
|
+
`(type, login)` (`collate "C"`, so `like 'prefix%'` is a range scan).
|
|
464
|
+
- Nothing, `''` or a blank string means no filter. A prefix no user can
|
|
465
|
+
hold (a NUL character, half a surrogate pair) lists nothing and counts `0`
|
|
466
|
+
without reaching the store. A prefix that is not a string throws a
|
|
467
|
+
`TypeError`.
|
|
468
|
+
- The cursor is the last id, so a page after `after` keeps the same order
|
|
469
|
+
with or without a prefix. Pass the same `emailPrefix` on every page.
|
|
470
|
+
- A type that signs in with a **username** stores that too as a login, so
|
|
471
|
+
the prefix matches a username as well as an e-mail.
|
|
472
|
+
- `count` is a separate read, exact at the instant of the read; it can differ
|
|
473
|
+
by a user from a list read a moment before or after.
|
|
474
|
+
|
|
475
|
+
### Searching by display name
|
|
476
|
+
|
|
477
|
+
A picker that finds people by the start of their name passes `namePrefix`,
|
|
478
|
+
beside or instead of `emailPrefix`.
|
|
479
|
+
|
|
480
|
+
```ts
|
|
481
|
+
const page = await auth.list({ namePrefix: 'ada l', limit: 20 }); // Ada Lovelace, …
|
|
482
|
+
const total = await auth.count({ namePrefix: 'ada l' });
|
|
483
|
+
const both = await auth.list({ namePrefix: 'ada', emailPrefix: 'ada@' }); // both must hold
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
```ts
|
|
487
|
+
janus({ displayName: 'fullName', // … the rest of the config });
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
- **The name is a schema field.** `name` by default; a type whose schema calls
|
|
491
|
+
it `fullName` says so with `displayName: 'fullName'` (on `janus()` for one
|
|
492
|
+
type, in the type's config for several). A user whose schema leaves the
|
|
493
|
+
field out, or holds anything but a string there, has no name: `namePrefix`
|
|
494
|
+
never finds them.
|
|
495
|
+
- **Case-insensitive, plain text.** Name and prefix are folded alike: NFKC,
|
|
496
|
+
lowercased, runs of white space as one space, trimmed, first 128 characters.
|
|
497
|
+
`'ADA l'` finds `Ada Lovelace`; `.`, `%`, `_` and `*` match themselves.
|
|
498
|
+
- **A prefix of the whole name**, not of a word: `'lovelace'` does not find
|
|
499
|
+
`Ada Lovelace`.
|
|
500
|
+
- **Index-backed.** The core writes the folded name as `nameKey` on the user
|
|
501
|
+
record, again on every `update` that changes the fields. MongoDB reads the
|
|
502
|
+
`{ type, nameKey }` index and PostgreSQL `users_type_name_key`
|
|
503
|
+
(`collate "C"`, `like 'prefix%'`) as ranges.
|
|
504
|
+
- **Same rules as `emailPrefix`**: nothing, `''` or a blank string filters
|
|
505
|
+
nothing; a prefix no user can hold lists nothing; a prefix that is not a
|
|
506
|
+
string throws a `TypeError`. The cursor is the last id and binds to no
|
|
507
|
+
filter, so pass the same `namePrefix` (and `emailPrefix`) on every page.
|
|
508
|
+
- **Users written before `nameKey` existed** are found by name only after
|
|
509
|
+
their next write that sets fields. Backfill them once:
|
|
510
|
+
[PostgreSQL](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus-drizzle/docs/guide/migrations.md#to-024-a-name-key-on-users),
|
|
511
|
+
[MongoDB](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus-mongo/docs/guide/sync.md#backfilling-name-keys).
|
|
512
|
+
|
|
513
|
+
### Across types
|
|
514
|
+
|
|
515
|
+
`findUser(id)` and `getUser(id)` are on the instance itself and find a user
|
|
516
|
+
whatever their type; the answer is a union narrowed by `user.type`.
|
|
517
|
+
|
|
518
|
+
## A sign-up route
|
|
519
|
+
|
|
520
|
+
A fetch-style handler — the shape Bun, Hono and most frameworks hand you:
|
|
521
|
+
|
|
522
|
+
```ts
|
|
523
|
+
import { JanusError } from '@softistx/janus';
|
|
524
|
+
|
|
525
|
+
export async function signUpRoute(request: Request): Promise<Response> {
|
|
526
|
+
const body = (await request.json()) as { email: string; name: string; password: string };
|
|
527
|
+
try {
|
|
528
|
+
const { user, session, token } = await auth.signUp(body);
|
|
529
|
+
return Response.json(
|
|
530
|
+
{ id: user.id },
|
|
531
|
+
{ status: 201, headers: { 'Set-Cookie': auth.cookie.serialize(token, session) } },
|
|
532
|
+
);
|
|
533
|
+
} catch (error) {
|
|
534
|
+
if (!(error instanceof JanusError)) throw error;
|
|
535
|
+
switch (error.code) {
|
|
536
|
+
case 'USER_INVALID':
|
|
537
|
+
return Response.json({ issues: error.issues }, { status: 400 });
|
|
538
|
+
case 'PASSWORD_TOO_SHORT':
|
|
539
|
+
return Response.json({ minLength: error.minLength }, { status: 400 });
|
|
540
|
+
case 'LOGIN_TAKEN':
|
|
541
|
+
return Response.json({ error: 'taken' }, { status: 409 });
|
|
542
|
+
default:
|
|
543
|
+
throw error; // STORE_FAILED: your 503
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
Validate the body's shape yourself in a real route; `janus` validates the
|
|
550
|
+
fields against your schema, not that `password` is a string.
|
|
551
|
+
|
|
552
|
+
## See also
|
|
553
|
+
|
|
554
|
+
- [Sessions](sessions.md) — `authenticate`, the cookie, signing out
|
|
555
|
+
- [User events](events.md) — what `create`, `signUp`, `update`, `setPassword`, `changePassword` and `delete` send
|
|
556
|
+
- [Errors](errors.md) — every code, and the status it deserves
|
|
557
|
+
- [Writing an adapter](adapters.md) — the identity stores behind `store`
|