@gadicc/loom 1.37.0 → 2.0.0
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/.loom-source-manifest.json +97 -0
- package/README.md +113 -31
- package/db/databaseTls.js +6 -3
- package/db/databaseUrl.js +3 -2
- package/db/drizzle-config.js +14 -16
- package/db/fixtures.d.ts +1 -3
- package/db/fixtures.js +4 -7
- package/esm/bin/loom.d.ts +2 -1
- package/esm/bin/loom.d.ts.map +1 -1
- package/esm/bin/loom.js +37 -10
- package/esm/bin/loom.js.map +1 -0
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/esm/mod.js.map +1 -0
- package/esm/src/apiKeys/authorize.d.ts.map +1 -1
- package/esm/src/apiKeys/authorize.js +15 -14
- package/esm/src/apiKeys/authorize.js.map +1 -0
- package/esm/src/apiKeys/betterAuth.d.ts.map +1 -1
- package/esm/src/apiKeys/betterAuth.js +1 -0
- package/esm/src/apiKeys/betterAuth.js.map +1 -0
- package/esm/src/apiKeys/country.d.ts.map +1 -1
- package/esm/src/apiKeys/country.js +1 -0
- package/esm/src/apiKeys/country.js.map +1 -0
- package/esm/src/apiKeys/credentials.d.ts.map +1 -1
- package/esm/src/apiKeys/credentials.js +3 -1
- package/esm/src/apiKeys/credentials.js.map +1 -0
- package/esm/src/apiKeys/fingerprint.d.ts.map +1 -1
- package/esm/src/apiKeys/fingerprint.js +1 -0
- package/esm/src/apiKeys/fingerprint.js.map +1 -0
- package/esm/src/apiKeys/lifecycle.d.ts.map +1 -1
- package/esm/src/apiKeys/lifecycle.js +1 -0
- package/esm/src/apiKeys/lifecycle.js.map +1 -0
- package/esm/src/apiKeys/limits.d.ts.map +1 -1
- package/esm/src/apiKeys/limits.js +10 -10
- package/esm/src/apiKeys/limits.js.map +1 -0
- package/esm/src/apiKeys/mod.d.ts +0 -1
- package/esm/src/apiKeys/mod.d.ts.map +1 -1
- package/esm/src/apiKeys/mod.js +1 -1
- package/esm/src/apiKeys/mod.js.map +1 -0
- package/esm/src/apiKeys/permissions.d.ts.map +1 -1
- package/esm/src/apiKeys/permissions.js +1 -0
- package/esm/src/apiKeys/permissions.js.map +1 -0
- package/esm/src/apiKeys/policy.d.ts.map +1 -1
- package/esm/src/apiKeys/policy.js +1 -0
- package/esm/src/apiKeys/policy.js.map +1 -0
- package/esm/src/apiKeys/retention.d.ts.map +1 -1
- package/esm/src/apiKeys/retention.js +1 -0
- package/esm/src/apiKeys/retention.js.map +1 -0
- package/esm/src/apiKeys/types.d.ts.map +1 -1
- package/esm/src/apiKeys/types.js +1 -0
- package/esm/src/apiKeys/types.js.map +1 -0
- package/esm/src/cli/atomicText.d.ts +3 -0
- package/esm/src/cli/atomicText.d.ts.map +1 -0
- package/esm/src/cli/atomicText.js +33 -0
- package/esm/src/cli/atomicText.js.map +1 -0
- package/esm/src/cli/bunLocalDev.d.ts +65 -0
- package/esm/src/cli/bunLocalDev.d.ts.map +1 -0
- package/esm/src/cli/bunLocalDev.js +459 -0
- package/esm/src/cli/bunLocalDev.js.map +1 -0
- package/esm/src/cli/bunProject.d.ts +30 -0
- package/esm/src/cli/bunProject.d.ts.map +1 -0
- package/esm/src/cli/bunProject.js +309 -0
- package/esm/src/cli/bunProject.js.map +1 -0
- package/esm/src/cli/cliBootstrap.d.ts +83 -0
- package/esm/src/cli/cliBootstrap.d.ts.map +1 -0
- package/esm/src/cli/cliBootstrap.js +186 -0
- package/esm/src/cli/cliBootstrap.js.map +1 -0
- package/esm/src/cli/externalSkills.d.ts.map +1 -1
- package/esm/src/cli/externalSkills.js +9 -5
- package/esm/src/cli/externalSkills.js.map +1 -0
- package/esm/src/cli/filesR2Policy.d.ts.map +1 -1
- package/esm/src/cli/filesR2Policy.js +18 -11
- package/esm/src/cli/filesR2Policy.js.map +1 -0
- package/esm/src/cli/generatedBuild.d.ts +42 -0
- package/esm/src/cli/generatedBuild.d.ts.map +1 -0
- package/esm/src/cli/generatedBuild.js +259 -0
- package/esm/src/cli/generatedBuild.js.map +1 -0
- package/esm/src/cli/generatedCleanup.d.ts +7 -0
- package/esm/src/cli/generatedCleanup.d.ts.map +1 -0
- package/esm/src/cli/generatedCleanup.js +67 -0
- package/esm/src/cli/generatedCleanup.js.map +1 -0
- package/esm/src/cli/generatedDevLease.d.ts +8 -0
- package/esm/src/cli/generatedDevLease.d.ts.map +1 -0
- package/esm/src/cli/generatedDevLease.js +39 -0
- package/esm/src/cli/generatedDevLease.js.map +1 -0
- package/esm/src/cli/generatedInstall.d.ts +64 -0
- package/esm/src/cli/generatedInstall.d.ts.map +1 -0
- package/esm/src/cli/generatedInstall.js +466 -0
- package/esm/src/cli/generatedInstall.js.map +1 -0
- package/esm/src/cli/generatedWorkflow.d.ts +34 -0
- package/esm/src/cli/generatedWorkflow.d.ts.map +1 -0
- package/esm/src/cli/generatedWorkflow.js +85 -0
- package/esm/src/cli/generatedWorkflow.js.map +1 -0
- package/esm/src/cli/legacyManagedOutputs.d.ts.map +1 -1
- package/esm/src/cli/legacyManagedOutputs.js +1 -0
- package/esm/src/cli/legacyManagedOutputs.js.map +1 -0
- package/esm/src/cli/localDb.d.ts.map +1 -1
- package/esm/src/cli/localDb.js +35 -30
- package/esm/src/cli/localDb.js.map +1 -0
- package/esm/src/cli/localDevLock.d.ts +9 -0
- package/esm/src/cli/localDevLock.d.ts.map +1 -1
- package/esm/src/cli/localDevLock.js +54 -13
- package/esm/src/cli/localDevLock.js.map +1 -0
- package/esm/src/cli/localDevPackage.d.ts +6 -11
- package/esm/src/cli/localDevPackage.d.ts.map +1 -1
- package/esm/src/cli/localDevPackage.js +51 -48
- package/esm/src/cli/localDevPackage.js.map +1 -0
- package/esm/src/cli/managedFiles.d.ts.map +1 -1
- package/esm/src/cli/managedFiles.js +34 -18
- package/esm/src/cli/managedFiles.js.map +1 -0
- package/esm/src/cli/migrationEnv.d.ts +16 -3
- package/esm/src/cli/migrationEnv.d.ts.map +1 -1
- package/esm/src/cli/migrationEnv.js +9 -6
- package/esm/src/cli/migrationEnv.js.map +1 -0
- package/esm/src/cli/mod.d.ts +20 -7
- package/esm/src/cli/mod.d.ts.map +1 -1
- package/esm/src/cli/mod.js +2148 -730
- package/esm/src/cli/mod.js.map +1 -0
- package/esm/src/cli/packageTreeSignature.d.ts +8 -0
- package/esm/src/cli/packageTreeSignature.d.ts.map +1 -0
- package/esm/src/cli/packageTreeSignature.js +60 -0
- package/esm/src/cli/packageTreeSignature.js.map +1 -0
- package/esm/src/cli/processIdentity.d.ts +7 -0
- package/esm/src/cli/processIdentity.d.ts.map +1 -0
- package/esm/src/cli/processIdentity.js +39 -0
- package/esm/src/cli/processIdentity.js.map +1 -0
- package/esm/src/cli/projectSkills.d.ts +1 -1
- package/esm/src/cli/projectSkills.d.ts.map +1 -1
- package/esm/src/cli/projectSkills.js +31 -23
- package/esm/src/cli/projectSkills.js.map +1 -0
- package/esm/src/cli/projectTooling.d.ts +6 -3
- package/esm/src/cli/projectTooling.d.ts.map +1 -1
- package/esm/src/cli/projectTooling.js +86 -41
- package/esm/src/cli/projectTooling.js.map +1 -0
- package/esm/src/cli/releaseConfig.d.ts.map +1 -1
- package/esm/src/cli/releaseConfig.js +5 -3
- package/esm/src/cli/releaseConfig.js.map +1 -0
- package/esm/src/cli/releaseCredentials.d.ts.map +1 -1
- package/esm/src/cli/releaseCredentials.js +19 -31
- package/esm/src/cli/releaseCredentials.js.map +1 -0
- package/esm/src/cli/releaseTrust.d.ts.map +1 -1
- package/esm/src/cli/releaseTrust.js +11 -4
- package/esm/src/cli/releaseTrust.js.map +1 -0
- package/esm/src/cli/releaseTrustCommand.d.ts.map +1 -1
- package/esm/src/cli/releaseTrustCommand.js +6 -4
- package/esm/src/cli/releaseTrustCommand.js.map +1 -0
- package/esm/src/cli/sourceConfig.d.ts +3 -0
- package/esm/src/cli/sourceConfig.d.ts.map +1 -0
- package/esm/src/cli/sourceConfig.js +91 -0
- package/esm/src/cli/sourceConfig.js.map +1 -0
- package/esm/src/cli/sourceDev.d.ts +77 -0
- package/esm/src/cli/sourceDev.d.ts.map +1 -0
- package/esm/src/cli/sourceDev.js +974 -0
- package/esm/src/cli/sourceDev.js.map +1 -0
- package/esm/src/cli/vercelBuildEnv.d.ts.map +1 -1
- package/esm/src/cli/vercelBuildEnv.js +44 -21
- package/esm/src/cli/vercelBuildEnv.js.map +1 -0
- package/esm/src/cli/vercelEnvMask.d.ts +38 -0
- package/esm/src/cli/vercelEnvMask.d.ts.map +1 -0
- package/esm/src/cli/vercelEnvMask.js +140 -0
- package/esm/src/cli/vercelEnvMask.js.map +1 -0
- package/esm/src/cli/vercelProjectRelease.d.ts.map +1 -1
- package/esm/src/cli/vercelProjectRelease.js +47 -24
- package/esm/src/cli/vercelProjectRelease.js.map +1 -0
- package/esm/src/cli/vercelPulledEnv.d.ts +65 -0
- package/esm/src/cli/vercelPulledEnv.d.ts.map +1 -0
- package/esm/src/cli/vercelPulledEnv.js +133 -0
- package/esm/src/cli/vercelPulledEnv.js.map +1 -0
- package/esm/src/clientData/identity.d.ts.map +1 -1
- package/esm/src/clientData/identity.js +1 -0
- package/esm/src/clientData/identity.js.map +1 -0
- package/esm/src/clientData/mod.d.ts +0 -1
- package/esm/src/clientData/mod.d.ts.map +1 -1
- package/esm/src/clientData/mod.js +1 -0
- package/esm/src/clientData/mod.js.map +1 -0
- package/esm/src/files/client.d.ts +1 -1
- package/esm/src/files/client.d.ts.map +1 -1
- package/esm/src/files/client.js +3 -4
- package/esm/src/files/client.js.map +1 -0
- package/esm/src/files/errors.d.ts.map +1 -1
- package/esm/src/files/errors.js +3 -12
- package/esm/src/files/errors.js.map +1 -0
- package/esm/src/files/hash.d.ts +1 -1
- package/esm/src/files/hash.d.ts.map +1 -1
- package/esm/src/files/hash.js +1 -0
- package/esm/src/files/hash.js.map +1 -0
- package/esm/src/files/memory.d.ts.map +1 -1
- package/esm/src/files/memory.js +2 -1
- package/esm/src/files/memory.js.map +1 -0
- package/esm/src/files/metadata.d.ts.map +1 -1
- package/esm/src/files/metadata.js +11 -18
- package/esm/src/files/metadata.js.map +1 -0
- package/esm/src/files/mod.d.ts +0 -1
- package/esm/src/files/mod.d.ts.map +1 -1
- package/esm/src/files/mod.js +1 -1
- package/esm/src/files/mod.js.map +1 -0
- package/esm/src/files/s3.d.ts.map +1 -1
- package/esm/src/files/s3.js +6 -4
- package/esm/src/files/s3.js.map +1 -0
- package/esm/src/files/service.d.ts.map +1 -1
- package/esm/src/files/service.js +3 -4
- package/esm/src/files/service.js.map +1 -0
- package/esm/src/files/types.d.ts.map +1 -1
- package/esm/src/files/types.js +1 -0
- package/esm/src/files/types.js.map +1 -0
- package/esm/src/jobs/catalog.d.ts.map +1 -1
- package/esm/src/jobs/catalog.js +5 -1
- package/esm/src/jobs/catalog.js.map +1 -0
- package/esm/src/jobs/controller.d.ts +1 -1
- package/esm/src/jobs/controller.d.ts.map +1 -1
- package/esm/src/jobs/controller.js +11 -55
- package/esm/src/jobs/controller.js.map +1 -0
- package/esm/src/jobs/direct.d.ts.map +1 -1
- package/esm/src/jobs/direct.js +3 -3
- package/esm/src/jobs/direct.js.map +1 -0
- package/esm/src/jobs/events.d.ts.map +1 -1
- package/esm/src/jobs/events.js +1 -0
- package/esm/src/jobs/events.js.map +1 -0
- package/esm/src/jobs/format.d.ts +5 -5
- package/esm/src/jobs/format.d.ts.map +1 -1
- package/esm/src/jobs/format.js +2 -1
- package/esm/src/jobs/format.js.map +1 -0
- package/esm/src/jobs/http.d.ts +3 -3
- package/esm/src/jobs/http.d.ts.map +1 -1
- package/esm/src/jobs/http.js +1 -0
- package/esm/src/jobs/http.js.map +1 -0
- package/esm/src/jobs/log.d.ts.map +1 -1
- package/esm/src/jobs/log.js +1 -0
- package/esm/src/jobs/log.js.map +1 -0
- package/esm/src/jobs/mod.d.ts.map +1 -1
- package/esm/src/jobs/mod.js +1 -0
- package/esm/src/jobs/mod.js.map +1 -0
- package/esm/src/jobs/run.d.ts.map +1 -1
- package/esm/src/jobs/run.js +1 -0
- package/esm/src/jobs/run.js.map +1 -0
- package/esm/src/jobs/sanitize.d.ts.map +1 -1
- package/esm/src/jobs/sanitize.js +1 -0
- package/esm/src/jobs/sanitize.js.map +1 -0
- package/esm/src/jobs/types.d.ts +1 -0
- package/esm/src/jobs/types.d.ts.map +1 -1
- package/esm/src/jobs/types.js +1 -0
- package/esm/src/jobs/types.js.map +1 -0
- package/esm/src/mail/errors.d.ts.map +1 -1
- package/esm/src/mail/errors.js +8 -42
- package/esm/src/mail/errors.js.map +1 -0
- package/esm/src/mail/memory.d.ts +1 -1
- package/esm/src/mail/memory.d.ts.map +1 -1
- package/esm/src/mail/memory.js +10 -14
- package/esm/src/mail/memory.js.map +1 -0
- package/esm/src/mail/mod.d.ts +0 -1
- package/esm/src/mail/mod.d.ts.map +1 -1
- package/esm/src/mail/mod.js +1 -1
- package/esm/src/mail/mod.js.map +1 -0
- package/esm/src/mail/postal.d.ts +1 -2
- package/esm/src/mail/postal.d.ts.map +1 -1
- package/esm/src/mail/postal.js +22 -18
- package/esm/src/mail/postal.js.map +1 -0
- package/esm/src/mail/retry.d.ts.map +1 -1
- package/esm/src/mail/retry.js +1 -0
- package/esm/src/mail/retry.js.map +1 -0
- package/esm/src/mail/sender.d.ts.map +1 -1
- package/esm/src/mail/sender.js +1 -0
- package/esm/src/mail/sender.js.map +1 -0
- package/esm/src/mail/service.d.ts.map +1 -1
- package/esm/src/mail/service.js +6 -7
- package/esm/src/mail/service.js.map +1 -0
- package/esm/src/mail/types.d.ts.map +1 -1
- package/esm/src/mail/types.js +1 -0
- package/esm/src/mail/types.js.map +1 -0
- package/esm/src/mui/apiKeys.d.ts +10 -11
- package/esm/src/mui/apiKeys.d.ts.map +1 -1
- package/esm/src/mui/apiKeys.js +83 -214
- package/esm/src/mui/apiKeys.js.map +1 -0
- package/esm/src/mui/apiKeysView.d.ts +1 -1
- package/esm/src/mui/apiKeysView.d.ts.map +1 -1
- package/esm/src/mui/apiKeysView.js +11 -9
- package/esm/src/mui/apiKeysView.js.map +1 -0
- package/esm/src/mui/confirm.d.ts +2 -2
- package/esm/src/mui/confirm.d.ts.map +1 -1
- package/esm/src/mui/confirm.js +3 -7
- package/esm/src/mui/confirm.js.map +1 -0
- package/esm/src/mui/mail.d.ts +4 -4
- package/esm/src/mui/mail.d.ts.map +1 -1
- package/esm/src/mui/mail.js +11 -71
- package/esm/src/mui/mail.js.map +1 -0
- package/esm/src/mui/mailView.d.ts +1 -1
- package/esm/src/mui/mailView.d.ts.map +1 -1
- package/esm/src/mui/mailView.js +1 -0
- package/esm/src/mui/mailView.js.map +1 -0
- package/esm/src/mui/mod.d.ts +0 -1
- package/esm/src/mui/mod.d.ts.map +1 -1
- package/esm/src/mui/mod.js +1 -0
- package/esm/src/mui/mod.js.map +1 -0
- package/esm/src/next/apiKeys/mod.d.ts +2 -3
- package/esm/src/next/apiKeys/mod.d.ts.map +1 -1
- package/esm/src/next/apiKeys/mod.js +6 -5
- package/esm/src/next/apiKeys/mod.js.map +1 -0
- package/esm/src/next/auth/client.d.ts +0 -1
- package/esm/src/next/auth/client.d.ts.map +1 -1
- package/esm/src/next/auth/client.js +1 -0
- package/esm/src/next/auth/client.js.map +1 -0
- package/esm/src/next/auth/config.d.ts.map +1 -1
- package/esm/src/next/auth/config.js +11 -17
- package/esm/src/next/auth/config.js.map +1 -0
- package/esm/src/next/auth/localTestLogin.d.ts.map +1 -1
- package/esm/src/next/auth/localTestLogin.js +13 -9
- package/esm/src/next/auth/localTestLogin.js.map +1 -0
- package/esm/src/next/auth/mod.d.ts.map +1 -1
- package/esm/src/next/auth/mod.js +1 -0
- package/esm/src/next/auth/mod.js.map +1 -0
- package/esm/src/next/auth/server.d.ts +2 -2
- package/esm/src/next/auth/server.d.ts.map +1 -1
- package/esm/src/next/auth/server.js +1 -0
- package/esm/src/next/auth/server.js.map +1 -0
- package/esm/src/next/files/mod.d.ts +0 -1
- package/esm/src/next/files/mod.d.ts.map +1 -1
- package/esm/src/next/files/mod.js +1 -1
- package/esm/src/next/files/mod.js.map +1 -0
- package/esm/src/next/files/route.d.ts +1 -1
- package/esm/src/next/files/route.d.ts.map +1 -1
- package/esm/src/next/files/route.js +11 -11
- package/esm/src/next/files/route.js.map +1 -0
- package/esm/src/next/jobs/list.d.ts +5 -5
- package/esm/src/next/jobs/list.d.ts.map +1 -1
- package/esm/src/next/jobs/list.js +15 -19
- package/esm/src/next/jobs/list.js.map +1 -0
- package/esm/src/next/jobs/mod.d.ts.map +1 -1
- package/esm/src/next/jobs/mod.js +1 -0
- package/esm/src/next/jobs/mod.js.map +1 -0
- package/esm/src/next/jobs/paths.d.ts +2 -2
- package/esm/src/next/jobs/paths.d.ts.map +1 -1
- package/esm/src/next/jobs/paths.js +1 -0
- package/esm/src/next/jobs/paths.js.map +1 -0
- package/esm/src/next/jobs/route.d.ts +2 -2
- package/esm/src/next/jobs/route.d.ts.map +1 -1
- package/esm/src/next/jobs/route.js +4 -4
- package/esm/src/next/jobs/route.js.map +1 -0
- package/esm/src/next/jobs/run.d.ts +2 -2
- package/esm/src/next/jobs/run.d.ts.map +1 -1
- package/esm/src/next/jobs/run.js +68 -132
- package/esm/src/next/jobs/run.js.map +1 -0
- package/esm/src/next/jobs/runRequest.d.ts +1 -1
- package/esm/src/next/jobs/runRequest.d.ts.map +1 -1
- package/esm/src/next/jobs/runRequest.js +3 -4
- package/esm/src/next/jobs/runRequest.js.map +1 -0
- package/esm/src/next/jobs/stream.d.ts.map +1 -1
- package/esm/src/next/jobs/stream.js +1 -0
- package/esm/src/next/jobs/stream.js.map +1 -0
- package/esm/src/next/mail/mod.d.ts +0 -1
- package/esm/src/next/mail/mod.d.ts.map +1 -1
- package/esm/src/next/mail/mod.js +1 -1
- package/esm/src/next/mail/mod.js.map +1 -0
- package/esm/src/next/mail/route.d.ts +2 -2
- package/esm/src/next/mail/route.d.ts.map +1 -1
- package/esm/src/next/mail/route.js +1 -0
- package/esm/src/next/mail/route.js.map +1 -0
- package/esm/src/next/pwa/mod.d.ts +0 -4
- package/esm/src/next/pwa/mod.d.ts.map +1 -1
- package/esm/src/next/pwa/mod.js +32 -16
- package/esm/src/next/pwa/mod.js.map +1 -0
- package/esm/src/next/pwa/worker.d.ts +0 -1
- package/esm/src/next/pwa/worker.d.ts.map +1 -1
- package/esm/src/next/pwa/worker.js +1 -0
- package/esm/src/next/pwa/worker.js.map +1 -0
- package/esm/src/next/secrets/constants.d.ts +3 -0
- package/esm/src/next/secrets/constants.d.ts.map +1 -0
- package/esm/src/next/secrets/constants.js +3 -0
- package/esm/src/next/secrets/constants.js.map +1 -0
- package/esm/src/next/secrets/mod.d.ts +1 -3
- package/esm/src/next/secrets/mod.d.ts.map +1 -1
- package/esm/src/next/secrets/mod.js +6 -7
- package/esm/src/next/secrets/mod.js.map +1 -0
- package/esm/src/next/sourceDev.d.ts +6 -0
- package/esm/src/next/sourceDev.d.ts.map +1 -0
- package/esm/src/next/sourceDev.js +41 -0
- package/esm/src/next/sourceDev.js.map +1 -0
- package/esm/src/secrets/encoding.d.ts.map +1 -1
- package/esm/src/secrets/encoding.js +1 -0
- package/esm/src/secrets/encoding.js.map +1 -0
- package/esm/src/secrets/errors.d.ts.map +1 -1
- package/esm/src/secrets/errors.js +3 -7
- package/esm/src/secrets/errors.js.map +1 -0
- package/esm/src/secrets/fingerprint.d.ts.map +1 -1
- package/esm/src/secrets/fingerprint.js +1 -0
- package/esm/src/secrets/fingerprint.js.map +1 -0
- package/esm/src/secrets/frame.d.ts.map +1 -1
- package/esm/src/secrets/frame.js +4 -3
- package/esm/src/secrets/frame.js.map +1 -0
- package/esm/src/secrets/keyring.d.ts.map +1 -1
- package/esm/src/secrets/keyring.js +6 -6
- package/esm/src/secrets/keyring.js.map +1 -0
- package/esm/src/secrets/legacy.d.ts +0 -1
- package/esm/src/secrets/legacy.d.ts.map +1 -1
- package/esm/src/secrets/legacy.js +13 -10
- package/esm/src/secrets/legacy.js.map +1 -0
- package/esm/src/secrets/maintenance.d.ts +0 -1
- package/esm/src/secrets/maintenance.d.ts.map +1 -1
- package/esm/src/secrets/maintenance.js +9 -24
- package/esm/src/secrets/maintenance.js.map +1 -0
- package/esm/src/secrets/mod.d.ts +0 -1
- package/esm/src/secrets/mod.d.ts.map +1 -1
- package/esm/src/secrets/mod.js +1 -1
- package/esm/src/secrets/mod.js.map +1 -0
- package/esm/src/secrets/secrets.d.ts.map +1 -1
- package/esm/src/secrets/secrets.js +38 -30
- package/esm/src/secrets/secrets.js.map +1 -0
- package/package.json +111 -135
- package/skills/loom/SKILL.md +40 -5
- package/skills/loom/references/dependency-upgrades.md +4 -0
- package/skills/loom/references/esm-package.md +35 -0
- package/skills/loom/references/local-development.md +261 -29
- package/skills/loom/references/release-safety.md +10 -3
- package/skills/loom-auth/references/secrets-and-rotation.md +2 -1
- package/skills/loom-mail/SKILL.md +1 -0
- package/skills/loom-scaffold/references/greenfield-workflow.md +2 -1
- package/skills/upgrade-deps/SKILL.md +4 -2
- package/source/bin/loom.ts +50 -0
- package/source/mod.ts +10 -0
- package/source/src/apiKeys/authorize.ts +294 -0
- package/source/src/apiKeys/betterAuth.ts +253 -0
- package/source/src/apiKeys/country.ts +7 -0
- package/source/src/apiKeys/credentials.ts +171 -0
- package/source/src/apiKeys/fingerprint.ts +10 -0
- package/{script/src/apiKeys/lifecycle.d.ts → source/src/apiKeys/lifecycle.ts} +21 -23
- package/source/src/apiKeys/limits.ts +372 -0
- package/source/src/apiKeys/mod.ts +11 -0
- package/source/src/apiKeys/permissions.ts +153 -0
- package/source/src/apiKeys/policy.ts +189 -0
- package/source/src/apiKeys/retention.ts +136 -0
- package/source/src/apiKeys/types.ts +288 -0
- package/source/src/cli/atomicText.ts +38 -0
- package/source/src/cli/bunLocalDev.ts +646 -0
- package/source/src/cli/bunProject.ts +433 -0
- package/source/src/cli/cliBootstrap.ts +313 -0
- package/source/src/cli/externalSkills.ts +315 -0
- package/source/src/cli/filesR2Policy.ts +212 -0
- package/source/src/cli/generatedBuild.ts +380 -0
- package/source/src/cli/generatedCleanup.ts +87 -0
- package/source/src/cli/generatedDevLease.ts +52 -0
- package/source/src/cli/generatedInstall.ts +630 -0
- package/source/src/cli/generatedWorkflow.ts +135 -0
- package/{script/src/cli/legacyManagedOutputs.js → source/src/cli/legacyManagedOutputs.ts} +36 -30
- package/source/src/cli/localDb.ts +548 -0
- package/source/src/cli/localDevLock.ts +462 -0
- package/source/src/cli/localDevPackage.ts +754 -0
- package/source/src/cli/managedFiles.ts +688 -0
- package/source/src/cli/migrationEnv.ts +267 -0
- package/source/src/cli/mod.ts +26788 -0
- package/source/src/cli/packageTreeSignature.ts +65 -0
- package/source/src/cli/processIdentity.ts +38 -0
- package/source/src/cli/projectSkills.ts +1102 -0
- package/source/src/cli/projectTooling.ts +1140 -0
- package/source/src/cli/releaseConfig.ts +36 -0
- package/source/src/cli/releaseCredentials.ts +642 -0
- package/source/src/cli/releaseTrust.ts +194 -0
- package/source/src/cli/releaseTrustCommand.ts +210 -0
- package/source/src/cli/sourceConfig.ts +106 -0
- package/source/src/cli/sourceDev.ts +1279 -0
- package/source/src/cli/vercelBuildEnv.ts +714 -0
- package/source/src/cli/vercelEnvMask.ts +182 -0
- package/source/src/cli/vercelProjectRelease.ts +807 -0
- package/source/src/cli/vercelPulledEnv.ts +174 -0
- package/source/src/clientData/identity.ts +229 -0
- package/source/src/clientData/mod.ts +1 -0
- package/source/src/files/client.ts +75 -0
- package/source/src/files/errors.ts +69 -0
- package/source/src/files/hash.ts +109 -0
- package/source/src/files/memory.ts +158 -0
- package/source/src/files/metadata.ts +251 -0
- package/source/src/files/mod.ts +8 -0
- package/source/src/files/s3.ts +182 -0
- package/source/src/files/service.ts +210 -0
- package/source/src/files/types.ts +171 -0
- package/source/src/jobs/catalog.ts +303 -0
- package/source/src/jobs/controller.ts +156 -0
- package/source/src/jobs/direct.ts +177 -0
- package/source/src/jobs/events.ts +74 -0
- package/source/src/jobs/format.ts +233 -0
- package/source/src/jobs/http.ts +83 -0
- package/source/src/jobs/log.ts +10 -0
- package/source/src/jobs/mod.ts +10 -0
- package/source/src/jobs/run.ts +141 -0
- package/source/src/jobs/sanitize.ts +142 -0
- package/source/src/jobs/types.ts +43 -0
- package/source/src/mail/errors.ts +77 -0
- package/source/src/mail/memory.ts +451 -0
- package/source/src/mail/mod.ts +5 -0
- package/source/src/mail/postal.ts +363 -0
- package/source/src/mail/retry.ts +30 -0
- package/source/src/mail/sender.ts +57 -0
- package/source/src/mail/service.ts +252 -0
- package/source/src/mail/types.ts +229 -0
- package/source/src/mui/apiKeys.tsx +1044 -0
- package/source/src/mui/apiKeysView.ts +535 -0
- package/source/src/mui/confirm.tsx +138 -0
- package/source/src/mui/mail.tsx +279 -0
- package/source/src/mui/mailView.ts +50 -0
- package/source/src/mui/mod.ts +3 -0
- package/source/src/next/apiKeys/mod.ts +393 -0
- package/{script/src/next/auth/client.d.ts → source/src/next/auth/client.ts} +19 -5
- package/source/src/next/auth/config.ts +207 -0
- package/source/src/next/auth/localTestLogin.ts +412 -0
- package/source/src/next/auth/mod.ts +3 -0
- package/source/src/next/auth/server.ts +94 -0
- package/source/src/next/files/mod.ts +1 -0
- package/source/src/next/files/route.ts +621 -0
- package/source/src/next/jobs/list.tsx +90 -0
- package/source/src/next/jobs/mod.ts +5 -0
- package/source/src/next/jobs/paths.ts +70 -0
- package/source/src/next/jobs/route.ts +207 -0
- package/source/src/next/jobs/run.tsx +888 -0
- package/source/src/next/jobs/runRequest.ts +92 -0
- package/source/src/next/jobs/stream.ts +33 -0
- package/source/src/next/mail/mod.ts +1 -0
- package/source/src/next/mail/route.ts +75 -0
- package/source/src/next/pwa/mod.tsx +453 -0
- package/source/src/next/pwa/worker.ts +59 -0
- package/source/src/next/secrets/constants.ts +2 -0
- package/source/src/next/secrets/mod.ts +319 -0
- package/source/src/next/sourceDev.ts +50 -0
- package/source/src/secrets/encoding.ts +102 -0
- package/source/src/secrets/errors.ts +58 -0
- package/source/src/secrets/fingerprint.ts +132 -0
- package/source/src/secrets/frame.ts +119 -0
- package/source/src/secrets/keyring.ts +225 -0
- package/source/src/secrets/legacy.ts +244 -0
- package/source/src/secrets/maintenance.ts +517 -0
- package/source/src/secrets/mod.ts +38 -0
- package/source/src/secrets/secrets.ts +926 -0
- package/db/databaseTls.test.ts +0 -171
- package/db/databaseUrl.test.ts +0 -72
- package/db/neonEndpoint.test.ts +0 -51
- package/db/testing.test.ts +0 -28
- package/deno.json +0 -3
- package/esm/_dnt.polyfills.d.ts +0 -166
- package/esm/_dnt.polyfills.d.ts.map +0 -1
- package/esm/_dnt.polyfills.js +0 -177
- package/esm/_dnt.shims.d.ts +0 -2
- package/esm/_dnt.shims.d.ts.map +0 -1
- package/esm/_dnt.shims.js +0 -57
- package/esm/package.json +0 -3
- package/script/_dnt.polyfills.d.ts +0 -166
- package/script/_dnt.polyfills.d.ts.map +0 -1
- package/script/_dnt.polyfills.js +0 -180
- package/script/_dnt.shims.d.ts +0 -2
- package/script/_dnt.shims.d.ts.map +0 -1
- package/script/_dnt.shims.js +0 -60
- package/script/bin/loom.d.ts +0 -2
- package/script/bin/loom.d.ts.map +0 -1
- package/script/bin/loom.js +0 -17
- package/script/mod.d.ts +0 -12
- package/script/mod.d.ts.map +0 -1
- package/script/mod.js +0 -27
- package/script/package.json +0 -3
- package/script/src/apiKeys/authorize.d.ts +0 -4
- package/script/src/apiKeys/authorize.d.ts.map +0 -1
- package/script/src/apiKeys/authorize.js +0 -258
- package/script/src/apiKeys/betterAuth.d.ts +0 -123
- package/script/src/apiKeys/betterAuth.d.ts.map +0 -1
- package/script/src/apiKeys/betterAuth.js +0 -169
- package/script/src/apiKeys/country.d.ts +0 -3
- package/script/src/apiKeys/country.d.ts.map +0 -1
- package/script/src/apiKeys/country.js +0 -10
- package/script/src/apiKeys/credentials.d.ts +0 -39
- package/script/src/apiKeys/credentials.d.ts.map +0 -1
- package/script/src/apiKeys/credentials.js +0 -121
- package/script/src/apiKeys/fingerprint.d.ts +0 -3
- package/script/src/apiKeys/fingerprint.d.ts.map +0 -1
- package/script/src/apiKeys/fingerprint.js +0 -8
- package/script/src/apiKeys/lifecycle.d.ts.map +0 -1
- package/script/src/apiKeys/lifecycle.js +0 -7
- package/script/src/apiKeys/limits.d.ts +0 -132
- package/script/src/apiKeys/limits.d.ts.map +0 -1
- package/script/src/apiKeys/limits.js +0 -254
- package/script/src/apiKeys/mod.d.ts +0 -13
- package/script/src/apiKeys/mod.d.ts.map +0 -1
- package/script/src/apiKeys/mod.js +0 -28
- package/script/src/apiKeys/permissions.d.ts +0 -56
- package/script/src/apiKeys/permissions.d.ts.map +0 -1
- package/script/src/apiKeys/permissions.js +0 -136
- package/script/src/apiKeys/policy.d.ts +0 -61
- package/script/src/apiKeys/policy.d.ts.map +0 -1
- package/script/src/apiKeys/policy.js +0 -94
- package/script/src/apiKeys/retention.d.ts +0 -55
- package/script/src/apiKeys/retention.d.ts.map +0 -1
- package/script/src/apiKeys/retention.js +0 -70
- package/script/src/apiKeys/types.d.ts +0 -242
- package/script/src/apiKeys/types.d.ts.map +0 -1
- package/script/src/apiKeys/types.js +0 -2
- package/script/src/cli/externalSkills.d.ts +0 -39
- package/script/src/cli/externalSkills.d.ts.map +0 -1
- package/script/src/cli/externalSkills.js +0 -204
- package/script/src/cli/filesR2Policy.d.ts +0 -33
- package/script/src/cli/filesR2Policy.d.ts.map +0 -1
- package/script/src/cli/filesR2Policy.js +0 -135
- package/script/src/cli/legacyManagedOutputs.d.ts +0 -33
- package/script/src/cli/legacyManagedOutputs.d.ts.map +0 -1
- package/script/src/cli/localDb.d.ts +0 -28
- package/script/src/cli/localDb.d.ts.map +0 -1
- package/script/src/cli/localDb.js +0 -370
- package/script/src/cli/localDevLock.d.ts +0 -97
- package/script/src/cli/localDevLock.d.ts.map +0 -1
- package/script/src/cli/localDevLock.js +0 -320
- package/script/src/cli/localDevPackage.d.ts +0 -172
- package/script/src/cli/localDevPackage.d.ts.map +0 -1
- package/script/src/cli/localDevPackage.js +0 -635
- package/script/src/cli/managedFiles.d.ts +0 -131
- package/script/src/cli/managedFiles.d.ts.map +0 -1
- package/script/src/cli/managedFiles.js +0 -536
- package/script/src/cli/migrationEnv.d.ts +0 -63
- package/script/src/cli/migrationEnv.d.ts.map +0 -1
- package/script/src/cli/migrationEnv.js +0 -217
- package/script/src/cli/mod.d.ts +0 -581
- package/script/src/cli/mod.d.ts.map +0 -1
- package/script/src/cli/mod.js +0 -16850
- package/script/src/cli/projectSkills.d.ts +0 -109
- package/script/src/cli/projectSkills.d.ts.map +0 -1
- package/script/src/cli/projectSkills.js +0 -749
- package/script/src/cli/projectTooling.d.ts +0 -164
- package/script/src/cli/projectTooling.d.ts.map +0 -1
- package/script/src/cli/projectTooling.js +0 -847
- package/script/src/cli/releaseConfig.d.ts +0 -10
- package/script/src/cli/releaseConfig.d.ts.map +0 -1
- package/script/src/cli/releaseConfig.js +0 -26
- package/script/src/cli/releaseCredentials.d.ts +0 -32
- package/script/src/cli/releaseCredentials.d.ts.map +0 -1
- package/script/src/cli/releaseCredentials.js +0 -392
- package/script/src/cli/releaseTrust.d.ts +0 -39
- package/script/src/cli/releaseTrust.d.ts.map +0 -1
- package/script/src/cli/releaseTrust.js +0 -130
- package/script/src/cli/releaseTrustCommand.d.ts +0 -18
- package/script/src/cli/releaseTrustCommand.d.ts.map +0 -1
- package/script/src/cli/releaseTrustCommand.js +0 -145
- package/script/src/cli/vercelBuildEnv.d.ts +0 -62
- package/script/src/cli/vercelBuildEnv.d.ts.map +0 -1
- package/script/src/cli/vercelBuildEnv.js +0 -401
- package/script/src/cli/vercelProjectRelease.d.ts +0 -38
- package/script/src/cli/vercelProjectRelease.d.ts.map +0 -1
- package/script/src/cli/vercelProjectRelease.js +0 -607
- package/script/src/clientData/identity.d.ts +0 -89
- package/script/src/clientData/identity.d.ts.map +0 -1
- package/script/src/clientData/identity.js +0 -134
- package/script/src/clientData/mod.d.ts +0 -3
- package/script/src/clientData/mod.d.ts.map +0 -1
- package/script/src/clientData/mod.js +0 -18
- package/script/src/files/client.d.ts +0 -29
- package/script/src/files/client.d.ts.map +0 -1
- package/script/src/files/client.js +0 -45
- package/script/src/files/errors.d.ts +0 -37
- package/script/src/files/errors.d.ts.map +0 -1
- package/script/src/files/errors.js +0 -76
- package/script/src/files/hash.d.ts +0 -15
- package/script/src/files/hash.d.ts.map +0 -1
- package/script/src/files/hash.js +0 -89
- package/script/src/files/memory.d.ts +0 -29
- package/script/src/files/memory.d.ts.map +0 -1
- package/script/src/files/memory.js +0 -113
- package/script/src/files/metadata.d.ts +0 -10
- package/script/src/files/metadata.d.ts.map +0 -1
- package/script/src/files/metadata.js +0 -189
- package/script/src/files/mod.d.ts +0 -10
- package/script/src/files/mod.d.ts.map +0 -1
- package/script/src/files/mod.js +0 -25
- package/script/src/files/s3.d.ts +0 -29
- package/script/src/files/s3.d.ts.map +0 -1
- package/script/src/files/s3.js +0 -110
- package/script/src/files/service.d.ts +0 -27
- package/script/src/files/service.d.ts.map +0 -1
- package/script/src/files/service.js +0 -139
- package/script/src/files/types.d.ts +0 -134
- package/script/src/files/types.d.ts.map +0 -1
- package/script/src/files/types.js +0 -2
- package/script/src/jobs/catalog.d.ts +0 -32
- package/script/src/jobs/catalog.d.ts.map +0 -1
- package/script/src/jobs/catalog.js +0 -223
- package/script/src/jobs/controller.d.ts +0 -41
- package/script/src/jobs/controller.d.ts.map +0 -1
- package/script/src/jobs/controller.js +0 -151
- package/script/src/jobs/direct.d.ts +0 -36
- package/script/src/jobs/direct.d.ts.map +0 -1
- package/script/src/jobs/direct.js +0 -128
- package/script/src/jobs/events.d.ts +0 -23
- package/script/src/jobs/events.d.ts.map +0 -1
- package/script/src/jobs/events.js +0 -50
- package/script/src/jobs/format.d.ts +0 -16
- package/script/src/jobs/format.d.ts.map +0 -1
- package/script/src/jobs/format.js +0 -193
- package/script/src/jobs/http.d.ts +0 -22
- package/script/src/jobs/http.d.ts.map +0 -1
- package/script/src/jobs/http.js +0 -50
- package/script/src/jobs/log.d.ts +0 -2
- package/script/src/jobs/log.d.ts.map +0 -1
- package/script/src/jobs/log.js +0 -13
- package/script/src/jobs/mod.d.ts +0 -11
- package/script/src/jobs/mod.d.ts.map +0 -1
- package/script/src/jobs/mod.js +0 -26
- package/script/src/jobs/run.d.ts +0 -39
- package/script/src/jobs/run.d.ts.map +0 -1
- package/script/src/jobs/run.js +0 -86
- package/script/src/jobs/sanitize.d.ts +0 -30
- package/script/src/jobs/sanitize.d.ts.map +0 -1
- package/script/src/jobs/sanitize.js +0 -97
- package/script/src/jobs/types.d.ts +0 -31
- package/script/src/jobs/types.d.ts.map +0 -1
- package/script/src/jobs/types.js +0 -2
- package/script/src/mail/errors.d.ts +0 -33
- package/script/src/mail/errors.d.ts.map +0 -1
- package/script/src/mail/errors.js +0 -97
- package/script/src/mail/memory.d.ts +0 -30
- package/script/src/mail/memory.d.ts.map +0 -1
- package/script/src/mail/memory.js +0 -345
- package/script/src/mail/mod.d.ts +0 -7
- package/script/src/mail/mod.d.ts.map +0 -1
- package/script/src/mail/mod.js +0 -22
- package/script/src/mail/postal.d.ts +0 -57
- package/script/src/mail/postal.d.ts.map +0 -1
- package/script/src/mail/postal.js +0 -251
- package/script/src/mail/retry.d.ts +0 -9
- package/script/src/mail/retry.d.ts.map +0 -1
- package/script/src/mail/retry.js +0 -22
- package/script/src/mail/sender.d.ts +0 -5
- package/script/src/mail/sender.d.ts.map +0 -1
- package/script/src/mail/sender.js +0 -52
- package/script/src/mail/service.d.ts +0 -23
- package/script/src/mail/service.d.ts.map +0 -1
- package/script/src/mail/service.js +0 -191
- package/script/src/mail/types.d.ts +0 -176
- package/script/src/mail/types.d.ts.map +0 -1
- package/script/src/mail/types.js +0 -2
- package/script/src/mui/apiKeys.d.ts +0 -171
- package/script/src/mui/apiKeys.d.ts.map +0 -1
- package/script/src/mui/apiKeys.js +0 -470
- package/script/src/mui/apiKeysView.d.ts +0 -193
- package/script/src/mui/apiKeysView.d.ts.map +0 -1
- package/script/src/mui/apiKeysView.js +0 -331
- package/script/src/mui/confirm.d.ts +0 -12
- package/script/src/mui/confirm.d.ts.map +0 -1
- package/script/src/mui/confirm.js +0 -85
- package/script/src/mui/mail.d.ts +0 -29
- package/script/src/mui/mail.d.ts.map +0 -1
- package/script/src/mui/mail.js +0 -159
- package/script/src/mui/mailView.d.ts +0 -20
- package/script/src/mui/mailView.d.ts.map +0 -1
- package/script/src/mui/mailView.js +0 -32
- package/script/src/mui/mod.d.ts +0 -5
- package/script/src/mui/mod.d.ts.map +0 -1
- package/script/src/mui/mod.js +0 -20
- package/script/src/next/apiKeys/mod.d.ts +0 -71
- package/script/src/next/apiKeys/mod.d.ts.map +0 -1
- package/script/src/next/apiKeys/mod.js +0 -227
- package/script/src/next/auth/client.d.ts.map +0 -1
- package/script/src/next/auth/client.js +0 -39
- package/script/src/next/auth/config.d.ts +0 -62
- package/script/src/next/auth/config.d.ts.map +0 -1
- package/script/src/next/auth/config.js +0 -178
- package/script/src/next/auth/localTestLogin.d.ts +0 -75
- package/script/src/next/auth/localTestLogin.d.ts.map +0 -1
- package/script/src/next/auth/localTestLogin.js +0 -291
- package/script/src/next/auth/mod.d.ts +0 -4
- package/script/src/next/auth/mod.d.ts.map +0 -1
- package/script/src/next/auth/mod.js +0 -19
- package/script/src/next/auth/server.d.ts +0 -44
- package/script/src/next/auth/server.d.ts.map +0 -1
- package/script/src/next/auth/server.js +0 -39
- package/script/src/next/files/mod.d.ts +0 -3
- package/script/src/next/files/mod.d.ts.map +0 -1
- package/script/src/next/files/mod.js +0 -18
- package/script/src/next/files/route.d.ts +0 -99
- package/script/src/next/files/route.d.ts.map +0 -1
- package/script/src/next/files/route.js +0 -353
- package/script/src/next/jobs/list.d.ts +0 -25
- package/script/src/next/jobs/list.d.ts.map +0 -1
- package/script/src/next/jobs/list.js +0 -48
- package/script/src/next/jobs/mod.d.ts +0 -6
- package/script/src/next/jobs/mod.d.ts.map +0 -1
- package/script/src/next/jobs/mod.js +0 -21
- package/script/src/next/jobs/paths.d.ts +0 -14
- package/script/src/next/jobs/paths.d.ts.map +0 -1
- package/script/src/next/jobs/paths.js +0 -47
- package/script/src/next/jobs/route.d.ts +0 -48
- package/script/src/next/jobs/route.d.ts.map +0 -1
- package/script/src/next/jobs/route.js +0 -105
- package/script/src/next/jobs/run.d.ts +0 -58
- package/script/src/next/jobs/run.d.ts.map +0 -1
- package/script/src/next/jobs/run.js +0 -592
- package/script/src/next/jobs/runRequest.d.ts +0 -19
- package/script/src/next/jobs/runRequest.d.ts.map +0 -1
- package/script/src/next/jobs/runRequest.js +0 -81
- package/script/src/next/jobs/stream.d.ts +0 -3
- package/script/src/next/jobs/stream.d.ts.map +0 -1
- package/script/src/next/jobs/stream.js +0 -28
- package/script/src/next/mail/mod.d.ts +0 -3
- package/script/src/next/mail/mod.d.ts.map +0 -1
- package/script/src/next/mail/mod.js +0 -18
- package/script/src/next/mail/route.d.ts +0 -12
- package/script/src/next/mail/route.d.ts.map +0 -1
- package/script/src/next/mail/route.js +0 -46
- package/script/src/next/pwa/mod.d.ts +0 -112
- package/script/src/next/pwa/mod.d.ts.map +0 -1
- package/script/src/next/pwa/mod.js +0 -303
- package/script/src/next/pwa/worker.d.ts +0 -27
- package/script/src/next/pwa/worker.d.ts.map +0 -1
- package/script/src/next/pwa/worker.js +0 -33
- package/script/src/next/secrets/mod.d.ts +0 -108
- package/script/src/next/secrets/mod.d.ts.map +0 -1
- package/script/src/next/secrets/mod.js +0 -218
- package/script/src/secrets/encoding.d.ts +0 -32
- package/script/src/secrets/encoding.d.ts.map +0 -1
- package/script/src/secrets/encoding.js +0 -95
- package/script/src/secrets/errors.d.ts +0 -45
- package/script/src/secrets/errors.d.ts.map +0 -1
- package/script/src/secrets/errors.js +0 -45
- package/script/src/secrets/fingerprint.d.ts +0 -43
- package/script/src/secrets/fingerprint.d.ts.map +0 -1
- package/script/src/secrets/fingerprint.js +0 -92
- package/script/src/secrets/frame.d.ts +0 -34
- package/script/src/secrets/frame.d.ts.map +0 -1
- package/script/src/secrets/frame.js +0 -91
- package/script/src/secrets/keyring.d.ts +0 -62
- package/script/src/secrets/keyring.d.ts.map +0 -1
- package/script/src/secrets/keyring.js +0 -202
- package/script/src/secrets/legacy.d.ts +0 -60
- package/script/src/secrets/legacy.d.ts.map +0 -1
- package/script/src/secrets/legacy.js +0 -186
- package/script/src/secrets/maintenance.d.ts +0 -173
- package/script/src/secrets/maintenance.d.ts.map +0 -1
- package/script/src/secrets/maintenance.js +0 -323
- package/script/src/secrets/mod.d.ts +0 -6
- package/script/src/secrets/mod.d.ts.map +0 -1
- package/script/src/secrets/mod.js +0 -24
- package/script/src/secrets/secrets.d.ts +0 -192
- package/script/src/secrets/secrets.d.ts.map +0 -1
- package/script/src/secrets/secrets.js +0 -532
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { normalizeApiKeyCountryCode } from "./country.ts";
|
|
2
|
+
import { extractApiKeyCredential } from "./credentials.ts";
|
|
3
|
+
import { fingerprintApiKeyCredential } from "./fingerprint.ts";
|
|
4
|
+
import type {
|
|
5
|
+
ApiKeyAuthorizationAuditEvent,
|
|
6
|
+
ApiKeyAuthorizationResult,
|
|
7
|
+
ApiKeyDenialCode,
|
|
8
|
+
ApiKeyPrincipal,
|
|
9
|
+
ApiKeyVerifierResult,
|
|
10
|
+
AuthorizeApiKeyOptions,
|
|
11
|
+
} from "./types.ts";
|
|
12
|
+
|
|
13
|
+
function statusForExtraction(kind: "ambiguous" | "malformed" | "missing") {
|
|
14
|
+
return kind === "missing" ? (401 as const) : (400 as const);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function codeForExtraction(
|
|
18
|
+
kind: "ambiguous" | "malformed" | "missing",
|
|
19
|
+
): ApiKeyDenialCode {
|
|
20
|
+
if (kind === "ambiguous") return "ambiguous_credentials";
|
|
21
|
+
if (kind === "malformed") return "credential_malformed";
|
|
22
|
+
return "credential_missing";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function baseAuditEvent(
|
|
26
|
+
options: AuthorizeApiKeyOptions,
|
|
27
|
+
): Omit<ApiKeyAuthorizationAuditEvent, "authorizationOutcome" | "eventType"> {
|
|
28
|
+
const descriptor = options.descriptor;
|
|
29
|
+
return {
|
|
30
|
+
actionName: descriptor.actionName,
|
|
31
|
+
countryCode: normalizeApiKeyCountryCode(options.request?.countryCode),
|
|
32
|
+
functionName: descriptor.functionName,
|
|
33
|
+
ipAddress: options.request?.ipAddress,
|
|
34
|
+
metadata: descriptor.metadata,
|
|
35
|
+
method: options.request?.method,
|
|
36
|
+
operation: descriptor.operation,
|
|
37
|
+
pageName: descriptor.pageName,
|
|
38
|
+
requestId: options.request?.requestId,
|
|
39
|
+
routeTemplate: options.request?.routeTemplate,
|
|
40
|
+
scopeAction: descriptor.permission.action,
|
|
41
|
+
scopeResource: descriptor.permission.resource,
|
|
42
|
+
userAgent: options.request?.userAgent,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function recordDenied(
|
|
47
|
+
options: AuthorizeApiKeyOptions,
|
|
48
|
+
event: ApiKeyAuthorizationAuditEvent,
|
|
49
|
+
) {
|
|
50
|
+
try {
|
|
51
|
+
return await options.audit.append(event);
|
|
52
|
+
} catch {
|
|
53
|
+
// A persistence outage cannot make an already-denied request less denied.
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Audit attribution for a verifier denial: only an `insufficient_permission`
|
|
60
|
+
* denial with a well-formed principal names the key and its owner.
|
|
61
|
+
*/
|
|
62
|
+
function deniedKeyAuditFields(
|
|
63
|
+
verification: Extract<ApiKeyVerifierResult, { ok: false }>,
|
|
64
|
+
) {
|
|
65
|
+
const principal = verification.principal;
|
|
66
|
+
if (
|
|
67
|
+
verification.code !== "insufficient_permission" ||
|
|
68
|
+
!principal ||
|
|
69
|
+
typeof principal.keyId !== "string" ||
|
|
70
|
+
!principal.keyId ||
|
|
71
|
+
typeof principal.ownerId !== "string" ||
|
|
72
|
+
!principal.ownerId
|
|
73
|
+
) {
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
// A custom verifier's snapshots are untrusted input to the audit insert;
|
|
77
|
+
// drop anything that is not a string rather than fail the denial's record.
|
|
78
|
+
return {
|
|
79
|
+
keyId: principal.keyId,
|
|
80
|
+
keyNameSnapshot:
|
|
81
|
+
typeof principal.keyName === "string" ? principal.keyName : undefined,
|
|
82
|
+
keyStartSnapshot:
|
|
83
|
+
typeof principal.keyStart === "string" ? principal.keyStart : undefined,
|
|
84
|
+
ownerId: principal.ownerId,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function principalAuditFields(principal: ApiKeyPrincipal) {
|
|
89
|
+
return {
|
|
90
|
+
keyId: principal.keyId,
|
|
91
|
+
keyNameSnapshot: principal.keyName,
|
|
92
|
+
keyStartSnapshot: principal.keyStart,
|
|
93
|
+
ownerId: principal.ownerId,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Authorizes one credential and durably records access before it is granted. */
|
|
98
|
+
export async function authorizeApiKey(
|
|
99
|
+
options: AuthorizeApiKeyOptions,
|
|
100
|
+
): Promise<ApiKeyAuthorizationResult> {
|
|
101
|
+
const extracted = extractApiKeyCredential(
|
|
102
|
+
options.source,
|
|
103
|
+
options.credentialOptions,
|
|
104
|
+
);
|
|
105
|
+
const auditBase = baseAuditEvent(options);
|
|
106
|
+
|
|
107
|
+
if (extracted.kind !== "present") {
|
|
108
|
+
const code = codeForExtraction(extracted.kind);
|
|
109
|
+
const status = statusForExtraction(extracted.kind);
|
|
110
|
+
const recorded = await recordDenied(options, {
|
|
111
|
+
...auditBase,
|
|
112
|
+
authorizationOutcome: "denied",
|
|
113
|
+
eventType: "authorization",
|
|
114
|
+
httpStatus: status,
|
|
115
|
+
reasonCode: code,
|
|
116
|
+
transport:
|
|
117
|
+
extracted.kind === "missing"
|
|
118
|
+
? undefined
|
|
119
|
+
: extracted.kind === "ambiguous"
|
|
120
|
+
? undefined
|
|
121
|
+
: extracted.transport,
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
authorizationEventId: recorded?.id,
|
|
125
|
+
code,
|
|
126
|
+
ok: false,
|
|
127
|
+
status,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (options.rejectCredential) {
|
|
132
|
+
let rejected: boolean;
|
|
133
|
+
try {
|
|
134
|
+
rejected =
|
|
135
|
+
(await options.rejectCredential(extracted.credential, {
|
|
136
|
+
descriptor: options.descriptor,
|
|
137
|
+
transport: extracted.transport,
|
|
138
|
+
})) !== false;
|
|
139
|
+
} catch {
|
|
140
|
+
// Fail closed without fingerprinting a credential the app may have
|
|
141
|
+
// been about to reject.
|
|
142
|
+
const recorded = await recordDenied(options, {
|
|
143
|
+
...auditBase,
|
|
144
|
+
authorizationOutcome: "error",
|
|
145
|
+
eventType: "authorization",
|
|
146
|
+
httpStatus: 500,
|
|
147
|
+
// Distinct from a verifier outage for operators; the response is not.
|
|
148
|
+
reasonCode: "credential_rejection_error",
|
|
149
|
+
transport: extracted.transport,
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
authorizationEventId: recorded?.id,
|
|
153
|
+
code: "verification_error",
|
|
154
|
+
ok: false,
|
|
155
|
+
status: 500,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (rejected) {
|
|
159
|
+
// Same result as an invalid key, so callers cannot tell a rejected
|
|
160
|
+
// value from a wrong one; only the audit reason differs.
|
|
161
|
+
const recorded = await recordDenied(options, {
|
|
162
|
+
...auditBase,
|
|
163
|
+
authorizationOutcome: "denied",
|
|
164
|
+
eventType: "authorization",
|
|
165
|
+
httpStatus: 401,
|
|
166
|
+
reasonCode: "credential_rejected",
|
|
167
|
+
transport: extracted.transport,
|
|
168
|
+
});
|
|
169
|
+
return {
|
|
170
|
+
authorizationEventId: recorded?.id,
|
|
171
|
+
code: "invalid_credential",
|
|
172
|
+
ok: false,
|
|
173
|
+
status: 401,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const credentialFingerprint = await fingerprintApiKeyCredential(
|
|
179
|
+
extracted.credential,
|
|
180
|
+
);
|
|
181
|
+
let verification;
|
|
182
|
+
try {
|
|
183
|
+
verification = await options.verifier.verify({
|
|
184
|
+
credential: extracted.credential,
|
|
185
|
+
permission: options.descriptor.permission,
|
|
186
|
+
});
|
|
187
|
+
} catch {
|
|
188
|
+
const recorded = await recordDenied(options, {
|
|
189
|
+
...auditBase,
|
|
190
|
+
authorizationOutcome: "error",
|
|
191
|
+
credentialFingerprint,
|
|
192
|
+
eventType: "authorization",
|
|
193
|
+
httpStatus: 500,
|
|
194
|
+
reasonCode: "verification_error",
|
|
195
|
+
transport: extracted.transport,
|
|
196
|
+
});
|
|
197
|
+
return {
|
|
198
|
+
authorizationEventId: recorded?.id,
|
|
199
|
+
code: "verification_error",
|
|
200
|
+
ok: false,
|
|
201
|
+
status: 500,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (!verification.ok) {
|
|
206
|
+
const status =
|
|
207
|
+
verification.status ??
|
|
208
|
+
(verification.code === "rate_limited"
|
|
209
|
+
? 429
|
|
210
|
+
: verification.code === "insufficient_permission"
|
|
211
|
+
? 403
|
|
212
|
+
: 401);
|
|
213
|
+
const recorded = await recordDenied(options, {
|
|
214
|
+
...auditBase,
|
|
215
|
+
...deniedKeyAuditFields(verification),
|
|
216
|
+
authorizationOutcome: "denied",
|
|
217
|
+
credentialFingerprint,
|
|
218
|
+
eventType: "authorization",
|
|
219
|
+
httpStatus: status,
|
|
220
|
+
reasonCode: verification.code,
|
|
221
|
+
transport: extracted.transport,
|
|
222
|
+
});
|
|
223
|
+
return {
|
|
224
|
+
authorizationEventId: recorded?.id,
|
|
225
|
+
code: verification.code,
|
|
226
|
+
ok: false,
|
|
227
|
+
status,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
let policy;
|
|
232
|
+
try {
|
|
233
|
+
policy = await options.policy.authorize(
|
|
234
|
+
verification.principal,
|
|
235
|
+
options.descriptor,
|
|
236
|
+
);
|
|
237
|
+
} catch {
|
|
238
|
+
const recorded = await recordDenied(options, {
|
|
239
|
+
...auditBase,
|
|
240
|
+
...principalAuditFields(verification.principal),
|
|
241
|
+
authorizationOutcome: "error",
|
|
242
|
+
credentialFingerprint,
|
|
243
|
+
eventType: "authorization",
|
|
244
|
+
httpStatus: 500,
|
|
245
|
+
reasonCode: "policy_error",
|
|
246
|
+
transport: extracted.transport,
|
|
247
|
+
});
|
|
248
|
+
return {
|
|
249
|
+
authorizationEventId: recorded?.id,
|
|
250
|
+
code: "policy_error",
|
|
251
|
+
ok: false,
|
|
252
|
+
status: 500,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
if (!policy.ok) {
|
|
256
|
+
const recorded = await recordDenied(options, {
|
|
257
|
+
...auditBase,
|
|
258
|
+
...principalAuditFields(verification.principal),
|
|
259
|
+
authorizationOutcome: "denied",
|
|
260
|
+
credentialFingerprint,
|
|
261
|
+
eventType: "authorization",
|
|
262
|
+
httpStatus: policy.status ?? 403,
|
|
263
|
+
reasonCode: policy.code ?? "forbidden",
|
|
264
|
+
transport: extracted.transport,
|
|
265
|
+
});
|
|
266
|
+
return {
|
|
267
|
+
authorizationEventId: recorded?.id,
|
|
268
|
+
code: policy.code ?? "forbidden",
|
|
269
|
+
ok: false,
|
|
270
|
+
status: policy.status ?? 403,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
try {
|
|
275
|
+
const recorded = await options.audit.append({
|
|
276
|
+
...auditBase,
|
|
277
|
+
...principalAuditFields(verification.principal),
|
|
278
|
+
authorizationOutcome: "allowed",
|
|
279
|
+
credentialFingerprint,
|
|
280
|
+
eventType: "authorization",
|
|
281
|
+
httpStatus: 200,
|
|
282
|
+
transport: extracted.transport,
|
|
283
|
+
});
|
|
284
|
+
return {
|
|
285
|
+
authorizationEventId: recorded.id,
|
|
286
|
+
credentialFingerprint,
|
|
287
|
+
ok: true,
|
|
288
|
+
principal: verification.principal,
|
|
289
|
+
transport: extracted.transport,
|
|
290
|
+
};
|
|
291
|
+
} catch {
|
|
292
|
+
return { code: "audit_unavailable", ok: false, status: 503 };
|
|
293
|
+
}
|
|
294
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import {
|
|
2
|
+
apiKeyGrantedPermissions,
|
|
3
|
+
apiKeyPrincipalPermissions,
|
|
4
|
+
hasApiKeyPermission,
|
|
5
|
+
} from "./permissions.ts";
|
|
6
|
+
import type { ApiKeyScopeDefinitions, DefinedApiKeyScopes } from "./policy.ts";
|
|
7
|
+
import type { ApiKeyVerifier, ApiKeyVerifierResult } from "./types.ts";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The part of a Better Auth instance with the api-key plugin that the shared
|
|
11
|
+
* verifier calls. Loom never imports Better Auth; pass the app's `auth`
|
|
12
|
+
* instance. Method syntax keeps the parameter check bivariant, so Better
|
|
13
|
+
* Auth's richer endpoint signature remains assignable.
|
|
14
|
+
*/
|
|
15
|
+
export interface BetterAuthApiKeyVerifyApi {
|
|
16
|
+
api: {
|
|
17
|
+
verifyApiKey(input: {
|
|
18
|
+
body: { configId?: string; key: string };
|
|
19
|
+
}): Promise<unknown>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A key record returned by a successful Better Auth `verifyApiKey` call, after
|
|
25
|
+
* Loom's shape checks. Fields beyond `id` are unvalidated plugin data.
|
|
26
|
+
*/
|
|
27
|
+
export interface BetterAuthVerifiedApiKey {
|
|
28
|
+
readonly [field: string]: unknown;
|
|
29
|
+
/** Non-empty key ID. */
|
|
30
|
+
readonly id: string;
|
|
31
|
+
/** `false` for a revoked key; re-checked as defense in depth. */
|
|
32
|
+
readonly enabled?: unknown;
|
|
33
|
+
/** Expiry; a past or unparseable value is re-checked as expired. */
|
|
34
|
+
readonly expiresAt?: unknown;
|
|
35
|
+
/** Display name, when the plugin returned a string. */
|
|
36
|
+
readonly name?: unknown;
|
|
37
|
+
/** Permissions as decoded once by Better Auth. Never decoded again. */
|
|
38
|
+
readonly permissions?: unknown;
|
|
39
|
+
/** Owner reference in current Better Auth api-key schemas. */
|
|
40
|
+
readonly referenceId?: unknown;
|
|
41
|
+
/** Non-secret key prefix, when the plugin returned a string. */
|
|
42
|
+
readonly start?: unknown;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Options for `createBetterAuthApiKeyVerifier`. */
|
|
46
|
+
export interface CreateBetterAuthApiKeyVerifierOptions<
|
|
47
|
+
TDefinitions extends ApiKeyScopeDefinitions = ApiKeyScopeDefinitions,
|
|
48
|
+
> {
|
|
49
|
+
/** The app's Better Auth instance, configured with the api-key plugin. */
|
|
50
|
+
auth: BetterAuthApiKeyVerifyApi;
|
|
51
|
+
/**
|
|
52
|
+
* The plugin configuration to verify against, always sent to Better Auth.
|
|
53
|
+
* Use `"default"` for a plugin configured without a `configId`.
|
|
54
|
+
*/
|
|
55
|
+
configId: string;
|
|
56
|
+
/**
|
|
57
|
+
* Resolves the key owner. Defaults to `key.referenceId`. A missing or
|
|
58
|
+
* non-string owner fails closed as a verification error.
|
|
59
|
+
*/
|
|
60
|
+
ownerId?: (key: BetterAuthVerifiedApiKey) => string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* The app's scope registry. When given, `principal.permissions` lists only
|
|
63
|
+
* registry permissions the key grants exactly; otherwise every exact grant
|
|
64
|
+
* stored on the key is listed.
|
|
65
|
+
*/
|
|
66
|
+
scopes?: DefinedApiKeyScopes<TDefinitions>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function isObject(value: unknown): value is Record<string, unknown> {
|
|
70
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function malformed(detail: string): Error {
|
|
74
|
+
return new Error(`Better Auth verifyApiKey returned ${detail}.`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function optionalString(value: unknown) {
|
|
78
|
+
return typeof value === "string" ? value : undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** True for a parseable expiry at or before now; unparseable values expire. */
|
|
82
|
+
function isExpired(expiresAt: unknown) {
|
|
83
|
+
if (expiresAt === null || expiresAt === undefined) return false;
|
|
84
|
+
// The tag check also accepts a Date from another realm.
|
|
85
|
+
const time =
|
|
86
|
+
Object.prototype.toString.call(expiresAt) === "[object Date]"
|
|
87
|
+
? (expiresAt as Date).valueOf()
|
|
88
|
+
: typeof expiresAt === "string" || typeof expiresAt === "number"
|
|
89
|
+
? new Date(expiresAt).valueOf()
|
|
90
|
+
: Number.NaN;
|
|
91
|
+
return !Number.isFinite(time) || time <= Date.now();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Creates a Loom `ApiKeyVerifier` that makes exactly one Better Auth
|
|
96
|
+
* `verifyApiKey` call per authorization and decides the requested permission
|
|
97
|
+
* locally.
|
|
98
|
+
*
|
|
99
|
+
* The plugin reports a valid key that lacks a requested permission as
|
|
100
|
+
* `KEY_NOT_FOUND`, indistinguishable from a forged or revoked key, so this
|
|
101
|
+
* verifier never sends `permissions`. Instead it checks the decoded grants
|
|
102
|
+
* with `hasApiKeyPermission` and reports a miss as `insufficient_permission`
|
|
103
|
+
* (403). Better Auth still owns hashing, config scoping, enablement, expiry,
|
|
104
|
+
* and usage accounting.
|
|
105
|
+
*
|
|
106
|
+
* Classification:
|
|
107
|
+
* - `valid: false` with code `RATE_LIMITED` (per-key rate limit) or
|
|
108
|
+
* `USAGE_EXCEEDED` (`remaining` quota spent; the plugin reports it as 429
|
|
109
|
+
* and deletes an exhausted key that has no refill) → `rate_limited` (429);
|
|
110
|
+
* - any other `valid: false`, `valid: true` without a key, or a returned key
|
|
111
|
+
* that is disabled or expired → `invalid_credential` (401);
|
|
112
|
+
* - a valid key without the exact permission → `insufficient_permission`
|
|
113
|
+
* (403), carrying the key's `principal` so Loom attributes the audit row
|
|
114
|
+
* to its owner;
|
|
115
|
+
* - a malformed result, key ID, or owner throws, which Loom records as
|
|
116
|
+
* `verification_error` (500). Exceptions from Better Auth propagate too.
|
|
117
|
+
*
|
|
118
|
+
* Caveats:
|
|
119
|
+
* - A scope miss now passes through the plugin's usage claim. It updates
|
|
120
|
+
* `lastRequest`/`requestCount`/`updatedAt` and, with per-key rate limits or
|
|
121
|
+
* `remaining` quotas enabled, would spend them and could delete an exhausted
|
|
122
|
+
* key. Keep those disabled or account for it.
|
|
123
|
+
* - The plugin catches internal failures such as a database outage and
|
|
124
|
+
* returns them as `INVALID_API_KEY`, so they deny as `invalid_credential`
|
|
125
|
+
* (fail closed) rather than `verification_error`. Monitor Better Auth's
|
|
126
|
+
* "Failed to validate API key" log to tell an outage from bad keys.
|
|
127
|
+
*/
|
|
128
|
+
export function createBetterAuthApiKeyVerifier<
|
|
129
|
+
const TDefinitions extends ApiKeyScopeDefinitions = ApiKeyScopeDefinitions,
|
|
130
|
+
>(
|
|
131
|
+
options: CreateBetterAuthApiKeyVerifierOptions<TDefinitions>,
|
|
132
|
+
): ApiKeyVerifier {
|
|
133
|
+
const { auth, configId, ownerId, scopes } = options;
|
|
134
|
+
if (typeof auth?.api?.verifyApiKey !== "function") {
|
|
135
|
+
throw new Error(
|
|
136
|
+
"createBetterAuthApiKeyVerifier requires a Better Auth instance with the api-key plugin.",
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
if (typeof configId !== "string" || configId.length === 0) {
|
|
140
|
+
throw new Error("createBetterAuthApiKeyVerifier requires a configId.");
|
|
141
|
+
}
|
|
142
|
+
if (ownerId !== undefined && typeof ownerId !== "function") {
|
|
143
|
+
throw new Error(
|
|
144
|
+
"createBetterAuthApiKeyVerifier ownerId must be a function.",
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
async verify(request): Promise<ApiKeyVerifierResult> {
|
|
150
|
+
// `permissions` is deliberately absent; see the JSDoc above.
|
|
151
|
+
const result = await auth.api.verifyApiKey({
|
|
152
|
+
body: { configId, key: request.credential },
|
|
153
|
+
});
|
|
154
|
+
if (!isObject(result)) throw malformed("a non-object result");
|
|
155
|
+
if (typeof result.valid !== "boolean") {
|
|
156
|
+
throw malformed("a result without a boolean `valid`");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (result.valid !== true) {
|
|
160
|
+
const error = result.error;
|
|
161
|
+
if (
|
|
162
|
+
isObject(error) &&
|
|
163
|
+
(error.code === "RATE_LIMITED" || error.code === "USAGE_EXCEEDED")
|
|
164
|
+
) {
|
|
165
|
+
return { code: "rate_limited", ok: false };
|
|
166
|
+
}
|
|
167
|
+
return { code: "invalid_credential", ok: false };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (result.error !== null && result.error !== undefined) {
|
|
171
|
+
throw malformed("a valid result that also carries an error");
|
|
172
|
+
}
|
|
173
|
+
const key = result.key;
|
|
174
|
+
if (key === null || key === undefined) {
|
|
175
|
+
return { code: "invalid_credential", ok: false };
|
|
176
|
+
}
|
|
177
|
+
if (!isObject(key)) throw malformed("a non-object key");
|
|
178
|
+
if (typeof key.id !== "string" || key.id.length === 0) {
|
|
179
|
+
throw malformed("a key without an ID");
|
|
180
|
+
}
|
|
181
|
+
const verifiedKey = key as BetterAuthVerifiedApiKey;
|
|
182
|
+
const owner = ownerId ? ownerId(verifiedKey) : verifiedKey.referenceId;
|
|
183
|
+
if (typeof owner !== "string" || owner.length === 0) {
|
|
184
|
+
throw malformed("a key without a resolvable owner");
|
|
185
|
+
}
|
|
186
|
+
// Better Auth already rejects these; re-checking keeps a plugin
|
|
187
|
+
// regression from granting a disabled or expired key.
|
|
188
|
+
if (verifiedKey.enabled === false || isExpired(verifiedKey.expiresAt)) {
|
|
189
|
+
return { code: "invalid_credential", ok: false };
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const principal = {
|
|
193
|
+
keyId: verifiedKey.id,
|
|
194
|
+
keyName: optionalString(verifiedKey.name),
|
|
195
|
+
keyStart: optionalString(verifiedKey.start),
|
|
196
|
+
ownerId: owner,
|
|
197
|
+
permissions: scopes
|
|
198
|
+
? apiKeyPrincipalPermissions(scopes, verifiedKey.permissions)
|
|
199
|
+
: apiKeyGrantedPermissions(verifiedKey.permissions),
|
|
200
|
+
};
|
|
201
|
+
if (!hasApiKeyPermission(verifiedKey.permissions, request.permission)) {
|
|
202
|
+
// The key is genuine, so the denial is attributed to its owner.
|
|
203
|
+
return { code: "insufficient_permission", ok: false, principal };
|
|
204
|
+
}
|
|
205
|
+
return { ok: true, principal };
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Better Auth api-key plugin endpoints served over HTTP, relative to the auth
|
|
212
|
+
* base path.
|
|
213
|
+
*
|
|
214
|
+
* Each is session-authenticated, so any signed-in user can call it for their
|
|
215
|
+
* own keys: `update` can re-enable an administratively revoked key or remove
|
|
216
|
+
* its expiry, `delete` hard-deletes the key row instead of soft-revoking it,
|
|
217
|
+
* and `create` skips the app's own validation. `verifyApiKey` and expired-key
|
|
218
|
+
* cleanup are server-only and are not listed.
|
|
219
|
+
*/
|
|
220
|
+
export const BETTER_AUTH_API_KEY_HTTP_PATHS = Object.freeze([
|
|
221
|
+
"/api-key/create",
|
|
222
|
+
"/api-key/update",
|
|
223
|
+
"/api-key/delete",
|
|
224
|
+
"/api-key/get",
|
|
225
|
+
"/api-key/list",
|
|
226
|
+
] as const);
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Returns Better Auth `disabledPaths` that also block every api-key plugin
|
|
230
|
+
* HTTP endpoint, preserving `existing` entries first and removing duplicates.
|
|
231
|
+
*
|
|
232
|
+
* Use it in the app-owned `betterAuth()` options so key lifecycle only goes
|
|
233
|
+
* through server actions that call `auth.api.*`; server-side calls never pass
|
|
234
|
+
* through the HTTP router, so they keep working:
|
|
235
|
+
*
|
|
236
|
+
* ```ts
|
|
237
|
+
* export const auth = betterAuth({
|
|
238
|
+
* disabledPaths: withBetterAuthApiKeyHttpPathsDisabled(),
|
|
239
|
+
* plugins: [apiKey({ ... })],
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
export function withBetterAuthApiKeyHttpPathsDisabled(
|
|
244
|
+
existing: readonly string[] = [],
|
|
245
|
+
): string[] {
|
|
246
|
+
if (
|
|
247
|
+
!Array.isArray(existing) ||
|
|
248
|
+
existing.some((path) => typeof path !== "string")
|
|
249
|
+
) {
|
|
250
|
+
throw new Error("Better Auth disabledPaths must be an array of strings.");
|
|
251
|
+
}
|
|
252
|
+
return [...new Set([...existing, ...BETTER_AUTH_API_KEY_HTTP_PATHS])];
|
|
253
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Normalizes a two-letter ISO country-code candidate for audit storage. */
|
|
2
|
+
export function normalizeApiKeyCountryCode(value?: string | null) {
|
|
3
|
+
const countryCode = value?.trim().toUpperCase();
|
|
4
|
+
return countryCode && /^[A-Z]{2}$/.test(countryCode)
|
|
5
|
+
? countryCode
|
|
6
|
+
: undefined;
|
|
7
|
+
}
|