@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,465 @@
|
|
|
1
|
+
# Invitations
|
|
2
|
+
|
|
3
|
+
Inviting somebody into an organization: a person with the right to invite
|
|
4
|
+
names an address, a role and a scope (a school, a team, a workspace); the
|
|
5
|
+
invitee follows a link, picks a password if the type has one and they have none,
|
|
6
|
+
and lands signed in.
|
|
7
|
+
`janus({ invitations })` adds `auth.invitations` to the instance: **issue**,
|
|
8
|
+
**resend**, **revoke**, **list**, **preview** and **accept**. Without the block
|
|
9
|
+
there is no `auth.invitations` — not at run time, and not in the type.
|
|
10
|
+
|
|
11
|
+
An invitation is a **scope** (a string of yours), an **address**, a **name**, a
|
|
12
|
+
**role** (a string of yours) and a **locale**. Janus keeps the invitation, its
|
|
13
|
+
lifetime and its one-time code; **what a role lets someone do, and who may
|
|
14
|
+
invite into a scope, stay with the application** — `onAccepted` is where it
|
|
15
|
+
adds the new member.
|
|
16
|
+
|
|
17
|
+
## Wiring
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createMemoryInvitations, janus } from '@softistx/janus';
|
|
21
|
+
|
|
22
|
+
const auth = janus({
|
|
23
|
+
user: User, // a type with an e-mail: a password login that is the e-mail, or no password
|
|
24
|
+
password: { login: 'email' },
|
|
25
|
+
store,
|
|
26
|
+
hasher,
|
|
27
|
+
invitations: {
|
|
28
|
+
store: createMemoryInvitations(), // or an adapter's: createMongoInvitations(db), createDrizzleInvitations(db, { tables })
|
|
29
|
+
lifetime: '7d',
|
|
30
|
+
maxPending: 200,
|
|
31
|
+
// The fields of the user an invitation makes, for an invitee with no account.
|
|
32
|
+
create: (invitation) => ({ email: invitation.email, name: invitation.name, locale: invitation.locale }),
|
|
33
|
+
// Before anything is written: return false to refuse, and the invitation stays pending.
|
|
34
|
+
beforeAccept: async ({ invitation, user }) => {
|
|
35
|
+
return directory.stillExists(invitation.email);
|
|
36
|
+
},
|
|
37
|
+
// The application adds the user to the scope with the role. If it throws, the invitation can be accepted again.
|
|
38
|
+
onAccepted: async ({ invitation, user }) => {
|
|
39
|
+
await memberships.add({ scope: invitation.scope, userId: user.id, role: invitation.role });
|
|
40
|
+
},
|
|
41
|
+
events: (event) => audit.write(event),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| Option | Default | Meaning |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| `store` | required | An [`InvitationStore`](adapters.md). A port of its own, **not** a slot of `store`: the identity stores are unchanged |
|
|
49
|
+
| `create` | required | The fields of the user an invitation makes (its address, name, locale), validated by the type's schema. Called only for an invitee with no account |
|
|
50
|
+
| `beforeAccept` | none | Called when a code names a pending invitation, **before anything is written** (the claim, the user, the proof of the e-mail, the password), with the invitation and `{ id, type }` of the user who already holds its e-mail, or `user: null`. Return `false` to refuse: `accept` throws `INVITATION_REFUSED` (403), the invitation stays pending and can be accepted later; `true` goes on. A throw is thrown as it is, with nothing written. It runs on every accept path (new user, existing user, second factor) not for a code that names no pending invitation, and not for a deactivated user (`INVITATION_INVALID`). **It may run for an accept that then loses the claim to a concurrent one: keep it free of side effects** |
|
|
51
|
+
| `onAccepted` | required | Called once the invitee is a user, with the invitation and `{ id, type }` of the user. Where the application adds them to the scope with the role |
|
|
52
|
+
| `type` | the only user type | The user type an invitation makes or signs in, or a **list** of them ([several types](#several-user-types)). Required with several types. A type has an e-mail and either no password ([passwordless](#user-types-with-no-password)) or a password whose login is that e-mail |
|
|
53
|
+
| `lifetime` | `'7d'` | How long a code is good for, from `issue` or `resend` |
|
|
54
|
+
| `maxPending` | none | Pending invitations, not lapsed, one scope may hold (1 to 10000). Absent, no limit: the application limits what it can see |
|
|
55
|
+
| `events` | none | Called with each [invitation event](events.md#invitation-events), awaited |
|
|
56
|
+
|
|
57
|
+
A wrong value is a `TypeError` naming it, at wiring: `janus: invitations.create
|
|
58
|
+
must be a function …`, `janus: invitations.type must name the user type an
|
|
59
|
+
invitation makes: this instance has several`, `janus: invitations.type: "<name>"
|
|
60
|
+
must have no password, or sign in with a password whose login is its e-mail …`,
|
|
61
|
+
`janus: invitations.type must be a user type, or a non-empty list of distinct
|
|
62
|
+
user types`, `janus: invitations.type: "<name>" is listed twice`. `invitations` is a
|
|
63
|
+
reserved user type name.
|
|
64
|
+
|
|
65
|
+
## Several user types
|
|
66
|
+
|
|
67
|
+
One `invitations` block can invite different kinds of user: list them in
|
|
68
|
+
`type`, and say which one each invitation is for when you issue it.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const auth = janus({
|
|
72
|
+
users: {
|
|
73
|
+
staff: { schema: Staff, password: { login: 'email' } },
|
|
74
|
+
guardian: { schema: Guardian }, // no password: see below
|
|
75
|
+
},
|
|
76
|
+
store,
|
|
77
|
+
hasher,
|
|
78
|
+
invitations: {
|
|
79
|
+
store: createMemoryInvitations(),
|
|
80
|
+
type: ['staff', 'guardian'], // list the type your invitations were issued for before this option first
|
|
81
|
+
create: (invitation) => ({ email: invitation.email, name: invitation.name }),
|
|
82
|
+
onAccepted: async ({ invitation, user }) => {
|
|
83
|
+
await memberships.add({ scope: invitation.scope, userId: user.id, role: invitation.role });
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
await auth.invitations.issue({ scope, email, name, role, invitedBy: current.user, type: 'guardian' });
|
|
89
|
+
const shown = await auth.invitations.preview(code); // shown.type === 'guardian'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- **`issue({ type })` is optional only with one type.** With several, an absent
|
|
93
|
+
or unlisted `type` is `INVITATION_INVALID` (`field: 'type'`, `issue: type must
|
|
94
|
+
be one of "staff", "guardian"`). It is a `string`, checked at run time.
|
|
95
|
+
- **The type is fixed at issue.** `resend` and `revoke` keep it; to change it,
|
|
96
|
+
issue again. It is answered as `invitation.type` (on `issue`, `list`, the
|
|
97
|
+
hooks and `accept`) and as `preview(code).type`.
|
|
98
|
+
- **`create`, `beforeAccept` and `onAccepted` keep their signatures**: read
|
|
99
|
+
`invitation.type` to tell the kinds apart. `beforeAccept` sees the user who
|
|
100
|
+
holds the address *on the invitation's type*; `accept` makes, proves or signs
|
|
101
|
+
in a user of that type.
|
|
102
|
+
- **One pending invitation per scope and address, across types**: issuing as
|
|
103
|
+
another type revokes the pending one and makes a new one.
|
|
104
|
+
- **An invitation stored before the field existed has no type**, and reads as
|
|
105
|
+
the **first type listed**. List the type you used until now first.
|
|
106
|
+
- **A stored type that is no longer listed** (you removed it from `type`) is
|
|
107
|
+
still listed by `list`, but `preview` and `accept` answer `INVITATION_INVALID`
|
|
108
|
+
like any code that names no invitation.
|
|
109
|
+
- **The store must keep `type`.** With several types, `issue` reads the
|
|
110
|
+
invitation back once and throws a `TypeError` if the store did not return the
|
|
111
|
+
type it was given: a dropped type would read as the first one listed. The
|
|
112
|
+
memory store, `@softistx/janus-mongo` and `@softistx/janus-drizzle` keep it;
|
|
113
|
+
a custom adapter passes the conformance case `invitations.insert.type`.
|
|
114
|
+
- The GraphQL SDL (`@softistx/janus-graphql`) issues only single-type
|
|
115
|
+
configurations until it learns the `type` argument.
|
|
116
|
+
|
|
117
|
+
## User types with no password
|
|
118
|
+
|
|
119
|
+
A type with no `password` can be invited: there is nothing for the invitee to
|
|
120
|
+
choose, and they come back with the link or code they already use. It needs an
|
|
121
|
+
e-mail (the invitation is for an address).
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
users: { guardian: { schema: Guardian } }, // Guardian has a required string `email`
|
|
125
|
+
invitations: { store, type: 'guardian', create, onAccepted },
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`preview` answers `needsPassword: false` for it, and `accept` ignores any
|
|
129
|
+
`password` sent. By who holds the address:
|
|
130
|
+
|
|
131
|
+
| Who holds the address | What `accept` does | Answer |
|
|
132
|
+
| --- | --- | --- |
|
|
133
|
+
| Nobody | Creates the user `create` describes, with the e-mail proved | `signedIn` |
|
|
134
|
+
| A user whose e-mail was never proved | Runs `verifyEmail.proveFirst` (what an unproved account held is dropped, every session revoked) | `signedIn` |
|
|
135
|
+
| A user whose e-mail is proved | Leaves them as they are | `signIn`: send them to your link or code page |
|
|
136
|
+
|
|
137
|
+
## Issuing
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
const current = await auth.authenticate(request);
|
|
141
|
+
if (current === null) return new Response(null, { status: 401 });
|
|
142
|
+
// Authorising the inviter is yours: may current.user invite into this scope?
|
|
143
|
+
await assertCanInvite(current.user, scope);
|
|
144
|
+
|
|
145
|
+
const { invitation, code } = await auth.invitations.issue({
|
|
146
|
+
scope,
|
|
147
|
+
email: 'ada@example.com',
|
|
148
|
+
name: 'Ada Lovelace',
|
|
149
|
+
role: 'teacher',
|
|
150
|
+
locale: 'fr-CA', // optional
|
|
151
|
+
ref: person.id, // optional: your own record's id, opaque to Janus
|
|
152
|
+
type: 'staff', // required with several user types, see below
|
|
153
|
+
invitedBy: current.user,
|
|
154
|
+
});
|
|
155
|
+
// code: 43 base64url characters — put it in the e-mail's link now. Only its sha256 is stored.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
- **The code is shown once.** It is 32 random bytes; the store holds its
|
|
159
|
+
`sha256`, so a dump of it cannot be replayed. A lost code is a `resend`.
|
|
160
|
+
- **One pending invitation per scope and address.** Issuing again for an
|
|
161
|
+
address that has one **revokes the old one** (lapsed or not) and makes a new
|
|
162
|
+
one, with a new id and a new code: the old link stops working. Only the invitation pending when the issue began is replaced: of concurrent issues exactly one wins; the others throw `INVITATION_PENDING`. A refused issue
|
|
163
|
+
that replaced one (a race over `maxPending`) leaves the old one revoked.
|
|
164
|
+
- A scope, address, name, role, locale, `ref`, `type` or `invitedBy` (neither a user, a user id nor `null`) that cannot be kept is
|
|
165
|
+
`INVITATION_INVALID` (400) with `field`, and nothing is written. The address is
|
|
166
|
+
normalised as a login is.
|
|
167
|
+
- At `maxPending` pending invitations that have not lapsed, in the scope and
|
|
168
|
+
none this address's own: `INVITATION_LIMIT` (409, `maxActive`).
|
|
169
|
+
- **`ref` ties the invitation to your own record** (a person row the inviter
|
|
170
|
+
already made): any string of 1 to 100 characters, kept as given, answered back
|
|
171
|
+
as `invitation.ref` (`null` when none) and kept by `resend` and `revoke`. It
|
|
172
|
+
is fixed at issue: to change it, issue again. Janus never reads it; it is
|
|
173
|
+
indexed with the scope so `list` and `count` can filter on it.
|
|
174
|
+
- **A system issue has no inviter.** A first administrator created from a
|
|
175
|
+
script or a migration has no user to be the inviter: pass `invitedBy: null`.
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
const { invitation, code } = await auth.invitations.issue({
|
|
179
|
+
scope, email: 'root@example.com', name: 'Root', role: 'admin',
|
|
180
|
+
invitedBy: null, // the system; invitation.invitedBy is null
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The invitation is stored and answered with `invitedBy: null`, and so are its
|
|
185
|
+
events. The key stays required, so leaving `invitedBy` out (a forgotten
|
|
186
|
+
inviter) is a type error and `INVITATION_INVALID`, never a silent system
|
|
187
|
+
issue. Send its e-mail without an `inviter` (`mail.invitation` has copy for
|
|
188
|
+
it).
|
|
189
|
+
- **Who may invite is yours.** `issue` does not know your roles: check before
|
|
190
|
+
calling.
|
|
191
|
+
|
|
192
|
+
## Sending the link
|
|
193
|
+
|
|
194
|
+
`@softistx/janus-mail` has a ready invitation e-mail, `mail.invitation`. Janus
|
|
195
|
+
hands you the code; you build the link and the e-mail says the rest.
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
const { invitation, code } = await auth.invitations.issue({ scope, email, name, role, invitedBy: current.user });
|
|
199
|
+
|
|
200
|
+
await mail.invitation(
|
|
201
|
+
{ email: invitation.email, locale: invitation.locale === null ? undefined : [invitation.locale] },
|
|
202
|
+
{
|
|
203
|
+
inviter: current.user.name,
|
|
204
|
+
organization: organizationName(scope),
|
|
205
|
+
role: roleLabel(invitation.role), // optional text
|
|
206
|
+
link: `https://acme.example/invitations/accept?code=${encodeURIComponent(code)}`, // your accept page
|
|
207
|
+
expiresAt: invitation.expiresAt,
|
|
208
|
+
},
|
|
209
|
+
);
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The accept page is yours. **A GET on it must spend nothing** — mail scanners
|
|
213
|
+
open links — so it calls `preview` (below) and shows a form; the form's POST
|
|
214
|
+
calls `accept`. If sending fails, the invitation exists and still stands:
|
|
215
|
+
`resend` gives it a new code to send again.
|
|
216
|
+
|
|
217
|
+
## Resending and revoking
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
const again = await auth.invitations.resend({ id, scope }); // { invitation, code }: new code, new lifetime
|
|
221
|
+
await mail.invitation(/* … with again.code … */);
|
|
222
|
+
|
|
223
|
+
const revoked = await auth.invitations.revoke({ id, scope }); // the invitation, now revoked
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Name who acts with `by`, the actor's user id, for an audit trail:
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
await auth.invitations.resend({ id, scope, by: admin.id }); // invitation.resentBy === admin.id
|
|
230
|
+
const revoked = await auth.invitations.revoke({ id, scope, by: admin.id });
|
|
231
|
+
revoked.revokedBy; // admin.id
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`by` is optional (calls without it keep working) and Janus does not check it.
|
|
235
|
+
`revokedBy` is `null` until a revoke names someone. `resentBy` is the **last**
|
|
236
|
+
resender: a resend that names nobody sets it back to `null`. The matching
|
|
237
|
+
events carry `by` when it was given.
|
|
238
|
+
|
|
239
|
+
- Both take the `scope`: an id of another scope is `NOT_FOUND`, the same as an
|
|
240
|
+
unknown or malformed one, so a request cannot tell which invitations exist
|
|
241
|
+
elsewhere.
|
|
242
|
+
- `resend` works on a pending invitation, lapsed or not; the old code stops
|
|
243
|
+
working. Reviving a **lapsed** one takes a place like an `issue` does, so with
|
|
244
|
+
`maxPending` set it is `INVITATION_LIMIT` when the scope is already full; a
|
|
245
|
+
resend of one that has not lapsed takes none. `revoke` takes a pending one back, lapsed or not.
|
|
246
|
+
- On an accepted or revoked invitation both are `INVITATION_NOT_PENDING` (409).
|
|
247
|
+
|
|
248
|
+
## Importing history
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
const report = await auth.invitations.importHistory(
|
|
252
|
+
[
|
|
253
|
+
{ key: 'inv-42', scope: 'school-1', email: 'ada@example.com', name: 'Ada', role: 'teacher',
|
|
254
|
+
status: 'accepted', createdAt, acceptedAt, acceptedBy: ada.id },
|
|
255
|
+
{ key: 'inv-43', scope: 'school-1', email: 'bob@example.com', name: 'Bob', role: 'teacher',
|
|
256
|
+
status: 'revoked', createdAt, revokedAt },
|
|
257
|
+
],
|
|
258
|
+
{ dryRun: true }, // look first; nothing is written
|
|
259
|
+
);
|
|
260
|
+
// { dryRun: true, inserted: 2, present: 0, refused: 0, items: [{ key, id, outcome }, …] }
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
For an application that moves from another system: copies its accepted,
|
|
264
|
+
revoked and lapsed pending invitations in as history, **with no event, no mail
|
|
265
|
+
and no code**. An imported record cannot be previewed or accepted (its code
|
|
266
|
+
hash matches nothing); `list`, `get` and `count` see it.
|
|
267
|
+
|
|
268
|
+
- It is **idempotent by (`scope`, `key`)**: the id is derived from them, so a
|
|
269
|
+
record already imported is reported `present` and left alone. **Concurrent
|
|
270
|
+
runs of the same records may both report `inserted`**; one write wins.
|
|
271
|
+
- A bad record is reported `refused` with a `reason` (`invalid` and its
|
|
272
|
+
`field`, `unknown-type`, `live-pending`, `pending-held`, `duplicate-key`, `key-taken`) and
|
|
273
|
+
the others go on. A live pending record is refused: issue it.
|
|
274
|
+
- At most 1000 records per call; a wrong call shape is a `TypeError`.
|
|
275
|
+
- `acceptedBy`, `revokedBy` and `invitedBy` are Janus user ids.
|
|
276
|
+
- A store that expires invitations (a Mongo TTL index, `deleteExpiredInvitations`)
|
|
277
|
+
drops imported history too: see [Migrating invitations](migrating-invitations.md)
|
|
278
|
+
for the field mapping, the dry run and what keeps it.
|
|
279
|
+
|
|
280
|
+
## Listing
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
const page = await auth.invitations.list(scope, { status: 'pending', limit: 20 });
|
|
284
|
+
const next = await auth.invitations.list(scope, { status: 'pending', limit: 20, after: page.nextCursor });
|
|
285
|
+
|
|
286
|
+
// The invitation of one of your records, newest first, and how many are pending.
|
|
287
|
+
const mine = await auth.invitations.list(scope, { ref: person.id, order: 'desc', limit: 1 });
|
|
288
|
+
const pending = await auth.invitations.count(scope, { status: 'pending' });
|
|
289
|
+
const teachers = await auth.invitations.count(scope, { role: 'teacher', ref: person.id });
|
|
290
|
+
|
|
291
|
+
// Lapsed invitations (pending, `expiresAt` at or before now) out of an admin screen, with a matching total.
|
|
292
|
+
const live = await auth.invitations.list(scope, { lapsed: 'exclude' });
|
|
293
|
+
const liveTotal = await auth.invitations.count(scope, { lapsed: 'exclude' });
|
|
294
|
+
const lapsed = await auth.invitations.list(scope, { lapsed: 'only' });
|
|
295
|
+
|
|
296
|
+
// One invitation by id, e.g. to authorize a resend or a revoke.
|
|
297
|
+
const one = await auth.invitations.get({ id, scope }); // Invitation | null
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
`lapsed` is `'exclude'` or `'only'` (another value is a `TypeError`); absent
|
|
301
|
+
keeps every invitation, lapsed ones included. A lapsed invitation is one
|
|
302
|
+
stored `pending` whose `expiresAt` is at or before the core clock's now, the
|
|
303
|
+
instant of expiry included. `'exclude'` leaves those out and keeps every other
|
|
304
|
+
record, of any status; `'only'` keeps only those. With `status` it intersects,
|
|
305
|
+
so `status: 'accepted'` with `lapsed: 'only'` is empty: an accepted invitation
|
|
306
|
+
is never lapsed. A cursor is bound to `lapsed` too: reusing it with another
|
|
307
|
+
value is a `CursorFilterMismatchError`.
|
|
308
|
+
|
|
309
|
+
`get` costs one store read, whatever the scope holds, and answers the same
|
|
310
|
+
`Invitation` as `list` (with `ref`). It is `null` for an id that is unknown,
|
|
311
|
+
malformed or of another scope, so a request-supplied id reveals nothing about
|
|
312
|
+
other scopes. A store outage throws; it is never `null`.
|
|
313
|
+
|
|
314
|
+
`list` answers one scope's invitations, **oldest first** (`order: 'desc'` for
|
|
315
|
+
newest first), as `Invitation`s (no code, no hash), of one `status`
|
|
316
|
+
(`'pending' | 'accepted' | 'revoked'`), `role` and `ref`, or all. The filters
|
|
317
|
+
combine (all must match). `limit` is 20 when absent, at most 100; `after` is the
|
|
318
|
+
previous page's `nextCursor`, **with the same scope, filters and order**: the cursor is bound to the list it was issued for, and replayed against another one it is refused with `CURSOR_FILTER_MISMATCH` (`CursorFilterMismatchError`, 400; `BAD_USER_INPUT` in `@softistx/janus-graphql`). A `pending` invitation whose
|
|
319
|
+
`expiresAt` has passed is lapsed: it is still listed as `pending`, and `resend`
|
|
320
|
+
revives it. A status, role, ref, lapsed or order that is not valid is a `TypeError`,
|
|
321
|
+
never an unfiltered answer. A cursor that `list` handed out before the upgrade that bound cursors to their list is refused as `INVALID_CURSOR`; the client restarts from the first page.
|
|
322
|
+
|
|
323
|
+
`count(scope, { status?, role?, ref?, lapsed? })` answers how many invitations match the
|
|
324
|
+
same filters, with no page limit. `status: 'pending'` is the **stored** status:
|
|
325
|
+
a lapsed invitation counts, as it is listed. A scope without invitations is `0`.
|
|
326
|
+
|
|
327
|
+
## Previewing
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
const code = new URL(request.url).searchParams.get('code') ?? '';
|
|
331
|
+
try {
|
|
332
|
+
const invitation = await auth.invitations.preview(code);
|
|
333
|
+
// { id, scope, email, name, role, locale, expiresAt, needsPassword } — nothing about who sent it
|
|
334
|
+
} catch (error) {
|
|
335
|
+
if (error instanceof InvitationInvalidError) return Response.json({ code: error.code }, { status: 400 });
|
|
336
|
+
throw error;
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
`preview` reads the invitation a code names **without spending it**, for the
|
|
341
|
+
page the invitee lands on ("Ada, you are invited to Globex as teacher"). It is
|
|
342
|
+
unauthenticated, so it answers only the `InvitationPreview` fields.
|
|
343
|
+
`needsPassword` is `false` only when the address belongs to a user with a
|
|
344
|
+
proved e-mail **and** a password (`accept` then answers `signIn` and needs no
|
|
345
|
+
password); it is `true` for a new invitee, for an account whose e-mail was never
|
|
346
|
+
proved, and for a proved account that holds no password. The page shows its
|
|
347
|
+
password field from it, before it calls `accept`. Every code
|
|
348
|
+
that names no pending, unlapsed invitation — unknown, malformed, accepted,
|
|
349
|
+
revoked, lapsed — is the same `INVITATION_INVALID`; `error.reason` tells them
|
|
350
|
+
apart (`'unknown'`, `'expired'`, `'accepted'`, `'revoked'`, typed `InvitationRefusal`: the code is the
|
|
351
|
+
invitee's own secret). A deactivated user, a taken login and a lost race stay
|
|
352
|
+
`'unknown'`. **Janus does not throttle it**: put a rate limit in front of the
|
|
353
|
+
route.
|
|
354
|
+
|
|
355
|
+
## Accepting
|
|
356
|
+
|
|
357
|
+
```ts
|
|
358
|
+
const accepted = await auth.invitations.accept({ code, password, device });
|
|
359
|
+
|
|
360
|
+
switch (accepted.status) {
|
|
361
|
+
case 'signedIn':
|
|
362
|
+
// a session: put accepted.token in the cookie; accepted.user, accepted.invitation
|
|
363
|
+
break;
|
|
364
|
+
case 'secondFactor':
|
|
365
|
+
// the user has a second factor to prove, as for any sign-in
|
|
366
|
+
break;
|
|
367
|
+
case 'signIn':
|
|
368
|
+
// the address already belongs to a proved user, who is NOT signed in: send them to the sign-in page
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
**The code is the proof of the invitee's inbox**, so no other proof is asked.
|
|
374
|
+
`accept` claims the invitation first, under its version: of two concurrent
|
|
375
|
+
accepts exactly one wins and the other is `INVITATION_INVALID`. Then, by who
|
|
376
|
+
holds the address:
|
|
377
|
+
|
|
378
|
+
| Who holds the address | What `accept` does | Answer |
|
|
379
|
+
| --- | --- | --- |
|
|
380
|
+
| Nobody | Creates the user `create` describes, with the e-mail proved and `password` set | `signedIn` (or `secondFactor`) |
|
|
381
|
+
| A user whose e-mail was never proved | Runs `verifyEmail.proveFirst` — **their old password, second factor and avatar are dropped, every session revoked** — then sets `password` | `signedIn` (or `secondFactor`) |
|
|
382
|
+
| A user whose e-mail is proved, with a password | Leaves them as they are; `password` is ignored | `signIn`, nobody signed in |
|
|
383
|
+
| A user whose e-mail is proved, with no password | Sets `password` when one is given (what a retry after a failed `setPassword` finds) | `signedIn` (or `secondFactor`); without a `password`, `signIn` |
|
|
384
|
+
|
|
385
|
+
A proved account with no password (a social-only one) of a type that has a
|
|
386
|
+
password is given the invitation's `password` on accept and signed in. A type
|
|
387
|
+
with no password at all has [its own table](#user-types-with-no-password).
|
|
388
|
+
|
|
389
|
+
For a proved user nothing is signed in on purpose: an invitation proves the
|
|
390
|
+
inbox, not who holds the account. `onAccepted` has run for them too, so they
|
|
391
|
+
are in the scope after they sign in as usual.
|
|
392
|
+
|
|
393
|
+
- `password` is **required** for the first two rows: without it `PASSWORD_REQUIRED`
|
|
394
|
+
(400), with nothing written and the invitation still pending. It is checked
|
|
395
|
+
against the type's policy before any user is made (`PASSWORD_TOO_SHORT`).
|
|
396
|
+
- `device` is as for any sign-in (a [device](devices.md) hint).
|
|
397
|
+
- **If anything fails before `onAccepted` returns, the claim is released** and
|
|
398
|
+
the invitation can be accepted again; once `onAccepted` returned, it stays
|
|
399
|
+
accepted. A release that fails too is a `JANUS_INVITATION_RELEASE_FAILED`
|
|
400
|
+
warning and the first error is the one thrown.
|
|
401
|
+
- **A retry after a failed `onAccepted` answers `signIn`.** The first try made
|
|
402
|
+
the user, proved their e-mail and set the password; the retry finds a proved
|
|
403
|
+
user with a password and, by the table, signs nobody in. If instead the
|
|
404
|
+
failure was `setPassword` itself (the user is proved and holds no password),
|
|
405
|
+
the retry sets the password it is given and signs them in. **The accept page must handle `signIn` after an
|
|
406
|
+
error**: send the person to sign in with the password they just chose. See
|
|
407
|
+
[troubleshooting](../troubleshooting.md#a-retry-after-a-failed-onaccepted-answers-signin).
|
|
408
|
+
- **Janus does not throttle `accept`** (nor `preview`): rate-limit the route.
|
|
409
|
+
- `accepted.invitation` is the invitation, now `accepted`.
|
|
410
|
+
|
|
411
|
+
## Errors
|
|
412
|
+
|
|
413
|
+
| Code | Status | When |
|
|
414
|
+
| --- | --- | --- |
|
|
415
|
+
| `INVITATION_INVALID` | 400 | `preview`/`accept` on a code that names no pending, unlapsed invitation (one code, `reason` says why: `unknown`, `expired`, `accepted` or `revoked`), `accept` for a deactivated user, `accept` that lost a race on the invitation's version, or `accept` whose new user's login is taken (`LOGIN_TAKEN` is never shown); `issue` on an input it cannot keep (`field`) |
|
|
416
|
+
| `INVITATION_LIMIT` | 409 | `issue`, or `resend` of a lapsed invitation, into a scope holding `maxPending` invitations (`maxActive`) |
|
|
417
|
+
| `INVITATION_NOT_PENDING` | 409 | `resend`/`revoke` on an accepted or revoked invitation |
|
|
418
|
+
| `INVITATION_REFUSED` | 403 | `accept` refused by `beforeAccept`; nothing was written and the invitation is still pending |
|
|
419
|
+
| `INVITATION_PENDING` | 409 | A store refused a write that would make a second pending invitation for a scope and address; a concurrent `issue` won the place first; `issue` retries only while the place frees up or the invitation it replaces moved, and of concurrent issues exactly one wins and the others throw `INVITATION_PENDING` |
|
|
420
|
+
| `PASSWORD_REQUIRED` | 400 | `accept` needs a password and got none |
|
|
421
|
+
| `PASSWORD_TOO_SHORT`, `USER_INVALID` | 400 | `accept` makes a user: as `signUp` |
|
|
422
|
+
| `NOT_FOUND` | 404 | `resend`/`revoke` on an id that is unknown, malformed or of another scope |
|
|
423
|
+
| `STORE_FAILED` | 503 | A store could not answer. Never a negative answer |
|
|
424
|
+
|
|
425
|
+
Every code is in [Errors](errors.md); each message is in
|
|
426
|
+
[troubleshooting](../troubleshooting.md#invitations).
|
|
427
|
+
|
|
428
|
+
## Events
|
|
429
|
+
|
|
430
|
+
Invitation events go to the block's own `events` listener, never to the
|
|
431
|
+
instance's user events: `invitation.issued`, `invitation.resent`,
|
|
432
|
+
`invitation.revoked` and `invitation.accepted`. They carry the invitation's id
|
|
433
|
+
and scope and who sent it — **never the address or the code**. See
|
|
434
|
+
[Invitation events](events.md#invitation-events).
|
|
435
|
+
|
|
436
|
+
## Traps
|
|
437
|
+
|
|
438
|
+
- **The code is in the link, nowhere else.** Do not log it, store it, or put it
|
|
439
|
+
in an analytics URL. It is the only credential the invitee has.
|
|
440
|
+
- **Authorise the inviter yourself.** `issue` trusts `invitedBy`, and
|
|
441
|
+
`invitedBy: null` too: only code you trust should issue as the system.
|
|
442
|
+
- **`invitedBy` is `null` for a system issue.** Code that reads
|
|
443
|
+
`invitation.invitedBy` (a list, an event listener) must handle it.
|
|
444
|
+
- **No throttle on `preview` and `accept`.** Rate-limit both.
|
|
445
|
+
- **A GET on the accept page spends nothing.** Preview on GET, accept on POST.
|
|
446
|
+
- **Handle `signIn`.** It is the answer for a proved user, and for a retry after
|
|
447
|
+
a failed `onAccepted`.
|
|
448
|
+
- **`onAccepted` must be safe to run twice for one user** if it can fail half
|
|
449
|
+
way: the invitation is released on a throw, and the retry runs it again.
|
|
450
|
+
- **Issuing again revokes the old link.** An inviter who re-invites invalidates
|
|
451
|
+
the e-mail already in the inbox.
|
|
452
|
+
- **A proved e-mail is never taken over.** Whoever follows a link to an address
|
|
453
|
+
that already has a proved account is told to sign in; their password is not
|
|
454
|
+
changed.
|
|
455
|
+
- **Only a never-proved account is replaced**, and its password, second factor,
|
|
456
|
+
avatar and sessions with it: somebody who signed up with an address they did not own
|
|
457
|
+
loses it to its owner.
|
|
458
|
+
|
|
459
|
+
## See also
|
|
460
|
+
|
|
461
|
+
- [Sessions](sessions.md) — what `signedIn` carries and the cookie
|
|
462
|
+
- [E-mail flows](email-flows.md) — `proveFirst`, which `accept` runs for an unproved address
|
|
463
|
+
- [Migrating invitations](migrating-invitations.md) — the field mapping, the dry run and retention of an import
|
|
464
|
+
- [Adapters](adapters.md) — the `InvitationStore` port and `describeInvitationStores`
|
|
465
|
+
- [Errors](errors.md) and [events](events.md#invitation-events)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Several issuers in one process
|
|
2
|
+
|
|
3
|
+
One process can serve several tenants (schools, clinics, brands), each with its
|
|
4
|
+
own `janus()` instance: its own store, user types, cookie name, mail and keys,
|
|
5
|
+
chosen per request (from the host, say). `createJanusIssuers()` resolves the
|
|
6
|
+
request's issuer, builds that issuer's instance once and keeps it in a bounded
|
|
7
|
+
in-process cache. A single-instance application does not need it, and `janus()`
|
|
8
|
+
behaves the same with or without it.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { createJanusIssuers, janus, scryptHasher } from '@softistx/janus';
|
|
13
|
+
|
|
14
|
+
const issuers = createJanusIssuers({
|
|
15
|
+
// Cheap: a lookup of plain data (cache it yourself, in Redis for instance).
|
|
16
|
+
resolve: (request) => tenants.byHost(request.headers.get('host') ?? ''), // { issuer, version, ... } | null
|
|
17
|
+
// Expensive: runs on a miss or a new version, once for concurrent misses.
|
|
18
|
+
build: (tenant) =>
|
|
19
|
+
janus({
|
|
20
|
+
user: z.object({ email: z.email() }),
|
|
21
|
+
password: { login: 'email' },
|
|
22
|
+
store: createMongoStores(db, { partition: tenant.issuer }), // your own store factory
|
|
23
|
+
hasher: scryptHasher(),
|
|
24
|
+
cookie: { name: `session_${tenant.issuer}` },
|
|
25
|
+
}),
|
|
26
|
+
cache: { max: 100, idle: '1h' }, // the defaults
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
app.use(async (c, next) => {
|
|
30
|
+
const auth = await issuers.forRequest(c.req.raw);
|
|
31
|
+
if (auth === null) return c.notFound(); // no such issuer
|
|
32
|
+
c.set('auth', auth);
|
|
33
|
+
await next();
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`forRequest` hands back exactly what `build` answered, fully typed: the
|
|
38
|
+
instance is not widened, so `auth.signIn`, `auth.users` and the rest keep the
|
|
39
|
+
types of your configuration.
|
|
40
|
+
|
|
41
|
+
## What `resolve` answers
|
|
42
|
+
|
|
43
|
+
`{ issuer, version }`, plus whatever else `build` needs (a tenant id, its
|
|
44
|
+
settings). Both are strings, and the same shape `createOAuthIssuers()` of
|
|
45
|
+
`@softistx/janus-oauth` takes ([issuers](../../../janus-oauth/docs/guide/issuers.md)), so one lookup can feed both.
|
|
46
|
+
|
|
47
|
+
- `issuer` is the cache key.
|
|
48
|
+
- `version` is any string that changes whenever the issuer's configuration
|
|
49
|
+
does (an `updatedAt`, a revision number). The cached instance is kept while the
|
|
50
|
+
resolved version is the same and rebuilt when it differs.
|
|
51
|
+
- `null` means "no such issuer": `forRequest` answers `null`.
|
|
52
|
+
- A failure (the directory is down) rejects. It is never read as `null`, so an
|
|
53
|
+
outage is not an absence.
|
|
54
|
+
- Anything else (an empty `issuer`, a non-string `version`) is a `TypeError`.
|
|
55
|
+
|
|
56
|
+
Janus reads no forwarded header: `resolve` reads the `Host` header, or whatever
|
|
57
|
+
your proxy sets that you trust, and answers `null` for hosts it does not know.
|
|
58
|
+
|
|
59
|
+
## The two methods
|
|
60
|
+
|
|
61
|
+
| Method | Does |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `forRequest(request)` | The request's instance, built or cached, or `null` when `resolve` answered `null` |
|
|
64
|
+
| `evict(issuer)` | Drops one issuer's instance so the next request builds it again. An unknown issuer does nothing |
|
|
65
|
+
|
|
66
|
+
## The cache
|
|
67
|
+
|
|
68
|
+
- Entries are kept least-recently-used first out, past `cache.max` (default `100`).
|
|
69
|
+
- An entry not used for `cache.idle` (default `'1h'`) is dropped. There is no
|
|
70
|
+
timer; the check happens at the next lookup. Pass `clock` (a `fixedClock()` in
|
|
71
|
+
a spec) to move time.
|
|
72
|
+
- **Concurrent misses share one build.** Ten requests for a new issuer call
|
|
73
|
+
`build` once, and all ten wait for it.
|
|
74
|
+
- **A failed build is not kept.** A `build` that threw is asked again by the next
|
|
75
|
+
request.
|
|
76
|
+
- The cache is in this process. With several processes each builds its own, and
|
|
77
|
+
a new `version` reaches each one on its next request.
|
|
78
|
+
- While a new version rolls out across processes, `resolve` may alternate between `v1` and `v2`, and each flip rebuilds: an older version arriving after a newer one replaces it. Make `resolve` answer one version at a time.
|
|
79
|
+
- A rebuilt instance replaces the old one; a request that already holds the old
|
|
80
|
+
one finishes with it.
|
|
81
|
+
- Wrong options (`resolve` or `build` not a function, `cache.max` not a positive
|
|
82
|
+
integer, `cache.idle` not a duration) are a `TypeError` when you call
|
|
83
|
+
`createJanusIssuers`.
|
|
84
|
+
|
|
85
|
+
## Isolation
|
|
86
|
+
|
|
87
|
+
Every issuer gets the store and options `build` answers; nothing is shared unless
|
|
88
|
+
you share it. Give each issuer its **own** store, or a partition of one, so a
|
|
89
|
+
user, a session or a token of one issuer does not exist for another. A cookie
|
|
90
|
+
name per issuer keeps a browser that visits two tenants on one parent domain
|
|
91
|
+
from sending one's cookie to the other.
|
|
92
|
+
|
|
93
|
+
## Traps
|
|
94
|
+
|
|
95
|
+
- `resolve` runs on every request: keep it to a lookup. Do not build instances there.
|
|
96
|
+
- Change `version` whenever the issuer's configuration changes, or the old
|
|
97
|
+
instance keeps answering until it is evicted or idle.
|
|
98
|
+
- A spoofed `Host` picks another tenant's instance: refuse hosts you do not know
|
|
99
|
+
(answer `null`).
|
|
100
|
+
- Do not call `janus()` yourself per request: each call is a new instance with
|
|
101
|
+
its own hashers and caches. This helper is the cache.
|
|
102
|
+
- Events registered on an instance (`events`) are registered once per build, so a
|
|
103
|
+
rebuilt instance registers them again; do not keep per-instance state in the
|
|
104
|
+
listener.
|
|
105
|
+
|
|
106
|
+
See also [Users](users.md), [Sessions](sessions.md) and
|
|
107
|
+
[the shared vocabulary](vocabulary.md) for `fixedClock` and durations.
|