@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,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `auth.apiKeys` as `janus()` adds it: only when the configuration has the
|
|
3
|
+
* `apiKeys` block.
|
|
4
|
+
*
|
|
5
|
+
* Part of what `janus()` hands back; `./janus` gathers it.
|
|
6
|
+
*/
|
|
7
|
+
import type { JanusConfig } from '../config';
|
|
8
|
+
import type { ApiKeysApi } from './api-keys';
|
|
9
|
+
import type { UserOf } from './inference';
|
|
10
|
+
/**
|
|
11
|
+
* `auth.apiKeys` — only when the configuration has the `apiKeys` block, with
|
|
12
|
+
* the lifetimes it lists as the only ones `create` takes.
|
|
13
|
+
*/
|
|
14
|
+
export type ApiKeysOf<C extends JanusConfig> = C extends {
|
|
15
|
+
readonly apiKeys: {
|
|
16
|
+
readonly lifetimes: readonly (infer L)[];
|
|
17
|
+
};
|
|
18
|
+
} ? ApiKeysApi<UserOf<C>, Extract<L, string | number>> : unknown;
|
|
19
|
+
//# sourceMappingURL=api-keys-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys-of.d.ts","sourceRoot":"","sources":["../../../src/auth/types/api-keys-of.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS;IACxD,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAA;KAAE,CAAC;CAC/D,GACE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,GAClD,OAAO,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API keys as application code sees them, and the `apiKeys` surface
|
|
3
|
+
* `janus({ apiKeys })` adds.
|
|
4
|
+
*
|
|
5
|
+
* Part of what `janus()` hands back; `./index` gathers it.
|
|
6
|
+
*/
|
|
7
|
+
import type { CursorPage } from '../../pagination/cursor-page';
|
|
8
|
+
import type { Duration } from '../../time/duration';
|
|
9
|
+
import type { ApiKeyBound, ApiKeyRecord } from '../port/types/api-keys';
|
|
10
|
+
import type { Principal } from './session';
|
|
11
|
+
import type { UserRef } from './user';
|
|
12
|
+
/**
|
|
13
|
+
* An API key, as application code sees it: everything but the secret's hash,
|
|
14
|
+
* with a `hint` to tell keys apart in a list. **The token is never here** —
|
|
15
|
+
* it is shown once, by `create`.
|
|
16
|
+
*/
|
|
17
|
+
export interface ApiKey extends Omit<ApiKeyRecord, 'secretHash' | 'scopes' | 'bound' | 'expiryNotifiedAt'> {
|
|
18
|
+
/** The start of the token — its prefix and the first characters of its id: `sl_0192ab…`. Safe to display. */
|
|
19
|
+
readonly hint: string;
|
|
20
|
+
/** What the key may do, as given to `create`; `null` for a key created without `scopes`. */
|
|
21
|
+
readonly scopes: readonly string[] | null;
|
|
22
|
+
/** The object the key is bound to, as given to `create`; `null` for an unbound key. */
|
|
23
|
+
readonly bound: ApiKeyBound | null;
|
|
24
|
+
/** When `markExpiryNotified` recorded the notice; `null` until then. */
|
|
25
|
+
readonly expiryNotifiedAt: Date | null;
|
|
26
|
+
}
|
|
27
|
+
/** What `apiKeys.create` takes. */
|
|
28
|
+
export interface CreateApiKeyInput<Lifetime extends string | number> {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly lifetime: Lifetime;
|
|
31
|
+
/**
|
|
32
|
+
* What the key may do (`['mcp:read']`), stored on the key and answered as
|
|
33
|
+
* `principal.scopes`. **Janus never enforces them**: the application checks
|
|
34
|
+
* them where it serves the request. Absent, the key is unscoped and
|
|
35
|
+
* `principal.scopes` is `null`. 1 to 32 distinct scope tokens of 1 to 100
|
|
36
|
+
* printable ASCII characters, no space, `"` or `\`; a repeat is dropped.
|
|
37
|
+
*/
|
|
38
|
+
readonly scopes?: readonly string[];
|
|
39
|
+
/**
|
|
40
|
+
* The one object the key acts in, answered as `principal.bound`. **Janus
|
|
41
|
+
* never enforces it either**: the application pins the request to it.
|
|
42
|
+
* Absent, the key is unbound and `principal.bound` is `null`.
|
|
43
|
+
*/
|
|
44
|
+
readonly bound?: ApiKeyBound;
|
|
45
|
+
}
|
|
46
|
+
/** A page request of `list`, `listBound` and `expiring`. */
|
|
47
|
+
export interface ApiKeyPage {
|
|
48
|
+
readonly limit?: number;
|
|
49
|
+
readonly after?: string | null;
|
|
50
|
+
}
|
|
51
|
+
/** The options of `list`: a page, and optionally the bound object to filter on. */
|
|
52
|
+
export interface ApiKeyListOptions extends ApiKeyPage {
|
|
53
|
+
/**
|
|
54
|
+
* Absent: all the user's keys. An object: only the keys bound to it. `null`:
|
|
55
|
+
* only the unbound keys. A value that is no bound shape has an empty page.
|
|
56
|
+
* Given, it needs a store with the `bound` capability (a `TypeError`
|
|
57
|
+
* otherwise); the `userBound` capability makes it one read, else the core
|
|
58
|
+
* reads the user's keys 100 at a time and filters them.
|
|
59
|
+
*/
|
|
60
|
+
readonly bound?: ApiKeyBound | null;
|
|
61
|
+
}
|
|
62
|
+
/** A key just created, and the only time its token is available. */
|
|
63
|
+
export interface CreatedApiKey {
|
|
64
|
+
readonly apiKey: ApiKey;
|
|
65
|
+
/**
|
|
66
|
+
* `${prefix}${id}_${secret}`. **Show it to the user once and keep it
|
|
67
|
+
* nowhere**: only its hash is stored, so a lost token is a new key.
|
|
68
|
+
*/
|
|
69
|
+
readonly token: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The `apiKeys` of an instance configured with `janus({ apiKeys })` — absent
|
|
73
|
+
* from the type without it. `Lifetime` is the configured lifetimes, as written.
|
|
74
|
+
*/
|
|
75
|
+
export interface ApiKeysApi<U extends {
|
|
76
|
+
readonly type: string;
|
|
77
|
+
}, Lifetime extends string | number = string | number> {
|
|
78
|
+
readonly apiKeys: {
|
|
79
|
+
/**
|
|
80
|
+
* Creates a key for the user `current` belongs to, and answers its token
|
|
81
|
+
* once.
|
|
82
|
+
*
|
|
83
|
+
* **Behind a fresh proof**: `current.session.authenticatedAt` must be
|
|
84
|
+
* within `apiKeys.freshWithin` (10 minutes when absent), else
|
|
85
|
+
* `STEP_UP_REQUIRED` — ask for a step-up and try again. A key can never
|
|
86
|
+
* be fresh: a key principal is refused with `STEP_UP_REQUIRED` and
|
|
87
|
+
* `reason: 'apiKey'`. `USER_INACTIVE` for an inactive user, `NOT_FOUND` for
|
|
88
|
+
* a user gone or of a type `apiKeys.types` leaves out.
|
|
89
|
+
*
|
|
90
|
+
* `API_KEY_INVALID` (400, `field`) for a `name` empty or over 100
|
|
91
|
+
* characters once trimmed, a `lifetime` not among the configured ones,
|
|
92
|
+
* `scopes` or `bound` not shaped as {@link CreateApiKeyInput} says;
|
|
93
|
+
* `API_KEY_LIMIT` (409, `maxActive`) when the user already holds the most.
|
|
94
|
+
* A `TypeError` for `scopes` or `bound` on a store without the `bound`
|
|
95
|
+
* capability, which would drop them.
|
|
96
|
+
*/
|
|
97
|
+
create(current: Principal<U>, input: CreateApiKeyInput<Lifetime>): Promise<CreatedApiKey>;
|
|
98
|
+
/**
|
|
99
|
+
* A user's keys — standing, revoked and lapsed — oldest first, all of them
|
|
100
|
+
* or, with `bound`, those bound to one object (`null`: the unbound ones).
|
|
101
|
+
* `INVALID_CURSOR` for a bad `after`; a `TypeError` for `bound` on a store
|
|
102
|
+
* without the `bound` capability.
|
|
103
|
+
*/
|
|
104
|
+
list(user: UserRef, options?: ApiKeyListOptions): Promise<CursorPage<ApiKey>>;
|
|
105
|
+
/**
|
|
106
|
+
* One key by id, as `list` answers it, or `null` for none (and for an id
|
|
107
|
+
* that is no key id, without reading the store). A revoked or lapsed key
|
|
108
|
+
* is answered as is: `get` does not check validity, `authenticate` does.
|
|
109
|
+
*
|
|
110
|
+
* **Pass `owner` whenever the id came from a request**: a key of another
|
|
111
|
+
* user is then `null`, as an unknown one. Without it any key is answered
|
|
112
|
+
* — the administrator's path, never to be answered to a request without
|
|
113
|
+
* checking its `userId`. A store failure throws.
|
|
114
|
+
*/
|
|
115
|
+
get(id: string, options?: {
|
|
116
|
+
readonly owner?: UserRef;
|
|
117
|
+
}): Promise<ApiKey | null>;
|
|
118
|
+
/**
|
|
119
|
+
* Every key bound to `object` — whoever holds it, standing, revoked and
|
|
120
|
+
* lapsed — oldest first: the object owner's view. An `object` that is no
|
|
121
|
+
* bound shape has an empty page. A `TypeError` on a store without the
|
|
122
|
+
* `bound` capability.
|
|
123
|
+
*/
|
|
124
|
+
listBound(object: ApiKeyBound, page?: ApiKeyPage): Promise<CursorPage<ApiKey>>;
|
|
125
|
+
/**
|
|
126
|
+
* Revokes every standing key of `user` bound to `object` — when the user
|
|
127
|
+
* leaves it — and answers how many; the user's other keys stand. A
|
|
128
|
+
* `TypeError` on a store without the `bound` capability.
|
|
129
|
+
*/
|
|
130
|
+
revokeAllBound(user: UserRef, object: ApiKeyBound): Promise<number>;
|
|
131
|
+
/**
|
|
132
|
+
* The standing keys that lapse within `within` (a duration, `'7d'`) and
|
|
133
|
+
* whose notice is not recorded yet, oldest first: what a daily sweep
|
|
134
|
+
* warns about. A `TypeError` for a `within` that is no positive
|
|
135
|
+
* duration, and on a store without the `expiryNotice` capability.
|
|
136
|
+
*/
|
|
137
|
+
expiring(options: {
|
|
138
|
+
readonly within: Duration;
|
|
139
|
+
} & ApiKeyPage): Promise<CursorPage<ApiKey>>;
|
|
140
|
+
/**
|
|
141
|
+
* Records that the key's expiry notice is sent, so the next sweep leaves
|
|
142
|
+
* it out. `true` when this call recorded it, `false` when it was already
|
|
143
|
+
* — of concurrent sweeps, exactly one wins, so it can be claimed before
|
|
144
|
+
* the notice is sent. `NOT_FOUND` for no such key. A `TypeError` on a
|
|
145
|
+
* store without the `expiryNotice` capability.
|
|
146
|
+
*/
|
|
147
|
+
markExpiryNotified(id: string): Promise<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Revokes one key; revoking a revoked key is not an error. `NOT_FOUND`
|
|
150
|
+
* for no such key.
|
|
151
|
+
*
|
|
152
|
+
* **Pass `owner` whenever the id came from a request**: a key of
|
|
153
|
+
* another user is then `NOT_FOUND`, as an unknown one. Without it any
|
|
154
|
+
* key may be revoked — the administrator's path, never to be called with
|
|
155
|
+
* an id read from a request.
|
|
156
|
+
*/
|
|
157
|
+
revoke(id: string, options?: {
|
|
158
|
+
readonly owner?: UserRef;
|
|
159
|
+
}): Promise<void>;
|
|
160
|
+
/** Revokes every standing key of a user and answers how many. */
|
|
161
|
+
revokeAll(user: UserRef): Promise<number>;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=api-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../../src/auth/types/api-keys.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC;;;;GAIG;AACH,MAAM,WAAW,MAChB,SAAQ,IAAI,CACX,YAAY,EACZ,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,kBAAkB,CACtD;IACD,6GAA6G;IAC7G,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4FAA4F;IAC5F,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1C,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,wEAAwE;IACxE,QAAQ,CAAC,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;CACvC;AAED,mCAAmC;AACnC,MAAM,WAAW,iBAAiB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAA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AAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAE/B;;;;WAIG;QACH,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAEpE;;;;;WAKG;QACH,QAAQ,CACP,OAAO,EAAE;YAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAA;SAAE,GAAG,UAAU,GACjD,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAE/B;;;;;;WAMG;QACH,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAEjD;;;;;;;;WAQG;QACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;YAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAE1E,iEAAiE;QACjE,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;KAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The avatar of a user: the id of the image the application stored for them,
|
|
3
|
+
* set and removed by every user type, and at the root of an instance with
|
|
4
|
+
* several.
|
|
5
|
+
*
|
|
6
|
+
* Part of what `janus()` hands back; `./index` gathers it.
|
|
7
|
+
*/
|
|
8
|
+
import type { UserRef, WriteOptions } from './user';
|
|
9
|
+
/**
|
|
10
|
+
* What every user type answers for the avatar of its users. **Janus stores
|
|
11
|
+
* only the id the application chose** — an opaque string, never parsed — and
|
|
12
|
+
* never the image: storing, processing, serving and deleting the bytes is the
|
|
13
|
+
* application's. Read it back as `user.avatar` ({@link UserAvatar} or `null`).
|
|
14
|
+
*
|
|
15
|
+
* An instance with several user types answers the same `avatar` at its root,
|
|
16
|
+
* for the page that holds a user's id and does not know their type: it reads
|
|
17
|
+
* the user to find the type, then does what that type's `avatar` does, and
|
|
18
|
+
* the answer's `type` says which it was. `NOT_FOUND` for a user of no type.
|
|
19
|
+
*
|
|
20
|
+
* These are server-side methods, like `update`: **no access check, no
|
|
21
|
+
* freshness check**. Whether a request may change this user's avatar, and who
|
|
22
|
+
* may see it, is for the application to decide before it calls them.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const id = crypto.randomUUID(); // a fresh id for every upload
|
|
26
|
+
* await store.replace({ imageId: id }, bytes); // the bytes first …
|
|
27
|
+
* await auth.avatar.set(userId, { id }); // … then the record
|
|
28
|
+
* // with several user types: auth.patient.avatar.set(userId, { id })
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export interface AvatarApi<U> {
|
|
32
|
+
readonly avatar: {
|
|
33
|
+
/**
|
|
34
|
+
* Points the user at the image stored under `avatar.id`, and answers the
|
|
35
|
+
* written user. `updatedAt` of the avatar is now.
|
|
36
|
+
*
|
|
37
|
+
* **Write the image to your storage first, then call this.** If this
|
|
38
|
+
* fails, the image is an orphan nobody points at; the other order could
|
|
39
|
+
* leave a record pointing at bytes that were never written.
|
|
40
|
+
*
|
|
41
|
+
* **Use a fresh id for every upload**, such as `crypto.randomUUID()`.
|
|
42
|
+
* Reusing the id of the current image lets a storage `replace` overwrite
|
|
43
|
+
* the image the user is showing, and the later removal of the former
|
|
44
|
+
* image — the same id — delete the new one. The id doubles as the
|
|
45
|
+
* cache-buster: a new image has a new id.
|
|
46
|
+
*
|
|
47
|
+
* Setting the id the user already has writes nothing and emits nothing.
|
|
48
|
+
* Otherwise `user.avatarChanged` is emitted with `formerAvatarId` — the
|
|
49
|
+
* id replaced, `null` for a first avatar — which is how the application
|
|
50
|
+
* deletes the former image.
|
|
51
|
+
*
|
|
52
|
+
* `AVATAR_ID_INVALID` when `id` is not a non-empty string of at most 512
|
|
53
|
+
* characters that every store can keep, before anything is read.
|
|
54
|
+
* `NOT_FOUND` for an unknown user. `VERSION_CONFLICT` when `ifVersion` is
|
|
55
|
+
* stale, and also when another write landed between this call's read and
|
|
56
|
+
* its write, with or without an `ifVersion`: **delete the image you just
|
|
57
|
+
* uploaded on any failure**, since nothing points at it.
|
|
58
|
+
*/
|
|
59
|
+
set(user: UserRef, avatar: {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
}, options?: WriteOptions): Promise<U>;
|
|
62
|
+
/**
|
|
63
|
+
* Clears the user's avatar, and answers the written user. A user with no
|
|
64
|
+
* avatar writes nothing and emits nothing. Otherwise `user.avatarRemoved`
|
|
65
|
+
* is emitted with `formerAvatarId`, the id it had: delete that image
|
|
66
|
+
* from your storage. `NOT_FOUND` for an unknown user; `VERSION_CONFLICT`
|
|
67
|
+
* when `ifVersion` is stale or another write landed in between.
|
|
68
|
+
*/
|
|
69
|
+
remove(user: UserRef, options?: WriteOptions): Promise<U>;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/auth/types/avatar.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE;QAChB;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;QACH,GAAG,CACF,IAAI,EAAE,OAAO,EACb,MAAM,EAAE;YAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;SAAE,EAC/B,OAAO,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,CAAC,CAAC,CAAC;QACd;;;;;;WAMG;QACH,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;KAC1D,CAAC;CACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a user type with an e-mail answers besides: moving the user to a new
|
|
3
|
+
* address, by a link sent to it.
|
|
4
|
+
*
|
|
5
|
+
* Part of what `janus()` hands back; `./index` gathers it.
|
|
6
|
+
*/
|
|
7
|
+
import type { IssuedToken } from './email-flows';
|
|
8
|
+
import type { UserRef } from './user';
|
|
9
|
+
/**
|
|
10
|
+
* Changing a user's e-mail, proved: a link is sent to the **new** address,
|
|
11
|
+
* and following it moves the user there.
|
|
12
|
+
*/
|
|
13
|
+
export interface ChangeEmailApi<U> {
|
|
14
|
+
readonly changeEmail: {
|
|
15
|
+
/**
|
|
16
|
+
* Issues a link's token for the new address `email`. `email` is the
|
|
17
|
+
* `email` field's value, validated by the type's schema as `update`
|
|
18
|
+
* would — a malformed one is `USER_INVALID` — and the answer's `email`
|
|
19
|
+
* is the address to send the link to. Nothing changes until `confirm`.
|
|
20
|
+
*
|
|
21
|
+
* **Gate it**: behind a fresh sign-in (`assertFresh`) or a step-up, since
|
|
22
|
+
* whoever changes the e-mail takes over password resets. Put `token` in
|
|
23
|
+
* a link to a page of yours, and **only in the e-mail** to the new
|
|
24
|
+
* address. Tell the former address from `user.emailChanged`.
|
|
25
|
+
*
|
|
26
|
+
* Whether somebody already holds the new address is **not** checked here
|
|
27
|
+
* — it would tell who has an account; `confirm` refuses `LOGIN_TAKEN`.
|
|
28
|
+
* The user's earlier links are spent: only the last one sent works.
|
|
29
|
+
* **Throttled** per user and per new address (`janus({ mail: { throttle } })`):
|
|
30
|
+
* `MAIL_THROTTLED` with `retryAfter`, and no token. An unknown user is
|
|
31
|
+
* `NOT_FOUND`, an inactive one `USER_INACTIVE`.
|
|
32
|
+
*/
|
|
33
|
+
send(user: UserRef, email: string): Promise<IssuedToken>;
|
|
34
|
+
/**
|
|
35
|
+
* Spends the link's token, moves the user to the address it was sent to
|
|
36
|
+
* and marks it verified — the link reached its inbox. Password, second
|
|
37
|
+
* factor and sessions are untouched. Emits `user.emailChanged` (with
|
|
38
|
+
* `formerEmail`) and `user.emailVerified`.
|
|
39
|
+
*
|
|
40
|
+
* **Call it from a `POST`**, never from the `GET` of the link. An
|
|
41
|
+
* unknown, spent or lapsed token is `TOKEN_UNKNOWN`, `TOKEN_SPENT` or
|
|
42
|
+
* `TOKEN_EXPIRED`; a user whose e-mail is no longer the one the link
|
|
43
|
+
* was asked from is `TOKEN_STALE`; an address another user of the type
|
|
44
|
+
* holds is `LOGIN_TAKEN` — the token already spent; an inactive user
|
|
45
|
+
* is `USER_INACTIVE`. A user written in between is `VERSION_CONFLICT`,
|
|
46
|
+
* also after the token is spent.
|
|
47
|
+
*
|
|
48
|
+
* **With several user types**, a token issued to a user of another type
|
|
49
|
+
* is `TOKEN_UNKNOWN` here, and it is spent. A page that does not know
|
|
50
|
+
* the type — an anonymous confirmation page — calls the root's
|
|
51
|
+
* `janus.changeEmail.confirm` instead.
|
|
52
|
+
*/
|
|
53
|
+
confirm(token: string): Promise<U>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* What an instance with several user types answers at its root when at least
|
|
58
|
+
* one has an e-mail: the confirmation of a change, whatever the user's type.
|
|
59
|
+
*/
|
|
60
|
+
export interface AnyTypeChangeEmailApi<U> {
|
|
61
|
+
readonly changeEmail: {
|
|
62
|
+
/**
|
|
63
|
+
* Confirms a change of e-mail for a page that does not know the user's
|
|
64
|
+
* type: spends the link's token, reads the user it was issued to,
|
|
65
|
+
* whatever their type, and then does what that type's `confirm` does —
|
|
66
|
+
* the same move, events and refusals. The answer's `type` says which
|
|
67
|
+
* type it was.
|
|
68
|
+
*
|
|
69
|
+
* **Call it from a `POST`**, never from the `GET` of the link. An
|
|
70
|
+
* unknown, spent or lapsed token is `TOKEN_UNKNOWN`, `TOKEN_SPENT` or
|
|
71
|
+
* `TOKEN_EXPIRED`; a user gone since, or of a type with no e-mail, is
|
|
72
|
+
* `TOKEN_UNKNOWN`; a user whose e-mail is no longer the one the link
|
|
73
|
+
* was asked from is `TOKEN_STALE`; an address another user of the type
|
|
74
|
+
* holds is `LOGIN_TAKEN` — the token already spent; an inactive user
|
|
75
|
+
* is `USER_INACTIVE`. A user written in between is `VERSION_CONFLICT`.
|
|
76
|
+
*
|
|
77
|
+
* `send` stays on each type: `janus.admin.changeEmail.send(...)`.
|
|
78
|
+
*/
|
|
79
|
+
confirm(token: string): Promise<U>;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=change-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-email.d.ts","sourceRoot":"","sources":["../../../src/auth/types/change-email.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE;QACrB;;;;;;;;;;;;;;;;;WAiBG;QACH,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QACzD;;;;;;;;;;;;;;;;;;WAkBG;QACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;KACnC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE;QACrB;;;;;;;;;;;;;;;;WAgBG;QACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;KACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The checks, as types: what `janus` intersects into its parameter so a wrong
|
|
3
|
+
* configuration is refused on the offending key.
|
|
4
|
+
*
|
|
5
|
+
* Part of what `janus()` takes; `./index` gathers it.
|
|
6
|
+
*/
|
|
7
|
+
import type { MultiTypeConfig, RESERVED_FIELDS, RESERVED_TYPES, UserSchema } from '../config';
|
|
8
|
+
import type { InputOf, LoginOf, OutputOf, RequiredStringKeys } from './inference';
|
|
9
|
+
import type { InvitedNames } from './invitations-of';
|
|
10
|
+
/**
|
|
11
|
+
* Makes a value that names no key of `Keys` unassignable, and says why on that
|
|
12
|
+
* key.
|
|
13
|
+
*
|
|
14
|
+
* The reason is the **key** of an object type, and the valid names its value.
|
|
15
|
+
* A string-literal message would not survive: `'emial' & 'message'` reduces to
|
|
16
|
+
* `never`, which collapses the whole object and loses the sentence — measured
|
|
17
|
+
* while writing `from` in the first surface. A string intersected with an
|
|
18
|
+
* object does not reduce, so the compiler prints both.
|
|
19
|
+
*/
|
|
20
|
+
type CheckName<V, Keys extends string, What extends string> = [V] extends [Keys] ? unknown : {
|
|
21
|
+
readonly [K in `"${V & string}" is not ${What}; name one of`]: Keys;
|
|
22
|
+
};
|
|
23
|
+
type Reserved<S> = Extract<keyof OutputOf<S>, (typeof RESERVED_FIELDS)[number]>;
|
|
24
|
+
/** The e-mail field of a type being checked: the one `email` names, or `'email'` when the schema has it. */
|
|
25
|
+
type EmailKeyOf<Def, SchemaKey extends string> = Def extends {
|
|
26
|
+
readonly email: infer E extends string;
|
|
27
|
+
} ? E : 'email' extends RequiredStringKeys<OutputOf<SchemaOf<Def, SchemaKey>>> ? 'email' : never;
|
|
28
|
+
/** A type's `social` block: it needs an e-mail, and a `signUp` needs the e-mail to be the login and to answer the type's fields. */
|
|
29
|
+
type CheckSocial<Def, SchemaKey extends string> = Def extends {
|
|
30
|
+
readonly social: infer S;
|
|
31
|
+
} ? ([EmailKeyOf<Def, SchemaKey>] extends [never] ? {
|
|
32
|
+
readonly social: {
|
|
33
|
+
readonly [M in 'social needs an e-mail: the schema has no required string "email" field and no `email` names one']: never;
|
|
34
|
+
};
|
|
35
|
+
} : unknown) & (S extends {
|
|
36
|
+
readonly signUp: (...args: never[]) => infer R;
|
|
37
|
+
} ? CheckSignUp<Def, SchemaKey, R> : unknown) : unknown;
|
|
38
|
+
/** `social.signUp`: only where the login is the e-mail, answering the type's fields. */
|
|
39
|
+
type CheckSignUp<Def, SchemaKey extends string, R> = ([LoginOf<Def>] extends [
|
|
40
|
+
never
|
|
41
|
+
] ? unknown : [LoginOf<Def>] extends [EmailKeyOf<Def, SchemaKey>] ? unknown : {
|
|
42
|
+
readonly social: {
|
|
43
|
+
readonly signUp: {
|
|
44
|
+
readonly [M in 'social.signUp needs a type whose login is its e-mail: password.login names another field']: never;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}) & ([Awaited<R>] extends [InputOf<SchemaOf<Def, SchemaKey>>] ? unknown : {
|
|
48
|
+
readonly social: {
|
|
49
|
+
readonly signUp: {
|
|
50
|
+
readonly [M in "social.signUp must answer the type's fields, as its schema reads them"]: never;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
/** The checks on one user type: its login, its e-mail, its field names and its social block. */
|
|
55
|
+
type CheckType<Def, SchemaKey extends string> = CheckSocial<Def, SchemaKey> & (Def extends {
|
|
56
|
+
readonly password: {
|
|
57
|
+
readonly login: infer L;
|
|
58
|
+
};
|
|
59
|
+
} ? {
|
|
60
|
+
readonly password: {
|
|
61
|
+
readonly login: CheckName<L, RequiredStringKeys<OutputOf<SchemaOf<Def, SchemaKey>>>, 'a required string field'>;
|
|
62
|
+
};
|
|
63
|
+
} : unknown) & (Def extends {
|
|
64
|
+
readonly password: {
|
|
65
|
+
readonly requireVerifiedEmail: true;
|
|
66
|
+
};
|
|
67
|
+
} ? [EmailKeyOf<Def, SchemaKey>] extends [never] ? {
|
|
68
|
+
readonly password: {
|
|
69
|
+
readonly requireVerifiedEmail: {
|
|
70
|
+
readonly [M in 'requireVerifiedEmail needs an e-mail: the schema has no required string "email" field and no `email` names one']: never;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
} : unknown : unknown) & (Def extends {
|
|
74
|
+
readonly email: infer E;
|
|
75
|
+
} ? {
|
|
76
|
+
readonly email: CheckName<E, RequiredStringKeys<OutputOf<SchemaOf<Def, SchemaKey>>>, 'a required string field'>;
|
|
77
|
+
} : unknown) & ([Reserved<SchemaOf<Def, SchemaKey>>] extends [never] ? unknown : {
|
|
78
|
+
readonly [K in SchemaKey]: {
|
|
79
|
+
readonly [M in `"${Reserved<SchemaOf<Def, SchemaKey>> & string}" is a field janus sets itself; rename it`]: never;
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
type SchemaOf<Def, SchemaKey extends string> = Def extends {
|
|
83
|
+
readonly [K in SchemaKey]: infer S extends UserSchema;
|
|
84
|
+
} ? S : never;
|
|
85
|
+
/** `passkeys` needs `secondFactor` (a passkey is only registered beside an active TOTP), unless `firstFactor: true`. */
|
|
86
|
+
type CheckPasskeysSecondFactor<C> = 'secondFactor' extends keyof C ? unknown : C extends {
|
|
87
|
+
readonly passkeys: {
|
|
88
|
+
readonly firstFactor: true;
|
|
89
|
+
};
|
|
90
|
+
} ? unknown : {
|
|
91
|
+
readonly passkeys: {
|
|
92
|
+
readonly [M in 'passkeys needs secondFactor: a passkey is only registered beside an active TOTP']: never;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/** `passkeys` needs a store with a `passkeys` slot: the type of `store` must name it. */
|
|
96
|
+
type CheckPasskeysSlot<C> = C extends {
|
|
97
|
+
readonly store: infer S;
|
|
98
|
+
} ? 'passkeys' extends keyof S ? unknown : {
|
|
99
|
+
readonly passkeys: {
|
|
100
|
+
readonly [M in 'passkeys needs store.passkeys: the store given has no passkeys slot']: never;
|
|
101
|
+
};
|
|
102
|
+
} : unknown;
|
|
103
|
+
/** The checks on `passkeys`, when the configuration has the block. */
|
|
104
|
+
type CheckPasskeys<C> = C extends {
|
|
105
|
+
readonly passkeys: unknown;
|
|
106
|
+
} ? CheckPasskeysSecondFactor<C> & CheckPasskeysSlot<C> : unknown;
|
|
107
|
+
/** The refusal `invitations` carries, on its own key, with the reason as the key of an object type. */
|
|
108
|
+
type Refuse<Reason extends string> = {
|
|
109
|
+
readonly invitations: {
|
|
110
|
+
readonly [M in Reason]: never;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/** Why a user type cannot accept an invitation, or `never`: it needs an e-mail, and a password only if its login is that e-mail. */
|
|
114
|
+
type InvitedProblem<Def, SchemaKey extends string> = [LoginOf<Def>] extends [
|
|
115
|
+
never
|
|
116
|
+
] ? [EmailKeyOf<Def, SchemaKey>] extends [never] ? 'invitations need a user type with an e-mail: the invitation is for an address' : never : [LoginOf<Def>] extends [EmailKeyOf<Def, SchemaKey>] ? never : 'invitations need a user type with no password, or whose password login is its e-mail: password.login names another field';
|
|
117
|
+
/** Whether a listed tuple names a type twice. */
|
|
118
|
+
type HasDuplicate<L> = L extends readonly [infer H, ...infer R] ? H extends R[number] ? true : HasDuplicate<R> : false;
|
|
119
|
+
/** The refusals about the shape of the list itself: empty, or a repeated name. */
|
|
120
|
+
type ListShape<T> = [T] extends [readonly []] ? 'invitations.type must list at least one user type' : HasDuplicate<T> extends true ? 'invitations.type lists a user type twice' : never;
|
|
121
|
+
/** Why each listed name is refused, as a union of reasons: `never` when every one can accept. */
|
|
122
|
+
type ListedProblems<Users, Names extends string> = Names extends keyof Users ? InvitedProblem<Users[Names], 'schema'> : 'invitations.type: not a user type of this instance';
|
|
123
|
+
/** The checks on `invitations`, when the configuration has the block: the user types it makes. */
|
|
124
|
+
type CheckInvitations<C> = C extends {
|
|
125
|
+
readonly invitations: infer I;
|
|
126
|
+
} ? C extends MultiTypeConfig ? [I] extends [
|
|
127
|
+
{
|
|
128
|
+
readonly type: infer T extends string | readonly string[];
|
|
129
|
+
}
|
|
130
|
+
] ? Refuse<ListShape<T> | ListedProblems<C['users'], InvitedNames<T>>> : Refuse<'invitations.type must name the user type an invitation makes: this instance has several'> : Refuse<InvitedProblem<C, 'user'>> : unknown;
|
|
131
|
+
/**
|
|
132
|
+
* The compile-time checks `janus` intersects into its parameter.
|
|
133
|
+
*
|
|
134
|
+
* `janus` infers its argument, so an excess-property check never fires;
|
|
135
|
+
* intersecting `C & Checked<C>` makes a wrong value unassignable **on the
|
|
136
|
+
* offending key**, with the reason as the type the compiler prints. The pattern
|
|
137
|
+
* is measured in `nxgt-data/packages/mongo-kit/src/config/types.ts`.
|
|
138
|
+
*/
|
|
139
|
+
export type Checked<C> = CheckPasskeys<C> & CheckInvitations<C> & (C extends MultiTypeConfig ? {
|
|
140
|
+
readonly users: {
|
|
141
|
+
readonly [K in keyof C['users']]: K extends (typeof RESERVED_TYPES)[number] ? {
|
|
142
|
+
readonly [M in `"${K & string}" cannot name a user type: janus() answers a method of that name`]: never;
|
|
143
|
+
} : CheckType<C['users'][K], 'schema'>;
|
|
144
|
+
};
|
|
145
|
+
} : CheckType<C, 'user'>);
|
|
146
|
+
export {};
|
|
147
|
+
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../src/auth/types/checks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,cAAc,EACd,UAAU,EACV,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACX,OAAO,EACP,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;GASG;AACH,KAAK,SAAS,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAC7E,OAAO,GACP;IACA,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,MAAM,YA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AG,KAAK;SACvG,GACA,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;KACrC,CAAC;CACF,GACA,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a user type with an e-mail answers besides: a sign-in code, a
|
|
3
|
+
* verification link and, with a password, a reset link.
|
|
4
|
+
*
|
|
5
|
+
* Part of what `janus()` hands back; `./index` gathers it.
|
|
6
|
+
*/
|
|
7
|
+
import type { PreparedCode, PreparedRequest } from './prepared';
|
|
8
|
+
import type { SignedIn, SignInOptions } from './sign-in';
|
|
9
|
+
/** A one-time token, given to the application once, to send by e-mail. */
|
|
10
|
+
export interface IssuedToken {
|
|
11
|
+
readonly token: string;
|
|
12
|
+
/** The address to send it to. */
|
|
13
|
+
readonly email: string;
|
|
14
|
+
readonly expiresAt: Date;
|
|
15
|
+
}
|
|
16
|
+
/** An e-mailed sign-in code: send `code`, keep `challenge` for the confirmation. */
|
|
17
|
+
export interface IssuedCode<U> {
|
|
18
|
+
/** Six digits, for the visitor to type. Put it in the e-mail, and nowhere else. */
|
|
19
|
+
readonly code: string;
|
|
20
|
+
/**
|
|
21
|
+
* The secret the code is checked against. **Keep it with the visitor** —
|
|
22
|
+
* a short-lived cookie, or the code form's body — never in the e-mail,
|
|
23
|
+
* a URL or a log.
|
|
24
|
+
*/
|
|
25
|
+
readonly challenge: string;
|
|
26
|
+
/** The address to send the code to. */
|
|
27
|
+
readonly email: string;
|
|
28
|
+
readonly expiresAt: Date;
|
|
29
|
+
readonly user: U;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* What a user type with an e-mail answers besides: signing in with a code
|
|
33
|
+
* sent to it, no password needed.
|
|
34
|
+
*
|
|
35
|
+
* `Answer` is {@link SignInResult} when the type may have a second factor:
|
|
36
|
+
* the code proves the e-mail, and an active factor is still asked for.
|
|
37
|
+
*/
|
|
38
|
+
export interface SignInCodeApi<U, Answer = SignedIn<U>> {
|
|
39
|
+
readonly signInCode: {
|
|
40
|
+
/**
|
|
41
|
+
* Issues a code for the user of this type holding this e-mail, or
|
|
42
|
+
* answers `null` when there is none, or they are inactive. **Never tell
|
|
43
|
+
* the visitor which**: answer the same page either way, and in the same
|
|
44
|
+
* time — send the e-mail off the request's path.
|
|
45
|
+
*
|
|
46
|
+
* Every call issues a new challenge with five attempts of its own, and
|
|
47
|
+
* spends the earlier ones: only the last code sent works, and a new
|
|
48
|
+
* `request` is five guesses more. **Throttled per address**, whether
|
|
49
|
+
* anybody holds it or not: past five requests in 10 minutes
|
|
50
|
+
* (`janus({ mail: { throttle } })`), `MAIL_THROTTLED` with
|
|
51
|
+
* `retryAfter`, and no code. Rate-limit it per client too.
|
|
52
|
+
*/
|
|
53
|
+
request(email: string): Promise<IssuedCode<U> | null>;
|
|
54
|
+
/**
|
|
55
|
+
* `request` in two steps, for an application that sends the code off
|
|
56
|
+
* the visitor's request: counts the address — `MAIL_THROTTLED` with
|
|
57
|
+
* `retryAfter` past the limit — looks nobody up, and mints the
|
|
58
|
+
* `challenge` to give the visitor now, whoever holds the address.
|
|
59
|
+
* `send()` on the answer does the rest, once.
|
|
60
|
+
*/
|
|
61
|
+
prepare(email: string): Promise<PreparedCode<U>>;
|
|
62
|
+
/**
|
|
63
|
+
* Checks the code against its challenge, marks the e-mail verified —
|
|
64
|
+
* the code reached the inbox — and signs the user in. **An e-mail
|
|
65
|
+
* proved for the first time drops the password, the second factor and the avatar,
|
|
66
|
+
* and signs out every session** before the new one opens, as for a
|
|
67
|
+
* link. An e-mail already verified changes nothing.
|
|
68
|
+
*
|
|
69
|
+
* A challenge takes **five attempts**: a code that does not match is
|
|
70
|
+
* `CODE_INVALID` with `attemptsLeft`, and the fifth spends it. An
|
|
71
|
+
* unknown, spent or lapsed challenge is `TOKEN_UNKNOWN`, `TOKEN_SPENT`
|
|
72
|
+
* or `TOKEN_EXPIRED`; an e-mail the user changed since is `TOKEN_STALE`;
|
|
73
|
+
* an inactive user is `USER_INACTIVE`.
|
|
74
|
+
*/
|
|
75
|
+
confirm(challenge: string, code: string, options?: SignInOptions): Promise<Answer>;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** What a user type with an e-mail and a password answers besides. */
|
|
79
|
+
export interface ResetPasswordApi<U> {
|
|
80
|
+
readonly resetPassword: {
|
|
81
|
+
/**
|
|
82
|
+
* Issues a reset token for the user of this type holding this e-mail, or
|
|
83
|
+
* answers `null` when there is none. **Never tell the visitor which**:
|
|
84
|
+
* answer the same page either way. The user's earlier reset tokens are
|
|
85
|
+
* spent: only the last one sent works. **Throttled per address**,
|
|
86
|
+
* whether anybody holds it or not: past five requests in 10 minutes
|
|
87
|
+
* (`janus({ mail: { throttle } })`), `MAIL_THROTTLED` with
|
|
88
|
+
* `retryAfter`, and no token.
|
|
89
|
+
*/
|
|
90
|
+
request(email: string): Promise<(IssuedToken & {
|
|
91
|
+
readonly user: U;
|
|
92
|
+
}) | null>;
|
|
93
|
+
/**
|
|
94
|
+
* `request` in two steps, for an application that sends the link off
|
|
95
|
+
* the visitor's request: counts the address — `MAIL_THROTTLED` with
|
|
96
|
+
* `retryAfter` past the limit — and looks nobody up. `send()` on the
|
|
97
|
+
* answer does the rest, once.
|
|
98
|
+
*/
|
|
99
|
+
prepare(email: string): Promise<PreparedRequest<IssuedToken & {
|
|
100
|
+
readonly user: U;
|
|
101
|
+
}>>;
|
|
102
|
+
/**
|
|
103
|
+
* Redeems the token, sets the password, marks the e-mail verified — the
|
|
104
|
+
* link proved it — and **signs the user out everywhere**. Every other
|
|
105
|
+
* reset token of the user is spent, as by `changePassword` and
|
|
106
|
+
* `setPassword`. Opens no session: call `signIn` next if that is your
|
|
107
|
+
* policy.
|
|
108
|
+
*
|
|
109
|
+
* **With several user types**, a token issued to a user of another type
|
|
110
|
+
* is `TOKEN_UNKNOWN` here, and it is spent. A page that does not know
|
|
111
|
+
* the type — an anonymous reset page — calls the root's
|
|
112
|
+
* `janus.resetPassword.confirm` instead.
|
|
113
|
+
*/
|
|
114
|
+
confirm(token: string, password: string): Promise<U>;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=email-flows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-flows.d.ts","sourceRoot":"","sources":["../../../src/auth/types/email-flows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAgB,MAAM,WAAW,CAAC;AAEvE,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CACzB;AAED,oFAAoF;AACpF,MAAM,WAAW,UAAU,CAAC,CAAC;IAC5B,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,UAAU,EAAE;QACpB;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QACtD;;;;;;WAMG;QACH,OAAO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