@seams/wallet-server 0.6.2 → 0.7.3
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 -105
- package/artifact-manifest.json +147 -32
- package/cloudflare-router-ab/build/deriver-a/build-stamp.json +1 -0
- 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 -0
- 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 -0
- 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 -0
- 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 -0
- 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/migrations/deriver-a/0012_tenant_root_creation_tombstones.sql +20 -0
- package/cloudflare-router-ab/migrations/deriver-a/0013_tenant_root_root_use_admissions.sql +32 -0
- package/cloudflare-router-ab/migrations/deriver-a/0014_tenant_root_refresh_supersessions.sql +24 -0
- package/cloudflare-router-ab/migrations/deriver-a/0015_tenant_root_root_use_attempts.sql +56 -0
- package/cloudflare-router-ab/migrations/deriver-a/0016_tenant_root_root_use_admission_settlement.sql +5 -0
- package/cloudflare-router-ab/migrations/deriver-a/0017_tenant_root_root_use_admission_claims.sql +64 -0
- package/cloudflare-router-ab/migrations/deriver-a/0018_tenant_root_recovery_retention_keys.sql +12 -0
- package/cloudflare-router-ab/migrations/deriver-b/0012_tenant_root_creation_tombstones.sql +20 -0
- package/cloudflare-router-ab/migrations/deriver-b/0013_tenant_root_root_use_admissions.sql +32 -0
- package/cloudflare-router-ab/migrations/deriver-b/0014_tenant_root_refresh_supersessions.sql +24 -0
- package/cloudflare-router-ab/migrations/deriver-b/0015_tenant_root_root_use_attempts.sql +56 -0
- package/cloudflare-router-ab/migrations/deriver-b/0016_tenant_root_root_use_admission_settlement.sql +5 -0
- package/cloudflare-router-ab/migrations/deriver-b/0017_tenant_root_root_use_admission_claims.sql +64 -0
- package/cloudflare-router-ab/migrations/deriver-b/0018_tenant_root_recovery_retention_keys.sql +12 -0
- package/cloudflare-router-ab/scripts/bootstrap-local-tenant-root.mjs +81 -16
- package/cloudflare-router-ab/scripts/prepare-local-runtime-config.mjs +102 -9
- package/cloudflare-router-ab/scripts/start-local-role-workers.mjs +4 -1
- package/cloudflare-router-ab/wrangler.deriver-a.toml +24 -0
- package/cloudflare-router-ab/wrangler.router.toml +13 -0
- package/dist/esm/authorization/capabilityPolicy.js +1 -1
- package/dist/esm/authorization/domain.js +2 -2
- package/dist/esm/authorization/factorEvidence.js +6 -100
- package/dist/esm/authorization/service.js +42 -2
- package/dist/esm/authorization/vaultProxyUse.js +5 -10
- package/dist/esm/cloud-host.js +17 -12
- package/dist/esm/core/EmailOtpRecords.js +19 -1
- package/dist/esm/core/EmailOtpStores.js +323 -924
- package/dist/esm/core/IdentityStore.js +67 -345
- package/dist/esm/core/NearPublicKeyStore.js +21 -63
- package/dist/esm/core/RegistrationCeremonyStore.js +3 -1793
- package/dist/esm/core/SessionService.js +7 -30
- package/dist/esm/core/ThresholdService/config.js +1 -82
- package/dist/esm/core/ThresholdService/kv.js +3 -3
- package/dist/esm/core/ThresholdService/routerAb/ecdsaDerivationPoolFillHandlers.js +37 -5
- package/dist/esm/core/ThresholdService/routerAb/ecdsaDerivationPresignBridge.js +4 -74
- package/dist/esm/core/ThresholdService/routerAbNormalSigningPolicy.js +3 -10
- package/dist/esm/core/ThresholdService/stores/CloudflareDurableObjectStore.js +15 -51
- package/dist/esm/core/ThresholdService/stores/KeyStore.js +3 -3
- package/dist/esm/core/ThresholdService/stores/SessionStore.js +5 -81
- package/dist/esm/core/ThresholdService/stores/WalletSessionStore.js +191 -372
- package/dist/esm/core/ThresholdService/stores/exportReplayGuard.js +7 -0
- package/dist/esm/core/ThresholdService/validation.js +18 -230
- package/dist/esm/core/WalletAuthMethodStore.js +22 -79
- package/dist/esm/core/WalletStore.js +62 -191
- package/dist/esm/core/WebAuthnAuthenticatorStore.js +57 -340
- package/dist/esm/core/WebAuthnCredentialBindingStore.js +90 -369
- package/dist/esm/core/WebAuthnLoginChallengeStore.js +17 -397
- package/dist/esm/core/WebAuthnSyncChallengeStore.js +17 -397
- package/dist/esm/core/authService/AuthService.js +2 -19
- package/dist/esm/core/authService/bytes.js +1 -4
- package/dist/esm/core/authService/emailOtpChallengeOperations.js +2 -5
- package/dist/esm/core/authService/emailOtpChallengeProof.js +10 -41
- package/dist/esm/core/authService/emailOtpChallengeVerification.js +19 -90
- package/dist/esm/core/authService/emailOtpChallenges.js +11 -46
- package/dist/esm/core/authService/emailOtpConfig.js +1 -32
- package/dist/esm/core/authService/emailOtpDelivery.js +10 -45
- package/dist/esm/core/authService/emailOtpEnrollment.js +9 -40
- package/dist/esm/core/authService/emailOtpGrant.js +9 -40
- package/dist/esm/core/authService/emailOtpRegistrationEnrollment.js +15 -193
- package/dist/esm/core/authService/emailOtpSeal.js +5 -20
- package/dist/esm/core/authService/emailOtpUnlock.js +20 -110
- package/dist/esm/core/authService/googleEmailOtpRegistration.js +29 -116
- package/dist/esm/core/authService/identity.js +5 -20
- package/dist/esm/core/authService/nearPrivateKeySigning.js +7 -15
- package/dist/esm/core/authService/nearPublicKeyMetadata.js +6 -25
- package/dist/esm/core/authService/nearTransactions.js +2 -1
- package/dist/esm/core/authService/oidcVerification.js +25 -38
- package/dist/esm/core/authService/rateLimits.js +3 -36
- package/dist/esm/core/authService/registrationThresholdHelpers.js +2 -103
- package/dist/esm/core/authService/storeRegistry.js +2 -13
- package/dist/esm/core/authService/thresholdEcdsaKeyInventory.js +6 -6
- package/dist/esm/core/authService/webauthn.js +52 -241
- package/dist/esm/core/authService/webauthnOidcHelpers.js +1 -6
- package/dist/esm/core/authService/webauthnVerificationOutcomes.js +41 -0
- package/dist/esm/core/authService/webauthnWalletBinding.js +2 -122
- package/dist/esm/core/d1EcdsaSignerRead.js +76 -0
- package/dist/esm/core/d1IdentityStore.js +46 -139
- package/dist/esm/core/d1TenantStore.js +82 -0
- package/dist/esm/core/d1WalletAuthMethodStore.js +92 -143
- package/dist/esm/core/d1WalletStore.js +28 -36
- package/dist/esm/core/deviceLinking/linkedDeviceEmailOtpGrant.js +10 -12
- package/dist/esm/core/deviceLinking/linkedDeviceManagement.js +25 -3
- package/dist/esm/core/deviceLinking/linkedDeviceSession.js +6 -895
- package/dist/esm/core/deviceLinking/linkedDeviceSessionApproval.js +100 -0
- package/dist/esm/core/deviceLinking/linkedDeviceSessionRecord.js +662 -0
- package/dist/esm/core/deviceLinking/requestProof.js +13 -4
- package/dist/esm/core/ecdsaMaterialReadSnapshot.js +85 -0
- package/dist/esm/core/emailOtpD1Statements.js +383 -0
- package/dist/esm/core/hostedAccountIds.js +2 -2
- package/dist/esm/core/keyMaterialBrands.js +2 -48
- package/dist/esm/core/nearRelayerAccountProvisioning.js +27 -155
- package/dist/esm/core/nearSignerWasmRuntime.js +1 -4
- package/dist/esm/core/rpcClients/near/NearClient.js +15 -218
- package/dist/esm/core/signingLanes/LaneEnrollmentActivation.js +1 -1
- package/dist/esm/core/signingLanes/LaneLifecycleApplicationService.js +2 -4
- package/dist/esm/core/signingLanes/LaneLifecycleStore.js +0 -24
- package/dist/esm/core/signingLanes/WalletExecutionLaneProjection.js +8 -11
- package/dist/esm/core/signingLanes/ecdsaServerRetirement.js +3 -8
- package/dist/esm/core/signingLanes/ed25519ServerRetirement.js +1 -4
- package/dist/esm/core/signingMaterial/ordinaryInactiveSignerMaterialReservation.js +2 -5
- package/dist/esm/core/storeBackends.js +208 -0
- package/dist/esm/core/thresholdEcdsaChainTarget.js +2 -10
- package/dist/esm/core/webAuthnD1Statements.js +92 -0
- package/dist/esm/core/webAuthnStoreBackends.js +198 -0
- package/dist/esm/hosted-wallet-gateway.js +34 -17
- package/dist/esm/index.js +2 -2
- package/dist/esm/local-hosted-wallet-gateway-worker.js +2 -23
- package/dist/esm/localHostedWalletGatewayHandler.js +312 -0
- package/dist/esm/localIntendedEcdsaFinalizeFault.js +85 -0
- package/dist/esm/localIntendedLinkExecuteFault.js +140 -0
- package/dist/esm/localIntendedMaterialAdmissionFault.js +176 -0
- package/dist/esm/localIntendedPresignCancellation.js +44 -0
- package/dist/esm/localIntendedRevokeFault.js +106 -0
- package/dist/esm/localIntendedSessionAdmissionFault.js +139 -0
- package/dist/esm/localIntendedYaoExportFault.js +117 -0
- package/dist/esm/localIntendedYaoFault.js +13 -16
- package/dist/esm/localIntendedYaoFinalizeFault.js +99 -0
- package/dist/esm/localIntendedYaoRecoveryFault.js +102 -0
- package/dist/esm/localIntendedYaoSigningFault.js +127 -0
- package/dist/esm/router/auth/authRequestValidation.js +1 -1
- package/dist/esm/router/auth/commonRouterUtils.js +34 -12
- package/dist/esm/router/auth/walletSessionFailure.js +3 -19
- package/dist/esm/router/auth/webAuthnCredentialCodecs.js +4 -15
- package/dist/esm/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.js +24 -0
- package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthBoundary.js +2 -6
- package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthService.js +87 -89
- package/dist/esm/router/cloudflare/d1/auth/walletSessionCredentialReaders.js +76 -0
- package/dist/esm/router/cloudflare/d1/authorization/authorizedOperationStatements.js +215 -0
- package/dist/esm/router/cloudflare/d1/authorization/d1AuthorizationStore.js +423 -308
- package/dist/esm/router/cloudflare/d1/authorization/d1VaultProxyStore.js +8 -12
- package/dist/esm/router/cloudflare/d1/authorization/persistedWalletSessionAuthorization.js +14 -0
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.js +107 -66
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEmailOtpGrantStore.js +3 -6
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEmailOtpTargetFactor.js +1 -19
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceManagementService.js +4 -3
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceOwnerAuthorizationProvider.js +52 -9
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceRequestProofNonceStore.js +3 -6
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceRevocation.js +100 -0
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionRecords.js +7 -10
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionStore.js +33 -124
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSourceContributionPreparationPlanner.js +2 -2
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.js +10 -18
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceVerifiedLinkBuilder.js +6 -6
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceVerifiedLinkSourceReader.js +3 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/index.js +4 -4
- package/dist/esm/router/cloudflare/d1/deviceLinking/installedEcdsaAuthority.js +69 -0
- package/dist/esm/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoCapabilityPersistence.js +39 -68
- package/dist/esm/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoLifecycleDecisionStore.js +69 -0
- package/dist/esm/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoProductRegistrationPartitionedStateStore.js +2 -2
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeIssuer.js +12 -55
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeService.js +17 -80
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeStore.js +26 -71
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeVerifier.js +20 -3
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpDeliveryRuntime.js +6 -25
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpEnrollmentStore.js +7 -94
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpGrantStore.js +5 -47
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.js +38 -170
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +24 -87
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.js +9 -32
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpServerSealRuntime.js +5 -20
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationAttemptStore.js +15 -134
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationRecords.js +54 -260
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.js +24 -111
- package/dist/esm/router/cloudflare/d1/identity/d1IdentityRecords.js +1 -28
- package/dist/esm/router/cloudflare/d1/identity/d1IdentityService.js +9 -40
- package/dist/esm/router/cloudflare/d1/near/d1NearPublicKeyStore.js +5 -18
- package/dist/esm/router/cloudflare/d1/oidc/d1OidcBoundary.js +18 -91
- package/dist/esm/router/cloudflare/d1/oidc/d1OidcVerificationService.js +6 -30
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyEnvelopeStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyRouteService.js +7 -18
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.js +25 -80
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpRecords.js +24 -15
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.js +23 -253
- package/dist/esm/router/cloudflare/d1/registration/d1EvmFamilyEcdsaRegistrationBranch.js +5 -20
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.js +20 -39
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +31 -73
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.js +4 -1
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationIntentService.js +10 -31
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.js +6 -30
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +286 -220
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetup.js +5 -3
- package/dist/esm/router/cloudflare/d1/registration/walletRegistrationEstablishedSessionIssuer.js +2 -2
- package/dist/esm/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.js +4 -7
- package/dist/esm/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.js +139 -27
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneEffectJournalStore.js +0 -1
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneLifecycleStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/signingLanes/d1LaneRecords.js +2 -1
- package/dist/esm/router/cloudflare/d1/versionedJson/d1VersionedJsonRecordStore.js +2 -60
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAddSignerService.js +158 -19
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodBoundary.js +19 -49
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodRevocationReplayStore.js +100 -0
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodService.js +132 -33
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorityStore.js +83 -4
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnAuthService.js +45 -217
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnRecords.js +10 -13
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnStore.js +22 -116
- package/dist/esm/router/cloudflare/durableObjects/thresholdStore.js +59 -66
- package/dist/esm/router/cloudflare/runtime/createSelfHostedCloudflareSigningWorker.js +1 -2
- package/dist/esm/router/cloudflare/runtime/routerAbPrewarm.js +2 -2
- package/dist/esm/router/cloudflare/runtime/staticWalletConsoleBinding.js +5 -20
- package/dist/esm/router/cloudflare/runtime/tenantRootCreationGrant.js +2 -9
- package/dist/esm/router/cloudflare/runtime/walletConsoleTenantRootLineage.js +11 -2
- package/dist/esm/router/cloudflare/runtime/walletControlOps.js +2 -1
- package/dist/esm/router/cloudflare/runtime/walletGateway.js +1 -1
- package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneCurveExecution.js +7 -7
- package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneProtocolCommitter.js +4 -3
- package/dist/esm/router/cloudflare/signingLanes/cloudflareOrdinaryInactiveSignerMaterialReservation.js +48 -21
- package/dist/esm/router/cloudflare.js +13343 -14372
- package/dist/esm/router/domains/ecdsa/routerAbEcdsaStrictRegistration.js +16 -5
- package/dist/esm/router/domains/ecdsa/thresholdEcdsaRequestValidation.js +2 -8
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoLifecycleDecision.js +33 -0
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration.js +17 -9
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitionedStateStore.js +29 -431
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitioning.js +7 -2
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPersistence.js +5 -8
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationRequestScopedRunner.js +2 -1
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationRequestScopedRuntime.js +70 -2
- package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.js +134 -169
- package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExportRequestScopedCloudflare.js +77 -162
- package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery.js +205 -51
- package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryRequestScopedCloudflare.js +29 -11
- package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryWalletSessionAuthorization.js +3 -6
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoHttpRegistrationBackend.js +182 -55
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistration.js +2 -1
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationExecutionRecord.js +63 -247
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization.js +9 -27
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationRequestScopedCloudflare.js +87 -132
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationSideEffectBoundary.js +39 -55
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationTwoPhaseRunner.js +5 -4
- package/dist/esm/router/domains/ed25519Yao/routerAbEd25519YaoGatewayEnvelope.js +45 -0
- package/dist/esm/router/domains/ed25519Yao/session/thresholdEd25519RequestValidation.js +1 -1
- package/dist/esm/router/domains/emailOtp/emailOtpExportPolicy.js +1 -42
- package/dist/esm/router/domains/emailOtp/emailOtpRequestValidation.js +1 -6
- package/dist/esm/router/domains/emailOtp/emailOtpRouteHandlers.js +15 -62
- package/dist/esm/router/domains/emailOtp/emailOtpSessionRouteHelpers.js +1 -142
- package/dist/esm/router/domains/passkeyCustody/passkeyCustodyEnvelopeRetrievalRoute.js +1 -1
- package/dist/esm/router/domains/passkeyCustody/walletCustodyRegistrationCommit.js +2 -2
- package/dist/esm/router/domains/passkeyCustody/walletRecoveryFinalization.js +23 -45
- package/dist/esm/router/domains/passkeyCustody/walletRecoveryKeyManifest.js +5 -5
- package/dist/esm/router/domains/signingOperations/ed25519AuthorizedOperationReceipt.js +1 -1
- package/dist/esm/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.js +836 -0
- package/dist/esm/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.js +698 -0
- package/dist/esm/router/domains/signingOperations/routerAbNormalSigningAdmission.js +210 -0
- package/dist/esm/router/domains/signingOperations/routerAbNormalSigningAdmissionCore.js +16 -15
- package/dist/esm/router/domains/signingOperations/routerAbOperationStepUp.js +314 -0
- package/dist/esm/router/domains/signingOperations/routerAbPrivateSigningWorker.js +62 -2159
- package/dist/esm/router/domains/signingOperations/walletExecutionAdmission.js +1 -4
- package/dist/esm/router/domains/tenantRoot/tenantRootIdentityResolution.js +8 -14
- package/dist/esm/router/domains/walletRegistration/walletRegistrationRoutes.js +18 -22
- package/dist/esm/router/domains/walletRegistration/walletRegistrationSetupPayload.js +3 -4
- package/dist/esm/router/domains/walletUnlock/walletUnlockRequestedCapabilitiesValidation.js +2 -2
- package/dist/esm/router/domains/walletUnlock/walletUnlockRouteHandlers.js +127 -339
- package/dist/esm/router/express.js +7172 -7997
- package/dist/esm/router/framework/http.js +5 -4
- package/dist/esm/router/framework/ror/normalize.js +1 -1
- package/dist/esm/router/framework/routerApiRouteSurface.js +1 -1
- package/dist/esm/router/framework/runtimeSnapshotConsumer.js +8 -35
- package/dist/esm/router/node/nodeHostedWalletGateway.js +64 -0
- package/dist/esm/router/node/nodeHostedWalletGatewayCheck.js +163 -0
- package/dist/esm/router/node/nodeHostedWalletGatewayMain.js +120 -0
- package/dist/esm/router/node/nodeHttp.js +79 -0
- package/dist/esm/router/node/nodeSqlite.js +43 -0
- package/dist/esm/router/node/signerSqlMigrations.js +48 -0
- package/dist/esm/router/transport/fetch/createFetchRouter.js +4 -7
- package/dist/esm/router/transport/fetch/routes/auth.js +9 -41
- package/dist/esm/router/transport/fetch/routes/deviceLinking.js +16 -18
- package/dist/esm/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.js +8 -27
- package/dist/esm/router/transport/fetch/routes/deviceManagement.js +15 -24
- package/dist/esm/router/transport/fetch/routes/nearPublicKeys.js +4 -16
- package/dist/esm/router/transport/fetch/routes/normalSigningRouterProxy.js +3 -16
- package/dist/esm/router/transport/fetch/routes/passkeyCustody.js +144 -461
- package/dist/esm/router/transport/fetch/routes/sessions.js +5 -4
- package/dist/esm/router/transport/fetch/routes/syncAccount.js +12 -42
- package/dist/esm/router/transport/fetch/routes/syncAccountBootstrap.js +2 -2
- package/dist/esm/router/transport/fetch/routes/thresholdEcdsa.js +96 -102
- package/dist/esm/router/transport/fetch/routes/thresholdEd25519.js +52 -27
- package/dist/esm/router/transport/fetch/routes/walletExecutionLanePreflight.js +4 -1
- package/dist/esm/router/transport/fetch/routes/webauthnAuthenticators.js +4 -16
- package/dist/esm/shared-ts/src/authorization/capabilityKinds.js +1 -1
- package/dist/esm/shared-ts/src/authorization/delegatedAuthority.js +1 -1
- package/dist/esm/shared-ts/src/authorization/operationFingerprint.js +1 -2
- package/dist/esm/shared-ts/src/authorization/walletAuthority.js +99 -227
- package/dist/esm/shared-ts/src/authorization/walletCustodyOperation.js +4 -6
- package/dist/esm/shared-ts/src/authorization/walletSignerActivationEquality.js +12 -0
- package/dist/esm/shared-ts/src/device-linking/activeWalletSession.js +74 -0
- package/dist/esm/shared-ts/src/device-linking/authorityActivation.js +50 -0
- package/dist/esm/shared-ts/src/device-linking/committedSignerPackages.js +10 -14
- package/dist/esm/shared-ts/src/device-linking/delegatedActivationPlan.js +3 -5
- package/dist/esm/shared-ts/src/device-linking/deviceManagement.js +55 -0
- package/dist/esm/shared-ts/src/device-linking/digests.js +10 -65
- package/dist/esm/shared-ts/src/device-linking/ed25519ExportRoot.js +14 -16
- package/dist/esm/shared-ts/src/device-linking/index.js +4 -1
- package/dist/esm/shared-ts/src/device-linking/parsers.js +510 -1063
- package/dist/esm/shared-ts/src/device-linking/requestProof.js +5 -14
- package/dist/esm/shared-ts/src/device-linking/sourceContribution.js +10 -16
- package/dist/esm/shared-ts/src/device-linking/walletSessionCredentialDelivery.js +9 -9
- package/dist/esm/shared-ts/src/device-linking/wireFields.js +59 -0
- package/dist/esm/shared-ts/src/near/nearClient.js +252 -0
- package/dist/esm/shared-ts/src/passkey-custody/credentialActivity.js +3 -1
- package/dist/esm/shared-ts/src/passkey-custody/custodyEnvelope.js +7 -5
- package/dist/esm/shared-ts/src/passkey-custody/custodySecretBinding.js +6 -4
- package/dist/esm/shared-ts/src/passkey-custody/primitives.js +9 -39
- package/dist/esm/shared-ts/src/signing-lanes/evmFamilySigningKeySlotId.js +1 -5
- package/dist/esm/shared-ts/src/signing-lanes/index.js +3 -3
- package/dist/esm/shared-ts/src/signing-lanes/ownerContinuity.js +8 -19
- package/dist/esm/shared-ts/src/signing-lanes/participantDigest.js +5 -14
- package/dist/esm/shared-ts/src/signing-lanes/participants.js +2 -5
- package/dist/esm/shared-ts/src/signing-lanes/recordParsers.js +7 -5
- package/dist/esm/shared-ts/src/signing-lanes/rotationDigests.js +6 -45
- package/dist/esm/shared-ts/src/signing-lanes/rotationParsers.js +423 -1511
- package/dist/esm/shared-ts/src/signing-lanes/rotationProtocolParsers.js +323 -0
- package/dist/esm/shared-ts/src/signing-lanes/rotationWireFields.js +59 -0
- package/dist/esm/shared-ts/src/tenant-root/tenantRootIdentifier.js +12 -0
- package/dist/esm/shared-ts/src/tenant-root/tenantRootIdentity.js +2 -9
- package/dist/esm/shared-ts/src/tenant-root/tenantRootOperationRecord.js +2 -5
- package/dist/esm/shared-ts/src/threshold/ecdsaDerivationRoleLocalBootstrap.js +1 -2
- package/dist/esm/shared-ts/src/threshold/keyMaterialBrands.js +49 -0
- package/dist/esm/shared-ts/src/utils/addAuthMethodRegistration.js +3 -4
- package/dist/esm/shared-ts/src/utils/canonicalPrimitives.js +8 -1
- package/dist/esm/shared-ts/src/utils/digestEncoding.js +63 -0
- package/dist/esm/shared-ts/src/utils/ecdsaKeyFactsInventory.js +2 -4
- package/dist/esm/shared-ts/src/utils/ecdsaServerTiming.js +0 -1
- package/dist/esm/shared-ts/src/utils/emailOtpDomain.js +5 -3
- package/dist/esm/shared-ts/src/utils/exactKeys.js +17 -0
- package/dist/esm/shared-ts/src/utils/exactRecord.js +44 -0
- package/dist/esm/shared-ts/src/utils/failure.js +20 -0
- package/dist/esm/shared-ts/src/utils/registrationAuthMethodInput.js +127 -0
- package/dist/esm/shared-ts/src/utils/registrationEstablishedSession.js +2 -2
- package/dist/esm/shared-ts/src/utils/registrationIds.js +280 -0
- package/dist/esm/shared-ts/src/utils/registrationIntent.js +7 -1182
- package/dist/esm/shared-ts/src/utils/registrationSignerPlan.js +426 -0
- package/dist/esm/shared-ts/src/utils/routerAbEcdsaDerivation.js +11 -136
- package/dist/esm/shared-ts/src/utils/routerAbEd25519Yao.js +3 -163
- package/dist/esm/shared-ts/src/utils/routerAbEd25519YaoDigests.js +160 -0
- package/dist/esm/shared-ts/src/utils/routerAbNormalSigningIdentity.js +1 -4
- package/dist/esm/shared-ts/src/utils/routerAbPublicKeyset.js +7 -15
- package/dist/esm/shared-ts/src/utils/thresholdEcdsaChainTarget.js +9 -0
- package/dist/esm/shared-ts/src/utils/validation.js +37 -6
- package/dist/esm/shared-ts/src/utils/walletAuthMethodRecord.js +362 -0
- package/dist/esm/shared-ts/src/utils/wireSchema.js +77 -0
- package/dist/esm/shared-ts/src/wallet-recovery/recoveryCodeLocator.js +1 -1
- package/dist/esm/shared-ts/src/wallet-recovery/recoveryCodeReservation.js +1 -1
- package/dist/esm/shared-ts/src/wallet-recovery/walletRecoveryCommittedProjection.js +8 -15
- package/dist/esm/shared-ts/src/wallet-recovery/walletRecoveryEcdsaPossession.js +4 -8
- package/dist/esm/shared-ts/src/wallet-recovery/walletRecoveryEnvelopeSet.js +3 -1
- package/dist/esm/storage/d1Sql.js +10 -1
- package/dist/esm/storage/syncSqlite.js +79 -0
- package/dist/esm/threshold/session/signingSessionSeal/crypto/cipher.js +11 -33
- package/dist/esm/threshold/session/signingSessionSeal/crypto/shamir3PassWasm.js +1 -1
- package/dist/esm/threshold/session/signingSessionSeal/idempotencyBackends.js +3 -3
- package/dist/esm/threshold/session/signingSessionSeal/idempotencyRecords.js +3 -10
- package/dist/esm/threshold/session/signingSessionSeal/options.js +1 -1
- package/dist/esm/threshold/session/signingSessionSeal/service.js +8 -35
- package/dist/esm/threshold/session/signingSessionSeal/transport/express.js +18 -94
- package/dist/esm/threshold/session/signingSessionSeal/transport/fetch.js +6 -30
- package/dist/esm/threshold/session/signingSessionSeal/transport/shared.js +23 -75
- package/dist/esm/threshold/statusCodes.js +1 -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 +3 -3
- package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
- package/dist/types/shared-ts/src/authorization/capabilityKinds.d.ts +8 -26
- package/dist/types/shared-ts/src/authorization/delegatedAuthority.d.ts +2 -9
- package/dist/types/shared-ts/src/authorization/operationFingerprint.d.ts +1 -3
- package/dist/types/shared-ts/src/authorization/walletAuthority.d.ts +25 -12
- package/dist/types/shared-ts/src/authorization/walletSessionIssuance.d.ts +8 -0
- package/dist/types/shared-ts/src/authorization/walletSignerActivationEquality.d.ts +4 -0
- package/dist/types/shared-ts/src/device-linking/activeWalletSession.d.ts +3 -2
- package/dist/types/shared-ts/src/device-linking/authorityActivation.d.ts +5 -0
- package/dist/types/shared-ts/src/device-linking/committedSignerPackages.d.ts +4 -8
- package/dist/types/shared-ts/src/device-linking/contracts.d.ts +13 -74
- package/dist/types/shared-ts/src/device-linking/contracts.typecheck.d.ts +2 -1
- package/dist/types/shared-ts/src/device-linking/deviceManagement.d.ts +7 -0
- package/dist/types/shared-ts/src/device-linking/digests.d.ts +0 -5
- package/dist/types/shared-ts/src/device-linking/ed25519ExportRoot.d.ts +3 -2
- package/dist/types/shared-ts/src/device-linking/index.d.ts +2 -0
- package/dist/types/shared-ts/src/device-linking/parsers.d.ts +4 -41
- package/dist/types/shared-ts/src/device-linking/requestProof.d.ts +0 -1
- package/dist/types/shared-ts/src/device-linking/sourceContribution.d.ts +5 -2
- package/dist/types/shared-ts/src/device-linking/walletSessionCredentialDelivery.d.ts +2 -1
- package/dist/types/shared-ts/src/device-linking/wireFields.d.ts +26 -0
- package/dist/types/shared-ts/src/near/actions.d.ts +4 -4
- package/dist/types/shared-ts/src/near/delegate.d.ts +3 -2
- package/dist/types/shared-ts/src/near/nearClient.d.ts +145 -0
- package/dist/types/shared-ts/src/passkey-custody/ceremonyCommitPayload.d.ts +0 -22
- package/dist/types/shared-ts/src/passkey-custody/credentialActivity.d.ts +2 -4
- package/dist/types/shared-ts/src/passkey-custody/custodyEnvelope.d.ts +14 -30
- package/dist/types/shared-ts/src/passkey-custody/custodySecretBinding.d.ts +8 -24
- package/dist/types/shared-ts/src/passkey-custody/index.d.ts +0 -2
- package/dist/types/shared-ts/src/passkey-custody/primitives.d.ts +9 -14
- package/dist/types/shared-ts/src/signing-lanes/evmFamilySigningKeySlotId.d.ts +0 -15
- package/dist/types/shared-ts/src/signing-lanes/execution.d.ts +11 -50
- package/dist/types/shared-ts/src/signing-lanes/ids.d.ts +1 -10
- package/dist/types/shared-ts/src/signing-lanes/index.d.ts +1 -2
- package/dist/types/shared-ts/src/signing-lanes/ownerContinuity.d.ts +1 -2
- package/dist/types/shared-ts/src/signing-lanes/participantDigest.d.ts +5 -27
- package/dist/types/shared-ts/src/signing-lanes/participants.d.ts +0 -11
- package/dist/types/shared-ts/src/signing-lanes/recordParsers.d.ts +6 -53
- package/dist/types/shared-ts/src/signing-lanes/records.d.ts +1 -2
- package/dist/types/shared-ts/src/signing-lanes/rotation.d.ts +18 -42
- package/dist/types/shared-ts/src/signing-lanes/rotationDigests.d.ts +1 -20
- package/dist/types/shared-ts/src/signing-lanes/rotationLifecycle.d.ts +4 -25
- package/dist/types/shared-ts/src/signing-lanes/rotationParsers.d.ts +1 -41
- package/dist/types/shared-ts/src/signing-lanes/rotationProtocolParsers.d.ts +6 -0
- package/dist/types/shared-ts/src/signing-lanes/rotationWireFields.d.ts +20 -0
- package/dist/types/shared-ts/src/tenant-root/tenantRootIdentifier.d.ts +3 -0
- package/dist/types/shared-ts/src/tenant-root/tenantRootOperationRecord.d.ts +2 -1
- package/dist/types/shared-ts/src/threshold/ecdsaDerivationRoleLocalBootstrap.d.ts +8 -35
- package/dist/types/shared-ts/src/threshold/ed25519OperationFingerprint.d.ts +8 -35
- package/dist/types/shared-ts/src/threshold/keyMaterialBrands.d.ts +25 -0
- package/dist/types/shared-ts/src/threshold/participants.d.ts +3 -9
- package/dist/types/shared-ts/src/threshold/secp256k1.d.ts +0 -37
- package/dist/types/shared-ts/src/threshold/sessionPolicy.d.ts +24 -0
- package/dist/types/shared-ts/src/threshold/signingRootScope.d.ts +3 -5
- package/dist/types/shared-ts/src/utils/addAuthMethodRegistration.d.ts +3 -4
- package/dist/types/shared-ts/src/utils/addWalletAuthMethod.d.ts +7 -108
- package/dist/types/shared-ts/src/utils/addWalletAuthMethod.typecheck.d.ts +16 -3
- package/dist/types/shared-ts/src/utils/canonicalPrimitives.d.ts +2 -0
- package/dist/types/shared-ts/src/utils/digestEncoding.d.ts +9 -0
- package/dist/types/shared-ts/src/utils/domainIds.d.ts +1 -2
- package/dist/types/shared-ts/src/utils/ecdsaKeyFactsInventory.d.ts +3 -13
- package/dist/types/shared-ts/src/utils/eip1559TxWasmJson.d.ts +16 -0
- package/dist/types/shared-ts/src/utils/emailOtpDomain.d.ts +7 -5
- package/dist/types/shared-ts/src/utils/emailOtpRecoveryKey.d.ts +0 -2
- package/dist/types/shared-ts/src/utils/errors.d.ts +0 -7
- package/dist/types/shared-ts/src/utils/exactKeys.d.ts +11 -0
- package/dist/types/shared-ts/src/utils/exactRecord.d.ts +12 -0
- package/dist/types/shared-ts/src/utils/failure.d.ts +12 -0
- package/dist/types/shared-ts/src/utils/index.d.ts +5 -2
- package/dist/types/shared-ts/src/utils/jsonRpc.d.ts +6 -6
- package/dist/types/shared-ts/src/utils/near.d.ts +2 -1
- package/dist/types/shared-ts/src/utils/nearRpcResults.d.ts +8 -7
- package/dist/types/shared-ts/src/utils/normalize.d.ts +0 -4
- package/dist/types/shared-ts/src/utils/registrationAuthMethodInput.d.ts +179 -0
- package/dist/types/shared-ts/src/utils/registrationContracts.d.ts +76 -0
- package/dist/types/shared-ts/src/utils/registrationEstablishedSession.d.ts +1 -2
- package/dist/types/shared-ts/src/utils/registrationIds.d.ts +56 -0
- package/dist/types/shared-ts/src/utils/registrationIntent.d.ts +9 -514
- package/dist/types/shared-ts/src/utils/registrationSignerPlan.d.ts +130 -0
- package/dist/types/shared-ts/src/utils/routerAbEcdsaDerivation.d.ts +24 -93
- package/dist/types/shared-ts/src/utils/routerAbEd25519Yao.d.ts +15 -99
- package/dist/types/shared-ts/src/utils/routerAbEd25519YaoDigests.d.ts +38 -0
- package/dist/types/shared-ts/src/utils/routerAbNormalSigningIdentity.d.ts +30 -8
- package/dist/types/shared-ts/src/utils/routerAbPublicKeyset.d.ts +10 -15
- package/dist/types/shared-ts/src/utils/routerAbTraceContext.d.ts +2 -1
- package/dist/types/shared-ts/src/utils/routerApiKeyAuth.d.ts +2 -0
- package/dist/types/shared-ts/src/utils/secureRandomId.d.ts +0 -2
- package/dist/types/shared-ts/src/utils/signerDomain.d.ts +3 -35
- package/dist/types/shared-ts/src/utils/signerSlot.d.ts +0 -4
- package/dist/types/shared-ts/src/utils/signingSessionSeal.d.ts +10 -17
- package/dist/types/shared-ts/src/utils/thresholdEcdsaChainTarget.d.ts +25 -0
- package/dist/types/shared-ts/src/utils/validation.d.ts +10 -10
- package/dist/types/shared-ts/src/utils/variant.d.ts +29 -0
- package/dist/types/shared-ts/src/utils/variant.typecheck.d.ts +22 -0
- package/dist/types/shared-ts/src/utils/walletAddSignerActivation.d.ts +2 -2
- package/dist/types/shared-ts/src/utils/walletAuthAuthority.d.ts +1 -58
- package/dist/types/shared-ts/src/utils/walletAuthMethodRecord.d.ts +101 -0
- package/dist/types/shared-ts/src/utils/walletCapabilityBindings.d.ts +3 -7
- package/dist/types/shared-ts/src/utils/webauthnDeviceInfo.d.ts +5 -4
- package/dist/types/shared-ts/src/utils/wireSchema.d.ts +60 -0
- package/dist/types/shared-ts/src/wallet-recovery/backupAcknowledgement.d.ts +2 -1
- package/dist/types/shared-ts/src/wallet-recovery/index.d.ts +0 -1
- package/dist/types/shared-ts/src/wallet-recovery/recoveryCodeLocator.d.ts +0 -16
- package/dist/types/shared-ts/src/wallet-recovery/recoveryCodeReservation.d.ts +2 -11
- package/dist/types/shared-ts/src/wallet-recovery/recoveryEnvelopes.d.ts +3 -16
- package/dist/types/shared-ts/src/wallet-recovery/walletRecoveryCommittedProjection.d.ts +6 -18
- package/dist/types/shared-ts/src/wallet-recovery/walletRecoveryEcdsaPossession.d.ts +0 -2
- package/dist/types/shared-ts/src/wallet-recovery/walletRecoveryEnvelopeSet.d.ts +1 -3
- package/dist/types/shared-ts/src/wallet-recovery/walletRecoveryPreparation.d.ts +15 -0
- package/dist/types/shared-ts/src/wallet-recovery/walletRecoveryTarget.d.ts +3 -4
- package/dist/types/wallet-server/src/authorization/capabilityPolicy.d.ts +0 -1
- package/dist/types/wallet-server/src/authorization/domain.d.ts +36 -5
- package/dist/types/wallet-server/src/authorization/ecdsaWalletSessionAdmission.d.ts +61 -0
- package/dist/types/wallet-server/src/authorization/ecdsaWalletSessionAdmission.typecheck.d.ts +2 -0
- package/dist/types/wallet-server/src/authorization/factorEvidence.d.ts +6 -7
- package/dist/types/wallet-server/src/authorization/service.d.ts +71 -3
- package/dist/types/wallet-server/src/cloud-host.d.ts +6 -2
- package/dist/types/wallet-server/src/core/EmailOtpRecords.d.ts +10 -1
- package/dist/types/wallet-server/src/core/EmailOtpStores.d.ts +16 -116
- package/dist/types/wallet-server/src/core/IdentityStore.d.ts +2 -7
- package/dist/types/wallet-server/src/core/NearPublicKeyStore.d.ts +6 -16
- package/dist/types/wallet-server/src/core/RegistrationCeremonyStore.d.ts +29 -90
- package/dist/types/wallet-server/src/core/ThresholdService/config.d.ts +0 -12
- package/dist/types/wallet-server/src/core/ThresholdService/routerAb/ecdsaDerivationPoolFillHandlers.d.ts +10 -3
- package/dist/types/wallet-server/src/core/ThresholdService/routerAb/ecdsaDerivationPresignBridge.d.ts +17 -48
- package/dist/types/wallet-server/src/core/ThresholdService/routerAb/internalServiceHttp.d.ts +2 -1
- package/dist/types/wallet-server/src/core/ThresholdService/stores/CloudflareDurableObjectStore.d.ts +4 -71
- package/dist/types/wallet-server/src/core/ThresholdService/stores/KeyStore.d.ts +2 -1
- package/dist/types/wallet-server/src/core/ThresholdService/stores/SessionStore.d.ts +2 -6
- package/dist/types/wallet-server/src/core/ThresholdService/stores/StoreConfig.d.ts +2 -1
- package/dist/types/wallet-server/src/core/ThresholdService/stores/WalletSessionStore.d.ts +2 -4
- package/dist/types/wallet-server/src/core/ThresholdService/stores/exportReplayGuard.d.ts +3 -0
- package/dist/types/wallet-server/src/core/ThresholdService/validation.d.ts +11 -137
- package/dist/types/wallet-server/src/core/WalletAuthMethodStore.d.ts +2 -7
- package/dist/types/wallet-server/src/core/WalletStore.d.ts +3 -8
- package/dist/types/wallet-server/src/core/WebAuthnAuthenticatorStore.d.ts +15 -22
- package/dist/types/wallet-server/src/core/WebAuthnCredentialBindingStore.d.ts +14 -36
- package/dist/types/wallet-server/src/core/WebAuthnLoginChallengeStore.d.ts +9 -34
- package/dist/types/wallet-server/src/core/WebAuthnSyncChallengeStore.d.ts +9 -34
- package/dist/types/wallet-server/src/core/authService/AuthService.d.ts +0 -3
- package/dist/types/wallet-server/src/core/authService/bytes.d.ts +0 -1
- package/dist/types/wallet-server/src/core/authService/emailOtpChallengeOperations.d.ts +6 -5
- package/dist/types/wallet-server/src/core/authService/emailOtpChallengeProof.d.ts +9 -17
- package/dist/types/wallet-server/src/core/authService/emailOtpChallengeVerification.d.ts +3 -2
- package/dist/types/wallet-server/src/core/authService/emailOtpChallenges.d.ts +8 -32
- package/dist/types/wallet-server/src/core/authService/emailOtpConfig.d.ts +3 -10
- package/dist/types/wallet-server/src/core/authService/emailOtpDelivery.d.ts +4 -3
- package/dist/types/wallet-server/src/core/authService/emailOtpGrant.d.ts +4 -3
- package/dist/types/wallet-server/src/core/authService/emailOtpRegistrationEnrollment.d.ts +3 -70
- package/dist/types/wallet-server/src/core/authService/emailOtpSeal.d.ts +2 -1
- package/dist/types/wallet-server/src/core/authService/emailOtpUnlock.d.ts +6 -12
- package/dist/types/wallet-server/src/core/authService/googleEmailOtpRegistration.d.ts +5 -8
- package/dist/types/wallet-server/src/core/authService/nearPrivateKeySigning.d.ts +3 -2
- package/dist/types/wallet-server/src/core/authService/nearPublicKeyMetadata.d.ts +2 -1
- package/dist/types/wallet-server/src/core/authService/nearTransactions.d.ts +2 -1
- package/dist/types/wallet-server/src/core/authService/oidcVerification.d.ts +4 -3
- package/dist/types/wallet-server/src/core/authService/rateLimits.d.ts +0 -3
- package/dist/types/wallet-server/src/core/authService/registrationThresholdHelpers.d.ts +0 -26
- package/dist/types/wallet-server/src/core/authService/storeRegistry.d.ts +0 -5
- package/dist/types/wallet-server/src/core/authService/thresholdEcdsaKeyInventory.d.ts +0 -23
- package/dist/types/wallet-server/src/core/authService/webauthn.d.ts +8 -16
- package/dist/types/wallet-server/src/core/authService/webauthnOidcHelpers.d.ts +7 -7
- package/dist/types/wallet-server/src/core/authService/webauthnVerificationOutcomes.d.ts +43 -0
- package/dist/types/wallet-server/src/core/authService/webauthnWalletBinding.d.ts +1 -28
- package/dist/types/wallet-server/src/core/d1EcdsaSignerRead.d.ts +39 -0
- package/dist/types/wallet-server/src/core/d1IdentityStore.d.ts +6 -16
- package/dist/types/wallet-server/src/core/d1TenantStore.d.ts +51 -0
- package/dist/types/wallet-server/src/core/d1WalletAuthMethodStore.d.ts +11 -29
- package/dist/types/wallet-server/src/core/d1WalletStore.d.ts +16 -1
- package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceEd25519ExportRoot.d.ts +2 -1
- package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceEmailOtpGrant.d.ts +2 -1
- package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceManagement.d.ts +44 -26
- package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceSession.d.ts +19 -217
- package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceSessionApproval.d.ts +8 -0
- package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceSessionRecord.d.ts +258 -0
- package/dist/types/wallet-server/src/core/deviceLinking/requestProof.d.ts +2 -2
- package/dist/types/wallet-server/src/core/ecdsaMaterialReadSnapshot.d.ts +19 -0
- package/dist/types/wallet-server/src/core/emailOtpD1Statements.d.ts +54 -0
- package/dist/types/wallet-server/src/core/hostedAccountIds.d.ts +0 -15
- package/dist/types/wallet-server/src/core/keyMaterialBrands.d.ts +4 -24
- package/dist/types/wallet-server/src/core/nearRelayerAccountProvisioning.d.ts +2 -3
- package/dist/types/wallet-server/src/core/nearSignerWasmRuntime.d.ts +0 -1
- package/dist/types/wallet-server/src/core/registrationContracts.d.ts +37 -108
- package/dist/types/wallet-server/src/core/routerAbSigning/RouterAbNormalSigningRuntime.d.ts +8 -9
- package/dist/types/wallet-server/src/core/rpcClients/near/NearClient.d.ts +10 -107
- package/dist/types/wallet-server/src/core/signingLanes/LaneAggregateRevocationApplicationService.d.ts +4 -3
- package/dist/types/wallet-server/src/core/signingLanes/LaneEffectJournalStore.d.ts +2 -3
- package/dist/types/wallet-server/src/core/signingLanes/LaneLifecycleStore.d.ts +2 -3
- package/dist/types/wallet-server/src/core/signingLanes/WalletExecutionLaneProjection.d.ts +5 -20
- package/dist/types/wallet-server/src/core/signingLanes/ecdsaServerRetirement.d.ts +4 -4
- package/dist/types/wallet-server/src/core/signingLanes/ed25519ServerRetirement.d.ts +3 -3
- package/dist/types/wallet-server/src/core/signingLanes/signingWorkerLaneMaterialIdentity.d.ts +2 -19
- package/dist/types/wallet-server/src/core/storeBackends.d.ts +83 -0
- package/dist/types/wallet-server/src/core/threeRouteRegistrationContracts.d.ts +13 -59
- package/dist/types/wallet-server/src/core/threeRouteRegistrationContracts.typecheck.d.ts +51 -3
- package/dist/types/wallet-server/src/core/thresholdEcdsaChainTarget.d.ts +3 -12
- package/dist/types/wallet-server/src/core/types.d.ts +5 -30
- package/dist/types/wallet-server/src/core/webAuthnD1Statements.d.ts +29 -0
- package/dist/types/wallet-server/src/core/webAuthnStoreBackends.d.ts +96 -0
- package/dist/types/wallet-server/src/hosted-wallet-gateway.d.ts +11 -7
- package/dist/types/wallet-server/src/index.d.ts +1 -1
- package/dist/types/wallet-server/src/local-hosted-wallet-gateway-worker.d.ts +1 -4
- package/dist/types/wallet-server/src/localHostedWalletGatewayHandler.d.ts +12 -0
- package/dist/types/wallet-server/src/localIntendedEcdsaFinalizeFault.d.ts +33 -0
- package/dist/types/wallet-server/src/localIntendedLinkExecuteFault.d.ts +47 -0
- package/dist/types/wallet-server/src/localIntendedMaterialAdmissionFault.d.ts +38 -0
- package/dist/types/wallet-server/src/localIntendedPresignCancellation.d.ts +4 -0
- package/dist/types/wallet-server/src/localIntendedRevokeFault.d.ts +40 -0
- package/dist/types/wallet-server/src/localIntendedSessionAdmissionFault.d.ts +41 -0
- package/dist/types/wallet-server/src/localIntendedYaoExportFault.d.ts +41 -0
- package/dist/types/wallet-server/src/localIntendedYaoFault.d.ts +7 -1
- package/dist/types/wallet-server/src/localIntendedYaoFinalizeFault.d.ts +37 -0
- package/dist/types/wallet-server/src/localIntendedYaoRecoveryFault.d.ts +45 -0
- package/dist/types/wallet-server/src/localIntendedYaoSigningFault.d.ts +51 -0
- package/dist/types/wallet-server/src/router/auth/authRequestValidation.d.ts +13 -29
- package/dist/types/wallet-server/src/router/auth/commonRouterUtils.d.ts +20 -11
- package/dist/types/wallet-server/src/router/auth/walletSessionFailure.d.ts +1 -4
- package/dist/types/wallet-server/src/router/auth/webAuthnCredentialCodecs.d.ts +3 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.d.ts +12 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthBoundary.d.ts +3 -3
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthConfig.d.ts +2 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthService.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/walletSessionCredentialReaders.d.ts +9 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/authorizedOperationStatements.d.ts +34 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/d1AuthorizationStore.d.ts +54 -21
- package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/persistedWalletSessionAuthorization.d.ts +3 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/walletSessionAuthorityProjection.d.ts +2 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.d.ts +74 -6
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEmailOtpGrantStore.d.ts +2 -3
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEmailOtpTargetFactor.d.ts +8 -21
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceOwnerAuthorizationProvider.d.ts +14 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceRevocation.d.ts +49 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionRecords.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionStore.d.ts +6 -8
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSourceContributionPreparationPlanner.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.d.ts +7 -10
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetPlanner.d.ts +8 -4
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceVerifiedLinkBuilder.d.ts +3 -5
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/installedEcdsaAuthority.d.ts +7 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoCapabilityPersistence.d.ts +1 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoLifecycleDecisionStore.d.ts +33 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeIssuer.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeStore.d.ts +13 -3
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeVerifier.d.ts +24 -5
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpEnrollmentStore.d.ts +4 -11
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpGrantStore.d.ts +1 -3
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRateLimitStore.d.ts +4 -12
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.d.ts +13 -12
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.d.ts +0 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.d.ts +5 -4
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpServerSealRuntime.d.ts +4 -14
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationAttemptStore.d.ts +1 -3
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationRecords.d.ts +3 -21
- package/dist/types/wallet-server/src/router/cloudflare/d1/identity/d1IdentityRecords.d.ts +0 -23
- package/dist/types/wallet-server/src/router/cloudflare/d1/near/d1NearPublicKeyStore.d.ts +1 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyEnvelopeStore.d.ts +11 -19
- package/dist/types/wallet-server/src/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyRouteService.d.ts +5 -54
- package/dist/types/wallet-server/src/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.d.ts +7 -19
- package/dist/types/wallet-server/src/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpRecords.d.ts +4 -3
- package/dist/types/wallet-server/src/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.d.ts +8 -12
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.d.ts +7 -14
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.d.ts +10 -22
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.d.ts +6 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.d.ts +10 -6
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationService.d.ts +21 -26
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationSetup.d.ts +5 -3
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/walletRegistrationEstablishedSessionIssuer.d.ts +4 -3
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.d.ts +5 -5
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.d.ts +17 -6
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingLanes/d1LaneEffectJournalStore.d.ts +0 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/versionedJson/d1VersionedJsonRecordStore.d.ts +0 -16
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAddSignerService.d.ts +29 -14
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthMethodBoundary.d.ts +15 -12
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthMethodRevocationReplayStore.d.ts +71 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthMethodService.d.ts +34 -24
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthorityStore.d.ts +44 -26
- package/dist/types/wallet-server/src/router/cloudflare/d1/webauthn/d1WebAuthnRecords.d.ts +13 -46
- package/dist/types/wallet-server/src/router/cloudflare/d1/webauthn/d1WebAuthnStore.d.ts +8 -19
- package/dist/types/wallet-server/src/router/cloudflare/runtime/walletConsoleOps.d.ts +8 -34
- package/dist/types/wallet-server/src/router/cloudflare/runtime/walletConsoleTenantRootLineage.d.ts +2 -1
- package/dist/types/wallet-server/src/router/cloudflare/runtime/walletGateway.d.ts +1 -0
- package/dist/types/wallet-server/src/router/cloudflare/signingLanes/cloudflareOrdinaryInactiveSignerMaterialReservation.d.ts +15 -2
- package/dist/types/wallet-server/src/router/cloudflare-adaptor.d.ts +2 -2
- package/dist/types/wallet-server/src/router/domains/ecdsa/routerAbEcdsaStrictRegistration.d.ts +9 -7
- package/dist/types/wallet-server/src/router/domains/ecdsa/thresholdEcdsaRequestValidation.d.ts +6 -18
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoLifecycleDecision.d.ts +46 -0
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration.d.ts +5 -3
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitionedStateStore.d.ts +20 -79
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitioning.d.ts +2 -0
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationRequestScopedRunner.d.ts +1 -1
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationRequestScopedRuntime.d.ts +4 -3
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.d.ts +62 -42
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery.d.ts +108 -32
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryActivation.typecheck.d.ts +5 -0
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoHttpRegistrationBackend.d.ts +36 -5
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistration.d.ts +5 -4
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationExecutionRecord.d.ts +41 -50
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization.d.ts +2 -2
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationRequestScopedCloudflare.d.ts +3 -3
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationSideEffectBoundary.d.ts +6 -5
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationTwoPhaseRunner.d.ts +14 -4
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/routerAbEd25519YaoGatewayEnvelope.d.ts +12 -1
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/session/routerAbEd25519YaoWalletSession.d.ts +11 -52
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/session/thresholdEd25519RequestValidation.d.ts +3 -4
- package/dist/types/wallet-server/src/router/domains/emailOtp/emailOtpExportPolicy.d.ts +2 -27
- package/dist/types/wallet-server/src/router/domains/emailOtp/emailOtpRequestValidation.d.ts +1 -2
- package/dist/types/wallet-server/src/router/domains/emailOtp/emailOtpRouteHandlers.d.ts +2 -1
- package/dist/types/wallet-server/src/router/domains/emailOtp/emailOtpSessionRouteHelpers.d.ts +2 -102
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/envelopeRevocationAdmission.d.ts +2 -1
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/passkeyCustodyEnvelopeRetrieval.d.ts +3 -2
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/passkeyCustodyEnvelopeRetrievalRoute.d.ts +1 -9
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/registrationCustodyOutcome.d.ts +2 -1
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/verifiedCustodyFactor.d.ts +2 -1
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/walletCustodyRegistrationAdmission.d.ts +2 -1
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/walletCustodyRegistrationCommit.d.ts +2 -28
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/walletRecoveryFinalization.d.ts +43 -1
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/walletRecoveryKeyManifest.d.ts +7 -19
- package/dist/types/wallet-server/src/router/domains/signingOperations/ed25519AuthorizedOperationReceipt.d.ts +0 -3
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.d.ts +164 -0
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.d.ts +110 -0
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbNormalSigningAdmission.d.ts +373 -0
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbNormalSigningAdmissionCore.d.ts +11 -10
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbNormalSigningAdmissionCore.typecheck.d.ts +2 -0
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbOperationStepUp.d.ts +164 -0
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbPrivateSigningWorker.d.ts +22 -717
- package/dist/types/wallet-server/src/router/domains/signingOperations/walletExecutionAdmission.d.ts +5 -12
- package/dist/types/wallet-server/src/router/domains/syncAccount/syncAccountRequestValidation.d.ts +6 -10
- package/dist/types/wallet-server/src/router/domains/tenantRoot/tenantRootCustodyLineage.d.ts +6 -1
- package/dist/types/wallet-server/src/router/domains/tenantRoot/tenantRootIdentityResolution.d.ts +4 -7
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationInputs.d.ts +2 -1
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationRoutes.d.ts +8 -8
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationSetupPayload.d.ts +4 -4
- package/dist/types/wallet-server/src/router/domains/walletUnlock/walletUnlockRequestedCapabilitiesValidation.d.ts +4 -4
- package/dist/types/wallet-server/src/router/domains/walletUnlock/walletUnlockRouteHandlers.d.ts +4 -62
- package/dist/types/wallet-server/src/router/express-adaptor.d.ts +2 -2
- package/dist/types/wallet-server/src/router/framework/apiCredentialPorts.d.ts +3 -1
- package/dist/types/wallet-server/src/router/framework/authServicePort.d.ts +89 -65
- package/dist/types/wallet-server/src/router/framework/http.d.ts +1 -1
- package/dist/types/wallet-server/src/router/framework/ror/normalize.d.ts +1 -9
- package/dist/types/wallet-server/src/router/framework/routeMeteringPolicy.d.ts +3 -2
- package/dist/types/wallet-server/src/router/framework/routerApi.d.ts +1 -1
- package/dist/types/wallet-server/src/router/framework/routerApiRouteSurface.d.ts +3 -3
- package/dist/types/wallet-server/src/router/node/nodeHostedWalletGateway.d.ts +34 -0
- package/dist/types/wallet-server/src/router/node/nodeHostedWalletGatewayCheck.d.ts +21 -0
- package/dist/types/wallet-server/src/router/node/nodeHostedWalletGatewayMain.d.ts +2 -0
- package/dist/types/wallet-server/src/router/node/nodeHttp.d.ts +13 -0
- package/dist/types/wallet-server/src/router/node/nodeSqlite.d.ts +22 -0
- package/dist/types/wallet-server/src/router/node/signerSqlMigrations.d.ts +20 -0
- package/dist/types/wallet-server/src/router/transport/fetch/createFetchRouter.d.ts +1 -3
- package/dist/types/wallet-server/src/router/transport/fetch/routes/deviceLinking.d.ts +5 -6
- package/dist/types/wallet-server/src/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.d.ts +5 -8
- package/dist/types/wallet-server/src/router/transport/fetch/routes/deviceManagement.d.ts +14 -16
- package/dist/types/wallet-server/src/router/transport/fetch/routes/normalSigningRouterProxy.d.ts +0 -12
- package/dist/types/wallet-server/src/router/transport/fetch/routes/passkeyCustody.d.ts +1 -1
- package/dist/types/wallet-server/src/router/transport/fetch/routes/sessions.d.ts +2 -1
- package/dist/types/wallet-server/src/router/transport/fetch/routes/syncAccountBootstrap.d.ts +9 -17
- package/dist/types/wallet-server/src/router/transport/fetch/routes/thresholdEcdsa.d.ts +3 -58
- package/dist/types/wallet-server/src/router/transport/fetch/routes/thresholdEd25519.d.ts +0 -44
- package/dist/types/wallet-server/src/storage/d1Sql.d.ts +7 -0
- package/dist/types/wallet-server/src/storage/syncSqlite.d.ts +28 -0
- package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/crypto/shamir3PassWasm.d.ts +0 -1
- package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/idempotencyRecords.d.ts +5 -7
- package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/signingSessionSeal.types.d.ts +6 -8
- package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/transport/shared.d.ts +1 -0
- package/dist/types/wallet-server/src/threshold/statusCodes.d.ts +4 -4
- package/migrations/d1-signer/0036_r150_yao_lifecycle_decisions.sql +22 -0
- package/migrations/d1-signer/0037_r150_wallet_auth_method_revocation_replays.sql +26 -0
- package/migrations/d1-signer/0038_r150_registration_ceremony_cas_guard_seed.sql +8 -0
- package/migrations/d1-signer/0039_r150_revocation_replay_answer_kind.sql +9 -0
- package/package.json +1 -1
- package/dist/esm/core/ThresholdService/ecdsaClientRootProof.js +0 -27
- package/dist/esm/core/ThresholdService/routerAbEcdsaSigningWorkerWasm.js +0 -115
- package/dist/esm/core/ThresholdService/secureRandomId.js +0 -9
- package/dist/esm/core/authService/record.js +0 -8
- package/dist/esm/core/authService/thresholdRuntimePolicy.js +0 -19
- package/dist/esm/core/authService/walletRegistrationPlanning.js +0 -49
- package/dist/esm/core/deviceLinking/index.js +0 -5
- package/dist/esm/core/errors.js +0 -54
- package/dist/esm/core/routerAbSigning/createCloudflareDurableObjectRouterAbSigningRuntimes.js +0 -39
- package/dist/esm/core/signingLanes/WalletKeyStore.js +0 -0
- package/dist/esm/core/signingLanes/index.js +0 -8
- package/dist/esm/router/domains/tenantRoot/tenantRootEcdsaWalletSessionComposition.js +0 -55
- package/dist/esm/router/domains/tenantRoot/tenantRootEd25519WalletSessionComposition.js +0 -56
- package/dist/esm/shared-ts/src/signing-lanes/linkedEcdsaScope.js +0 -1
- package/dist/esm/wasm/router_ab_ecdsa_signing_worker/pkg/router_ab_ecdsa_signing_worker.js +0 -414
- package/dist/esm/wasm/router_ab_ecdsa_signing_worker/pkg/router_ab_ecdsa_signing_worker_bg.wasm +0 -0
- package/dist/types/shared-ts/src/passkey-custody/credentialObservations.d.ts +0 -74
- package/dist/types/shared-ts/src/passkey-custody/kekContext.d.ts +0 -34
- package/dist/types/shared-ts/src/signing-lanes/linkedEcdsaScope.d.ts +0 -62
- package/dist/types/shared-ts/src/signing-lanes/linkedEcdsaScope.typecheck.d.ts +0 -2
- package/dist/types/shared-ts/src/signing-lanes/validation.d.ts +0 -11
- package/dist/types/shared-ts/src/utils/bigint.d.ts +0 -3
- package/dist/types/shared-ts/src/utils/paillier.d.ts +0 -37
- package/dist/types/shared-ts/src/utils/recoveryDomain.d.ts +0 -12
- package/dist/types/shared-ts/src/utils/signerDomain.typecheck.d.ts +0 -2
- package/dist/types/shared-ts/src/wallet-recovery/recoveryKekContext.d.ts +0 -37
- package/dist/types/wallet-server/src/core/ThresholdService/ecdsaClientRootProof.d.ts +0 -12
- package/dist/types/wallet-server/src/core/ThresholdService/routerAbEcdsaSigningWorkerWasm.d.ts +0 -17
- package/dist/types/wallet-server/src/core/ThresholdService/secureRandomId.d.ts +0 -2
- package/dist/types/wallet-server/src/core/authService/record.d.ts +0 -2
- package/dist/types/wallet-server/src/core/authService/thresholdRuntimePolicy.d.ts +0 -4
- package/dist/types/wallet-server/src/core/authService/walletRegistrationPlanning.d.ts +0 -19
- package/dist/types/wallet-server/src/core/deviceLinking/index.d.ts +0 -5
- package/dist/types/wallet-server/src/core/errors.d.ts +0 -10
- package/dist/types/wallet-server/src/core/routerAbSigning/createCloudflareDurableObjectRouterAbSigningRuntimes.d.ts +0 -28
- package/dist/types/wallet-server/src/core/signingLanes/SigningLaneStore.d.ts +0 -15
- package/dist/types/wallet-server/src/core/signingLanes/WalletKeyStore.d.ts +0 -13
- package/dist/types/wallet-server/src/core/signingLanes/index.d.ts +0 -11
- package/dist/types/wallet-server/src/router/domains/tenantRoot/tenantRootEcdsaWalletSessionComposition.d.ts +0 -35
- package/dist/types/wallet-server/src/router/domains/tenantRoot/tenantRootEd25519WalletSessionComposition.d.ts +0 -35
- /package/dist/esm/{core/signingLanes/SigningLaneStore.js → authorization/ecdsaWalletSessionAdmission.js} +0 -0
|
@@ -1,53 +1,21 @@
|
|
|
1
|
-
import { mpcMaterialActivationRefsEqual
|
|
1
|
+
import { mpcMaterialActivationRefsEqual } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { CAPABILITY_KINDS, parseAuthorizationAuditEventId, parseAuthorizationGrantRef, parseAuthorizedOperationId, parseCapabilityId, parseCapabilityOperationId, parseCapabilityOperationRef, parseMpcWalletSigningQuotaId, parsePrincipalId, parseTenantId, parseWalletSessionAuthorizationId, parseWalletSessionId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
3
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
4
4
|
import { buildCapabilityOperationEnvelope, computeCapabilityOperationFingerprintDigest, parseCapabilityOperationFingerprintDigest } from "../../../../shared-ts/src/authorization/operationFingerprint.js";
|
|
5
|
-
import { routerAbMpcMaterialActivationRefToWire, sameRouterAbMpcMaterialActivationRef } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
5
|
+
import { routerAbMpcMaterialActivationRefFromWire, routerAbMpcMaterialActivationRefToWire, sameRouterAbMpcMaterialActivationRef } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
6
6
|
import { buildActiveWalletSessionQuota, buildAuthorizedOperation, buildExactWalletSessionQuotaProjectionV1, computeAuthorizedOperationResultDigest, exactWalletSessionCapabilitySubjectsResolveAuthority, parseAuthorizedOperationReplayResponse, parseHostedWalletSessionCredentialId, parseSessionOrigin, parseWalletSessionAuthorizationV2, walletSessionAuthorizationV2RecordsEqual } from "../../../../authorization/domain.js";
|
|
7
|
+
import { ECDSA_INSTALLATION_SNAPSHOT_COLUMNS } from "../../../../core/ecdsaMaterialReadSnapshot.js";
|
|
7
8
|
import { d1ChangedRows, parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
9
|
+
import { EcdsaMaterialRead } from "../../../../core/d1EcdsaSignerRead.js";
|
|
8
10
|
import { D1WalletStore } from "../../../../core/d1WalletStore.js";
|
|
9
11
|
import { normalizeWalletAuthMethodV2 } from "../../../../core/d1WalletAuthMethodStore.js";
|
|
10
|
-
import {
|
|
12
|
+
import { D1EcdsaAdmissionPolicyRead, ECDSA_CREDENTIAL_POLICY_PROJECTION } from "../signingAdmission/d1RouterAbNormalSigningAdmissionStore.js";
|
|
13
|
+
import { parseInstalledEcdsaCustodySnapshotV1 } from "../deviceLinking/d1LinkedDeviceAuthorityInstallService.js";
|
|
14
|
+
import { prepareAuthorizedOperationAdmissionRead, prepareAuthorizedOperationCommittedRead, prepareAuthorizedOperationInsert, prepareAuthorizedOperationRead } from "./authorizedOperationStatements.js";
|
|
11
15
|
import { prepareD1WalletSessionAuthorityProjectionStatements } from "./walletSessionAuthorityProjection.js";
|
|
16
|
+
import { parseD1WalletAuthorityRow } from "../wallet/d1WalletAuthorityStore.js";
|
|
17
|
+
import { parsePersistedWalletSessionAuthorizationV2 } from "./persistedWalletSessionAuthorization.js";
|
|
12
18
|
//#region src/router/cloudflare/d1/authorization/d1AuthorizationStore.ts
|
|
13
|
-
const ECDSA_SIGNER_MATCH = `
|
|
14
|
-
EXISTS (
|
|
15
|
-
SELECT 1
|
|
16
|
-
FROM wallet_signers AS signer
|
|
17
|
-
WHERE signer.namespace = ?
|
|
18
|
-
AND signer.org_id = ?
|
|
19
|
-
AND signer.project_id = ?
|
|
20
|
-
AND signer.env_id = ?
|
|
21
|
-
AND signer.wallet_id = ?
|
|
22
|
-
AND signer.signer_family = 'ecdsa'
|
|
23
|
-
AND json_extract(signer.record_json, '$.walletKey.publicCapability.material_activation.material_owner') = signer.wallet_id
|
|
24
|
-
AND json_extract(signer.record_json, '$.walletKey.keyHandle') = ?
|
|
25
|
-
AND json_extract(signer.record_json, '$.walletKey.publicCapability.material_activation.kind') = ?
|
|
26
|
-
AND json_extract(signer.record_json, '$.walletKey.publicCapability.material_activation.activation_id') = ?
|
|
27
|
-
AND json_extract(signer.record_json, '$.walletKey.publicCapability.material_activation.capability') = ?
|
|
28
|
-
AND json_extract(signer.record_json, '$.walletKey.publicCapability.material_activation.material_owner') = ?
|
|
29
|
-
AND json_extract(signer.record_json, '$.walletKey.publicCapability.material_activation.key_binding') = ?
|
|
30
|
-
AND json_extract(signer.record_json, '$.walletKey.publicCapability.material_activation.lifecycle_binding') = ?
|
|
31
|
-
AND json_extract(signer.record_json, '$.walletKey.publicCapability.material_activation.signing_worker') = ?
|
|
32
|
-
)`;
|
|
33
|
-
function ecdsaSignerMatchBindings(walletSignerScope, material) {
|
|
34
|
-
const activation = material.materialActivation;
|
|
35
|
-
return [
|
|
36
|
-
walletSignerScope.namespace,
|
|
37
|
-
walletSignerScope.orgId,
|
|
38
|
-
walletSignerScope.projectId,
|
|
39
|
-
walletSignerScope.envId,
|
|
40
|
-
material.walletId,
|
|
41
|
-
material.keyHandle,
|
|
42
|
-
activation.kind,
|
|
43
|
-
activation.activation_id,
|
|
44
|
-
activation.capability,
|
|
45
|
-
activation.material_owner,
|
|
46
|
-
activation.key_binding,
|
|
47
|
-
activation.lifecycle_binding,
|
|
48
|
-
activation.signing_worker
|
|
49
|
-
];
|
|
50
|
-
}
|
|
51
19
|
const ACTIVE_V2_AUTHORITY_METHOD_EXISTS_SQL = `
|
|
52
20
|
EXISTS (
|
|
53
21
|
SELECT 1
|
|
@@ -118,11 +86,6 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
118
86
|
projectId: requireOpaqueString(options.walletSignerScope.projectId, "walletSignerScope.projectId"),
|
|
119
87
|
envId: requireOpaqueString(options.walletSignerScope.envId, "walletSignerScope.envId")
|
|
120
88
|
};
|
|
121
|
-
this.walletAuthorityStore = new D1WalletAuthorityStore({
|
|
122
|
-
database: this.database,
|
|
123
|
-
scope: this.walletSignerScope,
|
|
124
|
-
ensureSchema: false
|
|
125
|
-
});
|
|
126
89
|
this.walletStore = new D1WalletStore({
|
|
127
90
|
database: this.database,
|
|
128
91
|
namespace: this.walletSignerScope.namespace,
|
|
@@ -618,7 +581,7 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
618
581
|
const walletOrigin = parseSessionOrigin(row.wallet_origin);
|
|
619
582
|
if (walletOrigin !== input.requestOrigin) return null;
|
|
620
583
|
if (row.session_record_json === null || row.session_record_json === void 0 || row.session_operation_credential_hash === null || row.session_operation_credential_hash === void 0 || row.session_retired_at_ms !== null && row.session_retired_at_ms !== void 0 || row.credential_retired_at_ms !== null && row.credential_retired_at_ms !== void 0 || row.quota_lifecycle_kind !== "active" || integerColumn(row.quota_remaining_uses, "hosted credential quota remaining uses") <= 0 || integerColumn(row.expires_at_ms, "hosted credential expiry") <= input.nowMs || integerColumn(row.session_expires_at_ms, "hosted parent expiry") <= input.nowMs || integerColumn(row.session_expires_at_ms, "hosted parent expiry") < integerColumn(row.expires_at_ms, "hosted credential expiry") || integerColumn(row.quota_expires_at_ms, "hosted quota expiry") <= input.nowMs || integerColumn(row.quota_expires_at_ms, "hosted quota expiry") < integerColumn(row.expires_at_ms, "hosted credential expiry")) return null;
|
|
621
|
-
const expected =
|
|
584
|
+
const expected = parsePersistedWalletSessionAuthorizationV2(parseD1JsonColumn(row.session_record_json));
|
|
622
585
|
let authorization;
|
|
623
586
|
try {
|
|
624
587
|
authorization = await this.readWalletSessionAuthorizationV2ByAuthorizationId({
|
|
@@ -899,22 +862,6 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
899
862
|
}
|
|
900
863
|
});
|
|
901
864
|
}
|
|
902
|
-
async existingWalletSessionAuthorizationV2QuotaMatches(quota) {
|
|
903
|
-
const row = await this.database.prepare(`SELECT
|
|
904
|
-
tenant_id,
|
|
905
|
-
principal_id,
|
|
906
|
-
wallet_session_id,
|
|
907
|
-
quota_id,
|
|
908
|
-
remaining_uses,
|
|
909
|
-
lifecycle_kind,
|
|
910
|
-
expires_at_ms
|
|
911
|
-
FROM authorization_wallet_session_quotas
|
|
912
|
-
WHERE namespace = ?
|
|
913
|
-
AND tenant_id = ?
|
|
914
|
-
AND quota_id = ?
|
|
915
|
-
LIMIT 1`).bind(this.namespace, quota.tenantId, String(quota.quotaId)).first();
|
|
916
|
-
return row !== null && row.tenant_id === String(quota.tenantId) && row.principal_id === String(quota.principalId) && row.wallet_session_id === String(quota.walletSessionId) && row.quota_id === String(quota.quotaId) && row.lifecycle_kind === "active" && integerColumn(row.remaining_uses, "V2 quota.remainingUses") === quota.remainingUses && integerColumn(row.expires_at_ms, "V2 quota.expiresAtMs") === quota.expiresAtMs;
|
|
917
|
-
}
|
|
918
865
|
async readWalletSessionAuthorizationV2ByMint(input) {
|
|
919
866
|
const row = await this.database.prepare(`SELECT
|
|
920
867
|
record_json,
|
|
@@ -947,7 +894,7 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
947
894
|
AND mint_id = ?
|
|
948
895
|
LIMIT 1`).bind(this.namespace, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, input.tenantId, String(input.principalId), String(input.walletId), String(input.authorityId), String(input.walletAuthMethodId), String(input.mintId)).first();
|
|
949
896
|
if (!row) return null;
|
|
950
|
-
const session =
|
|
897
|
+
const session = parsePersistedWalletSessionAuthorizationV2(parseD1JsonColumn(row.record_json));
|
|
951
898
|
if (!walletSessionAuthorizationV2RowMatches({
|
|
952
899
|
session_tenant_id: row.tenant_id,
|
|
953
900
|
session_authorization_id: row.authorization_id,
|
|
@@ -988,6 +935,7 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
988
935
|
}
|
|
989
936
|
async readLiveWalletSessionAuthorizationProjectionV2(input) {
|
|
990
937
|
const row = await this.readJoinedWalletSessionAuthorizationV2Row({
|
|
938
|
+
projection: { kind: "session" },
|
|
991
939
|
lookupColumn: "authorization_id",
|
|
992
940
|
tenantId: input.expected.tenantId,
|
|
993
941
|
lookupValue: input.expected.authorizationId
|
|
@@ -1027,7 +975,7 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1027
975
|
LIMIT 1`).bind(this.namespace, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, input.tenantId, input.walletId, input.walletSessionId, input.authorizationId).first();
|
|
1028
976
|
if (!row) return null;
|
|
1029
977
|
if (row.retired_at_ms !== null && row.retired_at_ms !== void 0) return null;
|
|
1030
|
-
const session =
|
|
978
|
+
const session = parsePersistedWalletSessionAuthorizationV2(parseD1JsonColumn(row.record_json));
|
|
1031
979
|
if (session.tenantId !== input.tenantId || session.walletId !== input.walletId || session.walletSessionId !== input.walletSessionId || session.authorizationId !== input.authorizationId) throw new Error("Stored V2 Wallet Session identity does not match the request");
|
|
1032
980
|
const nowMs = requirePositiveInteger(input.nowMs, "V2 authorization read time");
|
|
1033
981
|
return session.expiresAtMs > nowMs ? session : null;
|
|
@@ -1039,8 +987,49 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1039
987
|
nowMs: input.nowMs
|
|
1040
988
|
}, "operation_credential_hash");
|
|
1041
989
|
}
|
|
990
|
+
/**
|
|
991
|
+
* The live session, its authority and its auth method from one joined read.
|
|
992
|
+
* A commit between separate reads could pair the session with an authority
|
|
993
|
+
* it was never bound to; one statement cannot.
|
|
994
|
+
*/
|
|
995
|
+
async readWalletSessionAdmissionSnapshotByOperationCredential(input) {
|
|
996
|
+
const row = await this.readJoinedWalletSessionAuthorizationV2Row({
|
|
997
|
+
projection: { kind: "session" },
|
|
998
|
+
lookupColumn: "operation_credential_hash",
|
|
999
|
+
tenantId: input.tenantId,
|
|
1000
|
+
lookupValue: input.tokenHash
|
|
1001
|
+
});
|
|
1002
|
+
if (!row) return null;
|
|
1003
|
+
return parseWalletSessionAdmissionRow(row, input);
|
|
1004
|
+
}
|
|
1005
|
+
async readEcdsaWalletSessionAdmissionSnapshotByOperationCredential(input) {
|
|
1006
|
+
const row = await this.readJoinedWalletSessionAuthorizationV2Row({
|
|
1007
|
+
projection: {
|
|
1008
|
+
kind: "ecdsa_material",
|
|
1009
|
+
materialActivation: input.materialActivation
|
|
1010
|
+
},
|
|
1011
|
+
lookupColumn: "operation_credential_hash",
|
|
1012
|
+
tenantId: input.tenantId,
|
|
1013
|
+
lookupValue: input.tokenHash
|
|
1014
|
+
});
|
|
1015
|
+
if (!row) return null;
|
|
1016
|
+
const snapshot = await parseWalletSessionAdmissionRow(row, input);
|
|
1017
|
+
const session = snapshot.kind === "active" ? snapshot.authorization.session : snapshot.session;
|
|
1018
|
+
return {
|
|
1019
|
+
snapshot,
|
|
1020
|
+
materialRead: EcdsaMaterialRead.fromRows(this.walletSignerScope, session.walletId, input.materialActivation, parseD1JsonColumn(row.ecdsa_material_records_json), await parseInstalledEcdsaCustodySnapshotV1({
|
|
1021
|
+
scope: this.walletSignerScope,
|
|
1022
|
+
walletId: session.walletId,
|
|
1023
|
+
materialActivation: routerAbMpcMaterialActivationRefFromWire(input.materialActivation),
|
|
1024
|
+
installations: parseD1JsonColumn(row.ecdsa_installations_json),
|
|
1025
|
+
signers: parseD1JsonColumn(row.ecdsa_source_signers_json)
|
|
1026
|
+
})),
|
|
1027
|
+
policyRead: D1EcdsaAdmissionPolicyRead.fromRows(this.database, this.namespace, session.walletId, input.materialActivation.activation_id, parseD1JsonColumn(row.ecdsa_policy_records_json))
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1042
1030
|
async readWalletSessionExactOperationContextByCredential(input) {
|
|
1043
1031
|
const row = await this.readJoinedWalletSessionAuthorizationV2Row({
|
|
1032
|
+
projection: { kind: "session" },
|
|
1044
1033
|
lookupColumn: "operation_credential_hash",
|
|
1045
1034
|
tenantId: input.tenantId,
|
|
1046
1035
|
lookupValue: input.tokenHash
|
|
@@ -1059,7 +1048,13 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1059
1048
|
session,
|
|
1060
1049
|
authority,
|
|
1061
1050
|
authMethod,
|
|
1062
|
-
retiredAtMs: null
|
|
1051
|
+
retiredAtMs: null,
|
|
1052
|
+
ownerWalletScope: {
|
|
1053
|
+
orgId: requireString(row.session_org_id, "session.ownerWalletScope.orgId"),
|
|
1054
|
+
projectId: requireString(row.session_project_id, "session.ownerWalletScope.projectId"),
|
|
1055
|
+
projectEnvironmentId: requireString(row.session_env_id, "session.ownerWalletScope.projectEnvironmentId"),
|
|
1056
|
+
walletId: session.walletId
|
|
1057
|
+
}
|
|
1063
1058
|
};
|
|
1064
1059
|
}
|
|
1065
1060
|
/**
|
|
@@ -1070,95 +1065,108 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1070
1065
|
* their record, and broken foreign-key identity still throw.
|
|
1071
1066
|
*/
|
|
1072
1067
|
async readExactWalletSessionStatusByOperationCredential(input) {
|
|
1068
|
+
return (await this.readExactWalletSessionStatusSnapshotByOperationCredential(input)).status;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* The exact status with the authority and auth method it was judged
|
|
1072
|
+
* against, all from the one joined read.
|
|
1073
|
+
*/
|
|
1074
|
+
async readExactWalletSessionStatusSnapshotByOperationCredential(input) {
|
|
1075
|
+
const unjudged = (status) => ({
|
|
1076
|
+
status,
|
|
1077
|
+
authority: null,
|
|
1078
|
+
authMethod: null
|
|
1079
|
+
});
|
|
1073
1080
|
const nowMs = requirePositiveInteger(input.nowMs, "exact Wallet Session status time");
|
|
1074
1081
|
const row = await this.readJoinedWalletSessionAuthorizationV2Row({
|
|
1082
|
+
projection: { kind: "session_status" },
|
|
1075
1083
|
lookupColumn: "operation_credential_hash",
|
|
1076
1084
|
tenantId: input.tenantId,
|
|
1077
1085
|
lookupValue: input.tokenHash
|
|
1078
1086
|
});
|
|
1079
|
-
if (!row) return { kind: "missing" };
|
|
1080
|
-
const session =
|
|
1087
|
+
if (!row) return unjudged({ kind: "missing" });
|
|
1088
|
+
const session = parsePersistedWalletSessionAuthorizationV2(parseD1JsonColumn(row.session_record_json));
|
|
1081
1089
|
if (!walletSessionAuthorizationV2RowMatches(row, session)) throw new Error("Stored V2 Wallet Session authorization columns disagree with record");
|
|
1082
1090
|
if (!walletSessionAuthorizationV2RecordsEqual(parseWalletSessionAuthorizationV2WithSubjects(row, parseD1JsonColumn(row.session_capability_subjects_json)), session)) throw new Error("Stored V2 Wallet Session capability subjects disagree with record");
|
|
1083
1091
|
if (session.tenantId !== input.tenantId) throw new Error("Stored V2 Wallet Session tenant does not match the request");
|
|
1084
1092
|
const quota = parseExactWalletSessionQuotaProjectionRow(row, session);
|
|
1085
|
-
if (session.expiresAtMs <= nowMs) return {
|
|
1093
|
+
if (session.expiresAtMs <= nowMs) return unjudged({
|
|
1086
1094
|
kind: "expired",
|
|
1087
1095
|
session,
|
|
1088
1096
|
quota
|
|
1089
|
-
};
|
|
1090
|
-
if (row.session_retired_at_ms !== null && row.session_retired_at_ms !== void 0) return {
|
|
1097
|
+
});
|
|
1098
|
+
if (row.session_retired_at_ms !== null && row.session_retired_at_ms !== void 0) return unjudged({
|
|
1091
1099
|
kind: "retired",
|
|
1092
1100
|
session,
|
|
1093
1101
|
quota,
|
|
1094
1102
|
retiredAtMs: requirePositiveInteger(row.session_retired_at_ms, "V2 session.retiredAtMs")
|
|
1095
|
-
};
|
|
1096
|
-
|
|
1103
|
+
});
|
|
1104
|
+
const joined = await joinedAuthorityAndMethod(row);
|
|
1105
|
+
const judged = (status) => ({
|
|
1106
|
+
status,
|
|
1107
|
+
...joined
|
|
1108
|
+
});
|
|
1109
|
+
if (quota.lifecycle === "exhausted") return judged({
|
|
1097
1110
|
kind: "exhausted",
|
|
1098
1111
|
session,
|
|
1099
1112
|
quota
|
|
1100
|
-
};
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
session,
|
|
1104
|
-
quota
|
|
1105
|
-
};
|
|
1106
|
-
const authority = await this.readExactStatusAuthority(row);
|
|
1107
|
-
if (!authority) return {
|
|
1113
|
+
});
|
|
1114
|
+
const authority = joined.authority;
|
|
1115
|
+
if (!authority) return judged({
|
|
1108
1116
|
kind: "authority_unavailable",
|
|
1109
1117
|
session,
|
|
1110
1118
|
quota
|
|
1111
|
-
};
|
|
1119
|
+
});
|
|
1112
1120
|
if (authority.authorityId !== session.authorityId || authority.walletId !== session.walletId || authority.state !== row.authority_lifecycle_state || authority.authorityDigestB64u !== row.authority_digest_b64u || authority.revocationEpoch !== integerColumn(row.authority_revocation_epoch, "authority.revocationEpoch")) throw new Error("Stored V2 Wallet Session authority identity does not match the record");
|
|
1113
|
-
if (authority.authorityId !== session.authorityId || authority.walletId !== session.walletId || authority.authorityDigestB64u !== session.authorityDigestB64u || authority.revocationEpoch !== session.authorityRevocationEpoch || authority.state !== "active") return {
|
|
1121
|
+
if (authority.authorityId !== session.authorityId || authority.walletId !== session.walletId || authority.authorityDigestB64u !== session.authorityDigestB64u || authority.revocationEpoch !== session.authorityRevocationEpoch || authority.state !== "active") return judged({
|
|
1114
1122
|
kind: "authority_unavailable",
|
|
1115
1123
|
session,
|
|
1116
1124
|
quota
|
|
1117
|
-
};
|
|
1118
|
-
if (row.auth_method_id === null || row.auth_method_id === void 0) return {
|
|
1125
|
+
});
|
|
1126
|
+
if (row.auth_method_id === null || row.auth_method_id === void 0) return judged({
|
|
1119
1127
|
kind: "method_unavailable",
|
|
1120
1128
|
session,
|
|
1121
1129
|
quota
|
|
1122
|
-
};
|
|
1130
|
+
});
|
|
1123
1131
|
if (row.auth_method_id !== String(session.walletAuthMethodId) || row.auth_method_wallet_id !== String(session.walletId) || row.auth_method_authority_id !== String(session.authorityId)) throw new Error("Stored V2 Wallet Session auth method identity does not match the record");
|
|
1124
|
-
if (row.auth_method_status !== "active") return {
|
|
1132
|
+
if (row.auth_method_status !== "active") return judged({
|
|
1125
1133
|
kind: "method_unavailable",
|
|
1126
1134
|
session,
|
|
1127
1135
|
quota
|
|
1128
|
-
};
|
|
1136
|
+
});
|
|
1129
1137
|
if (!exactWalletSessionCapabilitySubjectsResolveAuthority({
|
|
1130
1138
|
session,
|
|
1131
1139
|
signerActivations: authority.signerActivations
|
|
1132
|
-
})) return {
|
|
1140
|
+
})) return judged({
|
|
1133
1141
|
kind: "capability_unavailable",
|
|
1134
1142
|
session,
|
|
1135
1143
|
quota
|
|
1136
|
-
};
|
|
1137
|
-
if (!await this.exactWalletSessionCapabilitySubjectsResolveMaterial(session)) return {
|
|
1144
|
+
});
|
|
1145
|
+
if (!await this.exactWalletSessionCapabilitySubjectsResolveMaterial(session, parseD1JsonColumn(row.status_ecdsa_material_records_json))) return judged({
|
|
1138
1146
|
kind: "capability_unavailable",
|
|
1139
1147
|
session,
|
|
1140
1148
|
quota
|
|
1141
|
-
};
|
|
1142
|
-
return {
|
|
1149
|
+
});
|
|
1150
|
+
return judged({
|
|
1143
1151
|
kind: "active",
|
|
1144
1152
|
session,
|
|
1145
1153
|
quota
|
|
1146
|
-
};
|
|
1147
|
-
}
|
|
1148
|
-
async readExactStatusAuthority(row) {
|
|
1149
|
-
const authorityId = parseWalletAuthorityId(row.authority_id);
|
|
1150
|
-
if (!authorityId.ok) throw new Error("Stored V2 Wallet Session authority identity is invalid");
|
|
1151
|
-
return await this.walletAuthorityStore.readById(authorityId.value);
|
|
1154
|
+
});
|
|
1152
1155
|
}
|
|
1153
|
-
async exactWalletSessionCapabilitySubjectsResolveMaterial(session) {
|
|
1156
|
+
async exactWalletSessionCapabilitySubjectsResolveMaterial(session, ecdsaMaterialRows) {
|
|
1154
1157
|
const materials = [];
|
|
1155
1158
|
for (const subject of session.capabilitySubjects) switch (subject.kind) {
|
|
1156
1159
|
case "sign":
|
|
1157
1160
|
case "export_keys":
|
|
1158
|
-
if (!materials.some((material) => material.keyFamily === subject.keyFamily && mpcMaterialActivationRefsEqual(material.materialActivation, subject.materialActivation))) materials.push({
|
|
1159
|
-
keyFamily:
|
|
1161
|
+
if (!materials.some((material) => material.keyFamily === subject.keyFamily && mpcMaterialActivationRefsEqual(material.materialActivation, subject.materialActivation))) if (subject.keyFamily === "ed25519") materials.push({
|
|
1162
|
+
keyFamily: "ed25519",
|
|
1160
1163
|
materialActivation: subject.materialActivation
|
|
1161
1164
|
});
|
|
1165
|
+
else materials.push({
|
|
1166
|
+
keyFamily: "ecdsa_secp256k1",
|
|
1167
|
+
materialActivation: subject.materialActivation,
|
|
1168
|
+
materialRead: EcdsaMaterialRead.fromRows(this.walletSignerScope, session.walletId, routerAbMpcMaterialActivationRefToWire(subject.materialActivation), ecdsaMaterialRows, null)
|
|
1169
|
+
});
|
|
1162
1170
|
break;
|
|
1163
1171
|
case "link_devices":
|
|
1164
1172
|
case "revoke_devices": break;
|
|
@@ -1171,10 +1179,7 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1171
1179
|
const signer = subject.keyFamily === "ed25519" ? await this.walletStore.getEd25519SignerByMaterialActivation({
|
|
1172
1180
|
walletId,
|
|
1173
1181
|
materialActivation
|
|
1174
|
-
}) :
|
|
1175
|
-
walletId,
|
|
1176
|
-
materialActivation
|
|
1177
|
-
});
|
|
1182
|
+
}) : subject.materialRead.resolve(this.walletSignerScope, walletId, materialActivation)?.signer;
|
|
1178
1183
|
if (!signer) return await this.readLinkedAuthorityMaterial(walletId, subject) !== null;
|
|
1179
1184
|
if (signer.walletId !== walletId) throw new Error("Stored wallet signer material identity does not match the session");
|
|
1180
1185
|
return true;
|
|
@@ -1195,8 +1200,64 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1195
1200
|
return projection;
|
|
1196
1201
|
}
|
|
1197
1202
|
async readJoinedWalletSessionAuthorizationV2Row(input) {
|
|
1198
|
-
|
|
1203
|
+
const installationProjection = ECDSA_INSTALLATION_SNAPSHOT_COLUMNS.map(installationJsonColumn).join(", ");
|
|
1204
|
+
let materialProjection = "";
|
|
1205
|
+
let materialBindings = [];
|
|
1206
|
+
if (input.projection.kind === "ecdsa_material") {
|
|
1207
|
+
materialProjection = `
|
|
1208
|
+
(SELECT json_group_array(json_object('record_json', signer.record_json))
|
|
1209
|
+
FROM wallet_signers AS signer
|
|
1210
|
+
WHERE signer.namespace = session.namespace
|
|
1211
|
+
AND signer.org_id = session.org_id
|
|
1212
|
+
AND signer.project_id = session.project_id
|
|
1213
|
+
AND signer.env_id = session.env_id
|
|
1214
|
+
AND signer.wallet_id = session.wallet_id
|
|
1215
|
+
AND signer.signer_family = 'ecdsa'
|
|
1216
|
+
AND CASE WHEN json_valid(signer.record_json) THEN
|
|
1217
|
+
json_extract(signer.record_json,
|
|
1218
|
+
'$.walletKey.publicCapability.material_activation.activation_id') = ?
|
|
1219
|
+
ELSE 1 END
|
|
1220
|
+
) AS ecdsa_material_records_json,
|
|
1221
|
+
CASE WHEN authority.provenance_kind = 'device_link' THEN
|
|
1222
|
+
(SELECT json_group_array(json_object(${installationProjection}))
|
|
1223
|
+
FROM linked_device_authority_installations AS installation
|
|
1224
|
+
WHERE installation.namespace = session.namespace
|
|
1225
|
+
AND installation.org_id = session.org_id
|
|
1226
|
+
AND installation.project_id = session.project_id
|
|
1227
|
+
AND installation.env_id = session.env_id
|
|
1228
|
+
AND installation.wallet_id = session.wallet_id)
|
|
1229
|
+
END AS ecdsa_installations_json,
|
|
1230
|
+
CASE WHEN authority.provenance_kind = 'device_link' THEN
|
|
1231
|
+
(SELECT json_group_array(json_object('record_json', source_signer.record_json))
|
|
1232
|
+
FROM wallet_signers AS source_signer
|
|
1233
|
+
WHERE source_signer.namespace = session.namespace
|
|
1234
|
+
AND source_signer.org_id = session.org_id
|
|
1235
|
+
AND source_signer.project_id = session.project_id
|
|
1236
|
+
AND source_signer.env_id = session.env_id
|
|
1237
|
+
AND source_signer.wallet_id = session.wallet_id
|
|
1238
|
+
AND source_signer.signer_family = 'ecdsa')
|
|
1239
|
+
END AS ecdsa_source_signers_json,
|
|
1240
|
+
${ECDSA_CREDENTIAL_POLICY_PROJECTION}`;
|
|
1241
|
+
materialBindings = [input.projection.materialActivation.activation_id, input.projection.materialActivation.activation_id];
|
|
1242
|
+
} else if (input.projection.kind === "session_status") {
|
|
1243
|
+
materialProjection = `
|
|
1244
|
+
(SELECT json_group_array(json_object('record_json', signer.record_json))
|
|
1245
|
+
FROM wallet_signers AS signer
|
|
1246
|
+
WHERE signer.namespace = ? AND signer.org_id = ?
|
|
1247
|
+
AND signer.project_id = ? AND signer.env_id = ?
|
|
1248
|
+
AND signer.wallet_id = session.wallet_id
|
|
1249
|
+
AND signer.signer_family = 'ecdsa'
|
|
1250
|
+
) AS status_ecdsa_material_records_json,`;
|
|
1251
|
+
materialBindings = [
|
|
1252
|
+
this.walletSignerScope.namespace,
|
|
1253
|
+
this.walletSignerScope.orgId,
|
|
1254
|
+
this.walletSignerScope.projectId,
|
|
1255
|
+
this.walletSignerScope.envId
|
|
1256
|
+
];
|
|
1257
|
+
}
|
|
1258
|
+
return await this.database.prepare(`SELECT ${materialProjection}
|
|
1199
1259
|
authority.*,
|
|
1260
|
+
session.namespace AS session_namespace,
|
|
1200
1261
|
session.record_json AS session_record_json,
|
|
1201
1262
|
session.capability_subjects_json AS session_capability_subjects_json,
|
|
1202
1263
|
session.tenant_id AS session_tenant_id,
|
|
@@ -1206,6 +1267,9 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1206
1267
|
session.quota_id AS session_quota_id,
|
|
1207
1268
|
session.principal_id AS session_principal_id,
|
|
1208
1269
|
session.wallet_id AS session_wallet_id,
|
|
1270
|
+
session.org_id AS session_org_id,
|
|
1271
|
+
session.project_id AS session_project_id,
|
|
1272
|
+
session.env_id AS session_env_id,
|
|
1209
1273
|
session.authority_id AS session_authority_id,
|
|
1210
1274
|
session.wallet_auth_method_id AS session_wallet_auth_method_id,
|
|
1211
1275
|
session.authority_digest_b64u AS session_authority_digest_b64u,
|
|
@@ -1256,12 +1320,13 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1256
1320
|
AND session.env_id = ?
|
|
1257
1321
|
AND session.tenant_id = ?
|
|
1258
1322
|
AND session.${input.lookupColumn} = ?
|
|
1259
|
-
LIMIT 1`).bind(this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, this.namespace, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, input.tenantId, input.lookupValue).first();
|
|
1323
|
+
LIMIT 1`).bind(...materialBindings, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, this.namespace, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, input.tenantId, input.lookupValue).first();
|
|
1260
1324
|
}
|
|
1261
1325
|
async readWalletSessionAuthorizationV2(input, lookupColumn) {
|
|
1262
1326
|
const lookup = "expected" in input ? input.expected : "identity" in input ? input.identity : null;
|
|
1263
1327
|
const operationCredentialHash = "operationCredentialHash" in input ? input.operationCredentialHash : null;
|
|
1264
1328
|
const row = await this.readJoinedWalletSessionAuthorizationV2Row({
|
|
1329
|
+
projection: { kind: "session" },
|
|
1265
1330
|
lookupColumn,
|
|
1266
1331
|
tenantId: "operationCredentialHash" in input ? input.tenantId : lookup?.tenantId,
|
|
1267
1332
|
lookupValue: lookupColumn === "mint_id" ? String("expected" in input ? input.expected.mintId : lookup?.authorizationId) : lookupColumn === "authorization_id" ? String(lookup?.authorizationId) : operationCredentialHash
|
|
@@ -1274,7 +1339,8 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1274
1339
|
};
|
|
1275
1340
|
}
|
|
1276
1341
|
async readAuthorizedOperation(input) {
|
|
1277
|
-
|
|
1342
|
+
const row = await prepareAuthorizedOperationRead(this.database, this.namespace, input).first();
|
|
1343
|
+
return row ? await parseAuthorizedOperationRow(row) : null;
|
|
1278
1344
|
}
|
|
1279
1345
|
async readAuthorizedOperationById(input) {
|
|
1280
1346
|
const row = await this.database.prepare(`SELECT * FROM authorized_operations
|
|
@@ -1282,223 +1348,223 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1282
1348
|
LIMIT 1`).bind(this.namespace, input.tenantId, input.authorizedOperationId).first();
|
|
1283
1349
|
return row ? await parseAuthorizedOperationRow(row) : null;
|
|
1284
1350
|
}
|
|
1285
|
-
async
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
operation
|
|
1292
|
-
|
|
1351
|
+
async readPinnedOwnerWalletScope(input) {
|
|
1352
|
+
const { operation, walletId } = input;
|
|
1353
|
+
if (operation.operation.operation.capabilityKind !== CAPABILITY_KINDS.nearEd25519MpcSigning && operation.operation.operation.capabilityKind !== CAPABILITY_KINDS.evmEcdsaMpcSigning) throw new Error("Pinned owner wallet scope requires a signing operation");
|
|
1354
|
+
const row = await prepareAuthorizedOperationCommittedRead(this.database, this.namespace, operation).first();
|
|
1355
|
+
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
|
+
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");
|
|
1358
|
+
return {
|
|
1359
|
+
orgId: this.walletSignerScope.orgId,
|
|
1360
|
+
projectId: this.walletSignerScope.projectId,
|
|
1361
|
+
projectEnvironmentId: this.walletSignerScope.envId
|
|
1362
|
+
};
|
|
1363
|
+
}
|
|
1364
|
+
if (row.authorization_id !== operation.authorization.authorizationGrantRef.authorizationId) throw new Error("Pinned owner Wallet Session scope is unavailable");
|
|
1365
|
+
return this.pinnedWalletSessionOwnerScope(row, walletId);
|
|
1293
1366
|
}
|
|
1294
|
-
|
|
1367
|
+
pinnedWalletSessionOwnerScope(row, walletId) {
|
|
1368
|
+
if (row.pinned_owner_wallet_id !== walletId) throw new Error("Pinned owner Wallet Session scope is unavailable");
|
|
1369
|
+
return {
|
|
1370
|
+
orgId: requireString(row.linked_scope_org_id, "operation.ownerScope.orgId"),
|
|
1371
|
+
projectId: requireString(row.linked_scope_project_id, "operation.ownerScope.projectId"),
|
|
1372
|
+
projectEnvironmentId: requireString(row.linked_scope_env_id, "operation.ownerScope.projectEnvironmentId")
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
async readAuthorizedOperationForAdmission(input) {
|
|
1376
|
+
const row = await prepareAuthorizedOperationAdmissionRead({
|
|
1377
|
+
database: this.database,
|
|
1378
|
+
namespace: this.namespace,
|
|
1379
|
+
walletSignerScope: this.walletSignerScope,
|
|
1380
|
+
materialSnapshot: input.materialSnapshot,
|
|
1381
|
+
tenantId: input.tenantId,
|
|
1382
|
+
operationFingerprintDigest: input.operationFingerprintDigest,
|
|
1383
|
+
nowMs: requirePositiveInteger(input.nowMs, "operation replay time")
|
|
1384
|
+
}).first();
|
|
1385
|
+
return row ? parseAuthorizedOperationAdmissionRecord(row) : null;
|
|
1386
|
+
}
|
|
1387
|
+
/** How an operation already admitted for this fingerprint answers another admission. */
|
|
1388
|
+
answerExistingAuthorizedOperation(existing, operation, material) {
|
|
1389
|
+
if (!existing.materialActive) return { kind: "material_mismatch" };
|
|
1390
|
+
const replayMismatch = authorizedOperationReplayMismatch({
|
|
1391
|
+
existing: existing.row,
|
|
1392
|
+
incoming: operation,
|
|
1393
|
+
material,
|
|
1394
|
+
scope: this.walletSignerScope
|
|
1395
|
+
});
|
|
1396
|
+
if (replayMismatch) return replayMismatch;
|
|
1397
|
+
if (existing.operation.lifecycle === "completed") {
|
|
1398
|
+
if (existing.operation.authorization.kind === "authorization_grant" && !existing.sourceActive) return { kind: "authorization_grant_rejected" };
|
|
1399
|
+
return {
|
|
1400
|
+
kind: "replayed",
|
|
1401
|
+
operation: existing.operation,
|
|
1402
|
+
row: existing.row
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
if (!existing.sourceActive) return authorizationSourceRejected(operation.authorization);
|
|
1406
|
+
return {
|
|
1407
|
+
kind: "operation_in_progress",
|
|
1408
|
+
operation: existing.operation,
|
|
1409
|
+
row: existing.row
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* The admission `admitAuthorizedOperation` would make, prepared for a batch
|
|
1414
|
+
* another store owns, after the same reads. It admits no ECDSA material:
|
|
1415
|
+
* that admission is conditional on the signer row, not a plain insert.
|
|
1416
|
+
*/
|
|
1417
|
+
async prepareAuthorizedOperationAdmission(input) {
|
|
1295
1418
|
const operation = await buildAuthorizedOperation(input.operation);
|
|
1296
|
-
if (operation.operation.operation.capabilityKind === CAPABILITY_KINDS.evmEcdsaMpcSigning
|
|
1297
|
-
|
|
1298
|
-
const existing = await this.readAuthorizedOperationRecord({
|
|
1419
|
+
if (operation.operation.operation.capabilityKind === CAPABILITY_KINDS.evmEcdsaMpcSigning) return { kind: "material_mismatch" };
|
|
1420
|
+
const existing = await this.readAuthorizedOperationForAdmission({
|
|
1299
1421
|
tenantId: operation.tenantId,
|
|
1300
|
-
operationFingerprintDigest: operation.operationFingerprintDigest
|
|
1422
|
+
operationFingerprintDigest: operation.operationFingerprintDigest,
|
|
1423
|
+
nowMs: operation.claimedAtMs,
|
|
1424
|
+
materialSnapshot: null
|
|
1301
1425
|
});
|
|
1302
1426
|
if (existing) {
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
scope: this.walletSignerScope
|
|
1308
|
-
});
|
|
1309
|
-
if (replayMismatch) return replayMismatch;
|
|
1310
|
-
if (existing.operation.lifecycle === "completed") {
|
|
1311
|
-
if (existing.operation.authorization.kind === "authorization_grant" && !await this.isAuthorizedOperationSourceActive(existing.row, operation.claimedAtMs)) return { kind: "authorization_grant_rejected" };
|
|
1312
|
-
return {
|
|
1313
|
-
kind: "replayed",
|
|
1314
|
-
operation: existing.operation
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
if (!await this.isAuthorizedOperationSourceActive(existing.row, operation.claimedAtMs)) return authorizationSourceRejected(operation.authorization);
|
|
1318
|
-
return {
|
|
1319
|
-
kind: "operation_in_progress",
|
|
1320
|
-
operation: existing.operation
|
|
1427
|
+
const result = this.answerExistingAuthorizedOperation(existing, operation, void 0);
|
|
1428
|
+
if (result.kind === "replayed" || result.kind === "operation_in_progress") return {
|
|
1429
|
+
kind: result.kind,
|
|
1430
|
+
operation: result.operation
|
|
1321
1431
|
};
|
|
1432
|
+
return result;
|
|
1322
1433
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1434
|
+
return {
|
|
1435
|
+
kind: "prepared",
|
|
1436
|
+
statements: [prepareAuthorizedOperationInsert({
|
|
1437
|
+
database: this.database,
|
|
1438
|
+
namespace: this.namespace,
|
|
1439
|
+
walletSignerScope: this.walletSignerScope,
|
|
1440
|
+
operation,
|
|
1441
|
+
material: null,
|
|
1442
|
+
materialSnapshot: null,
|
|
1443
|
+
existingOperation: "reject"
|
|
1444
|
+
})]
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
classifyAuthorizedOperationAdmissionFailure(error) {
|
|
1448
|
+
return classifyAuthorizedOperationAdmissionError(error);
|
|
1449
|
+
}
|
|
1450
|
+
async admitAuthorizedOperation(input) {
|
|
1451
|
+
const result = await this.admitAuthorizedOperationRecord({
|
|
1452
|
+
operation: input.operation,
|
|
1453
|
+
material: input.material,
|
|
1454
|
+
materialSnapshot: null
|
|
1455
|
+
});
|
|
1456
|
+
if (result.kind === "claimed" || result.kind === "replayed" || result.kind === "operation_in_progress") return {
|
|
1457
|
+
kind: result.kind,
|
|
1458
|
+
operation: result.operation
|
|
1459
|
+
};
|
|
1460
|
+
return result;
|
|
1461
|
+
}
|
|
1462
|
+
async resolveEcdsaWalletSessionOperation(input) {
|
|
1463
|
+
const operation = await buildAuthorizedOperation(input.operation);
|
|
1464
|
+
if (!authorizedOperationMaterialScopeMatches(operation, input.material, input.material.readSnapshot)) return { kind: "material_mismatch" };
|
|
1465
|
+
const existing = await this.readAuthorizedOperationForAdmission({
|
|
1466
|
+
tenantId: operation.tenantId,
|
|
1467
|
+
operationFingerprintDigest: operation.operationFingerprintDigest,
|
|
1468
|
+
nowMs: operation.claimedAtMs,
|
|
1469
|
+
materialSnapshot: input.material.readSnapshot
|
|
1470
|
+
});
|
|
1471
|
+
if (!existing) return { kind: "authorized_operation_missing" };
|
|
1472
|
+
const result = this.answerExistingAuthorizedOperation(existing, operation, input.material);
|
|
1473
|
+
if (result.kind === "operation_in_progress") return {
|
|
1474
|
+
kind: result.kind,
|
|
1475
|
+
operation: result.operation,
|
|
1476
|
+
ownerScope: this.pinnedWalletSessionOwnerScope(result.row, input.material.walletId)
|
|
1477
|
+
};
|
|
1478
|
+
if (result.kind === "replayed") return {
|
|
1479
|
+
kind: result.kind,
|
|
1480
|
+
operation: result.operation
|
|
1481
|
+
};
|
|
1482
|
+
switch (result.kind) {
|
|
1483
|
+
case "authorization_grant_rejected":
|
|
1484
|
+
case "verified_step_up_rejected":
|
|
1485
|
+
case "wallet_session_quota_exhausted":
|
|
1486
|
+
case "material_mismatch": return result;
|
|
1487
|
+
default: throw new Error("Unexpected ECDSA operation resolution");
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
async admitEcdsaWalletSessionOperation(input) {
|
|
1491
|
+
const result = await this.admitAuthorizedOperationRecord({
|
|
1492
|
+
operation: input.operation,
|
|
1493
|
+
material: input.material,
|
|
1494
|
+
materialSnapshot: input.material.readSnapshot
|
|
1495
|
+
});
|
|
1496
|
+
switch (result.kind) {
|
|
1497
|
+
case "claimed":
|
|
1498
|
+
case "operation_in_progress": return {
|
|
1499
|
+
kind: result.kind,
|
|
1500
|
+
operation: result.operation,
|
|
1501
|
+
ownerScope: this.pinnedWalletSessionOwnerScope(result.row, input.material.walletId)
|
|
1502
|
+
};
|
|
1503
|
+
case "replayed": return {
|
|
1504
|
+
kind: "replayed",
|
|
1505
|
+
operation: result.operation
|
|
1506
|
+
};
|
|
1507
|
+
case "authorization_grant_rejected":
|
|
1508
|
+
case "verified_step_up_rejected":
|
|
1509
|
+
case "wallet_session_quota_exhausted":
|
|
1510
|
+
case "material_mismatch": return result;
|
|
1511
|
+
default: {
|
|
1512
|
+
const unexpected = result;
|
|
1513
|
+
throw new Error(`Unexpected ECDSA admission: ${unexpected}`);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
async admitAuthorizedOperationRecord(input) {
|
|
1518
|
+
const operation = await buildAuthorizedOperation(input.operation);
|
|
1519
|
+
if (!authorizedOperationMaterialScopeMatches(operation, input.material, input.materialSnapshot)) return { kind: "material_mismatch" };
|
|
1520
|
+
let committedRow;
|
|
1521
|
+
let claimed;
|
|
1326
1522
|
try {
|
|
1327
|
-
const
|
|
1328
|
-
this.
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
operation
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
operation.
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
materialActivationId,
|
|
1349
|
-
input.material?.materialActivation.capability ?? null,
|
|
1350
|
-
input.material?.materialActivation.material_owner ?? null,
|
|
1351
|
-
input.material?.materialActivation.key_binding ?? null,
|
|
1352
|
-
input.material?.materialActivation.lifecycle_binding ?? null,
|
|
1353
|
-
input.material?.materialActivation.signing_worker ?? null,
|
|
1354
|
-
null,
|
|
1355
|
-
null,
|
|
1356
|
-
null,
|
|
1357
|
-
null,
|
|
1358
|
-
null,
|
|
1359
|
-
null,
|
|
1360
|
-
null,
|
|
1361
|
-
source.kind === "authorization_grant" ? this.walletSignerScope.orgId : null,
|
|
1362
|
-
source.kind === "authorization_grant" ? this.walletSignerScope.projectId : null,
|
|
1363
|
-
source.kind === "authorization_grant" ? this.walletSignerScope.envId : null
|
|
1364
|
-
];
|
|
1365
|
-
const result = await (input.material?.kind === "ecdsa_material_activation" ? this.database.prepare(`INSERT INTO authorized_operations (
|
|
1366
|
-
namespace, tenant_id, authorized_operation_id, audit_event_id,
|
|
1367
|
-
principal_id, capability_id, capability_kind, operation_kind, operation_id,
|
|
1368
|
-
operation_fingerprint_digest, lane_digest, intent_digest, display_digest,
|
|
1369
|
-
authorization_source_kind, authorization_id, evidence_set_digest,
|
|
1370
|
-
quota_id, quota_kind, authorization_grant_kind, lifecycle_kind, result_kind,
|
|
1371
|
-
result_digest, result_status, result_content_type, result_body_text,
|
|
1372
|
-
claimed_at_ms, completed_at_ms,
|
|
1373
|
-
material_activation_id, material_activation_capability,
|
|
1374
|
-
material_activation_owner, material_activation_key_binding,
|
|
1375
|
-
material_activation_lifecycle_binding, material_activation_signing_worker,
|
|
1376
|
-
linked_wallet_id, linked_enrollment_id, linked_device_id,
|
|
1377
|
-
linked_wallet_key_id, linked_lane_id, linked_lane_share_epoch,
|
|
1378
|
-
linked_revocation_epoch, linked_scope_org_id, linked_scope_project_id,
|
|
1379
|
-
linked_scope_env_id
|
|
1380
|
-
) SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
1381
|
-
'claimed', 'pending', NULL, NULL, NULL, NULL, ?, NULL, ?,
|
|
1382
|
-
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
1383
|
-
WHERE ${ECDSA_SIGNER_MATCH}`).bind(...values, ...ecdsaSignerMatchBindings(this.walletSignerScope, input.material)) : this.database.prepare(`INSERT INTO authorized_operations (
|
|
1384
|
-
namespace, tenant_id, authorized_operation_id, audit_event_id,
|
|
1385
|
-
principal_id, capability_id, capability_kind, operation_kind, operation_id,
|
|
1386
|
-
operation_fingerprint_digest, lane_digest, intent_digest, display_digest,
|
|
1387
|
-
authorization_source_kind, authorization_id, evidence_set_digest,
|
|
1388
|
-
quota_id, quota_kind, authorization_grant_kind, lifecycle_kind, result_kind,
|
|
1389
|
-
result_digest, result_status, result_content_type, result_body_text,
|
|
1390
|
-
claimed_at_ms, completed_at_ms,
|
|
1391
|
-
material_activation_id, material_activation_capability,
|
|
1392
|
-
material_activation_owner, material_activation_key_binding,
|
|
1393
|
-
material_activation_lifecycle_binding, material_activation_signing_worker,
|
|
1394
|
-
linked_wallet_id, linked_enrollment_id, linked_device_id,
|
|
1395
|
-
linked_wallet_key_id, linked_lane_id, linked_lane_share_epoch,
|
|
1396
|
-
linked_revocation_epoch, linked_scope_org_id, linked_scope_project_id,
|
|
1397
|
-
linked_scope_env_id
|
|
1398
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
1399
|
-
'claimed', 'pending', NULL, NULL, NULL, NULL, ?, NULL, ?,
|
|
1400
|
-
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).bind(...values)).run();
|
|
1401
|
-
if (input.material && d1ChangedRows(result) === 0) return { kind: "material_mismatch" };
|
|
1523
|
+
const statement = prepareAuthorizedOperationInsert({
|
|
1524
|
+
database: this.database,
|
|
1525
|
+
namespace: this.namespace,
|
|
1526
|
+
walletSignerScope: this.walletSignerScope,
|
|
1527
|
+
operation,
|
|
1528
|
+
material: input.material ?? null,
|
|
1529
|
+
materialSnapshot: input.materialSnapshot,
|
|
1530
|
+
existingOperation: "preserve"
|
|
1531
|
+
});
|
|
1532
|
+
const [result, readback] = await this.database.batch([statement, prepareAuthorizedOperationAdmissionRead({
|
|
1533
|
+
database: this.database,
|
|
1534
|
+
namespace: this.namespace,
|
|
1535
|
+
walletSignerScope: this.walletSignerScope,
|
|
1536
|
+
tenantId: operation.tenantId,
|
|
1537
|
+
operationFingerprintDigest: operation.operationFingerprintDigest,
|
|
1538
|
+
nowMs: operation.claimedAtMs,
|
|
1539
|
+
materialSnapshot: input.materialSnapshot
|
|
1540
|
+
})]);
|
|
1541
|
+
if (!result?.success || !readback?.success) throw new Error("authorized operation admission batch returned incomplete results");
|
|
1542
|
+
claimed = d1ChangedRows(result) !== 0;
|
|
1543
|
+
committedRow = readback.results?.[0] ?? null;
|
|
1402
1544
|
} catch (error) {
|
|
1403
|
-
const raced = await this.
|
|
1545
|
+
const raced = await this.readAuthorizedOperationForAdmission({
|
|
1404
1546
|
tenantId: operation.tenantId,
|
|
1405
|
-
operationFingerprintDigest: operation.operationFingerprintDigest
|
|
1547
|
+
operationFingerprintDigest: operation.operationFingerprintDigest,
|
|
1548
|
+
nowMs: operation.claimedAtMs,
|
|
1549
|
+
materialSnapshot: input.materialSnapshot
|
|
1406
1550
|
});
|
|
1407
|
-
if (raced)
|
|
1408
|
-
const replayMismatch = authorizedOperationReplayMismatch({
|
|
1409
|
-
existing: raced.row,
|
|
1410
|
-
incoming: operation,
|
|
1411
|
-
material: input.material,
|
|
1412
|
-
scope: this.walletSignerScope
|
|
1413
|
-
});
|
|
1414
|
-
if (replayMismatch) return replayMismatch;
|
|
1415
|
-
if (raced.operation.lifecycle === "completed") {
|
|
1416
|
-
if (raced.operation.authorization.kind === "authorization_grant" && !await this.isAuthorizedOperationSourceActive(raced.row, operation.claimedAtMs)) return { kind: "authorization_grant_rejected" };
|
|
1417
|
-
return {
|
|
1418
|
-
kind: "replayed",
|
|
1419
|
-
operation: raced.operation
|
|
1420
|
-
};
|
|
1421
|
-
}
|
|
1422
|
-
if (!await this.isAuthorizedOperationSourceActive(raced.row, operation.claimedAtMs)) return authorizationSourceRejected(operation.authorization);
|
|
1423
|
-
return {
|
|
1424
|
-
kind: "operation_in_progress",
|
|
1425
|
-
operation: raced.operation
|
|
1426
|
-
};
|
|
1427
|
-
}
|
|
1551
|
+
if (raced) return this.answerExistingAuthorizedOperation(raced, operation, input.material);
|
|
1428
1552
|
const triggerFailure = classifyAuthorizedOperationAdmissionError(error);
|
|
1429
1553
|
if (triggerFailure) return triggerFailure;
|
|
1430
1554
|
throw error;
|
|
1431
1555
|
}
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1556
|
+
if (!committedRow) {
|
|
1557
|
+
if (!claimed && input.material) return { kind: "material_mismatch" };
|
|
1558
|
+
throw new Error("authorized operation admission could not be read back");
|
|
1559
|
+
}
|
|
1560
|
+
const admitted = await parseAuthorizedOperationAdmissionRecord(committedRow);
|
|
1561
|
+
if (!claimed) return this.answerExistingAuthorizedOperation(admitted, operation, input.material);
|
|
1437
1562
|
return {
|
|
1438
1563
|
kind: "claimed",
|
|
1439
|
-
operation:
|
|
1564
|
+
operation: admitted.operation,
|
|
1565
|
+
row: committedRow
|
|
1440
1566
|
};
|
|
1441
1567
|
}
|
|
1442
|
-
async isAuthorizedOperationSourceActive(row, nowMs) {
|
|
1443
|
-
const sourceKind = requireString(row.authorization_source_kind, "operation.authorization.kind");
|
|
1444
|
-
if (sourceKind === "authorization_grant") {
|
|
1445
|
-
const scope = [
|
|
1446
|
-
row.linked_scope_org_id,
|
|
1447
|
-
row.linked_scope_project_id,
|
|
1448
|
-
row.linked_scope_env_id
|
|
1449
|
-
];
|
|
1450
|
-
if (scope.some((value) => typeof value !== "string" || value.length === 0)) return false;
|
|
1451
|
-
if (scope[0] !== this.walletSignerScope.orgId || scope[1] !== this.walletSignerScope.projectId || scope[2] !== this.walletSignerScope.envId) return false;
|
|
1452
|
-
return await this.database.prepare(`SELECT 1 AS active
|
|
1453
|
-
FROM wallet_session_authorizations_v2 AS session
|
|
1454
|
-
JOIN wallet_authorities AS authority
|
|
1455
|
-
ON authority.namespace = session.namespace
|
|
1456
|
-
AND authority.org_id = session.org_id
|
|
1457
|
-
AND authority.project_id = session.project_id
|
|
1458
|
-
AND authority.env_id = session.env_id
|
|
1459
|
-
AND authority.authority_id = session.authority_id
|
|
1460
|
-
AND authority.wallet_id = session.wallet_id
|
|
1461
|
-
JOIN wallet_auth_methods AS auth_method
|
|
1462
|
-
ON auth_method.namespace = session.namespace
|
|
1463
|
-
AND auth_method.org_id = session.org_id
|
|
1464
|
-
AND auth_method.project_id = session.project_id
|
|
1465
|
-
AND auth_method.env_id = session.env_id
|
|
1466
|
-
AND auth_method.wallet_auth_method_id = session.wallet_auth_method_id
|
|
1467
|
-
AND auth_method.wallet_id = session.wallet_id
|
|
1468
|
-
AND auth_method.wallet_authority_id = session.authority_id
|
|
1469
|
-
WHERE session.namespace = ?
|
|
1470
|
-
AND session.org_id = ?
|
|
1471
|
-
AND session.project_id = ?
|
|
1472
|
-
AND session.env_id = ?
|
|
1473
|
-
AND session.tenant_id = ?
|
|
1474
|
-
AND session.authorization_id = ?
|
|
1475
|
-
AND session.principal_id = ?
|
|
1476
|
-
AND (? = 'quota_neutral' OR session.quota_id = ?)
|
|
1477
|
-
AND session.retired_at_ms IS NULL
|
|
1478
|
-
AND session.expires_at_ms > ?
|
|
1479
|
-
AND authority.lifecycle_state = 'active'
|
|
1480
|
-
AND authority.authority_digest_b64u = session.authority_digest_b64u
|
|
1481
|
-
AND authority.revocation_epoch = session.authority_revocation_epoch
|
|
1482
|
-
AND auth_method.status = 'active'
|
|
1483
|
-
LIMIT 1`).bind(this.namespace, ...scope, requireString(row.tenant_id, "operation.tenantId"), requireString(row.authorization_id, "operation.authorizationId"), requireString(row.principal_id, "operation.principalId"), requireString(row.quota_kind, "operation.quota.kind"), row.quota_id, requirePositiveInteger(nowMs, "operation replay time")).first() !== null;
|
|
1484
|
-
}
|
|
1485
|
-
if (sourceKind !== "verified_step_up") return false;
|
|
1486
|
-
const capabilityKind = requireString(row.capability_kind, "operation.capabilityKind");
|
|
1487
|
-
return await this.database.prepare(`SELECT 1 AS active
|
|
1488
|
-
FROM verified_wallet_operation_evidence_sets AS evidence
|
|
1489
|
-
WHERE evidence.namespace = ?
|
|
1490
|
-
AND evidence.tenant_id = ?
|
|
1491
|
-
AND evidence.evidence_set_digest = ?
|
|
1492
|
-
AND evidence.principal_id = ?
|
|
1493
|
-
AND evidence.capability_kind = ?
|
|
1494
|
-
AND evidence.operation_kind = ?
|
|
1495
|
-
AND evidence.lane_digest = ?
|
|
1496
|
-
AND evidence.intent_digest = ?
|
|
1497
|
-
AND evidence.display_digest = ?
|
|
1498
|
-
AND evidence.assurance = 'step_up'
|
|
1499
|
-
AND evidence.expires_at_ms > ?
|
|
1500
|
-
LIMIT 1`).bind(this.namespace, requireString(row.tenant_id, "operation.tenantId"), requireString(row.evidence_set_digest, "operation.evidenceSetDigest"), requireString(row.principal_id, "operation.principalId"), capabilityKind, requireString(row.operation_kind, "operation.operationKind"), requireString(row.lane_digest, "operation.laneDigest"), requireString(row.intent_digest, "operation.intentDigest"), requireString(row.display_digest, "operation.displayDigest"), requirePositiveInteger(nowMs, "operation replay time")).first() !== null;
|
|
1501
|
-
}
|
|
1502
1568
|
async completeAuthorizedOperation(input) {
|
|
1503
1569
|
const operation = input.operation;
|
|
1504
1570
|
const response = parseAuthorizedOperationReplayResponse(input.response);
|
|
@@ -1555,6 +1621,21 @@ var CloudflareD1AuthorizationStore = class {
|
|
|
1555
1621
|
LIMIT 1`).bind(this.namespace, this.walletSignerScope.orgId, this.walletSignerScope.projectId, this.walletSignerScope.envId, codeHash).first();
|
|
1556
1622
|
}
|
|
1557
1623
|
};
|
|
1624
|
+
async function parseAuthorizedOperationAdmissionRecord(row) {
|
|
1625
|
+
if (row.authorization_source_active !== 0 && row.authorization_source_active !== 1) throw new Error("Authorized operation source status must be a SQL boolean");
|
|
1626
|
+
return {
|
|
1627
|
+
row,
|
|
1628
|
+
operation: await parseAuthorizedOperationRow(row),
|
|
1629
|
+
sourceActive: row.authorization_source_active === 1,
|
|
1630
|
+
materialActive: row.material_snapshot_active === 1
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1633
|
+
function authorizedOperationMaterialScopeMatches(operation, material, snapshot) {
|
|
1634
|
+
if (snapshot && snapshot.walletId !== material?.walletId) return false;
|
|
1635
|
+
const requiresMaterial = operation.operation.operation.capabilityKind === CAPABILITY_KINDS.evmEcdsaMpcSigning;
|
|
1636
|
+
if (!material) return !requiresMaterial;
|
|
1637
|
+
return requiresMaterial && material.runtimePolicyScope.orgId === operation.tenantId && material.materialActivation.capability === operation.operation.capabilityId && material.materialActivation.material_owner === material.walletId;
|
|
1638
|
+
}
|
|
1558
1639
|
function classifyAuthorizedOperationAdmissionError(error) {
|
|
1559
1640
|
const message = error instanceof Error ? error.message : String(error);
|
|
1560
1641
|
if (message.includes("authorization_wallet_session_quota_rejected")) return { kind: "wallet_session_quota_exhausted" };
|
|
@@ -1797,9 +1878,16 @@ function parseWalletSessionAuthorizationV2WithSubjects(row, capabilitySubjects)
|
|
|
1797
1878
|
expiresAtMs: row.session_expires_at_ms
|
|
1798
1879
|
});
|
|
1799
1880
|
}
|
|
1881
|
+
/** The authority and auth method a joined session row carries, as read with it. */
|
|
1882
|
+
async function joinedAuthorityAndMethod(row) {
|
|
1883
|
+
return {
|
|
1884
|
+
authority: row.authority_id === null || row.authority_id === void 0 ? null : await parseD1WalletAuthorityRow(row),
|
|
1885
|
+
authMethod: row.auth_method_record_json === null || row.auth_method_record_json === void 0 ? null : normalizeWalletAuthMethodV2(parseD1JsonColumn(row.auth_method_record_json))
|
|
1886
|
+
};
|
|
1887
|
+
}
|
|
1800
1888
|
function parseLiveWalletSessionAuthorizationV2Row(row, input) {
|
|
1801
1889
|
if (row.session_retired_at_ms !== null && row.session_retired_at_ms !== void 0) throw new Error("Stored V2 Wallet Session authorization is retired");
|
|
1802
|
-
const session =
|
|
1890
|
+
const session = parsePersistedWalletSessionAuthorizationV2(parseD1JsonColumn(row.session_record_json));
|
|
1803
1891
|
if (!walletSessionAuthorizationV2RowMatches(row, session)) throw new Error("Stored V2 Wallet Session authorization columns disagree with record");
|
|
1804
1892
|
if (!walletSessionAuthorizationV2RecordsEqual(parseWalletSessionAuthorizationV2WithSubjects(row, parseD1JsonColumn(row.session_capability_subjects_json)), session)) throw new Error("Stored V2 Wallet Session capability subjects disagree with record");
|
|
1805
1893
|
if (row.authority_id !== String(session.authorityId) || row.authority_wallet_id !== String(session.walletId) || row.authority_lifecycle_state !== "active" || row.authority_digest_b64u !== String(session.authorityDigestB64u) || integerColumn(row.authority_revocation_epoch, "authority.revocationEpoch") !== session.authorityRevocationEpoch || row.auth_method_id !== String(session.walletAuthMethodId) || row.auth_method_wallet_id !== String(session.walletId) || row.auth_method_authority_id !== String(session.authorityId) || row.auth_method_status !== "active") throw new Error("Stored V2 Wallet Session authority provenance is no longer active");
|
|
@@ -1855,6 +1943,33 @@ function parseExactWalletSessionQuotaProjectionRow(row, session) {
|
|
|
1855
1943
|
function assertNeverDirectV2CommitMode(value) {
|
|
1856
1944
|
throw new Error(`Unsupported direct V2 Wallet Session commit mode: ${String(value)}`);
|
|
1857
1945
|
}
|
|
1946
|
+
async function parseWalletSessionAdmissionRow(row, input) {
|
|
1947
|
+
const session = parseLiveWalletSessionAuthorizationV2Row(row, {
|
|
1948
|
+
operationCredentialHash: input.tokenHash,
|
|
1949
|
+
tenantId: input.tenantId,
|
|
1950
|
+
nowMs: input.nowMs
|
|
1951
|
+
});
|
|
1952
|
+
const { authority, authMethod } = await joinedAuthorityAndMethod(row);
|
|
1953
|
+
if (row.quota_lifecycle_kind === "exhausted") return {
|
|
1954
|
+
kind: "exhausted",
|
|
1955
|
+
session,
|
|
1956
|
+
quota: parseExactWalletSessionQuotaProjectionRow(row, session),
|
|
1957
|
+
authority,
|
|
1958
|
+
authMethod
|
|
1959
|
+
};
|
|
1960
|
+
return {
|
|
1961
|
+
kind: "active",
|
|
1962
|
+
authorization: {
|
|
1963
|
+
session,
|
|
1964
|
+
quota: parseWalletSessionAuthorizationV2QuotaRow(row, session)
|
|
1965
|
+
},
|
|
1966
|
+
authority,
|
|
1967
|
+
authMethod
|
|
1968
|
+
};
|
|
1969
|
+
}
|
|
1970
|
+
function installationJsonColumn(column) {
|
|
1971
|
+
return `'${column}', installation.${column}`;
|
|
1972
|
+
}
|
|
1858
1973
|
//#endregion
|
|
1859
1974
|
export { CloudflareD1AuthorizationStore };
|
|
1860
1975
|
|