@yielded/auth 0.1.0-beta.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 +18 -0
- package/dist/Atom.d.mts +5 -0
- package/dist/Atom.mjs +5 -0
- package/dist/Auth.d.mts +9 -0
- package/dist/Auth.mjs +7 -0
- package/dist/AuthContract.d.mts +4 -0
- package/dist/AuthContract.mjs +4 -0
- package/dist/AuthSession.d.mts +82 -0
- package/dist/AuthSession.mjs +138 -0
- package/dist/AuthSession.mjs.map +1 -0
- package/dist/AuthStore.d.mts +68 -0
- package/dist/AuthStore.mjs +194 -0
- package/dist/AuthStore.mjs.map +1 -0
- package/dist/AuthTokenCodec.d.mts +40 -0
- package/dist/AuthTokenCodec.mjs +104 -0
- package/dist/AuthTokenCodec.mjs.map +1 -0
- package/dist/Client.d.mts +2 -0
- package/dist/Client.mjs +2 -0
- package/dist/Cloudflare.d.mts +89 -0
- package/dist/Cloudflare.mjs +166 -0
- package/dist/Cloudflare.mjs.map +1 -0
- package/dist/Drizzle.d.mts +28 -0
- package/dist/Drizzle.mjs +27 -0
- package/dist/DrizzleD1.d.mts +935 -0
- package/dist/DrizzleD1.mjs +29 -0
- package/dist/DrizzleD1.mjs.map +1 -0
- package/dist/DrizzleLibsql.d.mts +2288 -0
- package/dist/DrizzleLibsql.mjs +85 -0
- package/dist/DrizzleLibsql.mjs.map +1 -0
- package/dist/DrizzleMysql2.d.mts +1809 -0
- package/dist/DrizzleMysql2.mjs +55 -0
- package/dist/DrizzleMysql2.mjs.map +1 -0
- package/dist/DrizzlePglite.d.mts +1808 -0
- package/dist/DrizzlePglite.mjs +45 -0
- package/dist/DrizzlePglite.mjs.map +1 -0
- package/dist/DrizzlePostgres.d.mts +1808 -0
- package/dist/DrizzlePostgres.mjs +45 -0
- package/dist/DrizzlePostgres.mjs.map +1 -0
- package/dist/DrizzleSqliteBun.d.mts +2287 -0
- package/dist/DrizzleSqliteBun.mjs +62 -0
- package/dist/DrizzleSqliteBun.mjs.map +1 -0
- package/dist/DrizzleSqliteDo.d.mts +2343 -0
- package/dist/DrizzleSqliteDo.mjs +105 -0
- package/dist/DrizzleSqliteDo.mjs.map +1 -0
- package/dist/DrizzleSqliteNode.d.mts +2287 -0
- package/dist/DrizzleSqliteNode.mjs +62 -0
- package/dist/DrizzleSqliteNode.mjs.map +1 -0
- package/dist/DrizzleSqliteWasm.d.mts +2287 -0
- package/dist/DrizzleSqliteWasm.mjs +62 -0
- package/dist/DrizzleSqliteWasm.mjs.map +1 -0
- package/dist/Email.d.mts +12 -0
- package/dist/Email.mjs +11 -0
- package/dist/EmailOtp.d.mts +42 -0
- package/dist/EmailOtp.mjs +120 -0
- package/dist/EmailOtp.mjs.map +1 -0
- package/dist/EmailOtpSender.d.mts +22 -0
- package/dist/EmailOtpSender.mjs +18 -0
- package/dist/EmailOtpSender.mjs.map +1 -0
- package/dist/Errors.d.mts +55 -0
- package/dist/Errors.mjs +31 -0
- package/dist/Errors.mjs.map +1 -0
- package/dist/GitHub.d.mts +5 -0
- package/dist/GitHub.mjs +4 -0
- package/dist/Hooks.d.mts +6 -0
- package/dist/Hooks.mjs +6 -0
- package/dist/Http.d.mts +12 -0
- package/dist/Http.mjs +12 -0
- package/dist/HttpServer.d.mts +103 -0
- package/dist/HttpServer.mjs +326 -0
- package/dist/HttpServer.mjs.map +1 -0
- package/dist/Identity.d.mts +9 -0
- package/dist/Identity.mjs +9 -0
- package/dist/IdentityResolver.d.mts +16 -0
- package/dist/IdentityResolver.mjs +12 -0
- package/dist/IdentityResolver.mjs.map +1 -0
- package/dist/OAuth.d.mts +36 -0
- package/dist/OAuth.mjs +35 -0
- package/dist/OpenIdClient.d.mts +3 -0
- package/dist/OpenIdClient.mjs +3 -0
- package/dist/OpenIdClientConnected.d.mts +4 -0
- package/dist/OpenIdClientConnected.mjs +3 -0
- package/dist/OperationHttp.d.mts +3 -0
- package/dist/OperationHttp.mjs +3 -0
- package/dist/OperationHttpClient.d.mts +2 -0
- package/dist/OperationHttpClient.mjs +2 -0
- package/dist/OperationHttpServer.d.mts +5 -0
- package/dist/OperationHttpServer.mjs +4 -0
- package/dist/Operations.d.mts +8 -0
- package/dist/Operations.mjs +8 -0
- package/dist/Passkey.d.mts +12 -0
- package/dist/Passkey.mjs +12 -0
- package/dist/PasskeyBrowser.d.mts +4 -0
- package/dist/PasskeyBrowser.mjs +4 -0
- package/dist/PasskeyContract.d.mts +641 -0
- package/dist/PasskeyContract.mjs +174 -0
- package/dist/PasskeyContract.mjs.map +1 -0
- package/dist/PasskeyPassword.d.mts +412 -0
- package/dist/PasskeyPassword.mjs +174 -0
- package/dist/PasskeyPassword.mjs.map +1 -0
- package/dist/PasskeySimpleWebAuthn.d.mts +3 -0
- package/dist/PasskeySimpleWebAuthn.mjs +3 -0
- package/dist/Password.d.mts +19 -0
- package/dist/Password.mjs +17 -0
- package/dist/PasswordAuth.d.mts +45 -0
- package/dist/PasswordAuth.mjs +79 -0
- package/dist/PasswordAuth.mjs.map +1 -0
- package/dist/PasswordCredentialStore.d.mts +46 -0
- package/dist/PasswordCredentialStore.mjs +62 -0
- package/dist/PasswordCredentialStore.mjs.map +1 -0
- package/dist/PasswordHasher.d.mts +31 -0
- package/dist/PasswordHasher.mjs +76 -0
- package/dist/PasswordHasher.mjs.map +1 -0
- package/dist/PhoneOtp.d.mts +11 -0
- package/dist/PhoneOtp.mjs +11 -0
- package/dist/Policy.d.mts +52 -0
- package/dist/Policy.mjs +36 -0
- package/dist/Policy.mjs.map +1 -0
- package/dist/Proofs.d.mts +14 -0
- package/dist/Proofs.mjs +13 -0
- package/dist/Rpc.d.mts +12 -0
- package/dist/Rpc.mjs +11 -0
- package/dist/Rpc.mjs.map +1 -0
- package/dist/Schema.d.mts +160 -0
- package/dist/Schema.mjs +141 -0
- package/dist/Schema.mjs.map +1 -0
- package/dist/SessionContract.d.mts +3 -0
- package/dist/SessionContract.mjs +3 -0
- package/dist/Sessions.d.mts +14 -0
- package/dist/Sessions.mjs +12 -0
- package/dist/Testing.d.mts +7 -0
- package/dist/Testing.mjs +7 -0
- package/dist/Totp.d.mts +8 -0
- package/dist/Totp.mjs +8 -0
- package/dist/TotpContract.d.mts +318 -0
- package/dist/TotpContract.mjs +119 -0
- package/dist/TotpContract.mjs.map +1 -0
- package/dist/WebCrypto.d.mts +28 -0
- package/dist/WebCrypto.mjs +42 -0
- package/dist/WebCrypto.mjs.map +1 -0
- package/dist/Workflows.d.mts +16 -0
- package/dist/Workflows.mjs +11 -0
- package/dist/Workflows.mjs.map +1 -0
- package/dist/atom/AuthAtomLifetime.d.mts +35 -0
- package/dist/atom/AuthAtomLifetime.mjs +50 -0
- package/dist/atom/AuthAtomLifetime.mjs.map +1 -0
- package/dist/atom/AuthAtomWorkflow.d.mts +17 -0
- package/dist/atom/AuthAtomWorkflow.mjs +9 -0
- package/dist/atom/AuthAtomWorkflow.mjs.map +1 -0
- package/dist/atom/client.d.mts +43 -0
- package/dist/atom/client.mjs +168 -0
- package/dist/atom/client.mjs.map +1 -0
- package/dist/atom/operations.d.mts +35 -0
- package/dist/atom/operations.mjs +58 -0
- package/dist/atom/operations.mjs.map +1 -0
- package/dist/atom/scoped-runtime.mjs +151 -0
- package/dist/atom/scoped-runtime.mjs.map +1 -0
- package/dist/auth/Auth.d.mts +7806 -0
- package/dist/auth/Auth.mjs +141 -0
- package/dist/auth/Auth.mjs.map +1 -0
- package/dist/auth/AuthConfigurationError.d.mts +10 -0
- package/dist/auth/AuthConfigurationError.mjs +14 -0
- package/dist/auth/AuthConfigurationError.mjs.map +1 -0
- package/dist/auth/AuthRequest.d.mts +21 -0
- package/dist/auth/AuthRequest.mjs +10 -0
- package/dist/auth/AuthRequest.mjs.map +1 -0
- package/dist/auth/AuthStrategy.d.mts +23 -0
- package/dist/auth/AuthStrategy.mjs +33 -0
- package/dist/auth/AuthStrategy.mjs.map +1 -0
- package/dist/auth/ConsumeDecision.d.mts +11 -0
- package/dist/auth/actions.d.mts +18 -0
- package/dist/auth/actions.mjs +70 -0
- package/dist/auth/actions.mjs.map +1 -0
- package/dist/auth/defaults.mjs +12 -0
- package/dist/auth/defaults.mjs.map +1 -0
- package/dist/auth/definition.d.mts +46 -0
- package/dist/auth/session.d.mts +27 -0
- package/dist/auth/session.mjs +56 -0
- package/dist/auth/session.mjs.map +1 -0
- package/dist/drizzle/D1BatchStatements.d.mts +11 -0
- package/dist/drizzle/D1BatchStatements.mjs +8 -0
- package/dist/drizzle/D1BatchStatements.mjs.map +1 -0
- package/dist/drizzle/PasswordPreparedPostconditions.mjs +12 -0
- package/dist/drizzle/PasswordPreparedPostconditions.mjs.map +1 -0
- package/dist/drizzle/SuppliedService.d.mts +10 -0
- package/dist/drizzle/d1-emails.d.mts +68 -0
- package/dist/drizzle/d1-emails.mjs +580 -0
- package/dist/drizzle/d1-emails.mjs.map +1 -0
- package/dist/drizzle/d1-generated-statement.mjs +79 -0
- package/dist/drizzle/d1-generated-statement.mjs.map +1 -0
- package/dist/drizzle/d1-identity.d.mts +33 -0
- package/dist/drizzle/d1-identity.mjs +120 -0
- package/dist/drizzle/d1-identity.mjs.map +1 -0
- package/dist/drizzle/d1-oauth.d.mts +316 -0
- package/dist/drizzle/d1-oauth.mjs +79 -0
- package/dist/drizzle/d1-oauth.mjs.map +1 -0
- package/dist/drizzle/d1-passkey.d.mts +52 -0
- package/dist/drizzle/d1-passkey.mjs +97 -0
- package/dist/drizzle/d1-passkey.mjs.map +1 -0
- package/dist/drizzle/d1-password-prepared.d.mts +27 -0
- package/dist/drizzle/d1-password-prepared.mjs +464 -0
- package/dist/drizzle/d1-password-prepared.mjs.map +1 -0
- package/dist/drizzle/d1-passwords.d.mts +96 -0
- package/dist/drizzle/d1-passwords.mjs +1008 -0
- package/dist/drizzle/d1-passwords.mjs.map +1 -0
- package/dist/drizzle/d1-phone.d.mts +29 -0
- package/dist/drizzle/d1-phone.mjs +33 -0
- package/dist/drizzle/d1-phone.mjs.map +1 -0
- package/dist/drizzle/d1-planning.d.mts +12 -0
- package/dist/drizzle/d1-planning.mjs +43 -0
- package/dist/drizzle/d1-planning.mjs.map +1 -0
- package/dist/drizzle/d1-proofs.d.mts +88 -0
- package/dist/drizzle/d1-proofs.mjs +833 -0
- package/dist/drizzle/d1-proofs.mjs.map +1 -0
- package/dist/drizzle/d1-sessions.d.mts +77 -0
- package/dist/drizzle/d1-sessions.mjs +970 -0
- package/dist/drizzle/d1-sessions.mjs.map +1 -0
- package/dist/drizzle/d1-totp.d.mts +27 -0
- package/dist/drizzle/d1-totp.mjs +28 -0
- package/dist/drizzle/d1-totp.mjs.map +1 -0
- package/dist/drizzle/email-model.d.mts +352 -0
- package/dist/drizzle/email-model.mjs +21 -0
- package/dist/drizzle/email-model.mjs.map +1 -0
- package/dist/drizzle/email-registration.d.mts +33 -0
- package/dist/drizzle/email-registration.mjs +238 -0
- package/dist/drizzle/email-registration.mjs.map +1 -0
- package/dist/drizzle/email-sql.d.mts +18 -0
- package/dist/drizzle/email-sql.mjs +473 -0
- package/dist/drizzle/email-sql.mjs.map +1 -0
- package/dist/drizzle/email-target.d.mts +28 -0
- package/dist/drizzle/email-target.mjs +75 -0
- package/dist/drizzle/email-target.mjs.map +1 -0
- package/dist/drizzle/model.d.mts +259 -0
- package/dist/drizzle/model.mjs +81 -0
- package/dist/drizzle/model.mjs.map +1 -0
- package/dist/drizzle/mysql-emails.d.mts +82 -0
- package/dist/drizzle/mysql-emails.mjs +38 -0
- package/dist/drizzle/mysql-emails.mjs.map +1 -0
- package/dist/drizzle/mysql-identity.d.mts +24 -0
- package/dist/drizzle/mysql-identity.mjs +95 -0
- package/dist/drizzle/mysql-identity.mjs.map +1 -0
- package/dist/drizzle/mysql-password-prepared.d.mts +32 -0
- package/dist/drizzle/mysql-password-prepared.mjs +16 -0
- package/dist/drizzle/mysql-password-prepared.mjs.map +1 -0
- package/dist/drizzle/mysql-passwords.d.mts +102 -0
- package/dist/drizzle/mysql-passwords.mjs +38 -0
- package/dist/drizzle/mysql-passwords.mjs.map +1 -0
- package/dist/drizzle/mysql-proofs.d.mts +83 -0
- package/dist/drizzle/mysql-proofs.mjs +23 -0
- package/dist/drizzle/mysql-proofs.mjs.map +1 -0
- package/dist/drizzle/mysql-sessions.d.mts +250 -0
- package/dist/drizzle/mysql-sessions.mjs +53 -0
- package/dist/drizzle/mysql-sessions.mjs.map +1 -0
- package/dist/drizzle/mysql.d.mts +73 -0
- package/dist/drizzle/mysql.mjs +221 -0
- package/dist/drizzle/mysql.mjs.map +1 -0
- package/dist/drizzle/oauth-accounts.mjs +361 -0
- package/dist/drizzle/oauth-accounts.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-access.mjs +210 -0
- package/dist/drizzle/oauth-connected-access.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-collection.mjs +202 -0
- package/dist/drizzle/oauth-connected-collection.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-custody.mjs +146 -0
- package/dist/drizzle/oauth-connected-custody.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-drivers.mjs +78 -0
- package/dist/drizzle/oauth-connected-drivers.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-flow.mjs +248 -0
- package/dist/drizzle/oauth-connected-flow.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-input.mjs +105 -0
- package/dist/drizzle/oauth-connected-input.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-maintenance.mjs +215 -0
- package/dist/drizzle/oauth-connected-maintenance.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-management.mjs +228 -0
- package/dist/drizzle/oauth-connected-management.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-model.d.mts +278 -0
- package/dist/drizzle/oauth-connected-model.mjs +22 -0
- package/dist/drizzle/oauth-connected-model.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-reference.d.mts +17 -0
- package/dist/drizzle/oauth-connected-reference.mjs +53 -0
- package/dist/drizzle/oauth-connected-reference.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-settlement.mjs +117 -0
- package/dist/drizzle/oauth-connected-settlement.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-state.d.mts +16 -0
- package/dist/drizzle/oauth-connected-state.mjs +422 -0
- package/dist/drizzle/oauth-connected-state.mjs.map +1 -0
- package/dist/drizzle/oauth-connected-target.d.mts +114 -0
- package/dist/drizzle/oauth-connected-target.mjs +94 -0
- package/dist/drizzle/oauth-connected-target.mjs.map +1 -0
- package/dist/drizzle/oauth-drivers.mjs +53 -0
- package/dist/drizzle/oauth-drivers.mjs.map +1 -0
- package/dist/drizzle/oauth-flow.d.mts +7 -0
- package/dist/drizzle/oauth-flow.mjs +255 -0
- package/dist/drizzle/oauth-flow.mjs.map +1 -0
- package/dist/drizzle/oauth-input.mjs +130 -0
- package/dist/drizzle/oauth-input.mjs.map +1 -0
- package/dist/drizzle/oauth-model.d.mts +468 -0
- package/dist/drizzle/oauth-model.mjs +49 -0
- package/dist/drizzle/oauth-model.mjs.map +1 -0
- package/dist/drizzle/oauth-mysql.mjs +8 -0
- package/dist/drizzle/oauth-mysql.mjs.map +1 -0
- package/dist/drizzle/oauth-owner.d.mts +4 -0
- package/dist/drizzle/oauth-owner.mjs +10 -0
- package/dist/drizzle/oauth-owner.mjs.map +1 -0
- package/dist/drizzle/oauth-registration.d.mts +8 -0
- package/dist/drizzle/oauth-registration.mjs +375 -0
- package/dist/drizzle/oauth-registration.mjs.map +1 -0
- package/dist/drizzle/oauth-state.mjs +109 -0
- package/dist/drizzle/oauth-state.mjs.map +1 -0
- package/dist/drizzle/oauth-target.d.mts +125 -0
- package/dist/drizzle/oauth-target.mjs +252 -0
- package/dist/drizzle/oauth-target.mjs.map +1 -0
- package/dist/drizzle/passkey-admission.mjs +203 -0
- package/dist/drizzle/passkey-admission.mjs.map +1 -0
- package/dist/drizzle/passkey-credentials.mjs +239 -0
- package/dist/drizzle/passkey-credentials.mjs.map +1 -0
- package/dist/drizzle/passkey-drivers.mjs +34 -0
- package/dist/drizzle/passkey-drivers.mjs.map +1 -0
- package/dist/drizzle/passkey-enrollment.mjs +132 -0
- package/dist/drizzle/passkey-enrollment.mjs.map +1 -0
- package/dist/drizzle/passkey-flow.mjs +436 -0
- package/dist/drizzle/passkey-flow.mjs.map +1 -0
- package/dist/drizzle/passkey-management.mjs +225 -0
- package/dist/drizzle/passkey-management.mjs.map +1 -0
- package/dist/drizzle/passkey-model.d.mts +275 -0
- package/dist/drizzle/passkey-model.mjs +36 -0
- package/dist/drizzle/passkey-model.mjs.map +1 -0
- package/dist/drizzle/passkey-registration-ceremony-model.d.mts +50 -0
- package/dist/drizzle/passkey-registration-ceremony-model.mjs +18 -0
- package/dist/drizzle/passkey-registration-ceremony-model.mjs.map +1 -0
- package/dist/drizzle/passkey-registration-ceremony.mjs +124 -0
- package/dist/drizzle/passkey-registration-ceremony.mjs.map +1 -0
- package/dist/drizzle/passkey-registration-custody.mjs +51 -0
- package/dist/drizzle/passkey-registration-custody.mjs.map +1 -0
- package/dist/drizzle/passkey-registration-write.mjs +205 -0
- package/dist/drizzle/passkey-registration-write.mjs.map +1 -0
- package/dist/drizzle/passkey-state.d.mts +5 -0
- package/dist/drizzle/passkey-state.mjs +207 -0
- package/dist/drizzle/passkey-state.mjs.map +1 -0
- package/dist/drizzle/passkey-target.d.mts +16 -0
- package/dist/drizzle/passkey-target.mjs +174 -0
- package/dist/drizzle/passkey-target.mjs.map +1 -0
- package/dist/drizzle/passkey-write-drivers.mjs +33 -0
- package/dist/drizzle/passkey-write-drivers.mjs.map +1 -0
- package/dist/drizzle/passkey-write-model.d.mts +192 -0
- package/dist/drizzle/passkey-write-model.mjs +13 -0
- package/dist/drizzle/passkey-write-model.mjs.map +1 -0
- package/dist/drizzle/passkey-write-state.mjs +326 -0
- package/dist/drizzle/passkey-write-state.mjs.map +1 -0
- package/dist/drizzle/passkey-write-target.d.mts +14 -0
- package/dist/drizzle/passkey-write-target.mjs +185 -0
- package/dist/drizzle/passkey-write-target.mjs.map +1 -0
- package/dist/drizzle/password-model.d.mts +330 -0
- package/dist/drizzle/password-model.mjs +22 -0
- package/dist/drizzle/password-model.mjs.map +1 -0
- package/dist/drizzle/password-prepared-model.d.mts +93 -0
- package/dist/drizzle/password-prepared-model.mjs +11 -0
- package/dist/drizzle/password-prepared-model.mjs.map +1 -0
- package/dist/drizzle/password-prepared-sql.mjs +394 -0
- package/dist/drizzle/password-prepared-sql.mjs.map +1 -0
- package/dist/drizzle/password-prepared-state.mjs +107 -0
- package/dist/drizzle/password-prepared-state.mjs.map +1 -0
- package/dist/drizzle/password-prepared-target.d.mts +12 -0
- package/dist/drizzle/password-prepared-target.mjs +57 -0
- package/dist/drizzle/password-prepared-target.mjs.map +1 -0
- package/dist/drizzle/password-registration.d.mts +23 -0
- package/dist/drizzle/password-registration.mjs +136 -0
- package/dist/drizzle/password-registration.mjs.map +1 -0
- package/dist/drizzle/password-sql.d.mts +20 -0
- package/dist/drizzle/password-sql.mjs +702 -0
- package/dist/drizzle/password-sql.mjs.map +1 -0
- package/dist/drizzle/password-target.d.mts +25 -0
- package/dist/drizzle/password-target.mjs +63 -0
- package/dist/drizzle/password-target.mjs.map +1 -0
- package/dist/drizzle/pg-emails.d.mts +83 -0
- package/dist/drizzle/pg-emails.mjs +38 -0
- package/dist/drizzle/pg-emails.mjs.map +1 -0
- package/dist/drizzle/pg-password-prepared.d.mts +33 -0
- package/dist/drizzle/pg-password-prepared.mjs +16 -0
- package/dist/drizzle/pg-password-prepared.mjs.map +1 -0
- package/dist/drizzle/pg-passwords.d.mts +103 -0
- package/dist/drizzle/pg-passwords.mjs +38 -0
- package/dist/drizzle/pg-passwords.mjs.map +1 -0
- package/dist/drizzle/pg-proofs.d.mts +84 -0
- package/dist/drizzle/pg-proofs.mjs +22 -0
- package/dist/drizzle/pg-proofs.mjs.map +1 -0
- package/dist/drizzle/pg-sessions.d.mts +251 -0
- package/dist/drizzle/pg-sessions.mjs +53 -0
- package/dist/drizzle/pg-sessions.mjs.map +1 -0
- package/dist/drizzle/pg.d.mts +88 -0
- package/dist/drizzle/pg.mjs +294 -0
- package/dist/drizzle/pg.mjs.map +1 -0
- package/dist/drizzle/phone-model.d.mts +117 -0
- package/dist/drizzle/phone-model.mjs +39 -0
- package/dist/drizzle/phone-model.mjs.map +1 -0
- package/dist/drizzle/phone-state.mjs +426 -0
- package/dist/drizzle/phone-state.mjs.map +1 -0
- package/dist/drizzle/phone-target.d.mts +19 -0
- package/dist/drizzle/phone-target.mjs +171 -0
- package/dist/drizzle/phone-target.mjs.map +1 -0
- package/dist/drizzle/proof-model.d.mts +287 -0
- package/dist/drizzle/proof-model.mjs +17 -0
- package/dist/drizzle/proof-model.mjs.map +1 -0
- package/dist/drizzle/proof-sql.d.mts +16 -0
- package/dist/drizzle/proof-sql.mjs +618 -0
- package/dist/drizzle/proof-sql.mjs.map +1 -0
- package/dist/drizzle/proof-target.d.mts +17 -0
- package/dist/drizzle/proof-target.mjs +38 -0
- package/dist/drizzle/proof-target.mjs.map +1 -0
- package/dist/drizzle/session-model.d.mts +201 -0
- package/dist/drizzle/session-model.mjs +19 -0
- package/dist/drizzle/session-model.mjs.map +1 -0
- package/dist/drizzle/session-sql.mjs +732 -0
- package/dist/drizzle/session-sql.mjs.map +1 -0
- package/dist/drizzle/session-target.d.mts +37 -0
- package/dist/drizzle/session-target.mjs +47 -0
- package/dist/drizzle/session-target.mjs.map +1 -0
- package/dist/drizzle/sqlite-emails.mjs +45 -0
- package/dist/drizzle/sqlite-emails.mjs.map +1 -0
- package/dist/drizzle/sqlite-identity.mjs +92 -0
- package/dist/drizzle/sqlite-identity.mjs.map +1 -0
- package/dist/drizzle/sqlite-password-prepared.mjs +21 -0
- package/dist/drizzle/sqlite-password-prepared.mjs.map +1 -0
- package/dist/drizzle/sqlite-passwords.mjs +49 -0
- package/dist/drizzle/sqlite-passwords.mjs.map +1 -0
- package/dist/drizzle/sqlite-proofs.mjs +29 -0
- package/dist/drizzle/sqlite-proofs.mjs.map +1 -0
- package/dist/drizzle/sqlite-sessions.mjs +74 -0
- package/dist/drizzle/sqlite-sessions.mjs.map +1 -0
- package/dist/drizzle/sqlite.d.mts +81 -0
- package/dist/drizzle/sqlite.mjs +220 -0
- package/dist/drizzle/sqlite.mjs.map +1 -0
- package/dist/drizzle/standalone-guard.mjs +19 -0
- package/dist/drizzle/standalone-guard.mjs.map +1 -0
- package/dist/drizzle/step-up-model.d.mts +65 -0
- package/dist/drizzle/step-up-model.mjs +9 -0
- package/dist/drizzle/step-up-model.mjs.map +1 -0
- package/dist/drizzle/step-up-state.mjs +34 -0
- package/dist/drizzle/step-up-state.mjs.map +1 -0
- package/dist/drizzle/totp-model.d.mts +85 -0
- package/dist/drizzle/totp-model.mjs +13 -0
- package/dist/drizzle/totp-model.mjs.map +1 -0
- package/dist/drizzle/totp-state.d.mts +39 -0
- package/dist/drizzle/totp-state.mjs +288 -0
- package/dist/drizzle/totp-state.mjs.map +1 -0
- package/dist/drizzle/totp-target.d.mts +16 -0
- package/dist/drizzle/totp-target.mjs +83 -0
- package/dist/drizzle/totp-target.mjs.map +1 -0
- package/dist/drizzle/transaction-execution.d.mts +20 -0
- package/dist/drizzle/transaction-execution.mjs +111 -0
- package/dist/drizzle/transaction-execution.mjs.map +1 -0
- package/dist/drizzle/transaction-mysql.mjs +46 -0
- package/dist/drizzle/transaction-mysql.mjs.map +1 -0
- package/dist/drizzle/transaction-owner.d.mts +6 -0
- package/dist/drizzle/transaction-owner.mjs +252 -0
- package/dist/drizzle/transaction-owner.mjs.map +1 -0
- package/dist/email/EmailActionEvidence.d.mts +33 -0
- package/dist/email/EmailActionEvidence.mjs +15 -0
- package/dist/email/EmailActionEvidence.mjs.map +1 -0
- package/dist/email/EmailAddressPersistence.d.mts +63 -0
- package/dist/email/EmailAddressPersistence.mjs +19 -0
- package/dist/email/EmailAddressPersistence.mjs.map +1 -0
- package/dist/email/EmailIdentifierNotifier.d.mts +30 -0
- package/dist/email/EmailIdentifierNotifier.mjs +31 -0
- package/dist/email/EmailIdentifierNotifier.mjs.map +1 -0
- package/dist/email/EmailReturnTargets.d.mts +19 -0
- package/dist/email/EmailReturnTargets.mjs +29 -0
- package/dist/email/EmailReturnTargets.mjs.map +1 -0
- package/dist/email/EmailSignInTargets.d.mts +20 -0
- package/dist/email/EmailSignInTargets.mjs +12 -0
- package/dist/email/EmailSignInTargets.mjs.map +1 -0
- package/dist/email/addresses.d.mts +33 -0
- package/dist/email/addresses.mjs +404 -0
- package/dist/email/addresses.mjs.map +1 -0
- package/dist/email/definition.d.mts +10153 -0
- package/dist/email/definition.mjs +111 -0
- package/dist/email/definition.mjs.map +1 -0
- package/dist/email/errors.d.mts +15 -0
- package/dist/email/errors.mjs +11 -0
- package/dist/email/errors.mjs.map +1 -0
- package/dist/email/magicLink.d.mts +33 -0
- package/dist/email/magicLink.mjs +58 -0
- package/dist/email/magicLink.mjs.map +1 -0
- package/dist/email/models.d.mts +56 -0
- package/dist/email/models.mjs +31 -0
- package/dist/email/models.mjs.map +1 -0
- package/dist/email/module.d.mts +22296 -0
- package/dist/email/module.mjs +415 -0
- package/dist/email/module.mjs.map +1 -0
- package/dist/email/registration.d.mts +28 -0
- package/dist/email/registration.mjs +243 -0
- package/dist/email/registration.mjs.map +1 -0
- package/dist/email/snapshot.mjs +37 -0
- package/dist/email/snapshot.mjs.map +1 -0
- package/dist/hooks/LifecycleHooks.d.mts +34 -0
- package/dist/hooks/LifecycleHooks.mjs +74 -0
- package/dist/hooks/LifecycleHooks.mjs.map +1 -0
- package/dist/hooks/commit.d.mts +66 -0
- package/dist/hooks/commit.mjs +136 -0
- package/dist/hooks/commit.mjs.map +1 -0
- package/dist/hooks/models.d.mts +51 -0
- package/dist/hooks/models.mjs +87 -0
- package/dist/hooks/models.mjs.map +1 -0
- package/dist/hooks/plugins.d.mts +36 -0
- package/dist/hooks/plugins.mjs +60 -0
- package/dist/hooks/plugins.mjs.map +1 -0
- package/dist/hooks/transactions.d.mts +31 -0
- package/dist/hooks/transactions.mjs +38 -0
- package/dist/hooks/transactions.mjs.map +1 -0
- package/dist/http/auth-api.d.mts +9 -0
- package/dist/http/auth-api.mjs +13 -0
- package/dist/http/auth-api.mjs.map +1 -0
- package/dist/http/auth-contract.d.mts +84 -0
- package/dist/http/auth-contract.mjs +75 -0
- package/dist/http/auth-contract.mjs.map +1 -0
- package/dist/http/auth-http.d.mts +216 -0
- package/dist/http/auth-http.mjs +184 -0
- package/dist/http/auth-http.mjs.map +1 -0
- package/dist/http/endpoints/get-session.d.mts +8 -0
- package/dist/http/endpoints/get-session.mjs +12 -0
- package/dist/http/endpoints/get-session.mjs.map +1 -0
- package/dist/http/endpoints/password-sign-in.d.mts +8 -0
- package/dist/http/endpoints/password-sign-in.mjs +18 -0
- package/dist/http/endpoints/password-sign-in.mjs.map +1 -0
- package/dist/http/endpoints/request-email-otp.d.mts +8 -0
- package/dist/http/endpoints/request-email-otp.mjs +17 -0
- package/dist/http/endpoints/request-email-otp.mjs.map +1 -0
- package/dist/http/endpoints/set-password.d.mts +9 -0
- package/dist/http/endpoints/set-password.mjs +19 -0
- package/dist/http/endpoints/set-password.mjs.map +1 -0
- package/dist/http/endpoints/sign-out.d.mts +6 -0
- package/dist/http/endpoints/sign-out.mjs +7 -0
- package/dist/http/endpoints/sign-out.mjs.map +1 -0
- package/dist/http/endpoints/verify-email-otp.d.mts +9 -0
- package/dist/http/endpoints/verify-email-otp.mjs +18 -0
- package/dist/http/endpoints/verify-email-otp.mjs.map +1 -0
- package/dist/http/models.d.mts +49 -0
- package/dist/http/models.mjs +35 -0
- package/dist/http/models.mjs.map +1 -0
- package/dist/http/security.d.mts +91 -0
- package/dist/http/security.mjs +77 -0
- package/dist/http/security.mjs.map +1 -0
- package/dist/http/session-contract.d.mts +303 -0
- package/dist/http/session-contract.mjs +38 -0
- package/dist/http/session-contract.mjs.map +1 -0
- package/dist/http-operation/OperationHttpInvocation.d.mts +16 -0
- package/dist/http-operation/OperationHttpInvocation.mjs +11 -0
- package/dist/http-operation/OperationHttpInvocation.mjs.map +1 -0
- package/dist/http-operation/OperationHttpServerConfig.d.mts +18 -0
- package/dist/http-operation/OperationHttpServerConfig.mjs +72 -0
- package/dist/http-operation/OperationHttpServerConfig.mjs.map +1 -0
- package/dist/http-operation/auth-client.d.mts +75 -0
- package/dist/http-operation/auth-client.mjs +116 -0
- package/dist/http-operation/auth-client.mjs.map +1 -0
- package/dist/http-operation/client.d.mts +50 -0
- package/dist/http-operation/client.mjs +188 -0
- package/dist/http-operation/client.mjs.map +1 -0
- package/dist/http-operation/configuration-schema.mjs +19 -0
- package/dist/http-operation/configuration-schema.mjs.map +1 -0
- package/dist/http-operation/contract.d.mts +40 -0
- package/dist/http-operation/contract.mjs +37 -0
- package/dist/http-operation/contract.mjs.map +1 -0
- package/dist/http-operation/errors.d.mts +13 -0
- package/dist/http-operation/errors.mjs +31 -0
- package/dist/http-operation/errors.mjs.map +1 -0
- package/dist/http-operation/models.d.mts +32 -0
- package/dist/http-operation/models.mjs +14 -0
- package/dist/http-operation/models.mjs.map +1 -0
- package/dist/http-operation/private.mjs +35 -0
- package/dist/http-operation/private.mjs.map +1 -0
- package/dist/http-operation/security.mjs +58 -0
- package/dist/http-operation/security.mjs.map +1 -0
- package/dist/http-operation/server.d.mts +33 -0
- package/dist/http-operation/server.mjs +268 -0
- package/dist/http-operation/server.mjs.map +1 -0
- package/dist/identity/ExternalIdentityMutation.d.mts +15 -0
- package/dist/identity/ExternalIdentityMutation.mjs +11 -0
- package/dist/identity/ExternalIdentityMutation.mjs.map +1 -0
- package/dist/identity/IdentityMutation.d.mts +22 -0
- package/dist/identity/IdentityMutation.mjs +17 -0
- package/dist/identity/IdentityMutation.mjs.map +1 -0
- package/dist/identity/IdentityRepository.d.mts +20 -0
- package/dist/identity/IdentityRepository.mjs +11 -0
- package/dist/identity/IdentityRepository.mjs.map +1 -0
- package/dist/identity/SubjectLifecycle.d.mts +58 -0
- package/dist/identity/SubjectLifecycle.mjs +43 -0
- package/dist/identity/SubjectLifecycle.mjs.map +1 -0
- package/dist/identity/SubjectProvisioner.d.mts +37 -0
- package/dist/identity/SubjectProvisioner.mjs +20 -0
- package/dist/identity/SubjectProvisioner.mjs.map +1 -0
- package/dist/identity/codecs.d.mts +34 -0
- package/dist/identity/codecs.mjs +40 -0
- package/dist/identity/codecs.mjs.map +1 -0
- package/dist/identity/models.d.mts +62 -0
- package/dist/identity/models.mjs +51 -0
- package/dist/identity/models.mjs.map +1 -0
- package/dist/identity/operations.d.mts +118 -0
- package/dist/identity/operations.mjs +124 -0
- package/dist/identity/operations.mjs.map +1 -0
- package/dist/index.d.mts +23 -0
- package/dist/index.mjs +23 -0
- package/dist/internal/AuthStoreDecisions.d.mts +22 -0
- package/dist/internal/AuthStoreDecisions.mjs +8 -0
- package/dist/internal/AuthStoreDecisions.mjs.map +1 -0
- package/dist/internal/CurrentSession.d.mts +9 -0
- package/dist/internal/CurrentSession.mjs +8 -0
- package/dist/internal/CurrentSession.mjs.map +1 -0
- package/dist/internal/diagnostics.mjs +23 -0
- package/dist/internal/diagnostics.mjs.map +1 -0
- package/dist/oauth/GithubOAuthProvider.d.mts +43 -0
- package/dist/oauth/GithubOAuthProvider.mjs +66 -0
- package/dist/oauth/GithubOAuthProvider.mjs.map +1 -0
- package/dist/oauth/OAuth.d.mts +73 -0
- package/dist/oauth/OAuth.mjs +180 -0
- package/dist/oauth/OAuth.mjs.map +1 -0
- package/dist/oauth/OAuthAccountsPersistence.d.mts +109 -0
- package/dist/oauth/OAuthAccountsPersistence.mjs +12 -0
- package/dist/oauth/OAuthAccountsPersistence.mjs.map +1 -0
- package/dist/oauth/OAuthActionEvidence.d.mts +28 -0
- package/dist/oauth/OAuthActionEvidence.mjs +15 -0
- package/dist/oauth/OAuthActionEvidence.mjs.map +1 -0
- package/dist/oauth/OAuthConnectedActionEvidence.d.mts +22 -0
- package/dist/oauth/OAuthConnectedActionEvidence.mjs +9 -0
- package/dist/oauth/OAuthConnectedActionEvidence.mjs.map +1 -0
- package/dist/oauth/OAuthConnectedPersistence.d.mts +129 -0
- package/dist/oauth/OAuthConnectedPersistence.mjs +12 -0
- package/dist/oauth/OAuthConnectedPersistence.mjs.map +1 -0
- package/dist/oauth/OAuthConnectedProtocol.d.mts +41 -0
- package/dist/oauth/OAuthConnectedProtocol.mjs +13 -0
- package/dist/oauth/OAuthConnectedProtocol.mjs.map +1 -0
- package/dist/oauth/OAuthConnectedRevocations.d.mts +167 -0
- package/dist/oauth/OAuthConnectedRevocations.mjs +21 -0
- package/dist/oauth/OAuthConnectedRevocations.mjs.map +1 -0
- package/dist/oauth/OAuthConnectedTokenProtector.d.mts +24 -0
- package/dist/oauth/OAuthConnectedTokenProtector.mjs +153 -0
- package/dist/oauth/OAuthConnectedTokenProtector.mjs.map +1 -0
- package/dist/oauth/OAuthConnectedTransactionProtector.d.mts +23 -0
- package/dist/oauth/OAuthConnectedTransactionProtector.mjs +37 -0
- package/dist/oauth/OAuthConnectedTransactionProtector.mjs.map +1 -0
- package/dist/oauth/OAuthConnectedUseAuthority.d.mts +22 -0
- package/dist/oauth/OAuthConnectedUseAuthority.mjs +10 -0
- package/dist/oauth/OAuthConnectedUseAuthority.mjs.map +1 -0
- package/dist/oauth/OAuthConnectionStore.d.mts +33 -0
- package/dist/oauth/OAuthConnectionStore.mjs +38 -0
- package/dist/oauth/OAuthConnectionStore.mjs.map +1 -0
- package/dist/oauth/OAuthLinkTransactionProtector.d.mts +25 -0
- package/dist/oauth/OAuthLinkTransactionProtector.mjs +39 -0
- package/dist/oauth/OAuthLinkTransactionProtector.mjs.map +1 -0
- package/dist/oauth/OAuthProtocol.d.mts +33 -0
- package/dist/oauth/OAuthProtocol.mjs +16 -0
- package/dist/oauth/OAuthProtocol.mjs.map +1 -0
- package/dist/oauth/OAuthProvider.d.mts +70 -0
- package/dist/oauth/OAuthProvider.mjs +39 -0
- package/dist/oauth/OAuthProvider.mjs.map +1 -0
- package/dist/oauth/OAuthProviders.d.mts +27 -0
- package/dist/oauth/OAuthProviders.mjs +33 -0
- package/dist/oauth/OAuthProviders.mjs.map +1 -0
- package/dist/oauth/OAuthRegistrationIntents.d.mts +87 -0
- package/dist/oauth/OAuthRegistrationIntents.mjs +19 -0
- package/dist/oauth/OAuthRegistrationIntents.mjs.map +1 -0
- package/dist/oauth/OAuthReturnTargets.d.mts +15 -0
- package/dist/oauth/OAuthReturnTargets.mjs +24 -0
- package/dist/oauth/OAuthReturnTargets.mjs.map +1 -0
- package/dist/oauth/OAuthSignInPersistence.d.mts +68 -0
- package/dist/oauth/OAuthSignInPersistence.mjs +12 -0
- package/dist/oauth/OAuthSignInPersistence.mjs.map +1 -0
- package/dist/oauth/OAuthStateDecisions.d.mts +14 -0
- package/dist/oauth/OAuthStateDecisions.mjs +8 -0
- package/dist/oauth/OAuthStateDecisions.mjs.map +1 -0
- package/dist/oauth/OAuthStateStore.d.mts +35 -0
- package/dist/oauth/OAuthStateStore.mjs +64 -0
- package/dist/oauth/OAuthStateStore.mjs.map +1 -0
- package/dist/oauth/OAuthTransactionProtector.d.mts +26 -0
- package/dist/oauth/OAuthTransactionProtector.mjs +78 -0
- package/dist/oauth/OAuthTransactionProtector.mjs.map +1 -0
- package/dist/oauth/accounts.d.mts +29 -0
- package/dist/oauth/accounts.mjs +515 -0
- package/dist/oauth/accounts.mjs.map +1 -0
- package/dist/oauth/accountsModels.d.mts +463 -0
- package/dist/oauth/accountsModels.mjs +155 -0
- package/dist/oauth/accountsModels.mjs.map +1 -0
- package/dist/oauth/connected.d.mts +442 -0
- package/dist/oauth/connected.mjs +526 -0
- package/dist/oauth/connected.mjs.map +1 -0
- package/dist/oauth/connectedAccess.d.mts +20 -0
- package/dist/oauth/connectedAccess.mjs +279 -0
- package/dist/oauth/connectedAccess.mjs.map +1 -0
- package/dist/oauth/connectedMaintenance.d.mts +19 -0
- package/dist/oauth/connectedMaintenance.mjs +133 -0
- package/dist/oauth/connectedMaintenance.mjs.map +1 -0
- package/dist/oauth/connectedModels.d.mts +2023 -0
- package/dist/oauth/connectedModels.mjs +375 -0
- package/dist/oauth/connectedModels.mjs.map +1 -0
- package/dist/oauth/definition.d.mts +4396 -0
- package/dist/oauth/definition.mjs +120 -0
- package/dist/oauth/definition.mjs.map +1 -0
- package/dist/oauth/errors.d.mts +49 -0
- package/dist/oauth/errors.mjs +42 -0
- package/dist/oauth/errors.mjs.map +1 -0
- package/dist/oauth/github/identity.d.mts +8 -0
- package/dist/oauth/github/identity.mjs +24 -0
- package/dist/oauth/github/identity.mjs.map +1 -0
- package/dist/oauth/github/models.d.mts +34 -0
- package/dist/oauth/github/protocol.d.mts +54 -0
- package/dist/oauth/github/protocol.mjs +204 -0
- package/dist/oauth/github/protocol.mjs.map +1 -0
- package/dist/oauth/openid-client/ProviderRevocation.d.mts +4 -0
- package/dist/oauth/openid-client/ProviderRevocation.mjs +11 -0
- package/dist/oauth/openid-client/ProviderRevocation.mjs.map +1 -0
- package/dist/oauth/openid-client/compatibility.d.mts +1 -0
- package/dist/oauth/openid-client/compatibility.mjs +6 -0
- package/dist/oauth/openid-client/compatibility.mjs.map +1 -0
- package/dist/oauth/openid-client/configuration.mjs +305 -0
- package/dist/oauth/openid-client/configuration.mjs.map +1 -0
- package/dist/oauth/openid-client/connected/configuration.mjs +338 -0
- package/dist/oauth/openid-client/connected/configuration.mjs.map +1 -0
- package/dist/oauth/openid-client/connected/models.d.mts +42 -0
- package/dist/oauth/openid-client/connected/protocol.d.mts +16 -0
- package/dist/oauth/openid-client/connected/protocol.mjs +402 -0
- package/dist/oauth/openid-client/connected/protocol.mjs.map +1 -0
- package/dist/oauth/openid-client/models.d.mts +67 -0
- package/dist/oauth/openid-client/models.mjs +16 -0
- package/dist/oauth/openid-client/models.mjs.map +1 -0
- package/dist/oauth/openid-client/protocol.d.mts +27 -0
- package/dist/oauth/openid-client/protocol.mjs +218 -0
- package/dist/oauth/openid-client/protocol.mjs.map +1 -0
- package/dist/oauth/openid-client/transport.mjs +59 -0
- package/dist/oauth/openid-client/transport.mjs.map +1 -0
- package/dist/oauth/policy.d.mts +18 -0
- package/dist/oauth/policy.mjs +16 -0
- package/dist/oauth/policy.mjs.map +1 -0
- package/dist/oauth/registration.d.mts +24 -0
- package/dist/oauth/registration.mjs +177 -0
- package/dist/oauth/registration.mjs.map +1 -0
- package/dist/oauth/registrationModels.d.mts +152 -0
- package/dist/oauth/registrationModels.mjs +93 -0
- package/dist/oauth/registrationModels.mjs.map +1 -0
- package/dist/oauth/registrationSecrets.mjs +70 -0
- package/dist/oauth/registrationSecrets.mjs.map +1 -0
- package/dist/oauth/schema.d.mts +86 -0
- package/dist/oauth/schema.mjs +81 -0
- package/dist/oauth/schema.mjs.map +1 -0
- package/dist/oauth/signInErrors.d.mts +17 -0
- package/dist/oauth/signInErrors.mjs +16 -0
- package/dist/oauth/signInErrors.mjs.map +1 -0
- package/dist/oauth/signInModels.d.mts +343 -0
- package/dist/oauth/signInModels.mjs +181 -0
- package/dist/oauth/signInModels.mjs.map +1 -0
- package/dist/oauth/signInModule.d.mts +1546 -0
- package/dist/oauth/signInModule.mjs +430 -0
- package/dist/oauth/signInModule.mjs.map +1 -0
- package/dist/oauth/signInSnapshot.mjs +29 -0
- package/dist/oauth/signInSnapshot.mjs.map +1 -0
- package/dist/oauth/transactionEncryption.d.mts +14 -0
- package/dist/oauth/transactionEncryption.mjs +129 -0
- package/dist/oauth/transactionEncryption.mjs.map +1 -0
- package/dist/operations/RequestBindingConfig.d.mts +11 -0
- package/dist/operations/RequestBindingConfig.mjs +10 -0
- package/dist/operations/RequestBindingConfig.mjs.map +1 -0
- package/dist/operations/actions.d.mts +947 -0
- package/dist/operations/actions.mjs +148 -0
- package/dist/operations/actions.mjs.map +1 -0
- package/dist/operations/context.d.mts +63 -0
- package/dist/operations/context.mjs +55 -0
- package/dist/operations/context.mjs.map +1 -0
- package/dist/operations/credentials.d.mts +39 -0
- package/dist/operations/credentials.mjs +60 -0
- package/dist/operations/credentials.mjs.map +1 -0
- package/dist/operations/errors.d.mts +24 -0
- package/dist/operations/errors.mjs +31 -0
- package/dist/operations/errors.mjs.map +1 -0
- package/dist/operations/operation.d.mts +124 -0
- package/dist/operations/operation.mjs +220 -0
- package/dist/operations/operation.mjs.map +1 -0
- package/dist/operations/requestBinding.d.mts +46 -0
- package/dist/operations/requestBinding.mjs +130 -0
- package/dist/operations/requestBinding.mjs.map +1 -0
- package/dist/operations/requestBindingModels.d.mts +13 -0
- package/dist/operations/requestBindingModels.mjs +12 -0
- package/dist/operations/requestBindingModels.mjs.map +1 -0
- package/dist/operations/reveals.d.mts +28 -0
- package/dist/operations/reveals.mjs +88 -0
- package/dist/operations/reveals.mjs.map +1 -0
- package/dist/passkey/PasskeyActionEvidence.d.mts +22 -0
- package/dist/passkey/PasskeyActionEvidence.mjs +9 -0
- package/dist/passkey/PasskeyActionEvidence.mjs.map +1 -0
- package/dist/passkey/PasskeyCredentials.d.mts +16 -0
- package/dist/passkey/PasskeyCredentials.mjs +9 -0
- package/dist/passkey/PasskeyCredentials.mjs.map +1 -0
- package/dist/passkey/PasskeyEnrollmentContext.d.mts +22 -0
- package/dist/passkey/PasskeyEnrollmentContext.mjs +9 -0
- package/dist/passkey/PasskeyEnrollmentContext.mjs.map +1 -0
- package/dist/passkey/PasskeyManagementPersistence.d.mts +106 -0
- package/dist/passkey/PasskeyManagementPersistence.mjs +9 -0
- package/dist/passkey/PasskeyManagementPersistence.mjs.map +1 -0
- package/dist/passkey/PasskeyPersistence.d.mts +63 -0
- package/dist/passkey/PasskeyPersistence.mjs +10 -0
- package/dist/passkey/PasskeyPersistence.mjs.map +1 -0
- package/dist/passkey/PasskeyProtocol.d.mts +38 -0
- package/dist/passkey/PasskeyProtocol.mjs +11 -0
- package/dist/passkey/PasskeyProtocol.mjs.map +1 -0
- package/dist/passkey/actions.d.mts +50 -0
- package/dist/passkey/actions.mjs +376 -0
- package/dist/passkey/actions.mjs.map +1 -0
- package/dist/passkey/browser/PasskeyBrowser.d.mts +18 -0
- package/dist/passkey/browser/PasskeyBrowser.mjs +9 -0
- package/dist/passkey/browser/PasskeyBrowser.mjs.map +1 -0
- package/dist/passkey/browser/models.d.mts +38 -0
- package/dist/passkey/browser/models.mjs +41 -0
- package/dist/passkey/browser/models.mjs.map +1 -0
- package/dist/passkey/browser/simplewebauthn.d.mts +17 -0
- package/dist/passkey/browser/simplewebauthn.mjs +411 -0
- package/dist/passkey/browser/simplewebauthn.mjs.map +1 -0
- package/dist/passkey/definition.d.mts +5626 -0
- package/dist/passkey/definition.mjs +114 -0
- package/dist/passkey/definition.mjs.map +1 -0
- package/dist/passkey/errors.d.mts +20 -0
- package/dist/passkey/errors.mjs +20 -0
- package/dist/passkey/errors.mjs.map +1 -0
- package/dist/passkey/management.mjs +276 -0
- package/dist/passkey/management.mjs.map +1 -0
- package/dist/passkey/models.d.mts +1245 -0
- package/dist/passkey/models.mjs +301 -0
- package/dist/passkey/models.mjs.map +1 -0
- package/dist/passkey/module.d.mts +2132 -0
- package/dist/passkey/module.mjs +174 -0
- package/dist/passkey/module.mjs.map +1 -0
- package/dist/passkey/pending.mjs +99 -0
- package/dist/passkey/pending.mjs.map +1 -0
- package/dist/passkey/policy.d.mts +48 -0
- package/dist/passkey/policy.mjs +77 -0
- package/dist/passkey/policy.mjs.map +1 -0
- package/dist/passkey/registration.mjs +107 -0
- package/dist/passkey/registration.mjs.map +1 -0
- package/dist/passkey/simplewebauthn/configuration.mjs +45 -0
- package/dist/passkey/simplewebauthn/configuration.mjs.map +1 -0
- package/dist/passkey/simplewebauthn/models.d.mts +21 -0
- package/dist/passkey/simplewebauthn/models.mjs +8 -0
- package/dist/passkey/simplewebauthn/models.mjs.map +1 -0
- package/dist/passkey/simplewebauthn/protocol.d.mts +62 -0
- package/dist/passkey/simplewebauthn/protocol.mjs +402 -0
- package/dist/passkey/simplewebauthn/protocol.mjs.map +1 -0
- package/dist/passkey/snapshot.mjs +31 -0
- package/dist/passkey/snapshot.mjs.map +1 -0
- package/dist/passkey/stepUp.mjs +101 -0
- package/dist/passkey/stepUp.mjs.map +1 -0
- package/dist/password/CompromisedPasswords.d.mts +26 -0
- package/dist/password/CompromisedPasswords.mjs +23 -0
- package/dist/password/CompromisedPasswords.mjs.map +1 -0
- package/dist/password/NewPasswordCheck.d.mts +21 -0
- package/dist/password/NewPasswordCheck.mjs +39 -0
- package/dist/password/NewPasswordCheck.mjs.map +1 -0
- package/dist/password/PasswordHashing.d.mts +24 -0
- package/dist/password/PasswordHashing.mjs +96 -0
- package/dist/password/PasswordHashing.mjs.map +1 -0
- package/dist/password/PasswordKdfAdmission.d.mts +19 -0
- package/dist/password/PasswordKdfAdmission.mjs +25 -0
- package/dist/password/PasswordKdfAdmission.mjs.map +1 -0
- package/dist/password/configuration.d.mts +43 -0
- package/dist/password/configuration.mjs +64 -0
- package/dist/password/configuration.mjs.map +1 -0
- package/dist/password/defaults.mjs +13 -0
- package/dist/password/defaults.mjs.map +1 -0
- package/dist/password/encoding.mjs +64 -0
- package/dist/password/encoding.mjs.map +1 -0
- package/dist/password/errors.d.mts +28 -0
- package/dist/password/errors.mjs +25 -0
- package/dist/password/errors.mjs.map +1 -0
- package/dist/password/methods/PasswordActionEvidence.d.mts +38 -0
- package/dist/password/methods/PasswordActionEvidence.mjs +22 -0
- package/dist/password/methods/PasswordActionEvidence.mjs.map +1 -0
- package/dist/password/methods/PasswordPersistence.d.mts +102 -0
- package/dist/password/methods/PasswordPersistence.mjs +13 -0
- package/dist/password/methods/PasswordPersistence.mjs.map +1 -0
- package/dist/password/methods/PasswordPreparedPersistence.d.mts +111 -0
- package/dist/password/methods/contracts.d.mts +43 -0
- package/dist/password/methods/contracts.mjs +33 -0
- package/dist/password/methods/contracts.mjs.map +1 -0
- package/dist/password/methods/definition.d.mts +3813 -0
- package/dist/password/methods/definition.mjs +56 -0
- package/dist/password/methods/definition.mjs.map +1 -0
- package/dist/password/methods/errors.d.mts +15 -0
- package/dist/password/methods/errors.mjs +11 -0
- package/dist/password/methods/errors.mjs.map +1 -0
- package/dist/password/methods/models.d.mts +70 -0
- package/dist/password/methods/models.mjs +44 -0
- package/dist/password/methods/models.mjs.map +1 -0
- package/dist/password/methods/module.d.mts +3567 -0
- package/dist/password/methods/module.mjs +553 -0
- package/dist/password/methods/module.mjs.map +1 -0
- package/dist/password/methods/policy.d.mts +84 -0
- package/dist/password/methods/policy.mjs +80 -0
- package/dist/password/methods/policy.mjs.map +1 -0
- package/dist/password/methods/preparation.mjs +54 -0
- package/dist/password/methods/preparation.mjs.map +1 -0
- package/dist/password/methods/prepared.d.mts +53 -0
- package/dist/password/methods/prepared.mjs +610 -0
- package/dist/password/methods/prepared.mjs.map +1 -0
- package/dist/password/methods/preparedModels.d.mts +1295 -0
- package/dist/password/methods/preparedModels.mjs +278 -0
- package/dist/password/methods/preparedModels.mjs.map +1 -0
- package/dist/password/methods/signIn.d.mts +180 -0
- package/dist/password/methods/signIn.mjs +73 -0
- package/dist/password/methods/signIn.mjs.map +1 -0
- package/dist/password/methods/snapshot.mjs +38 -0
- package/dist/password/methods/snapshot.mjs.map +1 -0
- package/dist/password/methods/verification.mjs +138 -0
- package/dist/password/methods/verification.mjs.map +1 -0
- package/dist/password/models.d.mts +13 -0
- package/dist/password/models.mjs +12 -0
- package/dist/password/models.mjs.map +1 -0
- package/dist/password/policy.d.mts +33 -0
- package/dist/password/policy.mjs +37 -0
- package/dist/password/policy.mjs.map +1 -0
- package/dist/phone/PhoneActionEvidence.d.mts +23 -0
- package/dist/phone/PhoneActionEvidence.mjs +10 -0
- package/dist/phone/PhoneActionEvidence.mjs.map +1 -0
- package/dist/phone/PhoneAdmission.d.mts +29 -0
- package/dist/phone/PhoneAdmission.mjs +10 -0
- package/dist/phone/PhoneAdmission.mjs.map +1 -0
- package/dist/phone/PhoneDeliveryEligibility.d.mts +11 -0
- package/dist/phone/PhoneDeliveryEligibility.mjs +8 -0
- package/dist/phone/PhoneDeliveryEligibility.mjs.map +1 -0
- package/dist/phone/PhonePersistence.d.mts +33 -0
- package/dist/phone/PhonePersistence.mjs +10 -0
- package/dist/phone/PhonePersistence.mjs.map +1 -0
- package/dist/phone/PhoneRequestContext.d.mts +10 -0
- package/dist/phone/PhoneRequestContext.mjs +8 -0
- package/dist/phone/PhoneRequestContext.mjs.map +1 -0
- package/dist/phone/PhoneSignInTargets.d.mts +19 -0
- package/dist/phone/PhoneSignInTargets.mjs +13 -0
- package/dist/phone/PhoneSignInTargets.mjs.map +1 -0
- package/dist/phone/definition.d.mts +7190 -0
- package/dist/phone/definition.mjs +28 -0
- package/dist/phone/definition.mjs.map +1 -0
- package/dist/phone/failure.mjs +23 -0
- package/dist/phone/failure.mjs.map +1 -0
- package/dist/phone/lifecycle.mjs +427 -0
- package/dist/phone/lifecycle.mjs.map +1 -0
- package/dist/phone/lifecycleModels.d.mts +164 -0
- package/dist/phone/lifecycleModels.mjs +91 -0
- package/dist/phone/lifecycleModels.mjs.map +1 -0
- package/dist/phone/models.d.mts +41 -0
- package/dist/phone/models.mjs +29 -0
- package/dist/phone/models.mjs.map +1 -0
- package/dist/phone/module.d.mts +6027 -0
- package/dist/phone/module.mjs +293 -0
- package/dist/phone/module.mjs.map +1 -0
- package/dist/proofs/EmailProofDelivery.d.mts +13 -0
- package/dist/proofs/EmailProofDelivery.mjs +11 -0
- package/dist/proofs/EmailProofDelivery.mjs.map +1 -0
- package/dist/proofs/HostIngressLimiter.d.mts +20 -0
- package/dist/proofs/HostIngressLimiter.mjs +13 -0
- package/dist/proofs/HostIngressLimiter.mjs.map +1 -0
- package/dist/proofs/ProofPersistence.d.mts +140 -0
- package/dist/proofs/ProofPersistence.mjs +13 -0
- package/dist/proofs/ProofPersistence.mjs.map +1 -0
- package/dist/proofs/SmsProofDelivery.d.mts +13 -0
- package/dist/proofs/SmsProofDelivery.mjs +11 -0
- package/dist/proofs/SmsProofDelivery.mjs.map +1 -0
- package/dist/proofs/abuse.d.mts +15 -0
- package/dist/proofs/abuse.mjs +12 -0
- package/dist/proofs/abuse.mjs.map +1 -0
- package/dist/proofs/completion.d.mts +22 -0
- package/dist/proofs/crypto.d.mts +196 -0
- package/dist/proofs/crypto.mjs +189 -0
- package/dist/proofs/crypto.mjs.map +1 -0
- package/dist/proofs/definition.d.mts +335 -0
- package/dist/proofs/definition.mjs +10 -0
- package/dist/proofs/definition.mjs.map +1 -0
- package/dist/proofs/delivery.d.mts +30 -0
- package/dist/proofs/delivery.mjs +26 -0
- package/dist/proofs/delivery.mjs.map +1 -0
- package/dist/proofs/dispatch.d.mts +20 -0
- package/dist/proofs/dispatch.mjs +54 -0
- package/dist/proofs/dispatch.mjs.map +1 -0
- package/dist/proofs/errors.d.mts +21 -0
- package/dist/proofs/errors.mjs +25 -0
- package/dist/proofs/errors.mjs.map +1 -0
- package/dist/proofs/models.d.mts +141 -0
- package/dist/proofs/models.mjs +93 -0
- package/dist/proofs/models.mjs.map +1 -0
- package/dist/proofs/module.d.mts +344 -0
- package/dist/proofs/module.mjs +350 -0
- package/dist/proofs/module.mjs.map +1 -0
- package/dist/proofs/policy.d.mts +152 -0
- package/dist/proofs/policy.mjs +51 -0
- package/dist/proofs/policy.mjs.map +1 -0
- package/dist/sessions/AuthenticationAuthority.d.mts +31 -0
- package/dist/sessions/AuthenticationAuthority.mjs +8 -0
- package/dist/sessions/AuthenticationAuthority.mjs.map +1 -0
- package/dist/sessions/PendingAuthentication.d.mts +108 -0
- package/dist/sessions/PendingAuthentication.mjs +40 -0
- package/dist/sessions/PendingAuthentication.mjs.map +1 -0
- package/dist/sessions/SessionStepUpPersistence.d.mts +152 -0
- package/dist/sessions/SessionStepUpPersistence.mjs +63 -0
- package/dist/sessions/SessionStepUpPersistence.mjs.map +1 -0
- package/dist/sessions/assurance.d.mts +163 -0
- package/dist/sessions/assurance.mjs +95 -0
- package/dist/sessions/assurance.mjs.map +1 -0
- package/dist/sessions/commit.d.mts +13 -0
- package/dist/sessions/configuration.d.mts +46 -0
- package/dist/sessions/configuration.mjs +55 -0
- package/dist/sessions/configuration.mjs.map +1 -0
- package/dist/sessions/contract.d.mts +663 -0
- package/dist/sessions/contract.mjs +174 -0
- package/dist/sessions/contract.mjs.map +1 -0
- package/dist/sessions/crypto.d.mts +24 -0
- package/dist/sessions/crypto.mjs +106 -0
- package/dist/sessions/crypto.mjs.map +1 -0
- package/dist/sessions/definition.d.mts +11 -0
- package/dist/sessions/definition.mjs +10 -0
- package/dist/sessions/definition.mjs.map +1 -0
- package/dist/sessions/errors.d.mts +35 -0
- package/dist/sessions/errors.mjs +34 -0
- package/dist/sessions/errors.mjs.map +1 -0
- package/dist/sessions/invalidation.d.mts +23 -0
- package/dist/sessions/invalidation.mjs +33 -0
- package/dist/sessions/invalidation.mjs.map +1 -0
- package/dist/sessions/models.d.mts +143 -0
- package/dist/sessions/models.mjs +94 -0
- package/dist/sessions/models.mjs.map +1 -0
- package/dist/sessions/module.d.mts +1091 -0
- package/dist/sessions/module.mjs +943 -0
- package/dist/sessions/module.mjs.map +1 -0
- package/dist/sessions/persistence.d.mts +93 -0
- package/dist/sessions/policy.d.mts +80 -0
- package/dist/sessions/policy.mjs +66 -0
- package/dist/sessions/policy.mjs.map +1 -0
- package/dist/testing/conformance/AuthStore.d.mts +11 -0
- package/dist/testing/conformance/AuthStore.mjs +173 -0
- package/dist/testing/conformance/AuthStore.mjs.map +1 -0
- package/dist/testing/conformance/OAuthConnectionStore.d.mts +11 -0
- package/dist/testing/conformance/OAuthConnectionStore.mjs +102 -0
- package/dist/testing/conformance/OAuthConnectionStore.mjs.map +1 -0
- package/dist/testing/conformance/OAuthStateStore.d.mts +11 -0
- package/dist/testing/conformance/OAuthStateStore.mjs +45 -0
- package/dist/testing/conformance/OAuthStateStore.mjs.map +1 -0
- package/dist/testing/conformance/PasswordCredentialStore.d.mts +20 -0
- package/dist/testing/conformance/PasswordCredentialStore.mjs +103 -0
- package/dist/testing/conformance/PasswordCredentialStore.mjs.map +1 -0
- package/dist/testing/conformance/support.mjs +17 -0
- package/dist/testing/conformance/support.mjs.map +1 -0
- package/dist/testing/crypto.d.mts +11 -0
- package/dist/testing/crypto.mjs +41 -0
- package/dist/testing/crypto.mjs.map +1 -0
- package/dist/testing/keyring.d.mts +9 -0
- package/dist/testing/keyring.mjs +17 -0
- package/dist/testing/keyring.mjs.map +1 -0
- package/dist/totp/TotpActionEvidence.d.mts +18 -0
- package/dist/totp/TotpActionEvidence.mjs +8 -0
- package/dist/totp/TotpActionEvidence.mjs.map +1 -0
- package/dist/totp/TotpPersistence.d.mts +19 -0
- package/dist/totp/TotpPersistence.mjs +8 -0
- package/dist/totp/TotpPersistence.mjs.map +1 -0
- package/dist/totp/TotpSecretKeys.d.mts +15 -0
- package/dist/totp/TotpSecretKeys.mjs +8 -0
- package/dist/totp/TotpSecretKeys.mjs.map +1 -0
- package/dist/totp/crypto.mjs +96 -0
- package/dist/totp/crypto.mjs.map +1 -0
- package/dist/totp/definition.d.mts +764 -0
- package/dist/totp/definition.mjs +24 -0
- package/dist/totp/definition.mjs.map +1 -0
- package/dist/totp/errors.d.mts +16 -0
- package/dist/totp/errors.mjs +18 -0
- package/dist/totp/errors.mjs.map +1 -0
- package/dist/totp/models.d.mts +377 -0
- package/dist/totp/models.mjs +137 -0
- package/dist/totp/models.mjs.map +1 -0
- package/dist/totp/module.d.mts +737 -0
- package/dist/totp/module.mjs +355 -0
- package/dist/totp/module.mjs.map +1 -0
- package/package.json +1 -0
- package/src/Atom.ts +4 -0
- package/src/Auth.ts +16 -0
- package/src/AuthContract.ts +17 -0
- package/src/AuthSession.ts +298 -0
- package/src/AuthStore.ts +367 -0
- package/src/AuthTokenCodec.ts +226 -0
- package/src/Client.ts +9 -0
- package/src/Cloudflare.ts +345 -0
- package/src/Drizzle.ts +378 -0
- package/src/DrizzleD1.ts +136 -0
- package/src/DrizzleLibsql.ts +288 -0
- package/src/DrizzleMysql2.ts +184 -0
- package/src/DrizzlePglite.ts +160 -0
- package/src/DrizzlePostgres.ts +160 -0
- package/src/DrizzleSqliteBun.ts +244 -0
- package/src/DrizzleSqliteDo.ts +473 -0
- package/src/DrizzleSqliteNode.ts +245 -0
- package/src/DrizzleSqliteWasm.ts +245 -0
- package/src/Email.ts +55 -0
- package/src/EmailOtp.ts +250 -0
- package/src/EmailOtpSender.ts +28 -0
- package/src/Errors.ts +103 -0
- package/src/GitHub.ts +16 -0
- package/src/Hooks.ts +50 -0
- package/src/Http.ts +47 -0
- package/src/HttpServer.ts +742 -0
- package/src/Identity.ts +53 -0
- package/src/IdentityResolver.ts +18 -0
- package/src/OAuth.ts +242 -0
- package/src/OpenIdClient.ts +13 -0
- package/src/OpenIdClientConnected.ts +18 -0
- package/src/OperationHttp.ts +14 -0
- package/src/OperationHttpClient.ts +6 -0
- package/src/OperationHttpServer.ts +15 -0
- package/src/Operations.ts +69 -0
- package/src/Passkey.ts +81 -0
- package/src/PasskeyBrowser.ts +19 -0
- package/src/PasskeyContract.ts +212 -0
- package/src/PasskeyPassword.ts +319 -0
- package/src/PasskeySimpleWebAuthn.ts +6 -0
- package/src/Password.ts +113 -0
- package/src/PasswordAuth.ts +197 -0
- package/src/PasswordCredentialStore.ts +140 -0
- package/src/PasswordHasher.ts +147 -0
- package/src/PhoneOtp.ts +32 -0
- package/src/Policy.ts +95 -0
- package/src/Proofs.ts +71 -0
- package/src/Rpc.ts +15 -0
- package/src/Schema.ts +235 -0
- package/src/SessionContract.ts +2 -0
- package/src/Sessions.ts +105 -0
- package/src/Testing.ts +24 -0
- package/src/Totp.ts +28 -0
- package/src/TotpContract.ts +147 -0
- package/src/WebCrypto.ts +61 -0
- package/src/Workflows.ts +12 -0
- package/src/atom/AuthAtomLifetime.ts +87 -0
- package/src/atom/AuthAtomWorkflow.ts +27 -0
- package/src/atom/client.ts +364 -0
- package/src/atom/operations.ts +183 -0
- package/src/atom/scoped-runtime.ts +249 -0
- package/src/auth/Auth.ts +482 -0
- package/src/auth/AuthConfigurationError.ts +9 -0
- package/src/auth/AuthRequest.ts +21 -0
- package/src/auth/AuthStrategy.ts +116 -0
- package/src/auth/ConsumeDecision.ts +4 -0
- package/src/auth/actions.ts +220 -0
- package/src/auth/defaults.ts +23 -0
- package/src/auth/definition.ts +88 -0
- package/src/auth/session.ts +146 -0
- package/src/drizzle/D1BatchStatements.ts +10 -0
- package/src/drizzle/PasswordPreparedPostconditions.ts +30 -0
- package/src/drizzle/SuppliedService.ts +10 -0
- package/src/drizzle/d1-emails.ts +1808 -0
- package/src/drizzle/d1-generated-statement.ts +129 -0
- package/src/drizzle/d1-identity.ts +374 -0
- package/src/drizzle/d1-oauth.ts +338 -0
- package/src/drizzle/d1-passkey.ts +371 -0
- package/src/drizzle/d1-password-prepared.ts +1273 -0
- package/src/drizzle/d1-passwords.ts +2661 -0
- package/src/drizzle/d1-phone.ts +94 -0
- package/src/drizzle/d1-planning.ts +105 -0
- package/src/drizzle/d1-proofs.ts +2305 -0
- package/src/drizzle/d1-sessions.ts +2867 -0
- package/src/drizzle/d1-totp.ts +79 -0
- package/src/drizzle/email-model.ts +512 -0
- package/src/drizzle/email-registration.ts +696 -0
- package/src/drizzle/email-sql.ts +1468 -0
- package/src/drizzle/email-target.ts +243 -0
- package/src/drizzle/model.ts +492 -0
- package/src/drizzle/mysql-emails.ts +323 -0
- package/src/drizzle/mysql-identity.ts +323 -0
- package/src/drizzle/mysql-password-prepared.ts +206 -0
- package/src/drizzle/mysql-passwords.ts +341 -0
- package/src/drizzle/mysql-proofs.ts +183 -0
- package/src/drizzle/mysql-sessions.ts +742 -0
- package/src/drizzle/mysql.ts +686 -0
- package/src/drizzle/oauth-accounts.ts +801 -0
- package/src/drizzle/oauth-connected-access.ts +354 -0
- package/src/drizzle/oauth-connected-collection.ts +324 -0
- package/src/drizzle/oauth-connected-custody.ts +277 -0
- package/src/drizzle/oauth-connected-drivers.ts +463 -0
- package/src/drizzle/oauth-connected-flow.ts +439 -0
- package/src/drizzle/oauth-connected-input.ts +128 -0
- package/src/drizzle/oauth-connected-maintenance.ts +345 -0
- package/src/drizzle/oauth-connected-management.ts +365 -0
- package/src/drizzle/oauth-connected-model.ts +347 -0
- package/src/drizzle/oauth-connected-reference.ts +112 -0
- package/src/drizzle/oauth-connected-settlement.ts +226 -0
- package/src/drizzle/oauth-connected-state.ts +846 -0
- package/src/drizzle/oauth-connected-target.ts +264 -0
- package/src/drizzle/oauth-drivers.ts +567 -0
- package/src/drizzle/oauth-flow.ts +461 -0
- package/src/drizzle/oauth-input.ts +205 -0
- package/src/drizzle/oauth-model.ts +610 -0
- package/src/drizzle/oauth-mysql.ts +10 -0
- package/src/drizzle/oauth-owner.ts +29 -0
- package/src/drizzle/oauth-registration.ts +638 -0
- package/src/drizzle/oauth-state.ts +213 -0
- package/src/drizzle/oauth-target.ts +751 -0
- package/src/drizzle/passkey-admission.ts +333 -0
- package/src/drizzle/passkey-credentials.ts +465 -0
- package/src/drizzle/passkey-drivers.ts +385 -0
- package/src/drizzle/passkey-enrollment.ts +280 -0
- package/src/drizzle/passkey-flow.ts +983 -0
- package/src/drizzle/passkey-management.ts +369 -0
- package/src/drizzle/passkey-model.ts +350 -0
- package/src/drizzle/passkey-registration-ceremony-model.ts +69 -0
- package/src/drizzle/passkey-registration-ceremony.ts +254 -0
- package/src/drizzle/passkey-registration-custody.ts +82 -0
- package/src/drizzle/passkey-registration-write.ts +378 -0
- package/src/drizzle/passkey-state.ts +307 -0
- package/src/drizzle/passkey-target.ts +528 -0
- package/src/drizzle/passkey-write-drivers.ts +396 -0
- package/src/drizzle/passkey-write-model.ts +265 -0
- package/src/drizzle/passkey-write-state.ts +627 -0
- package/src/drizzle/passkey-write-target.ts +406 -0
- package/src/drizzle/password-model.ts +491 -0
- package/src/drizzle/password-prepared-model.ts +259 -0
- package/src/drizzle/password-prepared-sql.ts +1198 -0
- package/src/drizzle/password-prepared-state.ts +232 -0
- package/src/drizzle/password-prepared-target.ts +158 -0
- package/src/drizzle/password-registration.ts +372 -0
- package/src/drizzle/password-sql.ts +2082 -0
- package/src/drizzle/password-target.ts +223 -0
- package/src/drizzle/pg-emails.ts +323 -0
- package/src/drizzle/pg-password-prepared.ts +207 -0
- package/src/drizzle/pg-passwords.ts +340 -0
- package/src/drizzle/pg-proofs.ts +193 -0
- package/src/drizzle/pg-sessions.ts +751 -0
- package/src/drizzle/pg.ts +982 -0
- package/src/drizzle/phone-model.ts +185 -0
- package/src/drizzle/phone-state.ts +802 -0
- package/src/drizzle/phone-target.ts +471 -0
- package/src/drizzle/proof-model.ts +398 -0
- package/src/drizzle/proof-sql.ts +1912 -0
- package/src/drizzle/proof-target.ts +120 -0
- package/src/drizzle/session-model.ts +368 -0
- package/src/drizzle/session-sql.ts +2152 -0
- package/src/drizzle/session-target.ts +335 -0
- package/src/drizzle/sqlite-emails.ts +368 -0
- package/src/drizzle/sqlite-identity.ts +343 -0
- package/src/drizzle/sqlite-password-prepared.ts +262 -0
- package/src/drizzle/sqlite-passwords.ts +499 -0
- package/src/drizzle/sqlite-proofs.ts +204 -0
- package/src/drizzle/sqlite-sessions.ts +972 -0
- package/src/drizzle/sqlite.ts +704 -0
- package/src/drizzle/standalone-guard.ts +38 -0
- package/src/drizzle/step-up-model.ts +129 -0
- package/src/drizzle/step-up-state.ts +141 -0
- package/src/drizzle/totp-model.ts +91 -0
- package/src/drizzle/totp-state.ts +520 -0
- package/src/drizzle/totp-target.ts +304 -0
- package/src/drizzle/transaction-execution.ts +290 -0
- package/src/drizzle/transaction-mysql.ts +104 -0
- package/src/drizzle/transaction-owner.ts +570 -0
- package/src/email/EmailActionEvidence.ts +37 -0
- package/src/email/EmailAddressPersistence.ts +71 -0
- package/src/email/EmailIdentifierNotifier.ts +48 -0
- package/src/email/EmailReturnTargets.ts +50 -0
- package/src/email/EmailSignInTargets.ts +20 -0
- package/src/email/addresses.ts +630 -0
- package/src/email/definition.ts +309 -0
- package/src/email/errors.ts +23 -0
- package/src/email/magicLink.ts +84 -0
- package/src/email/models.ts +50 -0
- package/src/email/module.ts +664 -0
- package/src/email/registration.ts +415 -0
- package/src/email/snapshot.ts +51 -0
- package/src/hooks/LifecycleHooks.ts +136 -0
- package/src/hooks/commit.ts +271 -0
- package/src/hooks/models.ts +111 -0
- package/src/hooks/plugins.ts +87 -0
- package/src/hooks/transactions.ts +51 -0
- package/src/http/auth-api.ts +17 -0
- package/src/http/auth-contract.ts +148 -0
- package/src/http/auth-http.ts +467 -0
- package/src/http/endpoints/get-session.ts +9 -0
- package/src/http/endpoints/password-sign-in.ts +19 -0
- package/src/http/endpoints/request-email-otp.ts +10 -0
- package/src/http/endpoints/set-password.ts +18 -0
- package/src/http/endpoints/sign-out.ts +5 -0
- package/src/http/endpoints/verify-email-otp.ts +15 -0
- package/src/http/models.ts +80 -0
- package/src/http/security.ts +102 -0
- package/src/http/session-contract.ts +92 -0
- package/src/http-operation/OperationHttpInvocation.ts +39 -0
- package/src/http-operation/OperationHttpServerConfig.ts +124 -0
- package/src/http-operation/auth-client.ts +273 -0
- package/src/http-operation/client.ts +453 -0
- package/src/http-operation/configuration-schema.ts +19 -0
- package/src/http-operation/contract.ts +116 -0
- package/src/http-operation/errors.ts +38 -0
- package/src/http-operation/models.ts +42 -0
- package/src/http-operation/private.ts +50 -0
- package/src/http-operation/security.ts +93 -0
- package/src/http-operation/server.ts +544 -0
- package/src/identity/ExternalIdentityMutation.ts +18 -0
- package/src/identity/IdentityMutation.ts +41 -0
- package/src/identity/IdentityRepository.ts +37 -0
- package/src/identity/SubjectLifecycle.ts +80 -0
- package/src/identity/SubjectProvisioner.ts +40 -0
- package/src/identity/codecs.ts +54 -0
- package/src/identity/models.ts +82 -0
- package/src/identity/operations.ts +182 -0
- package/src/index.ts +23 -0
- package/src/internal/AuthStoreDecisions.ts +23 -0
- package/src/internal/CurrentSession.ts +8 -0
- package/src/internal/diagnostics.ts +71 -0
- package/src/oauth/GithubOAuthProvider.ts +106 -0
- package/src/oauth/OAuth.ts +436 -0
- package/src/oauth/OAuthAccountsPersistence.ts +142 -0
- package/src/oauth/OAuthActionEvidence.ts +31 -0
- package/src/oauth/OAuthConnectedActionEvidence.ts +28 -0
- package/src/oauth/OAuthConnectedPersistence.ts +163 -0
- package/src/oauth/OAuthConnectedProtocol.ts +54 -0
- package/src/oauth/OAuthConnectedRevocations.ts +48 -0
- package/src/oauth/OAuthConnectedTokenProtector.ts +240 -0
- package/src/oauth/OAuthConnectedTransactionProtector.ts +56 -0
- package/src/oauth/OAuthConnectedUseAuthority.ts +26 -0
- package/src/oauth/OAuthConnectionStore.ts +59 -0
- package/src/oauth/OAuthLinkTransactionProtector.ts +58 -0
- package/src/oauth/OAuthProtocol.ts +39 -0
- package/src/oauth/OAuthProvider.ts +126 -0
- package/src/oauth/OAuthProviders.ts +53 -0
- package/src/oauth/OAuthRegistrationIntents.ts +42 -0
- package/src/oauth/OAuthReturnTargets.ts +44 -0
- package/src/oauth/OAuthSignInPersistence.ts +91 -0
- package/src/oauth/OAuthStateDecisions.ts +16 -0
- package/src/oauth/OAuthStateStore.ts +102 -0
- package/src/oauth/OAuthTransactionProtector.ts +103 -0
- package/src/oauth/accounts.ts +987 -0
- package/src/oauth/accountsModels.ts +214 -0
- package/src/oauth/connected.ts +995 -0
- package/src/oauth/connectedAccess.ts +644 -0
- package/src/oauth/connectedMaintenance.ts +248 -0
- package/src/oauth/connectedModels.ts +495 -0
- package/src/oauth/definition.ts +414 -0
- package/src/oauth/errors.ts +78 -0
- package/src/oauth/github/identity.ts +26 -0
- package/src/oauth/github/models.ts +37 -0
- package/src/oauth/github/protocol.ts +329 -0
- package/src/oauth/openid-client/ProviderRevocation.ts +22 -0
- package/src/oauth/openid-client/compatibility.ts +47 -0
- package/src/oauth/openid-client/configuration.ts +472 -0
- package/src/oauth/openid-client/connected/configuration.ts +565 -0
- package/src/oauth/openid-client/connected/models.ts +58 -0
- package/src/oauth/openid-client/connected/protocol.ts +866 -0
- package/src/oauth/openid-client/models.ts +78 -0
- package/src/oauth/openid-client/protocol.ts +437 -0
- package/src/oauth/openid-client/transport.ts +67 -0
- package/src/oauth/policy.ts +26 -0
- package/src/oauth/registration.ts +410 -0
- package/src/oauth/registrationModels.ts +115 -0
- package/src/oauth/registrationSecrets.ts +127 -0
- package/src/oauth/schema.ts +102 -0
- package/src/oauth/signInErrors.ts +23 -0
- package/src/oauth/signInModels.ts +266 -0
- package/src/oauth/signInModule.ts +875 -0
- package/src/oauth/signInSnapshot.ts +37 -0
- package/src/oauth/transactionEncryption.ts +198 -0
- package/src/operations/RequestBindingConfig.ts +12 -0
- package/src/operations/actions.ts +342 -0
- package/src/operations/context.ts +130 -0
- package/src/operations/credentials.ts +121 -0
- package/src/operations/errors.ts +53 -0
- package/src/operations/operation.ts +740 -0
- package/src/operations/requestBinding.ts +237 -0
- package/src/operations/requestBindingModels.ts +18 -0
- package/src/operations/reveals.ts +147 -0
- package/src/passkey/PasskeyActionEvidence.ts +25 -0
- package/src/passkey/PasskeyCredentials.ts +16 -0
- package/src/passkey/PasskeyEnrollmentContext.ts +26 -0
- package/src/passkey/PasskeyManagementPersistence.ts +124 -0
- package/src/passkey/PasskeyPersistence.ts +85 -0
- package/src/passkey/PasskeyProtocol.ts +48 -0
- package/src/passkey/actions.ts +905 -0
- package/src/passkey/browser/PasskeyBrowser.ts +26 -0
- package/src/passkey/browser/models.ts +67 -0
- package/src/passkey/browser/simplewebauthn.ts +621 -0
- package/src/passkey/definition.ts +386 -0
- package/src/passkey/errors.ts +39 -0
- package/src/passkey/management.ts +552 -0
- package/src/passkey/models.ts +414 -0
- package/src/passkey/module.ts +367 -0
- package/src/passkey/pending.ts +203 -0
- package/src/passkey/policy.ts +88 -0
- package/src/passkey/registration.ts +251 -0
- package/src/passkey/simplewebauthn/configuration.ts +97 -0
- package/src/passkey/simplewebauthn/models.ts +9 -0
- package/src/passkey/simplewebauthn/protocol.ts +729 -0
- package/src/passkey/snapshot.ts +48 -0
- package/src/passkey/stepUp.ts +212 -0
- package/src/password/CompromisedPasswords.ts +36 -0
- package/src/password/NewPasswordCheck.ts +89 -0
- package/src/password/PasswordHashing.ts +209 -0
- package/src/password/PasswordKdfAdmission.ts +44 -0
- package/src/password/configuration.ts +52 -0
- package/src/password/defaults.ts +15 -0
- package/src/password/encoding.ts +137 -0
- package/src/password/errors.ts +43 -0
- package/src/password/methods/PasswordActionEvidence.ts +41 -0
- package/src/password/methods/PasswordPersistence.ts +128 -0
- package/src/password/methods/PasswordPreparedPersistence.ts +123 -0
- package/src/password/methods/contracts.ts +47 -0
- package/src/password/methods/definition.ts +199 -0
- package/src/password/methods/errors.ts +26 -0
- package/src/password/methods/models.ts +80 -0
- package/src/password/methods/module.ts +986 -0
- package/src/password/methods/policy.ts +68 -0
- package/src/password/methods/preparation.ts +73 -0
- package/src/password/methods/prepared.ts +1199 -0
- package/src/password/methods/preparedModels.ts +496 -0
- package/src/password/methods/signIn.ts +136 -0
- package/src/password/methods/snapshot.ts +53 -0
- package/src/password/methods/verification.ts +266 -0
- package/src/password/models.ts +15 -0
- package/src/password/policy.ts +41 -0
- package/src/phone/PhoneActionEvidence.ts +26 -0
- package/src/phone/PhoneAdmission.ts +29 -0
- package/src/phone/PhoneDeliveryEligibility.ts +9 -0
- package/src/phone/PhonePersistence.ts +43 -0
- package/src/phone/PhoneRequestContext.ts +7 -0
- package/src/phone/PhoneSignInTargets.ts +19 -0
- package/src/phone/definition.ts +87 -0
- package/src/phone/failure.ts +40 -0
- package/src/phone/lifecycle.ts +662 -0
- package/src/phone/lifecycleModels.ts +108 -0
- package/src/phone/models.ts +41 -0
- package/src/phone/module.ts +433 -0
- package/src/proofs/EmailProofDelivery.ts +19 -0
- package/src/proofs/HostIngressLimiter.ts +20 -0
- package/src/proofs/ProofPersistence.ts +172 -0
- package/src/proofs/SmsProofDelivery.ts +19 -0
- package/src/proofs/abuse.ts +23 -0
- package/src/proofs/completion.ts +23 -0
- package/src/proofs/crypto.ts +326 -0
- package/src/proofs/definition.ts +39 -0
- package/src/proofs/delivery.ts +73 -0
- package/src/proofs/dispatch.ts +99 -0
- package/src/proofs/errors.ts +46 -0
- package/src/proofs/models.ts +131 -0
- package/src/proofs/module.ts +620 -0
- package/src/proofs/policy.ts +77 -0
- package/src/sessions/AuthenticationAuthority.ts +51 -0
- package/src/sessions/PendingAuthentication.ts +121 -0
- package/src/sessions/SessionStepUpPersistence.ts +164 -0
- package/src/sessions/assurance.ts +192 -0
- package/src/sessions/commit.ts +13 -0
- package/src/sessions/configuration.ts +133 -0
- package/src/sessions/contract.ts +203 -0
- package/src/sessions/crypto.ts +181 -0
- package/src/sessions/definition.ts +25 -0
- package/src/sessions/errors.ts +68 -0
- package/src/sessions/invalidation.ts +46 -0
- package/src/sessions/models.ts +138 -0
- package/src/sessions/module.ts +1991 -0
- package/src/sessions/persistence.ts +135 -0
- package/src/sessions/policy.ts +103 -0
- package/src/testing/conformance/AuthStore.ts +314 -0
- package/src/testing/conformance/OAuthConnectionStore.ts +167 -0
- package/src/testing/conformance/OAuthStateStore.ts +105 -0
- package/src/testing/conformance/PasswordCredentialStore.ts +205 -0
- package/src/testing/conformance/support.ts +38 -0
- package/src/testing/crypto.ts +55 -0
- package/src/testing/keyring.ts +17 -0
- package/src/totp/TotpActionEvidence.ts +18 -0
- package/src/totp/TotpPersistence.ts +26 -0
- package/src/totp/TotpSecretKeys.ts +15 -0
- package/src/totp/crypto.ts +160 -0
- package/src/totp/definition.ts +78 -0
- package/src/totp/errors.ts +25 -0
- package/src/totp/models.ts +164 -0
- package/src/totp/module.ts +717 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthStore.mjs","names":[],"sources":["../src/AuthStore.ts"],"sourcesContent":["import { Context, DateTime, Duration, Effect, Layer, Schema, Semaphore } from \"effect\";\n\nimport { AuthRateLimited, AuthStoreError, InvalidRegistration } from \"./Errors\";\nimport {\n type ConsumeChallenge,\n type ConsumeRegistration,\n type TokenDigest,\n NewChallenge,\n NewRegistration,\n PendingRegistration,\n timingSafeStringEqual,\n VerifiedEmail,\n} from \"./Schema\";\n\nexport type IssueChallengeError = AuthRateLimited | AuthStoreError;\n\nexport const EmailOtpRejectionReason = Schema.Literals([\n \"missing_challenge\",\n \"consumed_challenge\",\n \"superseded_challenge\",\n \"expired_challenge\",\n \"missing_challenge_series\",\n \"attempts_exhausted\",\n \"bad_code\",\n]);\n\n/** Internal rejection detail that the HTTP workflow collapses to `InvalidEmailOtp`. */\nexport class EmailOtpRejected extends Schema.TaggedError<EmailOtpRejected>()(\"EmailOtpRejected\", {\n reason: EmailOtpRejectionReason,\n}) {}\n\n/**\n * Deliberately narrow storage driver behind the store state machine: the\n * in-memory map, Durable Object storage, or any keyed store whose writes\n * become visible in order. Values handed to `put` are already JSON-safe\n * encoded rows, so `get` legitimately yields `unknown`.\n * Retain challenge rows through their original expiry, including after consumption.\n */\nexport class AuthStoreBackend extends Context.Service<\n AuthStoreBackend,\n {\n /** Resolves the stored value for a key, or `undefined` when absent. */\n readonly get: (key: string) => Effect.Effect<unknown, AuthStoreError>;\n readonly put: (key: string, value: unknown) => Effect.Effect<void, AuthStoreError>;\n readonly remove: (key: string) => Effect.Effect<void, AuthStoreError>;\n }\n>()(\"effect-auth/AuthStoreBackend\") {\n /** In-memory backend for tests and local development; never durable. */\n static readonly layerMemory: Layer.Layer<AuthStoreBackend> = Layer.sync(AuthStoreBackend)(() => {\n const entries = new Map<string, unknown>();\n\n return AuthStoreBackend.of({\n get: (key) => Effect.sync(() => entries.get(key)),\n put: (key, value) =>\n Effect.sync(() => {\n entries.set(key, value);\n }),\n remove: (key) =>\n Effect.sync(() => {\n entries.delete(key);\n }),\n });\n });\n}\n\n// --- Stored rows ---------------------------------------------------------------\n\nclass StoredChallenge extends Schema.Class<StoredChallenge>(\"effect-auth/StoredChallenge\")({\n challenge: NewChallenge,\n consumed: Schema.Boolean,\n superseded: Schema.Boolean,\n}) {}\n\nclass StoredEmailSeries extends Schema.Class<StoredEmailSeries>(\"effect-auth/StoredEmailSeries\")({\n activeChallengeKey: Schema.UndefinedOr(Schema.String),\n lastIssuedAt: Schema.DateTimeUtcFromMillis,\n rollingAttempts: Schema.Natural,\n windowExpiresAt: Schema.DateTimeUtcFromMillis,\n}) {}\n\nclass StoredRegistration extends Schema.Class<StoredRegistration>(\"effect-auth/StoredRegistration\")(\n {\n registration: NewRegistration,\n consumed: Schema.Boolean,\n },\n) {}\n\n// oxlint-disable-next-line no-restricted-properties -- AuthStoreBackend intentionally returns unknown persisted values.\nconst decodeChallengeRow = Schema.decodeUnknownEffect(StoredChallenge);\nconst encodeChallengeRow = Schema.encodeEffect(StoredChallenge);\n// oxlint-disable-next-line no-restricted-properties -- AuthStoreBackend intentionally returns unknown persisted values.\nconst decodeSeriesRow = Schema.decodeUnknownEffect(StoredEmailSeries);\nconst encodeSeriesRow = Schema.encodeEffect(StoredEmailSeries);\n// oxlint-disable-next-line no-restricted-properties -- AuthStoreBackend intentionally returns unknown persisted values.\nconst decodeRegistrationRow = Schema.decodeUnknownEffect(StoredRegistration);\nconst encodeRegistrationRow = Schema.encodeEffect(StoredRegistration);\n\nconst challengeKey = (tokenDigest: string) => `challenge:${tokenDigest}`;\nconst seriesKey = (purpose: string, email: string) => `series:${purpose}|${email}`;\nconst registrationKey = (tokenDigest: string) => `registration:${tokenDigest}`;\n\n/**\n * The canonical store state machine over an `AuthStoreBackend`. Operations are\n * serialized through an internal semaphore, so the exactly-once consume\n * guarantees hold even when the backend's reads and writes suspend. Runtimes\n * that already serialize requests (a Durable Object's input gates) get a\n * second, redundant layer of protection.\n */\nconst makeBackendAuthStore = Effect.gen(function* () {\n const backend = yield* AuthStoreBackend;\n const semaphore = yield* Semaphore.make(1);\n const serialized = semaphore.withPermits(1);\n\n const read = <Row, DecodeError>(\n key: string,\n decode: (value: unknown) => Effect.Effect<Row, DecodeError>,\n ): Effect.Effect<Row | undefined, AuthStoreError> =>\n backend.get(key).pipe(\n Effect.mapError(() => AuthStoreError.make({ message: \"Auth store read failed\" })),\n Effect.flatMap((value) =>\n value === undefined\n ? // The absent row is a meaningful result, not a discarded void.\n // @effect-diagnostics-next-line effectSucceedWithVoid:off\n Effect.succeed(undefined)\n : decode(value).pipe(\n Effect.mapError(() => AuthStoreError.make({ message: \"Corrupt auth store row\" })),\n ),\n ),\n );\n\n const write = <Row, EncodeError>(\n key: string,\n encode: (row: Row) => Effect.Effect<unknown, EncodeError>,\n row: Row,\n ): Effect.Effect<void, AuthStoreError> =>\n encode(row).pipe(\n Effect.mapError(() => AuthStoreError.make({ message: \"Auth store write failed\" })),\n Effect.flatMap((value) =>\n backend\n .put(key, value)\n .pipe(Effect.mapError(() => AuthStoreError.make({ message: \"Auth store write failed\" }))),\n ),\n );\n\n const issueChallenge = Effect.fn(\"AuthStore.issueChallenge\")(function* (input: NewChallenge) {\n const now = DateTime.toEpochMillis(yield* DateTime.now);\n const existing = yield* read(challengeKey(input.tokenDigest), decodeChallengeRow);\n\n // An issuance is immutable; a retry must not reset its terminal state.\n if (existing !== undefined) {\n return yield* AuthRateLimited.make({ retryAfterSeconds: 1 });\n }\n\n const key = seriesKey(input.purpose, input.email);\n const series = yield* read(key, decodeSeriesRow);\n const cooldownMillis = Duration.toMillis(input.resendCooldown);\n\n if (series !== undefined) {\n const lastIssuedAt = DateTime.toEpochMillis(series.lastIssuedAt);\n\n if (now < lastIssuedAt + cooldownMillis) {\n return yield* AuthRateLimited.make({\n retryAfterSeconds: Math.ceil((lastIssuedAt + cooldownMillis - now) / 1000),\n });\n }\n if (series.activeChallengeKey !== undefined) {\n const active = yield* read(series.activeChallengeKey, decodeChallengeRow);\n\n if (active !== undefined && !active.superseded) {\n yield* write(\n series.activeChallengeKey,\n encodeChallengeRow,\n StoredChallenge.make({ ...active, superseded: true }),\n );\n }\n }\n }\n\n // The rolling wrong-code budget survives resends and only resets once\n // the previous window has fully expired.\n const rollingAttempts =\n series !== undefined && now < DateTime.toEpochMillis(series.windowExpiresAt)\n ? series.rollingAttempts\n : 0;\n\n yield* write(\n challengeKey(input.tokenDigest),\n encodeChallengeRow,\n StoredChallenge.make({ challenge: input, consumed: false, superseded: false }),\n );\n yield* write(\n key,\n encodeSeriesRow,\n StoredEmailSeries.make({\n activeChallengeKey: challengeKey(input.tokenDigest),\n lastIssuedAt: yield* DateTime.now,\n rollingAttempts,\n windowExpiresAt: input.expiresAt,\n }),\n );\n });\n\n const consumeChallenge = Effect.fn(\"AuthStore.consumeChallenge\")(function* (\n input: ConsumeChallenge,\n ) {\n const reject = (reason: typeof EmailOtpRejectionReason.Type) =>\n EmailOtpRejected.make({ reason });\n\n const now = DateTime.toEpochMillis(yield* DateTime.now);\n const row = yield* read(challengeKey(input.tokenDigest), decodeChallengeRow);\n\n if (row === undefined) {\n return yield* reject(\"missing_challenge\");\n }\n const key = seriesKey(row.challenge.purpose, row.challenge.email);\n const series = yield* read(key, decodeSeriesRow);\n\n if (row.consumed) return yield* reject(\"consumed_challenge\");\n if (row.superseded) return yield* reject(\"superseded_challenge\");\n if (now >= DateTime.toEpochMillis(row.challenge.expiresAt)) {\n return yield* reject(\"expired_challenge\");\n }\n if (series === undefined) return yield* reject(\"missing_challenge_series\");\n if (series.rollingAttempts >= row.challenge.attemptLimit) {\n return yield* reject(\"attempts_exhausted\");\n }\n const candidate = input.otpDigests[row.challenge.otpKeyId];\n\n const matches =\n candidate !== undefined && timingSafeStringEqual(candidate, row.challenge.otpDigest);\n\n if (!matches) {\n yield* write(\n key,\n encodeSeriesRow,\n StoredEmailSeries.make({ ...series, rollingAttempts: series.rollingAttempts + 1 }),\n );\n\n return yield* reject(\"bad_code\");\n }\n yield* write(\n challengeKey(input.tokenDigest),\n encodeChallengeRow,\n StoredChallenge.make({ ...row, consumed: true }),\n );\n yield* backend\n .remove(key)\n .pipe(Effect.mapError(() => AuthStoreError.make({ message: \"Auth store write failed\" })));\n\n return VerifiedEmail.make({\n email: row.challenge.email,\n purpose: row.challenge.purpose,\n });\n });\n\n const issueRegistration = Effect.fn(\"AuthStore.issueRegistration\")(function* (\n input: NewRegistration,\n ) {\n yield* write(\n registrationKey(input.tokenDigest),\n encodeRegistrationRow,\n StoredRegistration.make({ registration: input, consumed: false }),\n );\n });\n\n const inspectRegistration = Effect.fn(\"AuthStore.inspectRegistration\")(function* (\n tokenDigest: TokenDigest,\n ) {\n const now = DateTime.toEpochMillis(yield* DateTime.now);\n const row = yield* read(registrationKey(tokenDigest), decodeRegistrationRow);\n\n if (\n row === undefined ||\n row.consumed ||\n now >= DateTime.toEpochMillis(row.registration.expiresAt)\n ) {\n return yield* InvalidRegistration.make();\n }\n\n return PendingRegistration.make({\n registrationId: row.registration.registrationId,\n email: row.registration.email,\n purpose: row.registration.purpose,\n issuedAt: row.registration.issuedAt,\n expiresAt: row.registration.expiresAt,\n });\n });\n\n const consumeRegistration = Effect.fn(\"AuthStore.consumeRegistration\")(function* (\n input: ConsumeRegistration,\n ) {\n const now = DateTime.toEpochMillis(yield* DateTime.now);\n const row = yield* read(registrationKey(input.tokenDigest), decodeRegistrationRow);\n\n if (\n row === undefined ||\n row.consumed ||\n now >= DateTime.toEpochMillis(row.registration.expiresAt)\n ) {\n return yield* InvalidRegistration.make();\n }\n yield* write(\n registrationKey(input.tokenDigest),\n encodeRegistrationRow,\n StoredRegistration.make({ ...row, consumed: true }),\n );\n });\n\n return {\n issueChallenge: (input: NewChallenge) => serialized(issueChallenge(input)),\n consumeChallenge: (input: ConsumeChallenge) => serialized(consumeChallenge(input)),\n issueRegistration: (input: NewRegistration) => serialized(issueRegistration(input)),\n inspectRegistration: (tokenDigest: TokenDigest) => serialized(inspectRegistration(tokenDigest)),\n consumeRegistration: (input: ConsumeRegistration) => serialized(consumeRegistration(input)),\n };\n});\n\n/**\n * Semantic persistence port for challenges and pending registrations, not\n * CRUD. The consume operations must be atomic: exactly one of concurrent\n * valid consumptions may succeed. Per-challenge attempts, resend cooldown,\n * and email-scoped issuance limits live behind this contract; IP/network\n * limits stay at the edge.\n *\n * Adapters either implement this interface directly against a store with real\n * transactions, or provide an `AuthStoreBackend` to `layerBackend`. Either\n * way, the conformance suite exported from `effect-auth/Testing` is the\n * acceptance test.\n */\nexport class AuthStore extends Context.Service<\n AuthStore,\n {\n readonly issueChallenge: (input: NewChallenge) => Effect.Effect<void, IssueChallengeError>;\n /**\n * Checks token digest, OTP digest, purpose, expiry, supersession,\n * consumption, and attempt budget as one atomic operation. A failed\n * comparison increments the rolling attempt budget; success consumes the\n * challenge. The workflow logs the internal rejection reason, then\n * collapses every failure to the public `InvalidEmailOtp`.\n */\n readonly consumeChallenge: (\n input: ConsumeChallenge,\n ) => Effect.Effect<VerifiedEmail, EmailOtpRejected | AuthStoreError>;\n readonly issueRegistration: (input: NewRegistration) => Effect.Effect<void, AuthStoreError>;\n readonly inspectRegistration: (\n tokenDigest: TokenDigest,\n ) => Effect.Effect<PendingRegistration, InvalidRegistration | AuthStoreError>;\n readonly consumeRegistration: (\n input: ConsumeRegistration,\n ) => Effect.Effect<void, InvalidRegistration | AuthStoreError>;\n }\n>()(\"effect-auth/AuthStore\") {\n /** The canonical state machine over whichever `AuthStoreBackend` is provided. */\n static readonly layerBackend: Layer.Layer<AuthStore, never, AuthStoreBackend> =\n Layer.effect(AuthStore)(makeBackendAuthStore);\n\n /**\n * In-memory adapter for tests and local development. Never a durable\n * production adapter.\n */\n static readonly layerMemory: Layer.Layer<AuthStore> = AuthStore.layerBackend.pipe(\n Layer.provide(AuthStoreBackend.layerMemory),\n );\n}\n\nexport { AuthStoreDecisions, type ChallengeConsumeDecision } from \"./internal/AuthStoreDecisions\";\nexport type { ConsumeDecision } from \"./auth/ConsumeDecision\";\n"],"mappings":";;;;;AAgBA,MAAa,0BAA0B,OAAO,SAAS;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAGD,IAAa,mBAAb,cAAsC,OAAO,YAA8B,CAAC,CAAC,oBAAoB,EAC/F,QAAQ,wBACV,CAAC,CAAC,CAAC,CAAC;;;;;;;;AASJ,IAAa,mBAAb,MAAa,yBAAyB,QAAQ,QAQ5C,CAAC,CAAC,8BAA8B,CAAC,CAAC;;CAElC,OAAgB,cAA6C,MAAM,KAAK,gBAAgB,CAAC,OAAO;EAC9F,MAAM,0BAAU,IAAI,IAAqB;EAEzC,OAAO,iBAAiB,GAAG;GACzB,MAAM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MAAM,MAAM,OAAO,KAAK,gBAAgB,MAAM,WAAW,GAAG,qBAAqB;EAEjF,IACE,QAAQ,KAAA,KACR,IAAI,YACJ,OAAO,SAAS,cAAc,IAAI,aAAa,SAAS,GAExD,OAAO,OAAO,oBAAoB,KAAK;EAEzC,OAAO,MACL,gBAAgB,MAAM,WAAW,GACjC,uBACA,mBAAmB,KAAK;GAAE,GAAG;GAAK,UAAU;EAAK,CAAC,CACpD;CACF,CAAC;CAED,OAAO;EACL,iBAAiB,UAAwB,WAAW,eAAe,KAAK,CAAC;EACzE,mBAAmB,UAA4B,WAAW,iBAAiB,KAAK,CAAC;EACjF,oBAAoB,UAA2B,WAAW,kBAAkB,KAAK,CAAC;EAClF,sBAAsB,gBAA6B,WAAW,oBAAoB,WAAW,CAAC;EAC9F,sBAAsB,UAA+B,WAAW,oBAAoB,KAAK,CAAC;CAC5F;AACF,CAAC;;;;;;;;;;;;;AAcD,IAAa,YAAb,MAAa,kBAAkB,QAAQ,QAsBrC,CAAC,CAAC,uBAAuB,CAAC,CAAC;;CAE3B,OAAgB,eACd,MAAM,OAAO,SAAS,CAAC,CAAC,oBAAoB;;;;;CAM9C,OAAgB,cAAsC,UAAU,aAAa,KAC3E,MAAM,QAAQ,iBAAiB,WAAW,CAC5C;AACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { KeyId, KeyedDigest, SessionClaims, SessionToken, TokenDigest } from "./Schema.mjs";
|
|
2
|
+
import { AuthTokenError, InvalidSession } from "./Errors.mjs";
|
|
3
|
+
import { Context, Crypto, Effect, Layer, Redacted } from "effect";
|
|
4
|
+
//#region src/AuthTokenCodec.d.ts
|
|
5
|
+
declare const AuthKeyring_base: Context.ServiceClass<AuthKeyring, "effect-auth/AuthKeyring", {
|
|
6
|
+
readonly activeKeyId: KeyId;
|
|
7
|
+
readonly keys: ReadonlyArray<{
|
|
8
|
+
readonly keyId: KeyId;
|
|
9
|
+
readonly secret: Redacted.Redacted<string>;
|
|
10
|
+
}>;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* HMAC keyring: one active signing key plus verification keys retained until
|
|
14
|
+
* their sessions expire. Every secret must hold at least 256 random bits.
|
|
15
|
+
*/
|
|
16
|
+
declare class AuthKeyring extends AuthKeyring_base {}
|
|
17
|
+
interface AuthTokenCodecService {
|
|
18
|
+
readonly activeKeyId: KeyId;
|
|
19
|
+
/** Active key first, then verification-only keys. */
|
|
20
|
+
readonly keyIds: ReadonlyArray<KeyId>;
|
|
21
|
+
readonly encodeSession: (claims: SessionClaims) => Effect.Effect<SessionToken, AuthTokenError>;
|
|
22
|
+
/** Checks format, key id, and signature. Time and policy checks belong to `AuthSession`. */
|
|
23
|
+
readonly decodeSession: (token: Redacted.Redacted<string>) => Effect.Effect<SessionClaims, InvalidSession | AuthTokenError>;
|
|
24
|
+
/** Unkeyed digest for high-entropy tokens; stable across key rotation. */
|
|
25
|
+
readonly digestToken: (token: Redacted.Redacted<string>, scope: string) => Effect.Effect<TokenDigest, AuthTokenError>;
|
|
26
|
+
/** Keyed digest for low-entropy secrets, scoped so digests cannot be transplanted. */
|
|
27
|
+
readonly digestSecret: (value: Redacted.Redacted<string>, scope: string, keyId?: KeyId) => Effect.Effect<KeyedDigest, AuthTokenError>;
|
|
28
|
+
}
|
|
29
|
+
declare const AuthTokenCodec_base: Context.ServiceClass<AuthTokenCodec, "effect-auth/AuthTokenCodec", AuthTokenCodecService>;
|
|
30
|
+
declare class AuthTokenCodec extends AuthTokenCodec_base {
|
|
31
|
+
/**
|
|
32
|
+
* Default HMAC implementation backed by WebCrypto. The consumer may replace
|
|
33
|
+
* it with its own codec service.
|
|
34
|
+
*/
|
|
35
|
+
static readonly layerWebCrypto: Layer.Layer<AuthTokenCodec, AuthTokenError, AuthKeyring | Crypto.Crypto>;
|
|
36
|
+
static readonly layer: Layer.Layer<AuthTokenCodec, AuthTokenError, AuthKeyring | Crypto.Crypto>;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { AuthKeyring, AuthTokenCodec, AuthTokenCodecService };
|
|
40
|
+
//# sourceMappingURL=AuthTokenCodec.d.mts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { KeyedDigest, OtpDigest, SessionClaims, SessionToken, TokenDigest } from "./Schema.mjs";
|
|
2
|
+
import { SubtleCrypto } from "./WebCrypto.mjs";
|
|
3
|
+
import { AuthTokenError, InvalidSession } from "./Errors.mjs";
|
|
4
|
+
import { Context, Crypto, Effect, Encoding, Layer, Redacted, Result, Schema } from "effect";
|
|
5
|
+
//#region src/AuthTokenCodec.ts
|
|
6
|
+
/**
|
|
7
|
+
* HMAC keyring: one active signing key plus verification keys retained until
|
|
8
|
+
* their sessions expire. Every secret must hold at least 256 random bits.
|
|
9
|
+
*/
|
|
10
|
+
var AuthKeyring = class extends Context.Service()("effect-auth/AuthKeyring") {};
|
|
11
|
+
const envelopeVersion = "eav1";
|
|
12
|
+
const textEncoder = new TextEncoder();
|
|
13
|
+
const SessionClaimsJson = Schema.fromJsonString(SessionClaims);
|
|
14
|
+
const encodeClaimsJson = Schema.encodeEffect(SessionClaimsJson);
|
|
15
|
+
const decodeClaimsJson = Schema.decodeEffect(SessionClaimsJson);
|
|
16
|
+
const tokenDigestFromString = Schema.decodeEffect(TokenDigest);
|
|
17
|
+
const otpDigestFromString = Schema.decodeEffect(OtpDigest);
|
|
18
|
+
const sessionTokenFromString = Schema.decodeEffect(SessionToken);
|
|
19
|
+
/**
|
|
20
|
+
* Default HMAC-SHA-256 codec on WebCrypto. Signing keys never leave the
|
|
21
|
+
* runtime's key store; secure random bytes come from `Crypto.Crypto`.
|
|
22
|
+
*/
|
|
23
|
+
const makeWebCryptoCodec = Effect.gen(function* () {
|
|
24
|
+
const keyring = yield* AuthKeyring;
|
|
25
|
+
const crypto = yield* Crypto.Crypto;
|
|
26
|
+
const subtle = yield* SubtleCrypto;
|
|
27
|
+
if (!keyring.keys.some((key) => key.keyId === keyring.activeKeyId)) return yield* AuthTokenError.make({ message: "Keyring does not contain the active signing key" });
|
|
28
|
+
const importKey = (secret) => Effect.tryPromise({
|
|
29
|
+
try: () => subtle.importKey("raw", textEncoder.encode(Redacted.value(secret)), {
|
|
30
|
+
name: "HMAC",
|
|
31
|
+
hash: "SHA-256"
|
|
32
|
+
}, false, ["sign", "verify"]),
|
|
33
|
+
catch: () => AuthTokenError.make({ message: "Failed to import HMAC key" })
|
|
34
|
+
});
|
|
35
|
+
const keys = /* @__PURE__ */ new Map();
|
|
36
|
+
for (const entry of keyring.keys) keys.set(entry.keyId, yield* importKey(entry.secret));
|
|
37
|
+
const hmac = (keyId, data) => Effect.gen(function* () {
|
|
38
|
+
const key = keys.get(keyId);
|
|
39
|
+
if (key === void 0) return yield* AuthTokenError.make({ message: "Unknown key id" });
|
|
40
|
+
const signature = yield* Effect.tryPromise({
|
|
41
|
+
try: () => subtle.sign("HMAC", key, data),
|
|
42
|
+
catch: () => AuthTokenError.make({ message: "HMAC signing failed" })
|
|
43
|
+
});
|
|
44
|
+
return new Uint8Array(signature);
|
|
45
|
+
});
|
|
46
|
+
const hmacVerify = (keyId, data, signature) => Effect.gen(function* () {
|
|
47
|
+
const key = keys.get(keyId);
|
|
48
|
+
if (key === void 0) return false;
|
|
49
|
+
return yield* Effect.tryPromise({
|
|
50
|
+
try: () => subtle.verify("HMAC", key, signature, data),
|
|
51
|
+
catch: () => AuthTokenError.make({ message: "HMAC verification failed" })
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
activeKeyId: keyring.activeKeyId,
|
|
56
|
+
keyIds: [keyring.activeKeyId, ...keyring.keys.map((key) => key.keyId).filter((id) => id !== keyring.activeKeyId)],
|
|
57
|
+
encodeSession: Effect.fn("AuthTokenCodec.encodeSession")(function* (claims) {
|
|
58
|
+
const encoded = yield* encodeClaimsJson(claims).pipe(Effect.mapError(() => AuthTokenError.make({ message: "Session claims failed to encode" })));
|
|
59
|
+
const payload = Encoding.encodeBase64Url(encoded);
|
|
60
|
+
const signingInput = `${envelopeVersion}.${payload}`;
|
|
61
|
+
const signature = yield* hmac(claims.kid, textEncoder.encode(signingInput));
|
|
62
|
+
const token = `${signingInput}.${Encoding.encodeBase64Url(signature)}`;
|
|
63
|
+
return yield* sessionTokenFromString(token).pipe(Effect.mapError(() => AuthTokenError.make({ message: "Session token failed to encode" })));
|
|
64
|
+
}),
|
|
65
|
+
decodeSession: Effect.fn("AuthTokenCodec.decodeSession")(function* (token) {
|
|
66
|
+
const [version, payloadPart, signaturePart, ...rest] = Redacted.value(token).split(".");
|
|
67
|
+
if (version !== envelopeVersion || payloadPart === void 0 || signaturePart === void 0 || rest.length > 0) return yield* InvalidSession.make();
|
|
68
|
+
const payloadJson = Result.getOrUndefined(Encoding.decodeBase64UrlString(payloadPart));
|
|
69
|
+
const signature = Result.getOrUndefined(Encoding.decodeBase64Url(signaturePart));
|
|
70
|
+
if (payloadJson === void 0 || signature === void 0) return yield* InvalidSession.make();
|
|
71
|
+
const claims = yield* decodeClaimsJson(payloadJson).pipe(Effect.mapError(() => InvalidSession.make()));
|
|
72
|
+
const signingInput = `${envelopeVersion}.${payloadPart}`;
|
|
73
|
+
if (!(yield* hmacVerify(claims.kid, textEncoder.encode(signingInput), signature))) return yield* InvalidSession.make();
|
|
74
|
+
return claims;
|
|
75
|
+
}),
|
|
76
|
+
digestToken: Effect.fn("AuthTokenCodec.digestToken")(function* (token, scope) {
|
|
77
|
+
const data = textEncoder.encode(`${scope}\n${Redacted.value(token)}`);
|
|
78
|
+
const digest = yield* crypto.digest("SHA-256", data).pipe(Effect.mapError(() => AuthTokenError.make({ message: "Token digest failed" })));
|
|
79
|
+
return yield* tokenDigestFromString(Encoding.encodeBase64Url(digest)).pipe(Effect.mapError(() => AuthTokenError.make({ message: "Token digest failed to encode" })));
|
|
80
|
+
}),
|
|
81
|
+
digestSecret: Effect.fn("AuthTokenCodec.digestSecret")(function* (value, scope, keyId) {
|
|
82
|
+
const resolvedKeyId = keyId ?? keyring.activeKeyId;
|
|
83
|
+
const data = textEncoder.encode(`${scope}\n${Redacted.value(value)}`);
|
|
84
|
+
const digest = yield* hmac(resolvedKeyId, data);
|
|
85
|
+
const otpDigest = yield* otpDigestFromString(Encoding.encodeBase64Url(digest)).pipe(Effect.mapError(() => AuthTokenError.make({ message: "Secret digest failed to encode" })));
|
|
86
|
+
return KeyedDigest.make({
|
|
87
|
+
keyId: resolvedKeyId,
|
|
88
|
+
digest: otpDigest
|
|
89
|
+
});
|
|
90
|
+
})
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
var AuthTokenCodec = class AuthTokenCodec extends Context.Service()("effect-auth/AuthTokenCodec") {
|
|
94
|
+
/**
|
|
95
|
+
* Default HMAC implementation backed by WebCrypto. The consumer may replace
|
|
96
|
+
* it with its own codec service.
|
|
97
|
+
*/
|
|
98
|
+
static layerWebCrypto = Layer.effect(AuthTokenCodec)(makeWebCryptoCodec).pipe(Layer.provide(SubtleCrypto.layerWeb));
|
|
99
|
+
static layer = AuthTokenCodec.layerWebCrypto;
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
export { AuthKeyring, AuthTokenCodec };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=AuthTokenCodec.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthTokenCodec.mjs","names":[],"sources":["../src/AuthTokenCodec.ts"],"sourcesContent":["import { Context, Crypto, Effect, Encoding, Layer, Redacted, Result, Schema } from \"effect\";\n\nimport { AuthTokenError, InvalidSession } from \"./Errors\";\nimport {\n KeyedDigest,\n type KeyId,\n OtpDigest,\n SessionClaims,\n SessionToken,\n TokenDigest,\n} from \"./Schema\";\nimport { SubtleCrypto } from \"./WebCrypto\";\n\n/**\n * HMAC keyring: one active signing key plus verification keys retained until\n * their sessions expire. Every secret must hold at least 256 random bits.\n */\nexport class AuthKeyring extends Context.Service<\n AuthKeyring,\n {\n readonly activeKeyId: KeyId;\n readonly keys: ReadonlyArray<{\n readonly keyId: KeyId;\n readonly secret: Redacted.Redacted<string>;\n }>;\n }\n>()(\"effect-auth/AuthKeyring\") {}\n\nexport interface AuthTokenCodecService {\n readonly activeKeyId: KeyId;\n /** Active key first, then verification-only keys. */\n readonly keyIds: ReadonlyArray<KeyId>;\n readonly encodeSession: (claims: SessionClaims) => Effect.Effect<SessionToken, AuthTokenError>;\n /** Checks format, key id, and signature. Time and policy checks belong to `AuthSession`. */\n readonly decodeSession: (\n token: Redacted.Redacted<string>,\n ) => Effect.Effect<SessionClaims, InvalidSession | AuthTokenError>;\n /** Unkeyed digest for high-entropy tokens; stable across key rotation. */\n readonly digestToken: (\n token: Redacted.Redacted<string>,\n scope: string,\n ) => Effect.Effect<TokenDigest, AuthTokenError>;\n /** Keyed digest for low-entropy secrets, scoped so digests cannot be transplanted. */\n readonly digestSecret: (\n value: Redacted.Redacted<string>,\n scope: string,\n keyId?: KeyId,\n ) => Effect.Effect<KeyedDigest, AuthTokenError>;\n}\n\nconst envelopeVersion = \"eav1\";\nconst textEncoder = new TextEncoder();\n\n// One JSON-string codec owns the token payload text, both directions. Plain\n// `fromJsonString` (no `toCodecJson`): the opaque `ext` claims slot keeps\n// native `JSON.stringify` semantics.\nconst SessionClaimsJson = Schema.fromJsonString(SessionClaims);\nconst encodeClaimsJson = Schema.encodeEffect(SessionClaimsJson);\nconst decodeClaimsJson = Schema.decodeEffect(SessionClaimsJson);\nconst tokenDigestFromString = Schema.decodeEffect(TokenDigest);\nconst otpDigestFromString = Schema.decodeEffect(OtpDigest);\nconst sessionTokenFromString = Schema.decodeEffect(SessionToken);\n\n/**\n * Default HMAC-SHA-256 codec on WebCrypto. Signing keys never leave the\n * runtime's key store; secure random bytes come from `Crypto.Crypto`.\n */\nconst makeWebCryptoCodec: Effect.Effect<\n AuthTokenCodecService,\n AuthTokenError,\n AuthKeyring | Crypto.Crypto | SubtleCrypto\n> = Effect.gen(function* () {\n const keyring = yield* AuthKeyring;\n const crypto = yield* Crypto.Crypto;\n const subtle = yield* SubtleCrypto;\n\n if (!keyring.keys.some((key) => key.keyId === keyring.activeKeyId)) {\n return yield* AuthTokenError.make({\n message: \"Keyring does not contain the active signing key\",\n });\n }\n\n const importKey = (secret: Redacted.Redacted<string>) =>\n Effect.tryPromise({\n try: () =>\n subtle.importKey(\n \"raw\",\n textEncoder.encode(Redacted.value(secret)),\n { name: \"HMAC\", hash: \"SHA-256\" },\n false,\n [\"sign\", \"verify\"],\n ),\n catch: () => AuthTokenError.make({ message: \"Failed to import HMAC key\" }),\n });\n\n const keys = new Map<KeyId, CryptoKey>();\n\n for (const entry of keyring.keys) {\n keys.set(entry.keyId, yield* importKey(entry.secret));\n }\n\n const hmac = (keyId: KeyId, data: Uint8Array) =>\n Effect.gen(function* () {\n const key = keys.get(keyId);\n\n if (key === undefined) {\n return yield* AuthTokenError.make({ message: \"Unknown key id\" });\n }\n\n const signature = yield* Effect.tryPromise({\n try: () => subtle.sign(\"HMAC\", key, data as BufferSource),\n catch: () => AuthTokenError.make({ message: \"HMAC signing failed\" }),\n });\n\n return new Uint8Array(signature);\n });\n\n const hmacVerify = (keyId: KeyId, data: Uint8Array, signature: Uint8Array) =>\n Effect.gen(function* () {\n const key = keys.get(keyId);\n\n if (key === undefined) {\n return false;\n }\n\n return yield* Effect.tryPromise({\n try: () => subtle.verify(\"HMAC\", key, signature as BufferSource, data as BufferSource),\n catch: () => AuthTokenError.make({ message: \"HMAC verification failed\" }),\n });\n });\n\n return {\n activeKeyId: keyring.activeKeyId,\n keyIds: [\n keyring.activeKeyId,\n ...keyring.keys.map((key) => key.keyId).filter((id) => id !== keyring.activeKeyId),\n ],\n\n encodeSession: Effect.fn(\"AuthTokenCodec.encodeSession\")(function* (claims) {\n const encoded = yield* encodeClaimsJson(claims).pipe(\n Effect.mapError(() => AuthTokenError.make({ message: \"Session claims failed to encode\" })),\n );\n\n const payload = Encoding.encodeBase64Url(encoded);\n const signingInput = `${envelopeVersion}.${payload}`;\n const signature = yield* hmac(claims.kid, textEncoder.encode(signingInput));\n const token = `${signingInput}.${Encoding.encodeBase64Url(signature)}`;\n\n return yield* sessionTokenFromString(token).pipe(\n Effect.mapError(() => AuthTokenError.make({ message: \"Session token failed to encode\" })),\n );\n }),\n\n decodeSession: Effect.fn(\"AuthTokenCodec.decodeSession\")(function* (token) {\n const [version, payloadPart, signaturePart, ...rest] = Redacted.value(token).split(\".\");\n\n if (\n version !== envelopeVersion ||\n payloadPart === undefined ||\n signaturePart === undefined ||\n rest.length > 0\n ) {\n return yield* InvalidSession.make();\n }\n const payloadJson = Result.getOrUndefined(Encoding.decodeBase64UrlString(payloadPart));\n const signature = Result.getOrUndefined(Encoding.decodeBase64Url(signaturePart));\n\n if (payloadJson === undefined || signature === undefined) {\n return yield* InvalidSession.make();\n }\n\n const claims = yield* decodeClaimsJson(payloadJson).pipe(\n Effect.mapError(() => InvalidSession.make()),\n );\n\n const signingInput = `${envelopeVersion}.${payloadPart}`;\n const valid = yield* hmacVerify(claims.kid, textEncoder.encode(signingInput), signature);\n\n if (!valid) {\n return yield* InvalidSession.make();\n }\n\n return claims;\n }),\n\n digestToken: Effect.fn(\"AuthTokenCodec.digestToken\")(function* (token, scope) {\n const data = textEncoder.encode(`${scope}\\n${Redacted.value(token)}`);\n\n const digest = yield* crypto\n .digest(\"SHA-256\", data)\n .pipe(Effect.mapError(() => AuthTokenError.make({ message: \"Token digest failed\" })));\n\n return yield* tokenDigestFromString(Encoding.encodeBase64Url(digest)).pipe(\n Effect.mapError(() => AuthTokenError.make({ message: \"Token digest failed to encode\" })),\n );\n }),\n\n digestSecret: Effect.fn(\"AuthTokenCodec.digestSecret\")(function* (value, scope, keyId) {\n const resolvedKeyId = keyId ?? keyring.activeKeyId;\n const data = textEncoder.encode(`${scope}\\n${Redacted.value(value)}`);\n const digest = yield* hmac(resolvedKeyId, data);\n\n const otpDigest = yield* otpDigestFromString(Encoding.encodeBase64Url(digest)).pipe(\n Effect.mapError(() => AuthTokenError.make({ message: \"Secret digest failed to encode\" })),\n );\n\n return KeyedDigest.make({ keyId: resolvedKeyId, digest: otpDigest });\n }),\n };\n});\n\nexport class AuthTokenCodec extends Context.Service<AuthTokenCodec, AuthTokenCodecService>()(\n \"effect-auth/AuthTokenCodec\",\n) {\n /**\n * Default HMAC implementation backed by WebCrypto. The consumer may replace\n * it with its own codec service.\n */\n static readonly layerWebCrypto: Layer.Layer<\n AuthTokenCodec,\n AuthTokenError,\n AuthKeyring | Crypto.Crypto\n > = Layer.effect(AuthTokenCodec)(makeWebCryptoCodec).pipe(Layer.provide(SubtleCrypto.layerWeb));\n\n static readonly layer = AuthTokenCodec.layerWebCrypto;\n}\n"],"mappings":";;;;;;;;;AAiBA,IAAa,cAAb,cAAiC,QAAQ,QASvC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC;AAwBhC,MAAM,kBAAkB;AACxB,MAAM,cAAc,IAAI,YAAY;AAKpC,MAAM,oBAAoB,OAAO,eAAe,aAAa;AAC7D,MAAM,mBAAmB,OAAO,aAAa,iBAAiB;AAC9D,MAAM,mBAAmB,OAAO,aAAa,iBAAiB;AAC9D,MAAM,wBAAwB,OAAO,aAAa,WAAW;AAC7D,MAAM,sBAAsB,OAAO,aAAa,SAAS;AACzD,MAAM,yBAAyB,OAAO,aAAa,YAAY;;;;;AAM/D,MAAM,qBAIF,OAAO,IAAI,aAAa;CAC1B,MAAM,UAAU,OAAO;CACvB,MAAM,SAAS,OAAO,OAAO;CAC7B,MAAM,SAAS,OAAO;CAEtB,IAAI,CAAC,QAAQ,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,WAAW,GAC/D,OAAO,OAAO,eAAe,KAAK,EAChC,SAAS,kDACX,CAAC;CAGH,MAAM,aAAa,WACjB,OAAO,WAAW;EAChB,WACE,OAAO,UACL,OACA,YAAY,OAAO,SAAS,MAAM,MAAM,CAAC,GACzC;GAAE,MAAM;GAAQ,MAAM;EAAU,GAChC,OACA,CAAC,QAAQ,QAAQ,CACnB;E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CAAC;GAEtF,OAAO,OAAO,sBAAsB,SAAS,gBAAgB,MAAM,CAAC,CAAC,CAAC,KACpE,OAAO,eAAe,eAAe,KAAK,EAAE,SAAS,gCAAgC,CAAC,CAAC,CACzF;EACF,CAAC;EAED,cAAc,OAAO,GAAG,6BAA6B,CAAC,CAAC,WAAW,OAAO,OAAO,OAAO;GACrF,MAAM,gBAAgB,SAAS,QAAQ;GACvC,MAAM,OAAO,YAAY,OAAO,GAAG,MAAM,IAAI,SAAS,MAAM,KAAK,GAAG;GACpE,MAAM,SAAS,OAAO,KAAK,eAAe,IAAI;GAE9C,MAAM,YAAY,OAAO,oBAAoB,SAAS,gBAAgB,MAAM,CAAC,CAAC,CAAC,KAC7E,OAAO,eAAe,eAAe,KAAK,EAAE,SAAS,iCAAiC,CAAC,CAAC,CAC1F;GAEA,OAAO,YAAY,KAAK;IAAE,OAAO;IAAe,QAAQ;GAAU,CAAC;EACrE,CAAC;CACH;AACF,CAAC;AAED,IAAa,iBAAb,MAAa,uBAAuB,QAAQ,QAA+C,CAAC,CAC1F,4BACF,CAAC,CAAC;;;;;CAKA,OAAgB,iBAIZ,MAAM,OAAO,cAAc,CAAC,CAAC,kBAAkB,CAAC,CAAC,KAAK,MAAM,QAAQ,aAAa,QAAQ,CAAC;CAE9F,OAAgB,QAAQ,eAAe;AACzC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ActionArguments, ActionDecodeServices, AuthClient, ClientDefinition, ClientOptions, ClientService, make } from "./http-operation/auth-client.mjs";
|
|
2
|
+
export { type ActionArguments, type ActionDecodeServices, type AuthClient, type ClientDefinition, type ClientOptions, type ClientService, make };
|
package/dist/Client.mjs
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ConsumeChallenge, ConsumeRegistration, NewChallenge, NewRegistration, PendingRegistration, VerifiedEmail } from "./Schema.mjs";
|
|
2
|
+
import { AuthRateLimited, InvalidRegistration } from "./Errors.mjs";
|
|
3
|
+
import { AuthStore, EmailOtpRejected } from "./AuthStore.mjs";
|
|
4
|
+
import { EmailOtpSender } from "./EmailOtpSender.mjs";
|
|
5
|
+
import { Layer, Schema } from "effect";
|
|
6
|
+
import { Binding, DurableObject, DurableObjectState, Email, Environment, Worker } from "effect-cf";
|
|
7
|
+
import { OtlpExporter } from "effect/unstable/observability";
|
|
8
|
+
//#region src/Cloudflare.d.ts
|
|
9
|
+
declare const AuthStoreObject_base: DurableObject.TagClass<AuthStoreObject, "effect-auth/AuthStoreObject", {
|
|
10
|
+
readonly issueChallenge: DurableObject.Method<readonly [typeof NewChallenge], Schema.Union<readonly [Schema.Null, typeof AuthRateLimited]>>;
|
|
11
|
+
readonly consumeChallenge: DurableObject.Method<readonly [typeof ConsumeChallenge], Schema.Union<readonly [typeof VerifiedEmail, typeof EmailOtpRejected]>>;
|
|
12
|
+
readonly issueRegistration: DurableObject.Method<readonly [typeof NewRegistration], Schema.Null>;
|
|
13
|
+
readonly inspectRegistration: DurableObject.Method<readonly [Schema.brand<Schema.NonEmptyString, "effect-auth/TokenDigest">], Schema.Union<readonly [typeof PendingRegistration, typeof InvalidRegistration]>>;
|
|
14
|
+
readonly consumeRegistration: DurableObject.Method<readonly [typeof ConsumeRegistration], Schema.Union<readonly [Schema.Null, typeof InvalidRegistration]>>;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Typed RPC contract for the auth store Durable Object. A single named
|
|
18
|
+
* instance backs a deployment: auth traffic is low-rate, and one serialized
|
|
19
|
+
* object makes the store's exactly-once consume guarantees structural.
|
|
20
|
+
* Expected auth failures travel inside the success schemas; the worker-side
|
|
21
|
+
* client re-fails them.
|
|
22
|
+
*/
|
|
23
|
+
declare class AuthStoreObject extends AuthStoreObject_base {}
|
|
24
|
+
/** Builds the auth store object with an application-owned OTLP telemetry layer. */
|
|
25
|
+
declare const makeAuthStoreDurableObject: (telemetry: Layer.Layer<OtlpExporter.Flusher, never, DurableObjectState.DurableObjectState>) => DurableObject.DurableObjectClass<DurableObject.Handlers<AuthStore | OtlpExporter.Flusher, DurableObject.Definition<"effect-auth/AuthStoreObject", {
|
|
26
|
+
readonly issueChallenge: DurableObject.Method<readonly [typeof NewChallenge], Schema.Union<readonly [Schema.Null, typeof AuthRateLimited]>>;
|
|
27
|
+
readonly consumeChallenge: DurableObject.Method<readonly [typeof ConsumeChallenge], Schema.Union<readonly [typeof VerifiedEmail, typeof EmailOtpRejected]>>;
|
|
28
|
+
readonly issueRegistration: DurableObject.Method<readonly [typeof NewRegistration], Schema.Null>;
|
|
29
|
+
readonly inspectRegistration: DurableObject.Method<readonly [Schema.brand<Schema.NonEmptyString, "effect-auth/TokenDigest">], Schema.Union<readonly [typeof PendingRegistration, typeof InvalidRegistration]>>;
|
|
30
|
+
readonly consumeRegistration: DurableObject.Method<readonly [typeof ConsumeRegistration], Schema.Union<readonly [Schema.Null, typeof InvalidRegistration]>>;
|
|
31
|
+
}>>, AuthStore | OtlpExporter.Flusher>;
|
|
32
|
+
/**
|
|
33
|
+
* Worker-side `AuthStore` over the auth Durable Object binding. Swapping this
|
|
34
|
+
* layer for a different backing (Postgres, PlanetScale) is the intended
|
|
35
|
+
* migration path: implement the same `AuthStore` contract and rerun the
|
|
36
|
+
* conformance suite.
|
|
37
|
+
*/
|
|
38
|
+
declare const layerAuthStoreClient: Layer.Layer<AuthStore, never, AuthStoreObject>;
|
|
39
|
+
/**
|
|
40
|
+
* Everything the worker needs for a Durable-Object-backed `AuthStore`: the
|
|
41
|
+
* client layer wired to the given binding. The binding name is an intrinsic
|
|
42
|
+
* deployment definition, matching the `durable_objects` entry in the wrangler
|
|
43
|
+
* configuration.
|
|
44
|
+
*/
|
|
45
|
+
declare const layerAuthStore: (options: {
|
|
46
|
+
readonly binding: string;
|
|
47
|
+
}) => Layer.Layer<AuthStore, Binding.BindingNotFoundError | Binding.BindingValidationError, Environment.WorkerEnvironment>;
|
|
48
|
+
declare const AuthEmail_base: Email.TagClass<AuthEmail, "effect-auth/AuthEmail">;
|
|
49
|
+
/** Send Email binding used by {@link layerEmailOtpSender}. */
|
|
50
|
+
declare class AuthEmail extends AuthEmail_base {}
|
|
51
|
+
/** Input handed to a {@link layerEmailOtpSender} content renderer. */
|
|
52
|
+
interface EmailOtpContentInput {
|
|
53
|
+
readonly code: string;
|
|
54
|
+
readonly minutesRemaining: number;
|
|
55
|
+
}
|
|
56
|
+
/** A rendered OTP message for {@link layerEmailOtpSender}. */
|
|
57
|
+
interface EmailOtpContent {
|
|
58
|
+
readonly subject: string;
|
|
59
|
+
readonly text: string;
|
|
60
|
+
/** HTML alternative to `text`; clients that render HTML prefer it. */
|
|
61
|
+
readonly html?: string;
|
|
62
|
+
/** Attachments, e.g. `cid:`-referenced inline images used by `html`. */
|
|
63
|
+
readonly attachments?: ReadonlyArray<Email.EmailAttachment>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* `EmailOtpSender` over a Cloudflare Send Email binding. The consumer owns the
|
|
67
|
+
* sending domain (Email Routing must be configured for `from`); message
|
|
68
|
+
* wording can be overridden through `content`.
|
|
69
|
+
*
|
|
70
|
+
* Delivery runs past the response via `waitUntil`: the provider call is the
|
|
71
|
+
* slow part of an OTP request (routinely multiple seconds), and by the time
|
|
72
|
+
* the sender runs the challenge is already persisted, so the endpoint's 202
|
|
73
|
+
* honestly means "accepted". The trade is that a failed send can no longer
|
|
74
|
+
* surface to the caller; the structured delivery-failure log is the only
|
|
75
|
+
* signal.
|
|
76
|
+
*/
|
|
77
|
+
declare const layerEmailOtpSender: (options: {
|
|
78
|
+
/** `send_email` binding name from the wrangler configuration. */
|
|
79
|
+
readonly binding: string;
|
|
80
|
+
/**
|
|
81
|
+
* Verified sender address on a domain with Email Routing enabled. Pass an
|
|
82
|
+
* object to attach a display name.
|
|
83
|
+
*/
|
|
84
|
+
readonly from: string | Email.EmailAddress;
|
|
85
|
+
readonly content?: (input: EmailOtpContentInput) => EmailOtpContent;
|
|
86
|
+
}) => Layer.Layer<EmailOtpSender, Binding.BindingNotFoundError | Binding.BindingValidationError, Environment.WorkerEnvironment | Worker.WorkerContext>;
|
|
87
|
+
//#endregion
|
|
88
|
+
export { AuthEmail, AuthStoreObject, EmailOtpContent, EmailOtpContentInput, layerAuthStore, layerAuthStoreClient, layerEmailOtpSender, makeAuthStoreDurableObject };
|
|
89
|
+
//# sourceMappingURL=Cloudflare.d.mts.map
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { ConsumeChallenge, ConsumeRegistration, NewChallenge, NewRegistration, PendingRegistration, TokenDigest, VerifiedEmail } from "./Schema.mjs";
|
|
2
|
+
import { AuthRateLimited, AuthStoreError, InvalidRegistration } from "./Errors.mjs";
|
|
3
|
+
import { AuthStore, AuthStoreBackend, EmailOtpRejected } from "./AuthStore.mjs";
|
|
4
|
+
import { EmailOtpSender } from "./EmailOtpSender.mjs";
|
|
5
|
+
import { DateTime, Duration, Effect, Layer, Redacted, Schema } from "effect";
|
|
6
|
+
import { DurableObject, DurableObjectState, Email, Worker } from "effect-cf";
|
|
7
|
+
//#region src/Cloudflare.ts
|
|
8
|
+
/**
|
|
9
|
+
* Typed RPC contract for the auth store Durable Object. A single named
|
|
10
|
+
* instance backs a deployment: auth traffic is low-rate, and one serialized
|
|
11
|
+
* object makes the store's exactly-once consume guarantees structural.
|
|
12
|
+
* Expected auth failures travel inside the success schemas; the worker-side
|
|
13
|
+
* client re-fails them.
|
|
14
|
+
*/
|
|
15
|
+
var AuthStoreObject = class extends DurableObject.Tag()("effect-auth/AuthStoreObject", {
|
|
16
|
+
issueChallenge: DurableObject.method({
|
|
17
|
+
args: [NewChallenge],
|
|
18
|
+
success: Schema.Union([Schema.Null, AuthRateLimited])
|
|
19
|
+
}),
|
|
20
|
+
consumeChallenge: DurableObject.method({
|
|
21
|
+
args: [ConsumeChallenge],
|
|
22
|
+
success: Schema.Union([VerifiedEmail, EmailOtpRejected])
|
|
23
|
+
}),
|
|
24
|
+
issueRegistration: DurableObject.method({
|
|
25
|
+
args: [NewRegistration],
|
|
26
|
+
success: Schema.Null
|
|
27
|
+
}),
|
|
28
|
+
inspectRegistration: DurableObject.method({
|
|
29
|
+
args: [TokenDigest],
|
|
30
|
+
success: Schema.Union([PendingRegistration, InvalidRegistration])
|
|
31
|
+
}),
|
|
32
|
+
consumeRegistration: DurableObject.method({
|
|
33
|
+
args: [ConsumeRegistration],
|
|
34
|
+
success: Schema.Union([Schema.Null, InvalidRegistration])
|
|
35
|
+
})
|
|
36
|
+
}) {};
|
|
37
|
+
/**
|
|
38
|
+
* The canonical effect-auth store state machine over the object's own
|
|
39
|
+
* storage. The Durable Object's input gates serialize requests; the machine
|
|
40
|
+
* adds its own serialization on top, so exactly-once consumption holds
|
|
41
|
+
* regardless. Export this class from the worker entry module and register it
|
|
42
|
+
* under `durable_objects` in the wrangler configuration.
|
|
43
|
+
*/
|
|
44
|
+
const BackendLive = Layer.effect(AuthStoreBackend)(Effect.map(DurableObjectState.DurableObjectState, (state) => AuthStoreBackend.of({
|
|
45
|
+
get: (key) => state.storage.get(key).pipe(Effect.mapError(() => AuthStoreError.make({ message: "Auth store storage failed" }))),
|
|
46
|
+
put: (key, value) => state.storage.put(key, value).pipe(Effect.mapError(() => AuthStoreError.make({ message: "Auth store storage failed" }))),
|
|
47
|
+
remove: (key) => state.storage.delete(key).pipe(Effect.asVoid, Effect.mapError(() => AuthStoreError.make({ message: "Auth store storage failed" })))
|
|
48
|
+
})));
|
|
49
|
+
const AuthStoreLive = AuthStore.layerBackend.pipe(Layer.provide(BackendLive));
|
|
50
|
+
const AuthStoreDurableObjectOptions = { rpc: {
|
|
51
|
+
issueChallenge: (input) => Effect.gen(function* () {
|
|
52
|
+
return yield* (yield* AuthStore).issueChallenge(input).pipe(Effect.as(null), Effect.catchTags({
|
|
53
|
+
AuthRateLimited: (error) => Effect.succeed(error),
|
|
54
|
+
AuthStoreError: Effect.die
|
|
55
|
+
}));
|
|
56
|
+
}),
|
|
57
|
+
consumeChallenge: (input) => Effect.gen(function* () {
|
|
58
|
+
return yield* (yield* AuthStore).consumeChallenge(input).pipe(Effect.catchTags({
|
|
59
|
+
EmailOtpRejected: (error) => Effect.succeed(error),
|
|
60
|
+
AuthStoreError: Effect.die
|
|
61
|
+
}));
|
|
62
|
+
}),
|
|
63
|
+
issueRegistration: (input) => Effect.gen(function* () {
|
|
64
|
+
yield* (yield* AuthStore).issueRegistration(input).pipe(Effect.catchTag("AuthStoreError", Effect.die));
|
|
65
|
+
return null;
|
|
66
|
+
}),
|
|
67
|
+
inspectRegistration: (tokenDigest) => Effect.gen(function* () {
|
|
68
|
+
return yield* (yield* AuthStore).inspectRegistration(tokenDigest).pipe(Effect.catchTags({
|
|
69
|
+
InvalidRegistration: (error) => Effect.succeed(error),
|
|
70
|
+
AuthStoreError: Effect.die
|
|
71
|
+
}));
|
|
72
|
+
}),
|
|
73
|
+
consumeRegistration: (input) => Effect.gen(function* () {
|
|
74
|
+
return yield* (yield* AuthStore).consumeRegistration(input).pipe(Effect.as(null), Effect.catchTags({
|
|
75
|
+
InvalidRegistration: (error) => Effect.succeed(error),
|
|
76
|
+
AuthStoreError: Effect.die
|
|
77
|
+
}));
|
|
78
|
+
})
|
|
79
|
+
} };
|
|
80
|
+
/** Builds the auth store object with an application-owned OTLP telemetry layer. */
|
|
81
|
+
const makeAuthStoreDurableObject = (telemetry) => AuthStoreObject.make(Layer.merge(AuthStoreLive, telemetry), AuthStoreDurableObjectOptions);
|
|
82
|
+
const clientUnavailable = () => AuthStoreError.unavailable;
|
|
83
|
+
/**
|
|
84
|
+
* Worker-side `AuthStore` over the auth Durable Object binding. Swapping this
|
|
85
|
+
* layer for a different backing (Postgres, PlanetScale) is the intended
|
|
86
|
+
* migration path: implement the same `AuthStore` contract and rerun the
|
|
87
|
+
* conformance suite.
|
|
88
|
+
*/
|
|
89
|
+
const layerAuthStoreClient = Layer.effect(AuthStore)(Effect.map(AuthStoreObject, (objects) => {
|
|
90
|
+
const stub = objects.byName("primary");
|
|
91
|
+
return AuthStore.of({
|
|
92
|
+
issueChallenge: Effect.fn("AuthStoreObject.client.issueChallenge")(function* (input) {
|
|
93
|
+
const outcome = yield* stub.issueChallenge(input).pipe(Effect.mapError(clientUnavailable));
|
|
94
|
+
if (outcome !== null) return yield* outcome;
|
|
95
|
+
}),
|
|
96
|
+
consumeChallenge: Effect.fn("AuthStoreObject.client.consumeChallenge")(function* (input) {
|
|
97
|
+
const outcome = yield* stub.consumeChallenge(input).pipe(Effect.mapError(clientUnavailable));
|
|
98
|
+
if ("_tag" in outcome) return yield* outcome;
|
|
99
|
+
return outcome;
|
|
100
|
+
}),
|
|
101
|
+
issueRegistration: Effect.fn("AuthStoreObject.client.issueRegistration")(function* (input) {
|
|
102
|
+
yield* stub.issueRegistration(input).pipe(Effect.mapError(clientUnavailable));
|
|
103
|
+
}),
|
|
104
|
+
inspectRegistration: Effect.fn("AuthStoreObject.client.inspectRegistration")(function* (tokenDigest) {
|
|
105
|
+
const outcome = yield* stub.inspectRegistration(tokenDigest).pipe(Effect.mapError(clientUnavailable));
|
|
106
|
+
if ("_tag" in outcome) return yield* outcome;
|
|
107
|
+
return outcome;
|
|
108
|
+
}),
|
|
109
|
+
consumeRegistration: Effect.fn("AuthStoreObject.client.consumeRegistration")(function* (input) {
|
|
110
|
+
const outcome = yield* stub.consumeRegistration(input).pipe(Effect.mapError(clientUnavailable));
|
|
111
|
+
if (outcome !== null) return yield* outcome;
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
}));
|
|
115
|
+
/**
|
|
116
|
+
* Everything the worker needs for a Durable-Object-backed `AuthStore`: the
|
|
117
|
+
* client layer wired to the given binding. The binding name is an intrinsic
|
|
118
|
+
* deployment definition, matching the `durable_objects` entry in the wrangler
|
|
119
|
+
* configuration.
|
|
120
|
+
*/
|
|
121
|
+
const layerAuthStore = (options) => layerAuthStoreClient.pipe(Layer.provide(AuthStoreObject.layer({ binding: options.binding })));
|
|
122
|
+
/** Send Email binding used by {@link layerEmailOtpSender}. */
|
|
123
|
+
var AuthEmail = class extends Email.Tag()("effect-auth/AuthEmail") {};
|
|
124
|
+
/**
|
|
125
|
+
* `EmailOtpSender` over a Cloudflare Send Email binding. The consumer owns the
|
|
126
|
+
* sending domain (Email Routing must be configured for `from`); message
|
|
127
|
+
* wording can be overridden through `content`.
|
|
128
|
+
*
|
|
129
|
+
* Delivery runs past the response via `waitUntil`: the provider call is the
|
|
130
|
+
* slow part of an OTP request (routinely multiple seconds), and by the time
|
|
131
|
+
* the sender runs the challenge is already persisted, so the endpoint's 202
|
|
132
|
+
* honestly means "accepted". The trade is that a failed send can no longer
|
|
133
|
+
* surface to the caller; the structured delivery-failure log is the only
|
|
134
|
+
* signal.
|
|
135
|
+
*/
|
|
136
|
+
const layerEmailOtpSender = (options) => Layer.effect(EmailOtpSender)(Effect.gen(function* () {
|
|
137
|
+
const email = yield* AuthEmail;
|
|
138
|
+
const context = yield* Worker.WorkerContext;
|
|
139
|
+
return EmailOtpSender.of({ send: Effect.fn("EmailOtpSender.sendEmail")(function* (message) {
|
|
140
|
+
const now = yield* DateTime.now;
|
|
141
|
+
const minutesRemaining = Math.max(1, Math.round(Duration.toMinutes(Duration.millis(DateTime.toEpochMillis(message.expiresAt) - DateTime.toEpochMillis(now)))));
|
|
142
|
+
const code = Redacted.value(message.code);
|
|
143
|
+
const rendered = options.content?.({
|
|
144
|
+
code,
|
|
145
|
+
minutesRemaining
|
|
146
|
+
}) ?? {
|
|
147
|
+
subject: "Your sign-in code",
|
|
148
|
+
text: `Your sign-in code is ${code}. It expires in ${minutesRemaining} minute${minutesRemaining === 1 ? "" : "s"}. If you did not request it, ignore this email.`
|
|
149
|
+
};
|
|
150
|
+
yield* context.waitUntil(email.send({
|
|
151
|
+
from: options.from,
|
|
152
|
+
to: message.email,
|
|
153
|
+
subject: rendered.subject,
|
|
154
|
+
text: rendered.text,
|
|
155
|
+
...rendered.html === void 0 ? {} : { html: rendered.html },
|
|
156
|
+
...rendered.attachments === void 0 ? {} : { attachments: [...rendered.attachments] }
|
|
157
|
+
}).pipe(Effect.asVoid, Effect.tapError((error) => Effect.logError("Sign-in code delivery failed", {
|
|
158
|
+
code: Reflect.get(error, "code"),
|
|
159
|
+
reason: String(Reflect.get(error, "cause") ?? error)
|
|
160
|
+
})), Effect.catch(() => Effect.void)));
|
|
161
|
+
}) });
|
|
162
|
+
})).pipe(Layer.provide(AuthEmail.layer({ binding: options.binding })));
|
|
163
|
+
//#endregion
|
|
164
|
+
export { AuthEmail, AuthStoreObject, layerAuthStore, layerAuthStoreClient, layerEmailOtpSender, makeAuthStoreDurableObject };
|
|
165
|
+
|
|
166
|
+
//# sourceMappingURL=Cloudflare.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cloudflare.mjs","names":[],"sources":["../src/Cloudflare.ts"],"sourcesContent":["import { DateTime, Duration, Effect, Layer, Redacted, Schema } from \"effect\";\nimport {\n type Binding,\n type Environment,\n DurableObject,\n DurableObjectState,\n Email,\n Worker,\n} from \"effect-cf\";\nimport type { OtlpExporter } from \"effect/unstable/observability\";\n\nimport { AuthStore, AuthStoreBackend, EmailOtpRejected } from \"./AuthStore\";\nimport { EmailOtpSender } from \"./EmailOtpSender\";\nimport { AuthRateLimited, AuthStoreError, InvalidRegistration } from \"./Errors\";\nimport {\n type TokenDigest as TokenDigestType,\n ConsumeChallenge,\n ConsumeRegistration,\n NewChallenge,\n NewRegistration,\n PendingRegistration,\n TokenDigest,\n VerifiedEmail,\n} from \"./Schema\";\n\n/**\n * Typed RPC contract for the auth store Durable Object. A single named\n * instance backs a deployment: auth traffic is low-rate, and one serialized\n * object makes the store's exactly-once consume guarantees structural.\n * Expected auth failures travel inside the success schemas; the worker-side\n * client re-fails them.\n */\nexport class AuthStoreObject extends DurableObject.Tag<AuthStoreObject>()(\n \"effect-auth/AuthStoreObject\",\n {\n issueChallenge: DurableObject.method({\n args: [NewChallenge],\n success: Schema.Union([Schema.Null, AuthRateLimited]),\n }),\n consumeChallenge: DurableObject.method({\n args: [ConsumeChallenge],\n success: Schema.Union([VerifiedEmail, EmailOtpRejected]),\n }),\n issueRegistration: DurableObject.method({\n args: [NewRegistration],\n success: Schema.Null,\n }),\n inspectRegistration: DurableObject.method({\n args: [TokenDigest],\n success: Schema.Union([PendingRegistration, InvalidRegistration]),\n }),\n consumeRegistration: DurableObject.method({\n args: [ConsumeRegistration],\n success: Schema.Union([Schema.Null, InvalidRegistration]),\n }),\n },\n) {}\n\n/**\n * The canonical effect-auth store state machine over the object's own\n * storage. The Durable Object's input gates serialize requests; the machine\n * adds its own serialization on top, so exactly-once consumption holds\n * regardless. Export this class from the worker entry module and register it\n * under `durable_objects` in the wrangler configuration.\n */\nconst BackendLive = Layer.effect(AuthStoreBackend)(\n Effect.map(DurableObjectState.DurableObjectState, (state) =>\n AuthStoreBackend.of({\n get: (key) =>\n state.storage\n .get(key)\n .pipe(\n Effect.mapError(() => AuthStoreError.make({ message: \"Auth store storage failed\" })),\n ),\n put: (key, value) =>\n state.storage\n .put(key, value)\n .pipe(\n Effect.mapError(() => AuthStoreError.make({ message: \"Auth store storage failed\" })),\n ),\n remove: (key) =>\n state.storage.delete(key).pipe(\n Effect.asVoid,\n Effect.mapError(() => AuthStoreError.make({ message: \"Auth store storage failed\" })),\n ),\n }),\n ),\n);\n\n// Expected auth failures travel inside the RPC success schemas; infrastructure\n// failures become defects and surface as transport errors on the caller side.\nconst AuthStoreLive = AuthStore.layerBackend.pipe(Layer.provide(BackendLive));\n\nconst AuthStoreDurableObjectOptions = {\n rpc: {\n issueChallenge: (input) =>\n Effect.gen(function* () {\n const store = yield* AuthStore;\n\n return yield* store.issueChallenge(input).pipe(\n Effect.as(null),\n Effect.catchTags({\n AuthRateLimited: (error) => Effect.succeed(error),\n AuthStoreError: Effect.die,\n }),\n );\n }),\n consumeChallenge: (input) =>\n Effect.gen(function* () {\n const store = yield* AuthStore;\n\n return yield* store.consumeChallenge(input).pipe(\n Effect.catchTags({\n EmailOtpRejected: (error) => Effect.succeed(error),\n AuthStoreError: Effect.die,\n }),\n );\n }),\n issueRegistration: (input) =>\n Effect.gen(function* () {\n const store = yield* AuthStore;\n\n yield* store.issueRegistration(input).pipe(Effect.catchTag(\"AuthStoreError\", Effect.die));\n\n return null;\n }),\n inspectRegistration: (tokenDigest: TokenDigestType) =>\n Effect.gen(function* () {\n const store = yield* AuthStore;\n\n return yield* store.inspectRegistration(tokenDigest).pipe(\n Effect.catchTags({\n InvalidRegistration: (error) => Effect.succeed(error),\n AuthStoreError: Effect.die,\n }),\n );\n }),\n consumeRegistration: (input) =>\n Effect.gen(function* () {\n const store = yield* AuthStore;\n\n return yield* store.consumeRegistration(input).pipe(\n Effect.as(null),\n Effect.catchTags({\n InvalidRegistration: (error) => Effect.succeed(error),\n AuthStoreError: Effect.die,\n }),\n );\n }),\n },\n} satisfies DurableObject.Options<AuthStore, typeof AuthStoreObject>;\n\n/** Builds the auth store object with an application-owned OTLP telemetry layer. */\nexport const makeAuthStoreDurableObject = (\n telemetry: Layer.Layer<OtlpExporter.Flusher, never, DurableObjectState.DurableObjectState>,\n) => AuthStoreObject.make(Layer.merge(AuthStoreLive, telemetry), AuthStoreDurableObjectOptions);\n\nconst clientUnavailable = () => AuthStoreError.unavailable;\n\n/**\n * Worker-side `AuthStore` over the auth Durable Object binding. Swapping this\n * layer for a different backing (Postgres, PlanetScale) is the intended\n * migration path: implement the same `AuthStore` contract and rerun the\n * conformance suite.\n */\nexport const layerAuthStoreClient: Layer.Layer<AuthStore, never, AuthStoreObject> = Layer.effect(\n AuthStore,\n)(\n Effect.map(AuthStoreObject, (objects) => {\n const stub = objects.byName(\"primary\");\n\n return AuthStore.of({\n issueChallenge: Effect.fn(\"AuthStoreObject.client.issueChallenge\")(function* (input) {\n const outcome = yield* stub.issueChallenge(input).pipe(Effect.mapError(clientUnavailable));\n\n if (outcome !== null) {\n return yield* outcome;\n }\n }),\n consumeChallenge: Effect.fn(\"AuthStoreObject.client.consumeChallenge\")(function* (input) {\n const outcome = yield* stub\n .consumeChallenge(input)\n .pipe(Effect.mapError(clientUnavailable));\n\n if (\"_tag\" in outcome) {\n return yield* outcome;\n }\n\n return outcome;\n }),\n issueRegistration: Effect.fn(\"AuthStoreObject.client.issueRegistration\")(function* (input) {\n yield* stub.issueRegistration(input).pipe(Effect.mapError(clientUnavailable));\n }),\n inspectRegistration: Effect.fn(\"AuthStoreObject.client.inspectRegistration\")(\n function* (tokenDigest) {\n const outcome = yield* stub\n .inspectRegistration(tokenDigest)\n .pipe(Effect.mapError(clientUnavailable));\n\n if (\"_tag\" in outcome) {\n return yield* outcome;\n }\n\n return outcome;\n },\n ),\n consumeRegistration: Effect.fn(\"AuthStoreObject.client.consumeRegistration\")(\n function* (input) {\n const outcome = yield* stub\n .consumeRegistration(input)\n .pipe(Effect.mapError(clientUnavailable));\n\n if (outcome !== null) {\n return yield* outcome;\n }\n },\n ),\n });\n }),\n);\n\n/**\n * Everything the worker needs for a Durable-Object-backed `AuthStore`: the\n * client layer wired to the given binding. The binding name is an intrinsic\n * deployment definition, matching the `durable_objects` entry in the wrangler\n * configuration.\n */\nexport const layerAuthStore = (options: {\n readonly binding: string;\n}): Layer.Layer<\n AuthStore,\n Binding.BindingNotFoundError | Binding.BindingValidationError,\n Environment.WorkerEnvironment\n> => layerAuthStoreClient.pipe(Layer.provide(AuthStoreObject.layer({ binding: options.binding })));\n\n// --- Email delivery ------------------------------------------------------------\n\n/** Send Email binding used by {@link layerEmailOtpSender}. */\nexport class AuthEmail extends Email.Tag<AuthEmail>()(\"effect-auth/AuthEmail\") {}\n\n/** Input handed to a {@link layerEmailOtpSender} content renderer. */\nexport interface EmailOtpContentInput {\n readonly code: string;\n readonly minutesRemaining: number;\n}\n\n/** A rendered OTP message for {@link layerEmailOtpSender}. */\nexport interface EmailOtpContent {\n readonly subject: string;\n readonly text: string;\n /** HTML alternative to `text`; clients that render HTML prefer it. */\n readonly html?: string;\n /** Attachments, e.g. `cid:`-referenced inline images used by `html`. */\n readonly attachments?: ReadonlyArray<Email.EmailAttachment>;\n}\n\n/**\n * `EmailOtpSender` over a Cloudflare Send Email binding. The consumer owns the\n * sending domain (Email Routing must be configured for `from`); message\n * wording can be overridden through `content`.\n *\n * Delivery runs past the response via `waitUntil`: the provider call is the\n * slow part of an OTP request (routinely multiple seconds), and by the time\n * the sender runs the challenge is already persisted, so the endpoint's 202\n * honestly means \"accepted\". The trade is that a failed send can no longer\n * surface to the caller; the structured delivery-failure log is the only\n * signal.\n */\nexport const layerEmailOtpSender = (options: {\n /** `send_email` binding name from the wrangler configuration. */\n readonly binding: string;\n /**\n * Verified sender address on a domain with Email Routing enabled. Pass an\n * object to attach a display name.\n */\n readonly from: string | Email.EmailAddress;\n readonly content?: (input: EmailOtpContentInput) => EmailOtpContent;\n}): Layer.Layer<\n EmailOtpSender,\n Binding.BindingNotFoundError | Binding.BindingValidationError,\n Environment.WorkerEnvironment | Worker.WorkerContext\n> =>\n Layer.effect(EmailOtpSender)(\n Effect.gen(function* () {\n const email = yield* AuthEmail;\n const context = yield* Worker.WorkerContext;\n\n return EmailOtpSender.of({\n send: Effect.fn(\"EmailOtpSender.sendEmail\")(function* (message) {\n const now = yield* DateTime.now;\n\n const minutesRemaining = Math.max(\n 1,\n Math.round(\n Duration.toMinutes(\n Duration.millis(\n DateTime.toEpochMillis(message.expiresAt) - DateTime.toEpochMillis(now),\n ),\n ),\n ),\n );\n\n const code = Redacted.value(message.code);\n\n const rendered: EmailOtpContent = options.content?.({ code, minutesRemaining }) ?? {\n subject: \"Your sign-in code\",\n text: `Your sign-in code is ${code}. It expires in ${minutesRemaining} minute${\n minutesRemaining === 1 ? \"\" : \"s\"\n }. If you did not request it, ignore this email.`,\n };\n\n yield* context.waitUntil(\n email\n .send({\n from: options.from,\n to: message.email,\n subject: rendered.subject,\n text: rendered.text,\n ...(rendered.html === undefined ? {} : { html: rendered.html }),\n ...(rendered.attachments === undefined\n ? {}\n : { attachments: [...rendered.attachments] }),\n })\n .pipe(\n Effect.asVoid,\n // Delivery happens after the response, so this log is all an\n // undeliverable address leaves behind. Provider reasons are\n // operational and permanent — a suppressed recipient stays\n // suppressed — so record enough to act on. Only the provider's\n // own code and message are logged; the rendered message, which\n // carries the code, never is.\n Effect.tapError((error) =>\n Effect.logError(\"Sign-in code delivery failed\", {\n code: Reflect.get(error, \"code\"),\n reason: String(Reflect.get(error, \"cause\") ?? error),\n }),\n ),\n // Logged above; a second generic waitUntil log adds nothing.\n Effect.catch(() => Effect.void),\n ),\n );\n }),\n });\n }),\n ).pipe(Layer.provide(AuthEmail.layer({ binding: options.binding })));\n"],"mappings":";;;;;;;;;;;;;;AAgCA,IAAa,kBAAb,cAAqC,cAAc,IAAqB,CAAC,CACvE,+BACA;CACE,gBAAgB,cAAc,OAAO;EACnC,MAAM,CAAC,YAAY;EACnB,SAAS,OAAO,MAAM,CAAC,OAAO,MAAM,eAAe,CAAC;CACtD,CAAC;CACD,kBAAkB,cAAc,OAAO;EACrC,MAAM,CAAC,gBAAgB;EACvB,SAAS,OAAO,MAAM,CAAC,eAAe,gBAAgB,CAAC;CACzD,CAAC;CACD,mBAAmB,cAAc,OAAO;EACtC,MAAM,CAAC,eAAe;EACtB,SAAS,OAAO;CAClB,CAAC;CACD,qBAAqB,cAAc,OAAO;EACxC,MAAM,CAAC,WAAW;EAClB,SAAS,OAAO,MAAM,CAAC,qBAAqB,mBAAmB,CAAC;CAClE,CAAC;CACD,qBAAqB,cAAc,OAAO;EACxC,MAAM,CAAC,mBAAmB;EAC1B,SAAS,OAAO,MAAM,CAAC,OAAO,MAAM,mBAAmB,CAAC;CAC1D,CAAC;AACH,CACF,CAAC,CAAC,CAAC;;;;;;;;AASH,MAAM,cAAc,MAAM,OAAO,gBAAgB,CAAC,CAChD,OAAO,IAAI,mBAAmB,qBAAqB,UACjD,iBAAiB,GAAG;CAClB,MAAM,QACJ,MAAM,QACH,IAAI,GAAG,CAAC,CACR,KACC,OAAO,eAAe,eAAe,KAAK,EAAE,SAAS,4BAA4B,CAAC,CAAC,CACrF;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C,GAAG,SAAS,WAAW,EAAE;EAC/C,CAAC,CAAC,CACD,KACC,OAAO,QAOP,OAAO,UAAU,UACf,OAAO,SAAS,gCAAgC;GAC9C,MAAM,QAAQ,IAAI,OAAO,MAAM;GAC/B,QAAQ,OAAO,QAAQ,IAAI,OAAO,OAAO,KAAK,KAAK;EACrD,CAAC,CACH,GAEA,OAAO,YAAY,OAAO,IAAI,CAChC,CACJ;CACF,CAAC,EACH,CAAC;AACH,CAAC,CACH,CAAC,CAAC,KAAK,MAAM,QAAQ,UAAU,MAAM,EAAE,SAAS,QAAQ,QAAQ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ConsumeDecision } from "./auth/ConsumeDecision.mjs";
|
|
2
|
+
import { AuthStoreDecisions, ChallengeConsumeDecision } from "./internal/AuthStoreDecisions.mjs";
|
|
3
|
+
import { AuthStoreTables, AuthTables, ChallengeColumns, ChallengeInput, ChallengeRecord, ChallengeTableMapping, CommitMode, D1ExternalIdentityMapping, D1GeneratedIdentityMapping, D1SubjectProvisioningMapping, DrizzleMappingError, ExternalIdentityTables, IdentityTables, InstantCodec, OAuthStateColumns, OAuthStateTableMapping, OAuthStateTables, RegistrationColumns, RegistrationRecord, RegistrationTableMapping, RequiredAuthConstraints, RequiredAuthStoreConstraints, RequiredExternalIdentityConstraints, RequiredIdentityConstraints, RequiredOAuthStateConstraints, RequiredSubjectProvisioningConstraints, SubjectIdCodec, SubjectProvisioningTables, authServicesLayer, column, identityServicesLayer, isMappedConstraintConflict, provisioningFingerprint, requireStandaloneConsume, requiredAuthConstraints, requiredAuthStoreConstraints, requiredExternalIdentityConstraints, requiredIdentityConstraints, requiredOAuthStateConstraints, requiredSubjectProvisioningConstraints, updateValues } from "./drizzle/model.mjs";
|
|
4
|
+
import { AnyEmailAddressMapping, AnyEmailRegistrationMapping, AnyEmailSignInMapping, D1EmailAddressMapping, D1EmailRegistrationMapping, EmailAddressMapping, EmailAuthorityCredentialTable, EmailCommandTable, EmailCredentialReadTable, EmailCredentialTable, EmailD1Clock, EmailIdentifierReadTable, EmailIdentifierTable, EmailRegistrationAuthorityCredentialTable, EmailRegistrationCredentialTable, EmailRegistrationIdentifierTable, EmailRegistrationIntent, EmailRegistrationMapping, EmailRegistrationProvisioning, EmailRegistrationState, EmailRegistrationTable, EmailSignInMapping, EmailSubjectReadTable, EmailSubjectTable, RequiredEmailAddressConstraints, RequiredEmailRegistrationConstraints, RequiredEmailSignInConstraints, requiredEmailAddressConstraints, requiredEmailRegistrationConstraints, requiredEmailSignInConstraints } from "./drizzle/email-model.mjs";
|
|
5
|
+
import { AnyPasswordPersistenceMapping, AnyPasswordRegistrationMapping, D1PasswordPersistenceMapping, PasswordAttemptAction, PasswordAttemptRecord, PasswordAttemptState, PasswordAttemptTable, PasswordAuthorityCredentialTable, PasswordChargeTable, PasswordCommandTable, PasswordConstraintClassifier, PasswordCredentialTable, PasswordD1Clock, PasswordIdentifierTable, PasswordPersistenceMapping, PasswordRateScopeKind, PasswordRateScopeTable, PasswordRegistrationConstraintClassifier, PasswordRegistrationIntent, PasswordRegistrationMapping, PasswordRegistrationProvisioning, PasswordRegistrationState, PasswordRegistrationTable, PasswordScopeKeys, PasswordSubjectTable, RequiredPasswordConstraints, RequiredPasswordRegistrationConstraints, requiredPasswordConstraints, requiredPasswordRegistrationConstraints } from "./drizzle/password-model.mjs";
|
|
6
|
+
import { AnyProofPersistenceMapping, D1ProofPersistenceMapping, ProofAbuseEventTable, ProofAction, ProofAuthorityInput, ProofAuthorityTables, ProofCommandDecision, ProofCommandKind, ProofCommandTable, ProofConstraintClassifier, ProofContinuationRecord, ProofContinuationTable, ProofD1Clock, ProofDeliveryState, ProofFailureEventTable, ProofGenerationState, ProofGenerationTable, ProofPersistenceMapping, ProofRateScopeTable, ProofRequestTable, ProofScopeKeys, ProofScopeKind, ProofSeriesTable, RequiredProofConstraints, requiredProofConstraints } from "./drizzle/proof-model.mjs";
|
|
7
|
+
import { AnyPasswordPreparedPersistenceMapping, D1PasswordPreparedPersistenceMapping, D1PasswordPreparedProofMapping, PasswordPreparedAdmissionTable, PasswordPreparedIntentTable, PasswordPreparedPersistenceMapping, PasswordPreparedProofMapping, PasswordPreparedState, RequiredPasswordPreparedConstraints, requiredPasswordPreparedConstraints } from "./drizzle/password-prepared-model.mjs";
|
|
8
|
+
import { AuthenticationAuthorityMapping, D1AuthenticationAuthorityMapping, D1PendingAuthenticationMapping, D1SessionClockMapping, D1SignedSessionValidityMapping, D1StatefulSessionMapping, PendingAuthenticationMapping, PendingAuthenticationTables, RequiredPendingAuthenticationConstraints, RequiredSessionConstraints, RequiredSignedValidityConstraints, RequiredStatefulPendingConstraints, SessionAuthorityTables, SessionConstraintClassifier, SessionFlowTables, SessionIdCodec, SessionSubjectTables, SignedSessionValidityMapping, SignedSessionValidityTables, StatefulSessionMapping, StatefulSessionTables, requiredPendingAuthenticationConstraints, requiredSessionConstraints, requiredSignedValidityConstraints, requiredStatefulPendingConstraints } from "./drizzle/session-model.mjs";
|
|
9
|
+
import { D1PasskeyMapping, PasskeyAdmissionTable, PasskeyCeremonyMapping, PasskeyChargeInsert, PasskeyChargeKind, PasskeyChargeTable, PasskeyClock, PasskeyColumn, PasskeyCredentialMapping, PasskeyCredentialOwnershipTable, PasskeyCredentialReadTable, PasskeyCredentialServices, PasskeyEnrollmentContextMapping, PasskeyEnrollmentContextServices, PasskeyFactorReadTable, PasskeyFlowInsert, PasskeyFlowState, PasskeyFlowTable, PasskeyHandleOwnershipTable, PasskeyHandleReadTable, PasskeyHandleReservationTable, PasskeyMappingSource, PasskeyModuleTable, PasskeyPersistenceMapping, PasskeyPersistenceServices, PasskeyPolicyGuard, PasskeySubjectIdCodec, PasskeySubjectReadTable, passkeyCredentialsLayer, passkeyEnrollmentContextLayer, passkeyPersistenceLayer, passkeyPolicyGuard, requiredPasskeyCredentialConstraints, requiredPasskeyPersistenceConstraints } from "./drizzle/passkey-model.mjs";
|
|
10
|
+
import { D1SessionStepUpMapping, RequiredSessionStepUpConstraints, SessionStepUpIntentTables, SessionStepUpMapping, SessionStepUpSourceTables, requiredSessionStepUpConstraints } from "./drizzle/step-up-model.mjs";
|
|
11
|
+
import { OAuthAccountsMapping, OAuthAction, OAuthAuthorityReadTable, OAuthAuthorityTable, OAuthCleanupDescriptor, OAuthCleanupTable, OAuthClock, OAuthCredentialReadTable, OAuthCredentialTable, OAuthD1Mapping, OAuthEligibilityDescriptor, OAuthEligibilityFact, OAuthEligibilityTable, OAuthFlowState, OAuthFlowTable, OAuthMetadataPolicy, OAuthOwnershipMutation, OAuthOwnershipReadTable, OAuthOwnershipTable, OAuthReferenceGuardDescriptor, OAuthReferenceGuardTable, OAuthRegistrationAuthority, OAuthRegistrationBase, OAuthRegistrationCommandTable, OAuthRegistrationEligibility, OAuthRegistrationGuardDescriptor, OAuthRegistrationGuardTable, OAuthRegistrationIntentMapping, OAuthRegistrationIntentTable, OAuthRegistrationMapping, OAuthRegistrationState, OAuthSignInMapping, OAuthSubjectReadTable, OAuthSubjectTable, OAuthTupleAuthorityTable, OAuthTupleState, OAuthUnlinkCommandTable, oauthCleanupTable, oauthEligibilityTable, oauthReferenceGuardTable, oauthRegistrationGuardTable, requiredOAuthAccountsConstraints, requiredOAuthRegistrationConstraints, requiredOAuthSignInConstraints, requiredOAuthTupleConstraints } from "./drizzle/oauth-model.mjs";
|
|
12
|
+
import { OAuthConnectedAction, OAuthConnectedAdmissionTable, OAuthConnectedAuthorityMapping, OAuthConnectedClientRegistrationTable, OAuthConnectedCohortTable, OAuthConnectedCommandTable, OAuthConnectedFlowTable, OAuthConnectedGrantTable, OAuthConnectedMapping, OAuthConnectedOrderCodec, OAuthConnectedOwnershipRead, OAuthConnectedPolicyGuard, OAuthConnectedPolicyGuardTable, OAuthConnectedPolicyInput, OAuthConnectedRevocationJobTable, OAuthConnectedRevocationMapping, OAuthConnectedSqlPolicy, OAuthConnectedSubjectTable, oauthConnectedPolicyGuard, requiredOAuthConnectedConstraints, requiredOAuthConnectedRevocationConstraints } from "./drizzle/oauth-connected-model.mjs";
|
|
13
|
+
import { PasskeyRegistrationCeremonyCapabilities, PasskeyRegistrationCeremonyMapping, PasskeyRegistrationCeremonyServices, PasskeyRegistrationIntentReadTable, requiredPasskeyRegistrationCeremonyConstraints } from "./drizzle/passkey-registration-ceremony-model.mjs";
|
|
14
|
+
import { authenticationAuthorityLayer, pendingAuthenticationLayer, signedSessionValidityLayer, statefulSessionLayers } from "./drizzle/session-target.mjs";
|
|
15
|
+
import { proofPersistenceLayer } from "./drizzle/proof-target.mjs";
|
|
16
|
+
import { emailAddressPersistenceLayer, emailRegistrationLayer, emailSignInTargetsLayer } from "./drizzle/email-target.mjs";
|
|
17
|
+
import { OAuthStateDecisions } from "./oauth/OAuthStateDecisions.mjs";
|
|
18
|
+
import { oauthAccountsPersistenceLayer, oauthRegistrationAuthorityLayer, oauthRegistrationIntentsLayer, oauthSignInPersistenceLayer } from "./drizzle/oauth-target.mjs";
|
|
19
|
+
import { oauthConnectedOwnershipReferences } from "./drizzle/oauth-connected-reference.mjs";
|
|
20
|
+
import { oauthConnectedPersistenceLayer, oauthConnectedRevocationsLayer } from "./drizzle/oauth-connected-target.mjs";
|
|
21
|
+
import { passwordPersistenceLayer, passwordRegistrationLayer } from "./drizzle/password-target.mjs";
|
|
22
|
+
import { passwordPreparedPersistenceLayer } from "./drizzle/password-prepared-target.mjs";
|
|
23
|
+
import { D1TotpMapping, TotpMapping, TotpMappingSource, TotpPersistenceServices, requiredTotpConstraints, totpPersistenceLayer } from "./drizzle/totp-model.mjs";
|
|
24
|
+
import { decodeTotpRecord, encodeTotpRecord } from "./drizzle/totp-state.mjs";
|
|
25
|
+
import { PasskeyCommandTable, PasskeyCredentialInsert, PasskeyInvalidationInput, PasskeyInvalidationMutation, PasskeyManagementMapping, PasskeyManagementServices, PasskeyRegistrationMapping, PasskeyRegistrationServices, PasskeyRegistrationWriter, PasskeyWriteTables, passkeyInvalidationMutation, requiredPasskeyManagementConstraints, requiredPasskeyRegistrationWriteConstraints } from "./drizzle/passkey-write-model.mjs";
|
|
26
|
+
import { passkeyManagementPersistenceLayer } from "./drizzle/passkey-write-target.mjs";
|
|
27
|
+
import { D1PhoneMapping, PhoneMapping, PhoneMappingSource, PhonePersistenceServices, PhoneProofCompletionMapping, phonePersistenceLayer, phoneProofCompletionMapping, requiredPhoneConstraints } from "./drizzle/phone-model.mjs";
|
|
28
|
+
export { type AnyEmailAddressMapping, type AnyEmailRegistrationMapping, type AnyEmailSignInMapping, type AnyPasswordPersistenceMapping, type AnyPasswordPreparedPersistenceMapping, type AnyPasswordRegistrationMapping, type AnyProofPersistenceMapping, AuthStoreDecisions, type AuthStoreTables, type AuthTables, type AuthenticationAuthorityMapping, type ChallengeColumns, type ChallengeConsumeDecision, type ChallengeInput, type ChallengeRecord, type ChallengeTableMapping, type CommitMode, type ConsumeDecision, type D1AuthenticationAuthorityMapping, type D1EmailAddressMapping, type D1EmailRegistrationMapping, type D1ExternalIdentityMapping, type D1GeneratedIdentityMapping, type D1PasskeyMapping, type D1PasswordPersistenceMapping, type D1PasswordPreparedPersistenceMapping, type D1PasswordPreparedProofMapping, type D1PendingAuthenticationMapping, type D1PhoneMapping, type D1ProofPersistenceMapping, type D1SessionClockMapping, type D1SessionStepUpMapping, type D1SignedSessionValidityMapping, type D1StatefulSessionMapping, type D1SubjectProvisioningMapping, type D1TotpMapping, DrizzleMappingError, type EmailAddressMapping, type EmailAuthorityCredentialTable, type EmailCommandTable, type EmailCredentialReadTable, type EmailCredentialTable, type EmailD1Clock, type EmailIdentifierReadTable, type EmailIdentifierTable, type EmailRegistrationAuthorityCredentialTable, type EmailRegistrationCredentialTable, type EmailRegistrationIdentifierTable, type EmailRegistrationIntent, type EmailRegistrationMapping, type EmailRegistrationProvisioning, type EmailRegistrationState, type EmailRegistrationTable, type EmailSignInMapping, type EmailSubjectReadTable, type EmailSubjectTable, type ExternalIdentityTables, type IdentityTables, type InstantCodec, type OAuthAccountsMapping, type OAuthAction, type OAuthAuthorityReadTable, type OAuthAuthorityTable, type OAuthCleanupDescriptor, type OAuthCleanupTable, type OAuthClock, type OAuthConnectedAction, type OAuthConnectedAdmissionTable, type OAuthConnectedAuthorityMapping, type OAuthConnectedClientRegistrationTable, type OAuthConnectedCohortTable, type OAuthConnectedCommandTable, type OAuthConnectedFlowTable, type OAuthConnectedGrantTable, type OAuthConnectedMapping, type OAuthConnectedOrderCodec, type OAuthConnectedOwnershipRead, type OAuthConnectedPolicyGuard, type OAuthConnectedPolicyGuardTable, type OAuthConnectedPolicyInput, type OAuthConnectedRevocationJobTable, type OAuthConnectedRevocationMapping, type OAuthConnectedSqlPolicy, type OAuthConnectedSubjectTable, type OAuthCredentialReadTable, type OAuthCredentialTable, type OAuthD1Mapping, type OAuthEligibilityDescriptor, type OAuthEligibilityFact, type OAuthEligibilityTable, type OAuthFlowState, type OAuthFlowTable, type OAuthMetadataPolicy, type OAuthOwnershipMutation, type OAuthOwnershipReadTable, type OAuthOwnershipTable, type OAuthReferenceGuardDescriptor, type OAuthReferenceGuardTable, type OAuthRegistrationAuthority, type OAuthRegistrationBase, type OAuthRegistrationCommandTable, type OAuthRegistrationEligibility, type OAuthRegistrationGuardDescriptor, type OAuthRegistrationGuardTable, type OAuthRegistrationIntentMapping, type OAuthRegistrationIntentTable, type OAuthRegistrationMapping, type OAuthRegistrationState, type OAuthSignInMapping, type OAuthStateColumns, OAuthStateDecisions, type OAuthStateTableMapping, type OAuthStateTables, type OAuthSubjectReadTable, type OAuthSubjectTable, type OAuthTupleAuthorityTable, type OAuthTupleState, type OAuthUnlinkCommandTable, type PasskeyAdmissionTable, type PasskeyCeremonyMapping, type PasskeyChargeInsert, type PasskeyChargeKind, type PasskeyChargeTable, type PasskeyClock, type PasskeyColumn, type PasskeyCommandTable, type PasskeyCredentialInsert, type PasskeyCredentialMapping, type PasskeyCredentialOwnershipTable, type PasskeyCredentialReadTable, type PasskeyCredentialServices, type PasskeyEnrollmentContextMapping, type PasskeyEnrollmentContextServices, type PasskeyFactorReadTable, type PasskeyFlowInsert, type PasskeyFlowState, type PasskeyFlowTable, type PasskeyHandleOwnershipTable, type PasskeyHandleReadTable, type PasskeyHandleReservationTable, type PasskeyInvalidationInput, type PasskeyInvalidationMutation, type PasskeyManagementMapping, type PasskeyManagementServices, type PasskeyMappingSource, type PasskeyModuleTable, type PasskeyPersistenceMapping, type PasskeyPersistenceServices, type PasskeyPolicyGuard, type PasskeyRegistrationCeremonyCapabilities, type PasskeyRegistrationCeremonyMapping, type PasskeyRegistrationCeremonyServices, type PasskeyRegistrationIntentReadTable, type PasskeyRegistrationMapping, type PasskeyRegistrationServices, type PasskeyRegistrationWriter, type PasskeySubjectIdCodec, type PasskeySubjectReadTable, type PasskeyWriteTables, type PasswordAttemptAction, type PasswordAttemptRecord, type PasswordAttemptState, type PasswordAttemptTable, type PasswordAuthorityCredentialTable, type PasswordChargeTable, type PasswordCommandTable, type PasswordConstraintClassifier, type PasswordCredentialTable, type PasswordD1Clock, type PasswordIdentifierTable, type PasswordPersistenceMapping, type PasswordPreparedAdmissionTable, type PasswordPreparedIntentTable, type PasswordPreparedPersistenceMapping, type PasswordPreparedProofMapping, type PasswordPreparedState, type PasswordRateScopeKind, type PasswordRateScopeTable, type PasswordRegistrationConstraintClassifier, type PasswordRegistrationIntent, type PasswordRegistrationMapping, type PasswordRegistrationProvisioning, type PasswordRegistrationState, type PasswordRegistrationTable, type PasswordScopeKeys, type PasswordSubjectTable, type PendingAuthenticationMapping, type PendingAuthenticationTables, type PhoneMapping, type PhoneMappingSource, type PhonePersistenceServices, type PhoneProofCompletionMapping, type ProofAbuseEventTable, type ProofAction, type ProofAuthorityInput, type ProofAuthorityTables, type ProofCommandDecision, type ProofCommandKind, type ProofCommandTable, type ProofConstraintClassifier, type ProofContinuationRecord, type ProofContinuationTable, type ProofD1Clock, type ProofDeliveryState, type ProofFailureEventTable, type ProofGenerationState, type ProofGenerationTable, type ProofPersistenceMapping, type ProofRateScopeTable, type ProofRequestTable, type ProofScopeKeys, type ProofScopeKind, type ProofSeriesTable, type RegistrationColumns, type RegistrationRecord, type RegistrationTableMapping, type RequiredAuthConstraints, type RequiredAuthStoreConstraints, type RequiredEmailAddressConstraints, type RequiredEmailRegistrationConstraints, type RequiredEmailSignInConstraints, type RequiredExternalIdentityConstraints, type RequiredIdentityConstraints, type RequiredOAuthStateConstraints, type RequiredPasswordConstraints, type RequiredPasswordPreparedConstraints, type RequiredPasswordRegistrationConstraints, type RequiredPendingAuthenticationConstraints, type RequiredProofConstraints, type RequiredSessionConstraints, type RequiredSessionStepUpConstraints, type RequiredSignedValidityConstraints, type RequiredStatefulPendingConstraints, type RequiredSubjectProvisioningConstraints, type SessionAuthorityTables, type SessionConstraintClassifier, type SessionFlowTables, type SessionIdCodec, type SessionStepUpIntentTables, type SessionStepUpMapping, type SessionStepUpSourceTables, type SessionSubjectTables, type SignedSessionValidityMapping, type SignedSessionValidityTables, type StatefulSessionMapping, type StatefulSessionTables, type SubjectIdCodec, type SubjectProvisioningTables, type TotpMapping, type TotpMappingSource, type TotpPersistenceServices, authServicesLayer, authenticationAuthorityLayer, column, decodeTotpRecord, emailAddressPersistenceLayer, emailRegistrationLayer, emailSignInTargetsLayer, encodeTotpRecord, identityServicesLayer, isMappedConstraintConflict, oauthAccountsPersistenceLayer, oauthCleanupTable, oauthConnectedOwnershipReferences, oauthConnectedPersistenceLayer, oauthConnectedPolicyGuard, oauthConnectedRevocationsLayer, oauthEligibilityTable, oauthReferenceGuardTable, oauthRegistrationAuthorityLayer, oauthRegistrationGuardTable, oauthRegistrationIntentsLayer, oauthSignInPersistenceLayer, passkeyCredentialsLayer, passkeyEnrollmentContextLayer, passkeyInvalidationMutation, passkeyManagementPersistenceLayer, passkeyPersistenceLayer, passkeyPolicyGuard, passwordPersistenceLayer, passwordPreparedPersistenceLayer, passwordRegistrationLayer, pendingAuthenticationLayer, phonePersistenceLayer, phoneProofCompletionMapping, proofPersistenceLayer, provisioningFingerprint, requireStandaloneConsume, requiredAuthConstraints, requiredAuthStoreConstraints, requiredEmailAddressConstraints, requiredEmailRegistrationConstraints, requiredEmailSignInConstraints, requiredExternalIdentityConstraints, requiredIdentityConstraints, requiredOAuthAccountsConstraints, requiredOAuthConnectedConstraints, requiredOAuthConnectedRevocationConstraints, requiredOAuthRegistrationConstraints, requiredOAuthSignInConstraints, requiredOAuthStateConstraints, requiredOAuthTupleConstraints, requiredPasskeyCredentialConstraints, requiredPasskeyManagementConstraints, requiredPasskeyPersistenceConstraints, requiredPasskeyRegistrationCeremonyConstraints, requiredPasskeyRegistrationWriteConstraints, requiredPasswordConstraints, requiredPasswordPreparedConstraints, requiredPasswordRegistrationConstraints, requiredPendingAuthenticationConstraints, requiredPhoneConstraints, requiredProofConstraints, requiredSessionConstraints, requiredSessionStepUpConstraints, requiredSignedValidityConstraints, requiredStatefulPendingConstraints, requiredSubjectProvisioningConstraints, requiredTotpConstraints, signedSessionValidityLayer, statefulSessionLayers, totpPersistenceLayer, updateValues };
|