@seams/wallet-server 0.7.3 → 0.8.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/THIRD_PARTY_NOTICES.md +1 -9
- package/artifact-manifest.json +78 -33
- package/cloudflare-router-ab/build/deriver-a/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/deriver-a/index.js +2 -2
- package/cloudflare-router-ab/build/deriver-a/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/deriver-b/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/deriver-b/index.js +2 -2
- package/cloudflare-router-ab/build/deriver-b/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/local-tools/darwin-arm64/router_ab_local_init +0 -0
- package/cloudflare-router-ab/build/local-tools/darwin-x64/router_ab_local_init +0 -0
- package/cloudflare-router-ab/build/local-tools/linux-x64/router_ab_local_init +0 -0
- package/cloudflare-router-ab/build/router/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/router/index.js +2 -2
- package/cloudflare-router-ab/build/router/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/signing-worker/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/signing-worker/index.js +2 -2
- package/cloudflare-router-ab/build/signing-worker/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/tenant-root-control-plane/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/tenant-root-control-plane/index.js +2 -2
- package/cloudflare-router-ab/build/tenant-root-control-plane/index_bg.wasm +0 -0
- package/cloudflare-router-ab/scripts/prepare-local-runtime-config.mjs +0 -2
- package/cloudflare-router-ab/scripts/start-local-role-workers.mjs +77 -20
- package/dist/esm/authorization/lifecycleRouting.js +62 -0
- package/dist/esm/authorization/service.js +35 -12
- package/dist/esm/cloud-host.js +20 -22
- package/dist/esm/core/EmailOtpRecords.js +1 -217
- package/dist/esm/core/EmailOtpStores.js +0 -859
- package/dist/esm/core/IdentityStore.js +2 -339
- package/dist/esm/core/ThresholdService/config.js +1 -9
- package/dist/esm/core/ThresholdService/index.js +0 -4
- package/dist/esm/core/ThresholdService/kv.js +1 -66
- package/dist/esm/core/ThresholdService/routerAb/ecdsaDerivationPoolFillHandlers.js +1 -13
- package/dist/esm/core/ThresholdService/routerAbNormalSigningPolicy.js +1 -11
- package/dist/esm/core/ThresholdService/stores/WalletSessionStore.js +0 -541
- package/dist/esm/core/ThresholdService/validation.js +2 -346
- package/dist/esm/core/WalletAuthMethodStore.js +2 -123
- package/dist/esm/core/WalletStore.js +3 -209
- package/dist/esm/core/WebAuthnAuthenticatorStore.js +0 -202
- package/dist/esm/core/WebAuthnCredentialBindingStore.js +2 -182
- package/dist/esm/core/WebAuthnLoginChallengeStore.js +0 -52
- package/dist/esm/core/WebAuthnSyncChallengeStore.js +0 -54
- package/dist/esm/core/authService/emailOtpConfig.js +1 -195
- package/dist/esm/core/authService/emailOtpEnrollment.js +0 -110
- package/dist/esm/core/authService/emailOtpSeal.js +0 -63
- package/dist/esm/core/authService/nearTransactions.js +3 -98
- package/dist/esm/core/authService/rateLimits.js +0 -84
- package/dist/esm/core/authService/webauthn.js +2 -298
- package/dist/esm/core/authService/webauthnOidcHelpers.js +1 -24
- package/dist/esm/core/authService/webauthnWalletBinding.js +0 -37
- package/dist/esm/core/config.js +1 -95
- package/dist/esm/core/d1EcdsaSignerRead.js +1 -1
- package/dist/esm/core/d1IdentityStore.js +1 -2
- package/dist/esm/core/d1TenantStore.js +1 -24
- package/dist/esm/core/d1WalletAuthMethodStore.js +2 -5
- package/dist/esm/core/d1WalletStore.js +2 -2
- package/dist/esm/core/deviceLinking/linkedDeviceBootstrap.js +13 -0
- package/dist/esm/core/deviceLinking/linkedDeviceSession.js +20 -14
- package/dist/esm/core/deviceLinking/requestProof.js +9 -6
- package/dist/esm/core/emailOtpD1Statements.js +107 -94
- package/dist/esm/core/keyMaterialBrands.js +2 -12
- package/dist/esm/core/nearKeys.js +0 -1
- package/dist/esm/core/nearRelayerAccountProvisioning.js +6 -9
- package/dist/esm/core/passkeyCredentialClaims.js +8 -0
- package/dist/esm/core/routerAbSigning/RouterAbEcdsaPresignRuntime.js +2 -6
- package/dist/esm/core/routerAbSigning/RouterAbNormalSigningRuntime.js +2 -30
- package/dist/esm/core/thresholdEcdsaChainTarget.js +1 -4
- package/dist/esm/hosted-wallet-gateway.js +66 -43
- package/dist/esm/index.js +6 -19
- package/dist/esm/localHostedWalletGatewayHandler.js +12 -0
- package/dist/esm/localRegistrationSetupAuthority.js +89 -0
- package/dist/esm/router/auth/authRequestValidation.js +8 -16
- package/dist/esm/router/auth/webAuthnCredentialCodecs.js +0 -1
- package/dist/esm/router/cloudflare/d1/auth/d1AuthorizationAssembly.js +87 -0
- package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthConfig.js +12 -2
- package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthService.js +32 -281
- package/dist/esm/router/cloudflare/d1/authorization/authorizedOperationStatements.js +24 -22
- package/dist/esm/router/cloudflare/d1/authorization/d1AuthorizationStore.js +8 -6
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.js +12 -13
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEd25519ExportRootStore.js +6 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEmailOtpGrantStore.js +12 -2
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEmailOtpTargetFactor.js +4 -4
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceOwnerAuthorizationProvider.js +1 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceRequestProofNonceStore.js +3 -9
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceRouteService.js +2 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionStore.js +89 -7
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.js +23 -14
- package/dist/esm/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoCapabilityPersistence.js +9 -6
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeIssuer.js +0 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeService.js +0 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeVerifier.js +0 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpEnrollmentStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpGrantStore.js +1 -7
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRateLimitStore.js +19 -13
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.js +0 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +0 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.js +2 -2
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpServerSealRuntime.js +0 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationAttemptStore.js +44 -12
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationRecords.js +1 -49
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.js +19 -31
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleRegistrationCompletion.js +85 -0
- package/dist/esm/router/cloudflare/d1/identity/d1IdentityRecords.js +0 -1
- package/dist/esm/router/cloudflare/d1/identity/d1IdentityService.js +0 -48
- package/dist/esm/router/cloudflare/d1/near/d1SponsoredNearAccount.js +242 -0
- package/dist/esm/router/cloudflare/d1/oidc/d1OidcBoundary.js +0 -1
- package/dist/esm/router/cloudflare/d1/oidc/d1OidcVerificationService.js +2 -29
- package/dist/esm/router/cloudflare/d1/oidc/googleOidcToken.js +41 -0
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyRouteService.js +5 -0
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.js +34 -0
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.js +9 -3
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +7 -13
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.js +25 -13
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationIntentService.js +0 -1
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationSetupSupport.js +74 -0
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.js +7 -1
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +69 -238
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetup.js +12 -56
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetupExecution.js +155 -0
- package/dist/esm/router/cloudflare/d1/registration/walletRegistrationEstablishedSessionIssuer.js +1 -3
- package/dist/esm/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.js +12 -6
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAddSignerFinalizeRecord.js +68 -0
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAddSignerService.js +7 -54
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodService.js +9 -8
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorityStore.js +2 -142
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnAuthService.js +25 -4
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnRecords.js +4 -70
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnStore.js +23 -7
- package/dist/esm/router/cloudflare/runtime/staticWalletConsoleBinding.js +1 -0
- package/dist/esm/router/cloudflare/runtime/walletConsoleOps.js +1 -0
- package/dist/esm/router/cloudflare/runtime/walletConsoleOpsClient.js +5 -0
- package/dist/esm/router/cloudflare/runtime/walletGateway.js +1 -1
- package/dist/esm/router/cloudflare/runtime/walletRuntimeOps.js +16 -4
- package/dist/esm/router/cloudflare-adaptor.js +1 -2
- package/dist/esm/router/cloudflare.js +1342 -1733
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration.js +11 -8
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitionedStateStore.js +3 -2
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitioning.js +6 -6
- package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.js +6 -6
- package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExportRequestScopedCloudflare.js +3 -0
- package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryRequestScopedCloudflare.js +8 -0
- package/dist/esm/router/domains/emailOtp/emailOtpRequestValidation.js +0 -1
- package/dist/esm/router/domains/passkeyCustody/passkeyCustodyEnvelopeRetrieval.js +2 -8
- package/dist/esm/router/domains/passkeyCustody/walletCustodyRegistrationCommit.js +2 -8
- package/dist/esm/router/domains/signingOperations/routerAbPrivateSigningWorker.js +5 -19
- package/dist/esm/router/domains/signingOperations/walletExecutionAdmission.js +2 -3
- package/dist/esm/router/domains/walletRegistration/walletRegistrationReservation.js +70 -0
- package/dist/esm/router/domains/walletRegistration/walletRegistrationRoutes.js +10 -11
- package/dist/esm/router/domains/walletRegistration/walletRegistrationSetupPayload.js +2 -3
- package/dist/esm/router/domains/walletUnlock/walletUnlockRouteHandlers.js +14 -0
- package/dist/esm/router/express.js +574 -479
- package/dist/esm/router/framework/http.js +2 -0
- package/dist/esm/router/framework/registrationSetupDispatch.js +14 -0
- package/dist/esm/router/framework/ror/normalize.js +0 -1
- package/dist/esm/router/framework/ror/options.js +0 -1
- package/dist/esm/router/framework/ror/provider.js +0 -1
- package/dist/esm/router/framework/ror/staticProvider.js +0 -1
- package/dist/esm/router/framework/routeDefinitions.js +1 -2
- package/dist/esm/router/framework/routerApiWebhooks.js +0 -1
- package/dist/esm/router/ror.js +0 -1
- package/dist/esm/router/transport/fetch/createFetchRouter.js +0 -2
- package/dist/esm/router/transport/fetch/routes/auth.js +2 -0
- package/dist/esm/router/transport/fetch/routes/deviceLinking.js +36 -147
- package/dist/esm/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.js +3 -2
- package/dist/esm/router/transport/fetch/routes/deviceLinkingResponses.js +130 -0
- package/dist/esm/router/transport/fetch/routes/ecdsaOperationStepUpFactor.js +171 -0
- package/dist/esm/router/transport/fetch/routes/passkeyCustody.js +1 -0
- package/dist/esm/router/transport/fetch/routes/syncAccount.js +7 -2
- package/dist/esm/router/transport/fetch/routes/thresholdEcdsa.js +19 -115
- package/dist/esm/router/transport/fetch/routes/walletRegistration.js +3 -1
- package/dist/esm/shared-ts/src/authorization/walletSessionIssuance.js +0 -1
- package/dist/esm/shared-ts/src/device-linking/authorityActivation.js +0 -2
- package/dist/esm/shared-ts/src/device-linking/contracts.js +16 -1
- package/dist/esm/shared-ts/src/device-linking/digests.js +1 -8
- package/dist/esm/shared-ts/src/near/actions.js +0 -1
- package/dist/esm/shared-ts/src/near/nearClient.js +0 -2
- package/dist/esm/shared-ts/src/signing-lanes/evmFamilySigningKeySlotId.js +1 -1
- package/dist/esm/shared-ts/src/signing-lanes/index.js +1 -6
- package/dist/esm/shared-ts/src/signing-lanes/ownerContinuity.js +1 -1
- package/dist/esm/shared-ts/src/signing-lanes/participantDigest.js +2 -81
- package/dist/esm/shared-ts/src/signing-lanes/participants.js +1 -219
- package/dist/esm/shared-ts/src/signing-lanes/recordParsers.js +0 -3
- package/dist/esm/shared-ts/src/tenant-root/tenantRootOperationRecord.js +1 -2
- package/dist/esm/shared-ts/src/threshold/ecdsaDerivationRoleLocalBootstrap.js +0 -1
- package/dist/esm/shared-ts/src/threshold/keyMaterialBrands.js +1 -22
- package/dist/esm/shared-ts/src/threshold/participants.js +0 -1
- package/dist/esm/shared-ts/src/threshold/signingRootScope.js +0 -1
- package/dist/esm/shared-ts/src/utils/addWalletAuthMethod.js +4 -13
- package/dist/esm/shared-ts/src/utils/canonicalPrimitives.js +1 -7
- package/dist/esm/shared-ts/src/utils/domainIds.js +1 -16
- package/dist/esm/shared-ts/src/utils/ecdsaCapabilityActivation.js +1 -11
- package/dist/esm/shared-ts/src/utils/ecdsaKeyFactsInventory.js +0 -1
- package/dist/esm/shared-ts/src/utils/errors.js +1 -19
- package/dist/esm/shared-ts/src/utils/near.js +1 -1
- package/dist/esm/shared-ts/src/utils/registrationEstablishedSession.js +1 -1
- package/dist/esm/shared-ts/src/utils/registrationIds.js +1 -5
- package/dist/esm/shared-ts/src/utils/registrationIntent.js +0 -1
- package/dist/esm/shared-ts/src/utils/registrationSetupOperation.js +8 -0
- package/dist/esm/shared-ts/src/utils/registrationSignerPlan.js +1 -1
- package/dist/esm/shared-ts/src/utils/routerAbEcdsaDerivation.js +0 -1
- package/dist/esm/shared-ts/src/utils/validation.js +1 -5
- package/dist/esm/shared-ts/src/utils/walletAuthAuthority.js +0 -1
- package/dist/esm/shared-ts/src/utils/walletManagementProtocol.js +6 -0
- package/dist/esm/shared-ts/src/utils/wireSchema.js +2 -13
- package/dist/esm/shared-ts/src/wallet-recovery/backupAcknowledgement.js +6 -24
- package/dist/esm/shared-ts/src/wallet-recovery/recoveryCodeLocator.js +0 -1
- package/dist/esm/shared-ts/src/wallet-recovery/recoveryKeyId.js +5 -6
- package/dist/esm/storage/d1Sql.js +1 -7
- package/dist/esm/threshold/session/signingSessionSeal/crypto/cipher.js +0 -1
- package/dist/esm/threshold/session/signingSessionSeal/guards/backends.js +1 -2
- package/dist/esm/threshold/session/signingSessionSeal/idempotencyBackends.js +0 -1
- package/dist/esm/threshold/session/signingSessionSeal/idempotencyRecords.js +0 -1
- package/dist/esm/threshold/session/signingSessionSeal/options.js +0 -1
- package/dist/esm/wasm/evm_crypto/pkg/evm_crypto_bg.wasm +0 -0
- package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker.js +0 -611
- package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
- package/dist/esm/wasm/shamir3pass_runtime/pkg/shamir3pass_runtime_bg.wasm +0 -0
- package/dist/types/shared-ts/src/authorization/capabilityKinds.d.ts +0 -4
- package/dist/types/shared-ts/src/device-linking/contracts.d.ts +1 -0
- package/dist/types/shared-ts/src/signing-lanes/evmFamilySigningKeySlotId.d.ts +0 -2
- package/dist/types/shared-ts/src/signing-lanes/execution.d.ts +0 -11
- package/dist/types/shared-ts/src/signing-lanes/ids.d.ts +2 -7
- package/dist/types/shared-ts/src/signing-lanes/index.d.ts +0 -4
- package/dist/types/shared-ts/src/signing-lanes/ownerContinuity.d.ts +0 -1
- package/dist/types/shared-ts/src/signing-lanes/participantDigest.d.ts +0 -18
- package/dist/types/shared-ts/src/signing-lanes/participants.d.ts +6 -35
- package/dist/types/shared-ts/src/signing-lanes/rotation.d.ts +6 -843
- package/dist/types/shared-ts/src/threshold/keyMaterialBrands.d.ts +0 -10
- package/dist/types/shared-ts/src/threshold/participants.d.ts +1 -1
- package/dist/types/shared-ts/src/utils/addWalletAuthMethod.d.ts +1 -133
- package/dist/types/shared-ts/src/utils/addWalletAuthMethod.typecheck.d.ts +4 -18
- package/dist/types/shared-ts/src/utils/domainIds.d.ts +0 -12
- package/dist/types/shared-ts/src/utils/errors.d.ts +0 -4
- package/dist/types/shared-ts/src/utils/near.d.ts +0 -20
- package/dist/types/shared-ts/src/utils/normalize.d.ts +0 -2
- package/dist/types/shared-ts/src/utils/registrationSetupOperation.d.ts +3 -0
- package/dist/types/shared-ts/src/utils/validation.d.ts +1 -3
- package/dist/types/shared-ts/src/utils/walletCapabilityBindings.d.ts +0 -1
- package/dist/types/shared-ts/src/utils/walletManagementProtocol.d.ts +3 -0
- package/dist/types/shared-ts/src/utils/wireSchema.d.ts +0 -2
- package/dist/types/shared-ts/src/wallet-recovery/backupAcknowledgement.d.ts +0 -1
- package/dist/types/shared-ts/src/wallet-recovery/recoveryCodeReservation.d.ts +1 -10
- package/dist/types/shared-ts/src/wallet-recovery/recoveryCodes.d.ts +1 -3
- package/dist/types/shared-ts/src/wallet-recovery/recoveryKeyId.d.ts +5 -21
- package/dist/types/wallet-server/src/authorization/lifecycleRouting.d.ts +32 -0
- package/dist/types/wallet-server/src/authorization/lifecycleRouting.typecheck.d.ts +2 -0
- package/dist/types/wallet-server/src/authorization/recoveryRouting.d.ts +22 -0
- package/dist/types/wallet-server/src/authorization/recoveryRouting.typecheck.d.ts +2 -0
- package/dist/types/wallet-server/src/authorization/service.d.ts +8 -1
- package/dist/types/wallet-server/src/authorization/sessionRouting.d.ts +20 -0
- package/dist/types/wallet-server/src/authorization/sessionRouting.typecheck.d.ts +2 -0
- package/dist/types/wallet-server/src/cloud-host.d.ts +31 -9
- package/dist/types/wallet-server/src/core/EmailOtpRecords.d.ts +1 -22
- package/dist/types/wallet-server/src/core/EmailOtpStores.d.ts +1 -79
- package/dist/types/wallet-server/src/core/IdentityStore.d.ts +0 -10
- package/dist/types/wallet-server/src/core/RegistrationCeremonyStore.d.ts +0 -1
- package/dist/types/wallet-server/src/core/ThresholdService/config.d.ts +0 -2
- package/dist/types/wallet-server/src/core/ThresholdService/index.d.ts +1 -3
- package/dist/types/wallet-server/src/core/ThresholdService/kv.d.ts +0 -7
- package/dist/types/wallet-server/src/core/ThresholdService/routerAb/ecdsaDerivationPoolFillHandlers.d.ts +0 -3
- package/dist/types/wallet-server/src/core/ThresholdService/routerAbNormalSigningPolicy.d.ts +0 -1
- package/dist/types/wallet-server/src/core/ThresholdService/stores/WalletSessionStore.d.ts +7 -19
- package/dist/types/wallet-server/src/core/ThresholdService/validation.d.ts +0 -34
- package/dist/types/wallet-server/src/core/WalletAuthMethodStore.d.ts +1 -5
- package/dist/types/wallet-server/src/core/WalletStore.d.ts +0 -3
- package/dist/types/wallet-server/src/core/WebAuthnAuthenticatorStore.d.ts +0 -20
- package/dist/types/wallet-server/src/core/WebAuthnCredentialBindingStore.d.ts +1 -27
- package/dist/types/wallet-server/src/core/WebAuthnLoginChallengeStore.d.ts +2 -16
- package/dist/types/wallet-server/src/core/WebAuthnSyncChallengeStore.d.ts +22 -14
- package/dist/types/wallet-server/src/core/authService/emailOtpConfig.d.ts +0 -24
- package/dist/types/wallet-server/src/core/authService/emailOtpEnrollment.d.ts +1 -70
- package/dist/types/wallet-server/src/core/authService/emailOtpSeal.d.ts +0 -13
- package/dist/types/wallet-server/src/core/authService/githubOAuth.d.ts +2 -1
- package/dist/types/wallet-server/src/core/authService/nearTransactions.d.ts +1 -39
- package/dist/types/wallet-server/src/core/authService/rateLimits.d.ts +0 -17
- package/dist/types/wallet-server/src/core/authService/webauthn.d.ts +0 -125
- package/dist/types/wallet-server/src/core/authService/webauthnOidcHelpers.d.ts +0 -3
- package/dist/types/wallet-server/src/core/authService/webauthnVerificationOutcomes.d.ts +1 -1
- package/dist/types/wallet-server/src/core/authService/webauthnWalletBinding.d.ts +0 -12
- package/dist/types/wallet-server/src/core/config.d.ts +0 -10
- package/dist/types/wallet-server/src/core/d1IdentityStore.d.ts +0 -2
- package/dist/types/wallet-server/src/core/d1TenantStore.d.ts +0 -7
- package/dist/types/wallet-server/src/core/d1WalletAuthMethodStore.d.ts +0 -1
- package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceBootstrap.d.ts +19 -0
- package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceSession.d.ts +8 -6
- package/dist/types/wallet-server/src/core/deviceLinking/requestProof.d.ts +2 -5
- package/dist/types/wallet-server/src/core/emailOtpD1Statements.d.ts +10 -7
- package/dist/types/wallet-server/src/core/keyMaterialBrands.d.ts +1 -5
- package/dist/types/wallet-server/src/core/nearRelayerAccountProvisioning.d.ts +0 -1
- package/dist/types/wallet-server/src/core/passkeyCredentialClaims.d.ts +9 -0
- package/dist/types/wallet-server/src/core/routerAbSigning/RouterAbEcdsaPresignRuntime.d.ts +0 -2
- package/dist/types/wallet-server/src/core/routerAbSigning/RouterAbNormalSigningRuntime.d.ts +0 -2
- package/dist/types/wallet-server/src/core/threeRouteRegistrationContracts.d.ts +1 -92
- package/dist/types/wallet-server/src/core/threeRouteRegistrationContracts.typecheck.d.ts +4 -52
- package/dist/types/wallet-server/src/core/thresholdEcdsaChainTarget.d.ts +0 -1
- package/dist/types/wallet-server/src/core/types.d.ts +0 -299
- package/dist/types/wallet-server/src/hosted-wallet-gateway.d.ts +15 -3
- package/dist/types/wallet-server/src/index.d.ts +8 -13
- package/dist/types/wallet-server/src/localRegistrationSetupAuthority.d.ts +13 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1AuthorizationAssembly.d.ts +23 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthConfig.d.ts +25 -3
- package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/d1AuthorizationStore.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.d.ts +3 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEmailOtpGrantStore.d.ts +7 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceRequestProofNonceStore.d.ts +1 -10
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceRouteService.d.ts +4 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionStore.d.ts +6 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetPlanner.d.ts +1 -13
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeService.d.ts +2 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeStore.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpGrantStore.d.ts +0 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRateLimitStore.d.ts +18 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationAttemptStore.d.ts +29 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationRecords.d.ts +3 -16
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.d.ts +7 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1GoogleRegistrationCompletion.d.ts +23 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/identity/d1IdentityService.d.ts +0 -12
- package/dist/types/wallet-server/src/router/cloudflare/d1/near/d1SponsoredNearAccount.d.ts +24 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/near/d1SponsoredNearAccount.typecheck.d.ts +2 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/oidc/d1OidcVerificationService.d.ts +0 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/oidc/googleOidcToken.d.ts +4 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyRouteService.d.ts +5 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.d.ts +9 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.d.ts +10 -11
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.d.ts +3 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationSetupSupport.d.ts +51 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.d.ts +3 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationService.d.ts +30 -47
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationSetup.d.ts +3 -30
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationSetupExecution.d.ts +11 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAddSignerFinalizeRecord.d.ts +27 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAddSignerService.d.ts +1 -10
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthMethodService.d.ts +2 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthorityStore.d.ts +0 -4
- package/dist/types/wallet-server/src/router/cloudflare/d1/webauthn/d1WebAuthnAuthService.d.ts +3 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/webauthn/d1WebAuthnRecords.d.ts +0 -13
- package/dist/types/wallet-server/src/router/cloudflare/d1/webauthn/d1WebAuthnStore.d.ts +23 -10
- package/dist/types/wallet-server/src/router/cloudflare/d1/webauthn/d1WebAuthnStore.typecheck.d.ts +2 -0
- package/dist/types/wallet-server/src/router/cloudflare/runtime/cloudflare.types.d.ts +0 -2
- package/dist/types/wallet-server/src/router/cloudflare/runtime/walletConsoleOps.d.ts +1 -0
- package/dist/types/wallet-server/src/router/cloudflare/runtime/walletConsoleOpsClient.d.ts +2 -0
- package/dist/types/wallet-server/src/router/cloudflare/runtime/walletGateway.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/runtime/walletRuntimeOps.d.ts +3 -0
- package/dist/types/wallet-server/src/router/cloudflare-adaptor.d.ts +0 -1
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration.d.ts +1 -1
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitioning.d.ts +2 -2
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.d.ts +2 -2
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.typecheck.d.ts +2 -0
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/export/routerAbEd25519YaoExportRequestScopedCloudflare.d.ts +2 -0
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryRequestScopedCloudflare.d.ts +2 -0
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/passkeyCustodyEnvelopeRetrieval.d.ts +0 -2
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/walletCustodyRegistrationCommit.d.ts +0 -3
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbPrivateSigningWorker.d.ts +0 -17
- package/dist/types/wallet-server/src/router/domains/signingOperations/walletExecutionAdmission.d.ts +1 -2
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationInputs.d.ts +1 -0
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationReservation.d.ts +51 -0
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationRoutes.d.ts +2 -10
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationSetupPayload.d.ts +2 -2
- package/dist/types/wallet-server/src/router/framework/authServicePort.d.ts +14 -34
- package/dist/types/wallet-server/src/router/framework/googleLoginResolution.typecheck.d.ts +2 -0
- package/dist/types/wallet-server/src/router/framework/registrationSetupDispatch.d.ts +13 -0
- package/dist/types/wallet-server/src/router/transport/fetch/routes/deviceLinking.d.ts +1 -1
- package/dist/types/wallet-server/src/router/transport/fetch/routes/deviceLinkingResponses.d.ts +17 -0
- package/dist/types/wallet-server/src/router/transport/fetch/routes/ecdsaOperationStepUpFactor.d.ts +37 -0
- package/dist/types/wallet-server/src/storage/d1Sql.d.ts +0 -1
- package/migrations/d1-signer/0040_namespace_home_challenges.sql +16 -0
- package/migrations/d1-signer/0041_step_up_admission_expiry.sql +28 -0
- package/migrations/d1-signer/0042_deployment_resource_challenges.sql +4 -0
- package/migrations/d1-signer/0043_google_registration_candidate_claim.sql +2 -0
- package/migrations/d1-signer/0044_linked_device_bootstrap_imports.sql +6 -0
- package/migrations/d1-signer/0045_wallet_owned_capability_receipts.sql +29 -0
- package/migrations/d1-signer/0046_wallet_owned_signing_abuse.sql +41 -0
- package/migrations/d1-signer/0047_remove_unused_near_public_keys.sql +2 -0
- package/migrations/d1-signer/0048_operation_owner_scope.sql +45 -0
- package/package.json +2 -3
- package/src/README.md +11 -3
- package/dist/esm/core/AuthService.js +0 -2
- package/dist/esm/core/NearPublicKeyStore.js +0 -200
- package/dist/esm/core/ThresholdService/stores/CloudflareDurableObjectStore.js +0 -397
- package/dist/esm/core/ThresholdService/stores/KeyStore.js +0 -140
- package/dist/esm/core/ThresholdService/stores/SessionStore.js +0 -361
- package/dist/esm/core/ThresholdService/stores/StoreConfig.js +0 -13
- package/dist/esm/core/ThresholdService/stores/exportReplayGuard.js +0 -7
- package/dist/esm/core/authService/AuthService.js +0 -594
- package/dist/esm/core/authService/bytes.js +0 -19
- package/dist/esm/core/authService/configValues.js +0 -15
- package/dist/esm/core/authService/emailOtpChallengeOperations.js +0 -123
- package/dist/esm/core/authService/emailOtpChallengeProof.js +0 -183
- package/dist/esm/core/authService/emailOtpChallengeVerification.js +0 -264
- package/dist/esm/core/authService/emailOtpChallenges.js +0 -225
- package/dist/esm/core/authService/emailOtpDelivery.js +0 -134
- package/dist/esm/core/authService/emailOtpGrant.js +0 -43
- package/dist/esm/core/authService/emailOtpRegistrationEnrollment.js +0 -144
- package/dist/esm/core/authService/emailOtpUnlock.js +0 -174
- package/dist/esm/core/authService/googleEmailOtpOperations.js +0 -141
- package/dist/esm/core/authService/googleEmailOtpRegistration.js +0 -587
- package/dist/esm/core/authService/identity.js +0 -42
- package/dist/esm/core/authService/identityOperations.js +0 -32
- package/dist/esm/core/authService/nearAccountOperations.js +0 -229
- package/dist/esm/core/authService/nearPublicKeyMetadata.js +0 -108
- package/dist/esm/core/authService/oidcVerification.js +0 -249
- package/dist/esm/core/authService/registrationThresholdHelpers.js +0 -30
- package/dist/esm/core/authService/runtime.js +0 -45
- package/dist/esm/core/authService/storeRegistry.js +0 -102
- package/dist/esm/core/authService/thresholdStoreSummary.js +0 -32
- package/dist/esm/core/authService/webauthnAuthority.js +0 -17
- package/dist/esm/core/defaultConfigsServer.js +0 -9
- package/dist/esm/core/hostedAccountIds.js +0 -225
- package/dist/esm/core/routerAbSigning/createRouterAbSigningRuntimes.js +0 -84
- package/dist/esm/core/signingLanes/LaneAggregateRevocationApplicationService.js +0 -86
- package/dist/esm/core/signingLanes/LaneEnrollmentActivation.js +0 -324
- package/dist/esm/core/signingLanes/LaneEnrollmentRevocation.js +0 -173
- package/dist/esm/core/signingLanes/LaneLifecycleApplicationService.js +0 -198
- package/dist/esm/core/signingLanes/ecdsaServerRetirement.js +0 -73
- package/dist/esm/core/signingLanes/ed25519ServerRetirement.js +0 -68
- package/dist/esm/core/signingLanes/signingWorkerLaneMaterialIdentity.js +0 -0
- package/dist/esm/core/storeBackends.js +0 -208
- package/dist/esm/core/utils.js +0 -14
- package/dist/esm/core/webAuthnStoreBackends.js +0 -198
- package/dist/esm/router/cloudflare/d1/near/d1NearPublicKeyStore.js +0 -49
- package/dist/esm/router/cloudflare/d1/signingLanes/d1EcdsaLanePrivateBindingResolver.js +0 -10
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneAggregateRevocationApplicationService.js +0 -22
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneEffectJournalStore.js +0 -166
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneEnrollmentGateway.js +0 -38
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneLifecycleApplicationService.js +0 -20
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneLifecycleStore.js +0 -1459
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneLockStore.js +0 -114
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneProtocolCommitter.js +0 -16
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneRecords.js +0 -171
- package/dist/esm/router/cloudflare/d1/signingLanes/index.js +0 -10
- package/dist/esm/router/cloudflare/durableObjects/thresholdStore.js +0 -397
- package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneCurveExecution.js +0 -597
- package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneProtocolCommitter.js +0 -273
- package/dist/esm/router/cloudflare/signingLanes/index.js +0 -4
- package/dist/esm/router/cloudflare/signingLanes/linkedDeviceEd25519CeremonyBinding.js +0 -32
- package/dist/esm/router/transport/fetch/routes/nearPublicKeys.js +0 -27
- package/dist/esm/shared-ts/src/signing-lanes/rotation.js +0 -8
- package/dist/esm/shared-ts/src/signing-lanes/rotationDigests.js +0 -358
- package/dist/esm/shared-ts/src/signing-lanes/rotationLifecycle.js +0 -313
- package/dist/esm/shared-ts/src/signing-lanes/rotationParsers.js +0 -532
- package/dist/esm/shared-ts/src/signing-lanes/rotationProtocolParsers.js +0 -323
- package/dist/esm/shared-ts/src/signing-lanes/rotationWireFields.js +0 -59
- package/dist/types/shared-ts/src/signing-lanes/participantDigest.typecheck.d.ts +0 -2
- package/dist/types/shared-ts/src/signing-lanes/rotation.typecheck.d.ts +0 -2
- package/dist/types/shared-ts/src/signing-lanes/rotationDigests.d.ts +0 -13
- package/dist/types/shared-ts/src/signing-lanes/rotationLifecycle.d.ts +0 -78
- package/dist/types/shared-ts/src/signing-lanes/rotationParsers.d.ts +0 -27
- package/dist/types/shared-ts/src/signing-lanes/rotationProtocolParsers.d.ts +0 -6
- package/dist/types/shared-ts/src/signing-lanes/rotationWireFields.d.ts +0 -20
- package/dist/types/shared-ts/src/wallet-recovery/recoveryCodeAttempt.d.ts +0 -59
- package/dist/types/wallet-server/src/core/AuthService.d.ts +0 -3
- package/dist/types/wallet-server/src/core/NearPublicKeyStore.d.ts +0 -48
- package/dist/types/wallet-server/src/core/ThresholdService/stores/CloudflareDurableObjectStore.d.ts +0 -21
- package/dist/types/wallet-server/src/core/ThresholdService/stores/KeyStore.d.ts +0 -40
- package/dist/types/wallet-server/src/core/ThresholdService/stores/SessionStore.d.ts +0 -98
- package/dist/types/wallet-server/src/core/ThresholdService/stores/StoreConfig.d.ts +0 -4
- package/dist/types/wallet-server/src/core/ThresholdService/stores/ThresholdStoreConfig.typecheck.d.ts +0 -2
- package/dist/types/wallet-server/src/core/ThresholdService/stores/exportReplayGuard.d.ts +0 -3
- package/dist/types/wallet-server/src/core/authService/AuthService.d.ts +0 -490
- package/dist/types/wallet-server/src/core/authService/bytes.d.ts +0 -3
- package/dist/types/wallet-server/src/core/authService/configValues.d.ts +0 -7
- package/dist/types/wallet-server/src/core/authService/emailOtpChallengeOperations.d.ts +0 -109
- package/dist/types/wallet-server/src/core/authService/emailOtpChallengeProof.d.ts +0 -169
- package/dist/types/wallet-server/src/core/authService/emailOtpChallengeVerification.d.ts +0 -47
- package/dist/types/wallet-server/src/core/authService/emailOtpChallenges.d.ts +0 -86
- package/dist/types/wallet-server/src/core/authService/emailOtpDelivery.d.ts +0 -66
- package/dist/types/wallet-server/src/core/authService/emailOtpGrant.d.ts +0 -43
- package/dist/types/wallet-server/src/core/authService/emailOtpRegistrationEnrollment.d.ts +0 -49
- package/dist/types/wallet-server/src/core/authService/emailOtpUnlock.d.ts +0 -64
- package/dist/types/wallet-server/src/core/authService/googleEmailOtpOperations.d.ts +0 -126
- package/dist/types/wallet-server/src/core/authService/googleEmailOtpRegistration.d.ts +0 -169
- package/dist/types/wallet-server/src/core/authService/identity.d.ts +0 -25
- package/dist/types/wallet-server/src/core/authService/identityOperations.d.ts +0 -19
- package/dist/types/wallet-server/src/core/authService/nearAccountOperations.d.ts +0 -55
- package/dist/types/wallet-server/src/core/authService/nearPublicKeyMetadata.d.ts +0 -44
- package/dist/types/wallet-server/src/core/authService/oidcVerification.d.ts +0 -66
- package/dist/types/wallet-server/src/core/authService/registrationThresholdHelpers.d.ts +0 -11
- package/dist/types/wallet-server/src/core/authService/runtime.d.ts +0 -20
- package/dist/types/wallet-server/src/core/authService/storeRegistry.d.ts +0 -53
- package/dist/types/wallet-server/src/core/authService/thresholdStoreSummary.d.ts +0 -3
- package/dist/types/wallet-server/src/core/authService/webauthnAuthority.d.ts +0 -5
- package/dist/types/wallet-server/src/core/defaultConfigsServer.d.ts +0 -5
- package/dist/types/wallet-server/src/core/hostedAccountIds.d.ts +0 -16
- package/dist/types/wallet-server/src/core/routerAbSigning/createRouterAbSigningRuntimes.d.ts +0 -16
- package/dist/types/wallet-server/src/core/signingLanes/LaneAggregateRevocationApplicationService.d.ts +0 -36
- package/dist/types/wallet-server/src/core/signingLanes/LaneEffectJournalStore.d.ts +0 -62
- package/dist/types/wallet-server/src/core/signingLanes/LaneEnrollmentActivation.d.ts +0 -13
- package/dist/types/wallet-server/src/core/signingLanes/LaneEnrollmentRevocation.d.ts +0 -24
- package/dist/types/wallet-server/src/core/signingLanes/LaneLifecycleApplicationService.d.ts +0 -141
- package/dist/types/wallet-server/src/core/signingLanes/LaneLifecycleStore.d.ts +0 -228
- package/dist/types/wallet-server/src/core/signingLanes/ecdsaServerRetirement.d.ts +0 -58
- package/dist/types/wallet-server/src/core/signingLanes/ed25519ServerRetirement.d.ts +0 -30
- package/dist/types/wallet-server/src/core/signingLanes/signingWorkerLaneMaterialIdentity.d.ts +0 -4
- package/dist/types/wallet-server/src/core/storeBackends.d.ts +0 -83
- package/dist/types/wallet-server/src/core/utils.d.ts +0 -3
- package/dist/types/wallet-server/src/core/webAuthnStoreBackends.d.ts +0 -96
- package/dist/types/wallet-server/src/router/cloudflare/d1/near/d1NearPublicKeyStore.d.ts +0 -29
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1EcdsaLanePrivateBindingResolver.d.ts +0 -4
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1LaneAggregateRevocationApplicationService.d.ts +0 -4
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1LaneEffectJournalStore.d.ts +0 -24
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1LaneEnrollmentGateway.d.ts +0 -20
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1LaneLifecycleApplicationService.d.ts +0 -13
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1LaneLifecycleStore.d.ts +0 -51
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1LaneLockStore.d.ts +0 -28
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1LaneProtocolCommitter.d.ts +0 -5
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1LaneRecords.d.ts +0 -107
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/index.d.ts +0 -10
- package/dist/types/wallet-server/src/router/cloudflare/durableObjects/thresholdStore.d.ts +0 -18
- package/dist/types/wallet-server/src/router/cloudflare/signingLanes/cloudflareLaneCurveExecution.d.ts +0 -217
- package/dist/types/wallet-server/src/router/cloudflare/signingLanes/cloudflareLaneProtocolCommitter.d.ts +0 -73
- package/dist/types/wallet-server/src/router/cloudflare/signingLanes/index.d.ts +0 -4
- package/dist/types/wallet-server/src/router/cloudflare/signingLanes/linkedDeviceEd25519CeremonyBinding.d.ts +0 -6
- package/dist/types/wallet-server/src/router/transport/fetch/routes/nearPublicKeys.d.ts +0 -3
- /package/dist/esm/{core/signingLanes/LaneEffectJournalStore.js → authorization/recoveryRouting.js} +0 -0
- /package/dist/esm/{core/signingLanes/LaneLifecycleStore.js → authorization/sessionRouting.js} +0 -0
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { parseWalletAuthMethodId, parseWalletAuthorityId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { parseDeviceId, parsePrincipalId, parseTenantId, parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
|
-
import {
|
|
4
|
-
import { base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
5
|
-
import { alphabetizeStringify, sha256BytesUtf8, sha256HexUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
6
|
-
import "../../../../shared-ts/src/utils/encoders.js";
|
|
3
|
+
import { sha256HexUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
7
4
|
import { parseRouterAbEcdsaRegistrationActivationReceiptV1 } from "../../../../shared-ts/src/utils/routerAbEcdsaDerivation.js";
|
|
8
|
-
import { AuthorizationService } from "../../../../authorization/service.js";
|
|
9
5
|
import { D1WalletStore } from "../../../../core/d1WalletStore.js";
|
|
10
6
|
import { D1WalletAuthMethodStore } from "../../../../core/d1WalletAuthMethodStore.js";
|
|
11
7
|
import { normalizeLogger } from "../../../../core/logger.js";
|
|
@@ -16,39 +12,38 @@ import { resolveActiveOwnerWalletExecutionLane, resolveWalletAuthMethodIdForAuth
|
|
|
16
12
|
import { DEFAULT_WALLET_SESSION_TTL_MS } from "../../../../shared-ts/src/threshold/sessionPolicy.js";
|
|
17
13
|
import { createDeviceLinkingOwnerRequestAuthenticatorV1 } from "../../../transport/fetch/routes/deviceLinkingOwnerAuthorization.js";
|
|
18
14
|
import { sha256BytesPortable, toRecordValue } from "./d1RouterApiAuthBoundary.js";
|
|
19
|
-
import { CloudflareD1WebAuthnStore } from "../webauthn/d1WebAuthnStore.js";
|
|
20
15
|
import { verifyD1LinkedDeviceFreshRevokeProofV1 } from "../wallet/d1WalletAuthMethodBoundary.js";
|
|
21
|
-
import { CloudflareD1WebAuthnAuthService } from "../webauthn/d1WebAuthnAuthService.js";
|
|
22
16
|
import { D1LinkedDeviceAuthorityInstallServiceV1 } from "../deviceLinking/d1LinkedDeviceAuthorityInstallService.js";
|
|
23
17
|
import { D1WalletAuthorityStore } from "../wallet/d1WalletAuthorityStore.js";
|
|
24
|
-
import { CloudflareD1AuthorizationStore } from "../authorization/d1AuthorizationStore.js";
|
|
25
18
|
import { createCloudflareD1VersionedJsonRecordStore } from "../versionedJson/d1VersionedJsonRecordStore.js";
|
|
26
|
-
import { parseRouterAbEd25519YaoRegistrationSideEffectRecordV2
|
|
19
|
+
import { parseRouterAbEd25519YaoRegistrationSideEffectRecordV2 } from "../../../domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationSideEffectBoundary.js";
|
|
27
20
|
import { createCloudflareOrdinaryInactiveSignerMaterialActivationPortV1, createCloudflareOrdinaryInactiveSignerMaterialDeactivationPortV1, createCloudflareOrdinaryInactiveSignerMaterialReservationServiceV1 } from "../../signingLanes/cloudflareOrdinaryInactiveSignerMaterialReservation.js";
|
|
28
21
|
import { normalizeD1RouterApiAuthOptions } from "./d1RouterApiAuthConfig.js";
|
|
22
|
+
import { toPublicKeyStringFromSecretKey } from "../../../../core/nearKeys.js";
|
|
23
|
+
import { MinimalNearClient } from "../../../../core/rpcClients/near/NearClient.js";
|
|
24
|
+
import { fundImplicitNearAccountWithRelayer } from "../../../../core/nearRelayerAccountProvisioning.js";
|
|
25
|
+
import { createSponsoredNamedNearAccountForOptions } from "../near/d1SponsoredNearAccount.js";
|
|
26
|
+
import { parseD1EcdsaDerivationServerBootstrapResponse, parseD1WalletRegistrationCommittedInstallationProjection, parseD1WalletRegistrationFinalizeReplayResponse } from "../registration/d1RegistrationCeremonyRecords.js";
|
|
27
|
+
import { parseD1WalletAddSignerFinalizeSideEffectRecord } from "../wallet/d1WalletAddSignerFinalizeRecord.js";
|
|
28
|
+
import { dispatchWalletRegistrationSetup } from "../../../framework/registrationSetupDispatch.js";
|
|
29
29
|
import { readActiveWalletSessionCredential, readExhaustedWalletSessionCredential, readWalletSessionSigningCandidate } from "./walletSessionCredentialReaders.js";
|
|
30
30
|
import { createD1AuthorizedOperationRouteService } from "./d1AuthorizedOperationRouteService.js";
|
|
31
31
|
import { parseRegistrationEstablishedSessionProjectionV2 } from "../../../../shared-ts/src/utils/registrationEstablishedSession.js";
|
|
32
|
-
import { D1IdentityStore } from "../../../../core/d1IdentityStore.js";
|
|
33
|
-
import { toPublicKeyStringFromSecretKey } from "../../../../core/nearKeys.js";
|
|
34
|
-
import { MinimalNearClient } from "../../../../core/rpcClients/near/NearClient.js";
|
|
35
32
|
import { signGasRelayerNearTransactionWithDeps } from "../../../../core/authService/nearTransactions.js";
|
|
36
33
|
import { ensureSignerWasmRuntime } from "../../../../core/authService/wasm.js";
|
|
37
|
-
import {
|
|
34
|
+
import { CloudflareD1PasskeyCustodyEnvelopeStore } from "../passkeyCustody/d1PasskeyCustodyEnvelopeStore.js";
|
|
35
|
+
import { createD1AuthorizationAssembly, createD1EmailOtpRateLimits, createD1GoogleRegistrationAttempts, createD1IdentityStore, createD1WalletCustodyStore, createD1WebAuthnAssembly } from "./d1AuthorizationAssembly.js";
|
|
38
36
|
import { CloudflareD1RegistrationCeremonyIntentStore } from "../registration/d1RegistrationCeremonyStore.js";
|
|
39
|
-
import { CloudflareD1NearPublicKeyStore } from "../near/d1NearPublicKeyStore.js";
|
|
40
37
|
import { CloudflareD1EmailOtpChallengeStore } from "../emailOtp/d1EmailOtpChallengeStore.js";
|
|
41
38
|
import { CloudflareD1EmailOtpDeliveryRuntime } from "../emailOtp/d1EmailOtpDeliveryRuntime.js";
|
|
42
39
|
import { CloudflareD1EmailOtpEnrollmentStore } from "../emailOtp/d1EmailOtpEnrollmentStore.js";
|
|
43
40
|
import { CloudflareD1EmailOtpGrantStore } from "../emailOtp/d1EmailOtpGrantStore.js";
|
|
44
|
-
import { CloudflareD1EmailOtpRateLimitStore } from "../emailOtp/d1EmailOtpRateLimitStore.js";
|
|
45
41
|
import { CloudflareD1EmailOtpServerSealRuntime } from "../emailOtp/d1EmailOtpServerSealRuntime.js";
|
|
46
42
|
import { CloudflareD1EmailOtpRegistrationEnrollmentFinalizer } from "../emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.js";
|
|
47
43
|
import { CloudflareD1EmailOtpChallengeVerifier } from "../emailOtp/d1EmailOtpChallengeVerifier.js";
|
|
48
44
|
import { CloudflareD1EmailOtpChallengeIssuer } from "../emailOtp/d1EmailOtpChallengeIssuer.js";
|
|
49
45
|
import { CloudflareD1EmailOtpChallengeService } from "../emailOtp/d1EmailOtpChallengeService.js";
|
|
50
46
|
import { CloudflareD1EmailOtpRecoveryService } from "../emailOtp/d1EmailOtpRecoveryService.js";
|
|
51
|
-
import { CloudflareD1GoogleEmailOtpRegistrationAttemptStore } from "../emailOtp/d1GoogleEmailOtpRegistrationAttemptStore.js";
|
|
52
47
|
import { CloudflareD1GoogleEmailOtpSessionResolver } from "../emailOtp/d1GoogleEmailOtpSessionResolver.js";
|
|
53
48
|
import { CloudflareD1IdentityService } from "../identity/d1IdentityService.js";
|
|
54
49
|
import { CloudflareD1OidcVerificationService } from "../oidc/d1OidcVerificationService.js";
|
|
@@ -58,14 +53,11 @@ import { parseWalletRegistrationSessionCommitReceiptV2 } from "../registration/w
|
|
|
58
53
|
import { CloudflareD1WalletRegistrationService } from "../registration/d1WalletRegistrationService.js";
|
|
59
54
|
import { CloudflareD1WalletRegistrationCommitStore } from "../registration/d1WalletRegistrationCommitStore.js";
|
|
60
55
|
import { CloudflareD1Ed25519YaoLifecycleDecisionStoreV1 } from "../ed25519Yao/d1Ed25519YaoLifecycleDecisionStore.js";
|
|
61
|
-
import { CloudflareD1PasskeyCustodyEnvelopeStore } from "../passkeyCustody/d1PasskeyCustodyEnvelopeStore.js";
|
|
62
|
-
import { CloudflareD1WalletCustodyCommitStore } from "../passkeyCustody/d1WalletCustodyCommitStore.js";
|
|
63
56
|
import { createD1PasskeyCustodyRouteService } from "../passkeyCustody/d1PasskeyCustodyRouteService.js";
|
|
64
57
|
import { CloudflareD1WalletRecoveryGoogleEmailOtpAttemptStore } from "../passkeyCustody/d1WalletRecoveryGoogleEmailOtpAttemptStore.js";
|
|
65
58
|
import { CloudflareD1WalletRecoveryGoogleEmailOtpService } from "../passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.js";
|
|
66
|
-
import { CloudflareD1WalletAddSignerService,
|
|
59
|
+
import { CloudflareD1WalletAddSignerService, parseD1WalletAddSignerStartSideEffectRecord } from "../wallet/d1WalletAddSignerService.js";
|
|
67
60
|
import { CloudflareD1RegistrationIntentService } from "../registration/d1RegistrationIntentService.js";
|
|
68
|
-
import { broadcastPreparedSponsoredNearAccountCreation, fundImplicitNearAccountWithRelayer, prepareSponsoredNearAccountCreationWithRelayer, preparedSponsoredNearAccountCreationArtifactFingerprint } from "../../../../core/nearRelayerAccountProvisioning.js";
|
|
69
61
|
import { createD1LinkedDeviceSessionServiceV1 } from "../deviceLinking/d1LinkedDeviceSessionService.js";
|
|
70
62
|
import { D1LinkedDeviceSessionStoreV1 } from "../deviceLinking/d1LinkedDeviceSessionStore.js";
|
|
71
63
|
import { createD1LinkedDeviceRouteServiceV1 } from "../deviceLinking/d1LinkedDeviceRouteService.js";
|
|
@@ -199,6 +191,7 @@ function createD1LinkedDeviceComposition(input) {
|
|
|
199
191
|
});
|
|
200
192
|
}
|
|
201
193
|
const sessionStore = new D1LinkedDeviceSessionStoreV1({
|
|
194
|
+
bootstrap: input.options.linkedDeviceBootstrap,
|
|
202
195
|
database: input.options.database,
|
|
203
196
|
scope,
|
|
204
197
|
now: nowV1
|
|
@@ -228,6 +221,7 @@ function createD1LinkedDeviceComposition(input) {
|
|
|
228
221
|
});
|
|
229
222
|
const verifiedLinkBuilder = { source: verifiedLinkSourceReader };
|
|
230
223
|
const authorityInstall = new D1LinkedDeviceAuthorityInstallServiceV1({
|
|
224
|
+
credentialClaims: input.options.credentialClaims,
|
|
231
225
|
database: input.options.database,
|
|
232
226
|
scope,
|
|
233
227
|
authorityStore,
|
|
@@ -259,6 +253,8 @@ function createD1LinkedDeviceComposition(input) {
|
|
|
259
253
|
acknowledgeLocalAuthorityActivationV1: authorityInstall.acknowledgeLocalAuthorityActivationV1.bind(authorityInstall)
|
|
260
254
|
};
|
|
261
255
|
deviceLinking = createD1LinkedDeviceRouteServiceV1({
|
|
256
|
+
bootstrap: input.options.linkedDeviceBootstrap,
|
|
257
|
+
proofNonces: input.options.linkedDeviceProofNonces,
|
|
262
258
|
database: input.options.database,
|
|
263
259
|
scope,
|
|
264
260
|
ownerAuthorization: ownerAuthorizationProvider.ownerAuthorization,
|
|
@@ -433,48 +429,6 @@ async function fundImplicitNearAccountForOptions(options, input) {
|
|
|
433
429
|
fundedAmountYocto
|
|
434
430
|
});
|
|
435
431
|
}
|
|
436
|
-
/**
|
|
437
|
-
* Validates a persisted claim before it is trusted to skip a broadcast or to be
|
|
438
|
-
* replayed. An invalid record makes the D1 read fail, which leaves the effect
|
|
439
|
-
* uncertain and prevents any network action on unvalidated bytes.
|
|
440
|
-
*/
|
|
441
|
-
function parseSponsoredNearAccountSideEffectRecord(raw) {
|
|
442
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
443
|
-
if (Reflect.get(raw, "operation") !== "finalize") return null;
|
|
444
|
-
const requestFingerprint = parseSideEffectFingerprint(Reflect.get(raw, "requestFingerprint"));
|
|
445
|
-
const preparedArtifactFingerprint = parseSideEffectFingerprint(Reflect.get(raw, "preparedArtifactFingerprint"));
|
|
446
|
-
if (requestFingerprint === null || preparedArtifactFingerprint === null) return null;
|
|
447
|
-
const claimedAtMs = Reflect.get(raw, "claimedAtMs");
|
|
448
|
-
if (!isNonNegativeSafeInteger(claimedAtMs)) return null;
|
|
449
|
-
const prepared = parsePreparedSponsoredNearAccountCreation(Reflect.get(raw, "prepared"));
|
|
450
|
-
if (prepared === null) return null;
|
|
451
|
-
const kind = Reflect.get(raw, "kind");
|
|
452
|
-
if (kind === "router_ab_ed25519_yao_registration_side_effect_claim_v1") return {
|
|
453
|
-
kind: "router_ab_ed25519_yao_registration_side_effect_claim_v1",
|
|
454
|
-
operation: "finalize",
|
|
455
|
-
requestFingerprint,
|
|
456
|
-
preparedArtifactFingerprint,
|
|
457
|
-
claimedAtMs,
|
|
458
|
-
prepared
|
|
459
|
-
};
|
|
460
|
-
if (kind === "router_ab_ed25519_yao_registration_side_effect_completion_v1") {
|
|
461
|
-
const completedAtMs = Reflect.get(raw, "completedAtMs");
|
|
462
|
-
if (!isNonNegativeSafeInteger(completedAtMs)) return null;
|
|
463
|
-
const response = parseAccountCreationResult(Reflect.get(raw, "response"));
|
|
464
|
-
if (response === null) return null;
|
|
465
|
-
return {
|
|
466
|
-
kind: "router_ab_ed25519_yao_registration_side_effect_completion_v1",
|
|
467
|
-
operation: "finalize",
|
|
468
|
-
requestFingerprint,
|
|
469
|
-
preparedArtifactFingerprint,
|
|
470
|
-
claimedAtMs,
|
|
471
|
-
completedAtMs,
|
|
472
|
-
prepared,
|
|
473
|
-
response
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
return null;
|
|
477
|
-
}
|
|
478
432
|
function parseWalletRegistrationOperationPrepared(raw) {
|
|
479
433
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
480
434
|
if (Reflect.get(raw, "kind") !== "d1_wallet_registration_operation_prepared_v1") return null;
|
|
@@ -667,86 +621,9 @@ function registrationReceiptMatchesJournal(record) {
|
|
|
667
621
|
if (receipt.committed.kind === "near_pending") return true;
|
|
668
622
|
return "foundingAuthority" in receipt && receipt.foundingAuthority.authorityId === record.prepared.walletAuthorityId;
|
|
669
623
|
}
|
|
670
|
-
function parsePreparedSponsoredNearAccountCreation(value) {
|
|
671
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
|
|
672
|
-
if (Reflect.get(value, "kind") !== "prepared_sponsored_near_account_creation_v1") return null;
|
|
673
|
-
const accountId = parseNonEmptyString(Reflect.get(value, "accountId"));
|
|
674
|
-
const publicKey = parseNonEmptyString(Reflect.get(value, "publicKey"));
|
|
675
|
-
const relayerAccountId = parseNonEmptyString(Reflect.get(value, "relayerAccountId"));
|
|
676
|
-
const relayerPublicKey = parseNonEmptyString(Reflect.get(value, "relayerPublicKey"));
|
|
677
|
-
const initialBalanceYocto = parseNonEmptyString(Reflect.get(value, "initialBalanceYocto"));
|
|
678
|
-
const transactionHash = parseNonEmptyString(Reflect.get(value, "transactionHash"));
|
|
679
|
-
const nextNonce = parseNonEmptyString(Reflect.get(value, "nextNonce"));
|
|
680
|
-
const blockHash = parseNonEmptyString(Reflect.get(value, "blockHash"));
|
|
681
|
-
const signedTransactionBorshB64u = parseBoundedBase64Url(Reflect.get(value, "signedTransactionBorshB64u"));
|
|
682
|
-
if (accountId === null || publicKey === null || relayerAccountId === null || relayerPublicKey === null || initialBalanceYocto === null || transactionHash === null || nextNonce === null || blockHash === null || signedTransactionBorshB64u === null) return null;
|
|
683
|
-
return {
|
|
684
|
-
kind: "prepared_sponsored_near_account_creation_v1",
|
|
685
|
-
accountId,
|
|
686
|
-
publicKey,
|
|
687
|
-
relayerAccountId,
|
|
688
|
-
relayerPublicKey,
|
|
689
|
-
initialBalanceYocto,
|
|
690
|
-
transactionHash,
|
|
691
|
-
nextNonce,
|
|
692
|
-
blockHash,
|
|
693
|
-
signedTransactionBorshB64u
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
function parseAccountCreationResult(value) {
|
|
697
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
|
|
698
|
-
const success = Reflect.get(value, "success");
|
|
699
|
-
if (typeof success !== "boolean") return null;
|
|
700
|
-
const accountId = parseOptionalString(Reflect.get(value, "accountId"));
|
|
701
|
-
const transactionHash = parseOptionalString(Reflect.get(value, "transactionHash"));
|
|
702
|
-
const error = parseOptionalString(Reflect.get(value, "error"));
|
|
703
|
-
const message = parseOptionalString(Reflect.get(value, "message"));
|
|
704
|
-
if ("accountId" in value && accountId === null || "transactionHash" in value && transactionHash === null || "error" in value && error === null || "message" in value && message === null) return null;
|
|
705
|
-
if (success && (accountId === void 0 || transactionHash === void 0)) return null;
|
|
706
|
-
const normalizedAccountId = accountId ?? void 0;
|
|
707
|
-
const normalizedTransactionHash = transactionHash ?? void 0;
|
|
708
|
-
const normalizedError = error ?? void 0;
|
|
709
|
-
const normalizedMessage = message ?? void 0;
|
|
710
|
-
return {
|
|
711
|
-
success,
|
|
712
|
-
...normalizedAccountId === void 0 ? {} : { accountId: normalizedAccountId },
|
|
713
|
-
...normalizedTransactionHash === void 0 ? {} : { transactionHash: normalizedTransactionHash },
|
|
714
|
-
...normalizedError === void 0 ? {} : { error: normalizedError },
|
|
715
|
-
...normalizedMessage === void 0 ? {} : { message: normalizedMessage }
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
function parseNonEmptyString(value) {
|
|
719
|
-
return typeof value === "string" && value.trim() ? value : null;
|
|
720
|
-
}
|
|
721
|
-
function parseSideEffectFingerprint(value) {
|
|
722
|
-
return typeof value === "string" && /^[a-zA-Z0-9:_-]{32,192}$/u.test(value) ? value : null;
|
|
723
|
-
}
|
|
724
|
-
function parseBoundedBase64Url(value) {
|
|
725
|
-
return typeof value === "string" && value.length > 0 && value.length <= 8192 && /^[\w-]+$/u.test(value) ? value : null;
|
|
726
|
-
}
|
|
727
|
-
function parseOptionalString(value) {
|
|
728
|
-
return value === void 0 ? void 0 : parseNonEmptyString(value);
|
|
729
|
-
}
|
|
730
|
-
function isNonNegativeSafeInteger(value) {
|
|
731
|
-
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
732
|
-
}
|
|
733
624
|
function resolveEd25519YaoProductRegistration(options) {
|
|
734
625
|
return options.ed25519YaoProductRegistration || null;
|
|
735
626
|
}
|
|
736
|
-
function sponsoredNearAccountSideEffectStore(options) {
|
|
737
|
-
return createCloudflareD1VersionedJsonRecordStore({
|
|
738
|
-
database: options.database,
|
|
739
|
-
scope: {
|
|
740
|
-
namespace: options.namespace,
|
|
741
|
-
orgId: options.orgId,
|
|
742
|
-
projectId: options.projectId,
|
|
743
|
-
envId: options.envId
|
|
744
|
-
},
|
|
745
|
-
keyPrefix: "router-ab-yao-sponsored-account:",
|
|
746
|
-
encode: (value) => value,
|
|
747
|
-
parse: parseSponsoredNearAccountSideEffectRecord
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
627
|
function walletRegistrationActivateSideEffectStore(options) {
|
|
751
628
|
return createCloudflareD1VersionedJsonRecordStore({
|
|
752
629
|
database: options.database,
|
|
@@ -803,87 +680,6 @@ function walletAddSignerFinalizeSideEffectStore(options) {
|
|
|
803
680
|
parse: parseD1WalletAddSignerFinalizeSideEffectRecord
|
|
804
681
|
});
|
|
805
682
|
}
|
|
806
|
-
/**
|
|
807
|
-
* Creates the sponsored account through a durable claim. The signed transaction
|
|
808
|
-
* and its hash are persisted before the broadcast, so a lost response replays
|
|
809
|
-
* those exact bytes instead of building a second transaction under a fresh
|
|
810
|
-
* nonce. Rebroadcasting an identical signed transaction reuses its hash, so the
|
|
811
|
-
* network treats the retry as the same transaction.
|
|
812
|
-
*/
|
|
813
|
-
async function createSponsoredNamedNearAccountForOptions(options, input) {
|
|
814
|
-
const relayerAccount = options.relayerAccount;
|
|
815
|
-
const relayerPrivateKey = options.relayerPrivateKey;
|
|
816
|
-
const nearRpcUrl = options.nearRpcUrl;
|
|
817
|
-
const initialBalanceYocto = options.accountInitialBalance;
|
|
818
|
-
if (!relayerAccount || !relayerPrivateKey || !nearRpcUrl || !initialBalanceYocto) return {
|
|
819
|
-
kind: "rejected",
|
|
820
|
-
message: "Sponsored NEAR account creation is not configured on this server"
|
|
821
|
-
};
|
|
822
|
-
const relayerInput = {
|
|
823
|
-
accountId: input.accountId,
|
|
824
|
-
publicKey: input.publicKey,
|
|
825
|
-
relayerAccount,
|
|
826
|
-
relayerPrivateKey,
|
|
827
|
-
relayerPublicKey: options.relayerPublicKey,
|
|
828
|
-
nearRpcUrl,
|
|
829
|
-
initialBalanceYocto
|
|
830
|
-
};
|
|
831
|
-
const requestFingerprint = base64UrlEncode(await sha256BytesUtf8(alphabetizeStringify({
|
|
832
|
-
kind: "sponsored_near_account_creation_v1",
|
|
833
|
-
accountId: input.accountId,
|
|
834
|
-
publicKey: input.publicKey,
|
|
835
|
-
relayerAccountId: relayerAccount,
|
|
836
|
-
initialBalanceYocto
|
|
837
|
-
})));
|
|
838
|
-
const outcome = await runRouterAbEd25519YaoRegistrationSideEffectV1(sponsoredNearAccountSideEffectStore(options), {
|
|
839
|
-
kind: "prepared_resumable",
|
|
840
|
-
resumeAfterMs: 3e4,
|
|
841
|
-
operation: "finalize",
|
|
842
|
-
key: `sponsored-account:${input.idempotencyKey}`,
|
|
843
|
-
requestFingerprint,
|
|
844
|
-
nowMs: () => Date.now(),
|
|
845
|
-
prepare: async () => {
|
|
846
|
-
const prepared = await prepareSponsoredNearAccountCreationWithRelayer(relayerInput);
|
|
847
|
-
if (!prepared.ok) throw new Error(prepared.message);
|
|
848
|
-
return prepared.prepared;
|
|
849
|
-
},
|
|
850
|
-
derivePreparedArtifactFingerprint: preparedSponsoredNearAccountCreationArtifactFingerprint,
|
|
851
|
-
execute: async (prepared, attempt) => {
|
|
852
|
-
if (!prepared) throw new Error("Sponsored NEAR account transaction was not prepared");
|
|
853
|
-
const broadcast = await broadcastPreparedSponsoredNearAccountCreation({
|
|
854
|
-
prepared,
|
|
855
|
-
nearRpcUrl,
|
|
856
|
-
relayerAccountId: relayerAccount,
|
|
857
|
-
reconcileFirst: attempt === "resumed"
|
|
858
|
-
});
|
|
859
|
-
if (broadcast.kind === "uncertain") throw new Error(broadcast.message);
|
|
860
|
-
return broadcast.result;
|
|
861
|
-
}
|
|
862
|
-
});
|
|
863
|
-
switch (outcome.kind) {
|
|
864
|
-
case "executed":
|
|
865
|
-
case "exact_replay":
|
|
866
|
-
if (outcome.value.success && outcome.value.accountId && outcome.value.transactionHash) return {
|
|
867
|
-
kind: "created",
|
|
868
|
-
accountId: outcome.value.accountId,
|
|
869
|
-
transactionHash: outcome.value.transactionHash
|
|
870
|
-
};
|
|
871
|
-
return {
|
|
872
|
-
kind: "rejected",
|
|
873
|
-
message: outcome.value.message || outcome.value.error || "Sponsored NEAR account creation was rejected"
|
|
874
|
-
};
|
|
875
|
-
case "in_progress":
|
|
876
|
-
case "uncertain": return {
|
|
877
|
-
kind: "retryable",
|
|
878
|
-
message: outcome.kind === "uncertain" ? outcome.message : "Sponsored NEAR account creation is already in progress for this registration",
|
|
879
|
-
retryAfterMs: 3e4
|
|
880
|
-
};
|
|
881
|
-
case "request_conflict": return {
|
|
882
|
-
kind: "rejected",
|
|
883
|
-
message: "Sponsored NEAR account creation idempotency key conflicts with another request"
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
683
|
async function readD1Ed25519KeyManifestBySlot(walletStore, input) {
|
|
888
684
|
const signer = await walletStore.getEd25519SignerBySlot(input);
|
|
889
685
|
return signer ? { custodyKeyManifestDigestB64u: signer.custodyKeyManifestDigestB64u } : null;
|
|
@@ -898,18 +694,11 @@ function createCloudflareD1RouterApiAuthAssembly(input) {
|
|
|
898
694
|
const walletAuthMethodStore = getWalletAuthMethodStore();
|
|
899
695
|
const walletStore = getWalletStore();
|
|
900
696
|
const createSponsoredNamedNearAccount = createSponsoredNamedNearAccountForOptions.bind(void 0, options);
|
|
901
|
-
const identityStore =
|
|
902
|
-
database: options.database,
|
|
903
|
-
namespace: options.namespace,
|
|
904
|
-
orgId: options.orgId,
|
|
905
|
-
projectId: options.projectId,
|
|
906
|
-
envId: options.envId,
|
|
907
|
-
ensureSchema: false
|
|
908
|
-
});
|
|
697
|
+
const identityStore = createD1IdentityStore(options);
|
|
909
698
|
const linkIdentity = linkD1Identity.bind(void 0, identityStore);
|
|
910
699
|
const linkedDeviceEd25519AuthorityReaderSlot = { current: null };
|
|
911
700
|
const getLinkedDeviceEd25519AuthorityReader = linkedDeviceEd25519AuthorityReaderFromSlot.bind(void 0, linkedDeviceEd25519AuthorityReaderSlot);
|
|
912
|
-
const authorizationStore =
|
|
701
|
+
const { authorizationStore, authorizationService } = createD1AuthorizationAssembly({
|
|
913
702
|
database: options.database,
|
|
914
703
|
namespace: options.namespace,
|
|
915
704
|
walletSignerScope: {
|
|
@@ -919,32 +708,9 @@ function createCloudflareD1RouterApiAuthAssembly(input) {
|
|
|
919
708
|
envId: options.envId
|
|
920
709
|
},
|
|
921
710
|
getLinkedDeviceAuthorityReader: getLinkedDeviceEd25519AuthorityReader
|
|
922
|
-
});
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
sessions: authorizationStore,
|
|
926
|
-
evidence: authorizationStore,
|
|
927
|
-
grants: authorizationStore,
|
|
928
|
-
authorizedOperations: authorizationStore,
|
|
929
|
-
audit: authorizationStore
|
|
930
|
-
});
|
|
931
|
-
const googleEmailOtpRegistrationAttempts = new CloudflareD1GoogleEmailOtpRegistrationAttemptStore({
|
|
932
|
-
prepare,
|
|
933
|
-
orgId: options.orgId
|
|
934
|
-
});
|
|
935
|
-
const nearPublicKeys = new CloudflareD1NearPublicKeyStore({ prepare });
|
|
936
|
-
const webAuthnStore = new CloudflareD1WebAuthnStore({
|
|
937
|
-
database: options.database,
|
|
938
|
-
namespace: options.namespace,
|
|
939
|
-
orgId: options.orgId,
|
|
940
|
-
projectId: options.projectId,
|
|
941
|
-
envId: options.envId
|
|
942
|
-
});
|
|
943
|
-
const webAuthnAuthService = new CloudflareD1WebAuthnAuthService({
|
|
944
|
-
webAuthnStore,
|
|
945
|
-
walletAuthMethodStore,
|
|
946
|
-
walletManifestSource: { getEd25519KeyManifestBySlot: readD1Ed25519KeyManifestBySlot.bind(void 0, walletStore) }
|
|
947
|
-
});
|
|
711
|
+
}, options.sessionRouting);
|
|
712
|
+
const googleEmailOtpRegistrationAttempts = createD1GoogleRegistrationAttempts(options, prepare);
|
|
713
|
+
const { webAuthnStore, webAuthnAuthService } = createD1WebAuthnAssembly(options, walletAuthMethodStore, { getEd25519KeyManifestBySlot: readD1Ed25519KeyManifestBySlot.bind(void 0, walletStore) });
|
|
948
714
|
const emailOtpChallenges = new CloudflareD1EmailOtpChallengeStore({
|
|
949
715
|
database: options.database,
|
|
950
716
|
namespace: options.namespace,
|
|
@@ -955,10 +721,7 @@ function createCloudflareD1RouterApiAuthAssembly(input) {
|
|
|
955
721
|
const emailOtpDelivery = new CloudflareD1EmailOtpDeliveryRuntime(options.emailOtp);
|
|
956
722
|
const emailOtpEnrollments = new CloudflareD1EmailOtpEnrollmentStore({ prepare });
|
|
957
723
|
const emailOtpGrants = new CloudflareD1EmailOtpGrantStore({ prepare });
|
|
958
|
-
const emailOtpRateLimits =
|
|
959
|
-
prepare,
|
|
960
|
-
rateLimits: options.emailOtp.rateLimits
|
|
961
|
-
});
|
|
724
|
+
const emailOtpRateLimits = createD1EmailOtpRateLimits(options, prepare);
|
|
962
725
|
const emailOtpServerSeal = new CloudflareD1EmailOtpServerSealRuntime(options.emailOtpServerSeal);
|
|
963
726
|
const googleEmailOtpSessions = new CloudflareD1GoogleEmailOtpSessionResolver({
|
|
964
727
|
emailOtpEnrollments,
|
|
@@ -968,12 +731,7 @@ function createCloudflareD1RouterApiAuthAssembly(input) {
|
|
|
968
731
|
production: options.emailOtp.production,
|
|
969
732
|
registrationAttempts: googleEmailOtpRegistrationAttempts
|
|
970
733
|
});
|
|
971
|
-
const identityService = new CloudflareD1IdentityService({
|
|
972
|
-
accountIdDerivationSecret: options.accountIdDerivationSecret,
|
|
973
|
-
identityStore,
|
|
974
|
-
relayerAccount: options.relayerAccount,
|
|
975
|
-
resolveGoogleEmailOtpSession: googleEmailOtpSessions.resolve.bind(googleEmailOtpSessions)
|
|
976
|
-
});
|
|
734
|
+
const identityService = new CloudflareD1IdentityService({ identityStore });
|
|
977
735
|
const oidcVerification = new CloudflareD1OidcVerificationService({
|
|
978
736
|
googleOidcClientId: options.googleOidcClientId,
|
|
979
737
|
githubOAuth: options.githubOAuth,
|
|
@@ -1061,23 +819,17 @@ function createCloudflareD1RouterApiAuthAssembly(input) {
|
|
|
1061
819
|
envId: options.envId
|
|
1062
820
|
});
|
|
1063
821
|
const walletRegistrationCommitStore = new CloudflareD1WalletRegistrationCommitStore({
|
|
822
|
+
credentialClaims: options.credentialClaims,
|
|
1064
823
|
database: options.database,
|
|
1065
824
|
namespace: options.namespace,
|
|
1066
825
|
orgId: options.orgId,
|
|
1067
826
|
projectId: options.projectId,
|
|
1068
827
|
envId: options.envId
|
|
1069
828
|
});
|
|
1070
|
-
const walletCustodyCommitStore =
|
|
1071
|
-
database: options.database,
|
|
1072
|
-
scope: {
|
|
1073
|
-
namespace: options.namespace,
|
|
1074
|
-
orgId: options.orgId,
|
|
1075
|
-
projectId: options.projectId,
|
|
1076
|
-
envId: options.envId
|
|
1077
|
-
}
|
|
1078
|
-
});
|
|
829
|
+
const walletCustodyCommitStore = createD1WalletCustodyStore(options);
|
|
1079
830
|
const signedDelegateExecutor = new CloudflareD1SignedDelegateExecutor(options);
|
|
1080
831
|
const walletRegistrations = new CloudflareD1WalletRegistrationService({
|
|
832
|
+
registrationAuthority: options.registrationAuthority ?? null,
|
|
1081
833
|
authorizationService,
|
|
1082
834
|
authorizationTenantId: authorizationTenantId.value,
|
|
1083
835
|
createSponsoredNamedNearAccount,
|
|
@@ -1168,6 +920,7 @@ function createCloudflareD1RouterApiAuthAssembly(input) {
|
|
|
1168
920
|
authorizationService,
|
|
1169
921
|
authorizationStore,
|
|
1170
922
|
walletRegistration: createD1WalletRegistrationRouteService({
|
|
923
|
+
options,
|
|
1171
924
|
emailOtpRecoveryService,
|
|
1172
925
|
registrationIntents,
|
|
1173
926
|
walletAuthMethodStore,
|
|
@@ -1198,7 +951,6 @@ function createCloudflareD1RouterApiAuthAssembly(input) {
|
|
|
1198
951
|
authorizationService,
|
|
1199
952
|
authorizationStore,
|
|
1200
953
|
googleEmailOtpSessions,
|
|
1201
|
-
nearPublicKeys,
|
|
1202
954
|
webAuthnAuthService,
|
|
1203
955
|
walletAuthMethods,
|
|
1204
956
|
walletRegistrations,
|
|
@@ -1267,7 +1019,10 @@ function createD1WalletRegistrationRouteService(assembly) {
|
|
|
1267
1019
|
resolveActiveEcdsaTenantRoot: assembly.walletRegistrations.resolveActiveEcdsaTenantRoot.bind(assembly.walletRegistrations),
|
|
1268
1020
|
listWalletEcdsaKeyFactsInventory: assembly.walletRegistrations.listWalletEcdsaKeyFactsInventory.bind(assembly.walletRegistrations),
|
|
1269
1021
|
readActiveEmailOtpEnrollment: assembly.emailOtpRecoveryService.readActiveEmailOtpEnrollment.bind(assembly.emailOtpRecoveryService),
|
|
1270
|
-
setupWalletRegistration:
|
|
1022
|
+
setupWalletRegistration: dispatchWalletRegistrationSetup.bind(void 0, {
|
|
1023
|
+
dispatcher: assembly.options.registrationSetupDispatcher ?? null,
|
|
1024
|
+
local: assembly.walletRegistrations
|
|
1025
|
+
}),
|
|
1271
1026
|
respondWalletRegistration: assembly.walletRegistrations.respondWalletRegistration.bind(assembly.walletRegistrations),
|
|
1272
1027
|
authorizeWalletRegistrationNearAdmission: assembly.walletRegistrations.authorizeWalletRegistrationNearAdmission.bind(assembly.walletRegistrations),
|
|
1273
1028
|
activateWalletRegistration: assembly.walletRegistrations.activateWalletRegistration.bind(assembly.walletRegistrations),
|
|
@@ -1485,7 +1240,6 @@ function createD1IdentityRouteService(assembly) {
|
|
|
1485
1240
|
linkIdentity: assembly.identityService.linkIdentity.bind(assembly.identityService),
|
|
1486
1241
|
listIdentities: assembly.identityService.listIdentities.bind(assembly.identityService),
|
|
1487
1242
|
resolveGoogleEmailOtpSession: assembly.googleEmailOtpSessions.resolve.bind(assembly.googleEmailOtpSessions),
|
|
1488
|
-
resolveOidcWalletId: assembly.identityService.resolveOidcWalletId.bind(assembly.identityService),
|
|
1489
1243
|
unlinkIdentity: assembly.identityService.unlinkIdentity.bind(assembly.identityService),
|
|
1490
1244
|
verifyGoogleLogin: assembly.oidcVerification.verifyGoogleLogin.bind(assembly.oidcVerification),
|
|
1491
1245
|
verifyGithubOAuthCode: assembly.oidcVerification.verifyGithubOAuthCode.bind(assembly.oidcVerification)
|
|
@@ -1527,10 +1281,7 @@ function createD1ThresholdRuntimeRouteService(assembly) {
|
|
|
1527
1281
|
return { getRouterAbEcdsaPresignRuntime: () => assembly.options.routerAbEcdsaPresignRuntime || null };
|
|
1528
1282
|
}
|
|
1529
1283
|
function createD1NearFundingRouteService(assembly) {
|
|
1530
|
-
return {
|
|
1531
|
-
fundImplicitNearAccount: fundImplicitNearAccountForOptions.bind(void 0, assembly.options),
|
|
1532
|
-
listNearPublicKeysForUser: assembly.nearPublicKeys.listForRelayUser.bind(assembly.nearPublicKeys)
|
|
1533
|
-
};
|
|
1284
|
+
return { fundImplicitNearAccount: fundImplicitNearAccountForOptions.bind(void 0, assembly.options) };
|
|
1534
1285
|
}
|
|
1535
1286
|
function createD1RouterAccountRouteService(assembly) {
|
|
1536
1287
|
const accountId = assembly.options.relayerAccount || DEFAULT_D1_THRESHOLD_RELAYER_ACCOUNT;
|
|
@@ -38,16 +38,25 @@ function ecdsaSignerMatchBindings(walletSignerScope, material) {
|
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
40
|
const PINNED_OWNER_WALLET = `
|
|
41
|
-
|
|
41
|
+
CASE operation.authorization_source_kind
|
|
42
|
+
WHEN 'verified_step_up' THEN (
|
|
43
|
+
SELECT evidence.wallet_id
|
|
44
|
+
FROM verified_wallet_operation_evidence_sets AS evidence
|
|
45
|
+
WHERE evidence.namespace = operation.namespace
|
|
46
|
+
AND evidence.tenant_id = operation.tenant_id
|
|
47
|
+
AND evidence.evidence_set_digest = operation.evidence_set_digest
|
|
48
|
+
LIMIT 1)
|
|
49
|
+
WHEN 'authorization_grant' THEN (
|
|
50
|
+
SELECT session.wallet_id
|
|
42
51
|
FROM wallet_session_authorizations_v2 AS session
|
|
43
52
|
WHERE session.namespace = operation.namespace
|
|
44
53
|
AND session.tenant_id = operation.tenant_id
|
|
45
54
|
AND session.authorization_id = operation.authorization_id
|
|
46
|
-
AND session.org_id = operation.
|
|
47
|
-
AND session.project_id = operation.
|
|
48
|
-
AND session.env_id = operation.
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
AND session.org_id = operation.owner_scope_org_id
|
|
56
|
+
AND session.project_id = operation.owner_scope_project_id
|
|
57
|
+
AND session.env_id = operation.owner_scope_env_id
|
|
58
|
+
LIMIT 1)
|
|
59
|
+
END AS pinned_owner_wallet_id`;
|
|
51
60
|
function prepareAuthorizedOperationCommittedRead(database, namespace, input) {
|
|
52
61
|
return database.prepare(`SELECT operation.*, ${PINNED_OWNER_WALLET}
|
|
53
62
|
FROM authorized_operations AS operation
|
|
@@ -86,9 +95,9 @@ function prepareAuthorizedOperationAdmissionRead(input) {
|
|
|
86
95
|
AND auth_method.wallet_id = session.wallet_id
|
|
87
96
|
AND auth_method.wallet_authority_id = session.authority_id
|
|
88
97
|
WHERE session.namespace = operation.namespace
|
|
89
|
-
AND session.org_id = operation.
|
|
90
|
-
AND session.project_id = operation.
|
|
91
|
-
AND session.env_id = operation.
|
|
98
|
+
AND session.org_id = operation.owner_scope_org_id
|
|
99
|
+
AND session.project_id = operation.owner_scope_project_id
|
|
100
|
+
AND session.env_id = operation.owner_scope_env_id
|
|
92
101
|
AND session.org_id = ? AND session.project_id = ? AND session.env_id = ?
|
|
93
102
|
AND session.tenant_id = operation.tenant_id
|
|
94
103
|
AND session.authorization_id = operation.authorization_id
|
|
@@ -114,7 +123,9 @@ function prepareAuthorizedOperationAdmissionRead(input) {
|
|
|
114
123
|
AND evidence.intent_digest = operation.intent_digest
|
|
115
124
|
AND evidence.display_digest = operation.display_digest
|
|
116
125
|
AND evidence.assurance = 'step_up'
|
|
117
|
-
AND evidence.expires_at_ms >
|
|
126
|
+
AND evidence.expires_at_ms > MAX(
|
|
127
|
+
?, CAST(round(unixepoch('subsec') * 1000) AS INTEGER)
|
|
128
|
+
)
|
|
118
129
|
)
|
|
119
130
|
ELSE 0
|
|
120
131
|
END AS authorization_source_active
|
|
@@ -158,13 +169,6 @@ function prepareAuthorizedOperationInsert(input) {
|
|
|
158
169
|
material?.materialActivation.key_binding ?? null,
|
|
159
170
|
material?.materialActivation.lifecycle_binding ?? null,
|
|
160
171
|
material?.materialActivation.signing_worker ?? null,
|
|
161
|
-
null,
|
|
162
|
-
null,
|
|
163
|
-
null,
|
|
164
|
-
null,
|
|
165
|
-
null,
|
|
166
|
-
null,
|
|
167
|
-
null,
|
|
168
172
|
source.kind === "authorization_grant" ? walletSignerScope.orgId : null,
|
|
169
173
|
source.kind === "authorization_grant" ? walletSignerScope.projectId : null,
|
|
170
174
|
source.kind === "authorization_grant" ? walletSignerScope.envId : null
|
|
@@ -200,13 +204,11 @@ function prepareAuthorizedOperationInsert(input) {
|
|
|
200
204
|
material_activation_id, material_activation_capability,
|
|
201
205
|
material_activation_owner, material_activation_key_binding,
|
|
202
206
|
material_activation_lifecycle_binding, material_activation_signing_worker,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
linked_revocation_epoch, linked_scope_org_id, linked_scope_project_id,
|
|
206
|
-
linked_scope_env_id
|
|
207
|
+
owner_scope_org_id, owner_scope_project_id,
|
|
208
|
+
owner_scope_env_id
|
|
207
209
|
) SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
208
210
|
'claimed', 'pending', NULL, NULL, NULL, NULL, ?, NULL, ?,
|
|
209
|
-
?, ?, ?, ?, ?, ?, ?,
|
|
211
|
+
?, ?, ?, ?, ?, ?, ?, ?
|
|
210
212
|
WHERE (${condition.sql}) AND (${absence.sql})`).bind(...values, ...condition.bindings, ...absence.bindings);
|
|
211
213
|
}
|
|
212
214
|
//#endregion
|
|
@@ -319,11 +319,12 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
319
319
|
AND quota.expires_at_ms >= ?
|
|
320
320
|
AND ${ACTIVE_V2_HOSTED_PARENT_PROVENANCE_SQL}`).bind(this.namespace, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, exchange.tenantId, exchange.exchangeCodeId, exchange.authorizationId, exchange.walletSessionId, exchange.quotaId, exchange.principalId, exchange.walletId, exchange.authorityId, exchange.walletAuthMethodId, exchange.codeHash, exchange.nonceDigest, exchange.appOrigin, exchange.walletOrigin, requirePositiveInteger(exchange.issuedAtMs, "exchange.issuedAtMs"), requirePositiveInteger(exchange.expiresAtMs, "exchange.expiresAtMs"), this.namespace, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, exchange.tenantId, exchange.authorizationId, exchange.walletSessionId, exchange.quotaId, exchange.principalId, exchange.walletId, exchange.authorityId, exchange.walletAuthMethodId, exchange.expiresAtMs, exchange.expiresAtMs).run(), "hosted-wallet Seams session exchange code");
|
|
321
321
|
}
|
|
322
|
-
async redeemHostedWalletSeamsSessionExchange(input) {
|
|
322
|
+
async redeemHostedWalletSeamsSessionExchange(input, publishCredentialLocator) {
|
|
323
323
|
const current = await this.readHostedWalletExchangeV2(input.codeHash);
|
|
324
324
|
const rejected = classifyHostedWalletExchangeV2(current, input);
|
|
325
325
|
if (rejected) return rejected;
|
|
326
326
|
if (!current) throw new Error("hosted-wallet exchange disappeared");
|
|
327
|
+
await publishCredentialLocator?.();
|
|
327
328
|
try {
|
|
328
329
|
const insertCredential = this.database.prepare(`INSERT INTO wallet_session_hosted_credentials_v2 (
|
|
329
330
|
namespace,
|
|
@@ -1035,6 +1036,7 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1035
1036
|
lookupValue: input.tokenHash
|
|
1036
1037
|
});
|
|
1037
1038
|
if (!row) return null;
|
|
1039
|
+
if (row.session_retired_at_ms !== null && row.session_retired_at_ms !== void 0 || integerColumn(row.session_expires_at_ms, "session.expiresAtMs") <= input.nowMs) return null;
|
|
1038
1040
|
const session = parseLiveWalletSessionAuthorizationV2Row(row, {
|
|
1039
1041
|
operationCredentialHash: input.tokenHash,
|
|
1040
1042
|
tenantId: input.tenantId,
|
|
@@ -1354,7 +1356,7 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1354
1356
|
const row = await prepareAuthorizedOperationCommittedRead(this.database, this.namespace, operation).first();
|
|
1355
1357
|
if (!row || row.authorized_operation_id !== operation.authorizedOperationId || row.authorization_source_kind !== operation.authorization.kind) throw new Error("Pinned owner operation is not claimed");
|
|
1356
1358
|
if (operation.authorization.kind === "verified_step_up") {
|
|
1357
|
-
if (row.evidence_set_digest !== operation.authorization.evidenceSetDigest) throw new Error("Verified step-up operation is not claimed");
|
|
1359
|
+
if (row.evidence_set_digest !== operation.authorization.evidenceSetDigest || row.pinned_owner_wallet_id !== walletId) throw new Error("Verified step-up operation is not claimed");
|
|
1358
1360
|
return {
|
|
1359
1361
|
orgId: this.walletSignerScope.orgId,
|
|
1360
1362
|
projectId: this.walletSignerScope.projectId,
|
|
@@ -1367,9 +1369,9 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1367
1369
|
pinnedWalletSessionOwnerScope(row, walletId) {
|
|
1368
1370
|
if (row.pinned_owner_wallet_id !== walletId) throw new Error("Pinned owner Wallet Session scope is unavailable");
|
|
1369
1371
|
return {
|
|
1370
|
-
orgId: requireString(row.
|
|
1371
|
-
projectId: requireString(row.
|
|
1372
|
-
projectEnvironmentId: requireString(row.
|
|
1372
|
+
orgId: requireString(row.owner_scope_org_id, "operation.ownerScope.orgId"),
|
|
1373
|
+
projectId: requireString(row.owner_scope_project_id, "operation.ownerScope.projectId"),
|
|
1374
|
+
projectEnvironmentId: requireString(row.owner_scope_env_id, "operation.ownerScope.projectEnvironmentId")
|
|
1373
1375
|
};
|
|
1374
1376
|
}
|
|
1375
1377
|
async readAuthorizedOperationForAdmission(input) {
|
|
@@ -1646,7 +1648,7 @@ function classifyAuthorizedOperationAdmissionError(error) {
|
|
|
1646
1648
|
function authorizedOperationReplayMismatch(input) {
|
|
1647
1649
|
if (requireString(input.existing.authorization_source_kind, "operation.authorization.kind") !== input.incoming.authorization.kind) return authorizationSourceRejected(input.incoming.authorization);
|
|
1648
1650
|
if (input.incoming.authorization.kind === "authorization_grant") {
|
|
1649
|
-
if (input.existing.
|
|
1651
|
+
if (input.existing.owner_scope_org_id !== input.scope.orgId || input.existing.owner_scope_project_id !== input.scope.projectId || input.existing.owner_scope_env_id !== input.scope.envId) return { kind: "authorization_grant_rejected" };
|
|
1650
1652
|
const expectedGrantKind = input.incoming.authorization.authorizationGrantRef.kind;
|
|
1651
1653
|
if (input.existing.authorization_grant_kind !== expectedGrantKind) return { kind: "authorization_grant_rejected" };
|
|
1652
1654
|
if (input.existing.authorization_id !== input.incoming.authorization.authorizationGrantRef.authorizationId) return { kind: "authorization_grant_rejected" };
|