@seams/wallet-server 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +34 -2
- package/dist/esm/authorization/vaultProxyUse.js +3 -4
- package/dist/esm/cloud-host.js +16 -11
- package/dist/esm/core/EmailOtpRecords.js +19 -1
- package/dist/esm/core/EmailOtpStores.js +323 -924
- package/dist/esm/core/IdentityStore.js +44 -235
- package/dist/esm/core/NearPublicKeyStore.js +21 -63
- package/dist/esm/core/RegistrationCeremonyStore.js +3 -1793
- 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/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 +185 -290
- package/dist/esm/core/ThresholdService/validation.js +18 -230
- package/dist/esm/core/WalletAuthMethodStore.js +22 -79
- package/dist/esm/core/WalletStore.js +58 -185
- 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/emailOtpChallengeProof.js +1 -1
- package/dist/esm/core/authService/emailOtpChallenges.js +1 -1
- package/dist/esm/core/authService/emailOtpConfig.js +1 -32
- package/dist/esm/core/authService/emailOtpRegistrationEnrollment.js +6 -153
- package/dist/esm/core/authService/googleEmailOtpRegistration.js +1 -1
- package/dist/esm/core/authService/nearPrivateKeySigning.js +7 -15
- package/dist/esm/core/authService/nearTransactions.js +2 -1
- package/dist/esm/core/authService/oidcVerification.js +3 -4
- package/dist/esm/core/authService/rateLimits.js +1 -31
- 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 +4 -5
- package/dist/esm/core/authService/webauthn.js +15 -50
- package/dist/esm/core/authService/webauthnOidcHelpers.js +1 -6
- package/dist/esm/core/authService/webauthnVerificationOutcomes.js +60 -0
- package/dist/esm/core/authService/webauthnWalletBinding.js +2 -122
- package/dist/esm/core/d1IdentityStore.js +32 -66
- package/dist/esm/core/d1TenantStore.js +82 -0
- package/dist/esm/core/d1WalletAuthMethodStore.js +92 -143
- package/dist/esm/core/d1WalletStore.js +14 -12
- package/dist/esm/core/deviceLinking/linkedDeviceEmailOtpGrant.js +10 -8
- 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 +102 -0
- package/dist/esm/core/deviceLinking/linkedDeviceSessionRecord.js +668 -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 +25 -150
- 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 +5 -5
- package/dist/esm/core/signingLanes/ecdsaServerRetirement.js +3 -8
- package/dist/esm/core/signingLanes/ed25519ServerRetirement.js +1 -4
- package/dist/esm/core/storeBackends.js +208 -0
- package/dist/esm/core/thresholdEcdsaChainTarget.js +1 -7
- package/dist/esm/core/webAuthnD1Statements.js +92 -0
- package/dist/esm/core/webAuthnStoreBackends.js +198 -0
- package/dist/esm/hosted-wallet-gateway.js +33 -16
- package/dist/esm/index.js +2 -2
- package/dist/esm/local-hosted-wallet-gateway-worker.js +2 -23
- package/dist/esm/localHostedWalletGatewayHandler.js +299 -0
- package/dist/esm/localIntendedEcdsaFinalizeFault.js +85 -0
- package/dist/esm/localIntendedLinkExecuteFault.js +140 -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 +10 -2
- package/dist/esm/router/auth/walletSessionFailure.js +1 -14
- package/dist/esm/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.js +23 -0
- package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthService.js +86 -66
- package/dist/esm/router/cloudflare/d1/authorization/authorizedOperationStatements.js +208 -0
- package/dist/esm/router/cloudflare/d1/authorization/d1AuthorizationStore.js +246 -296
- package/dist/esm/router/cloudflare/d1/authorization/persistedWalletSessionAuthorization.js +14 -0
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.js +62 -63
- 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 +9 -17
- 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 +3 -3
- 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/d1EmailOtpChallengeStore.js +26 -71
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeVerifier.js +20 -3
- 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 +26 -123
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +0 -2
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.js +2 -2
- 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 +1 -1
- package/dist/esm/router/cloudflare/d1/identity/d1IdentityRecords.js +1 -28
- package/dist/esm/router/cloudflare/d1/near/d1NearPublicKeyStore.js +2 -8
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyEnvelopeStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyRouteService.js +3 -3
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.js +23 -73
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpRecords.js +15 -2
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.js +12 -203
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.js +16 -32
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +29 -72
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.js +4 -1
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationIntentService.js +3 -1
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.js +6 -30
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +261 -205
- 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 +3 -3
- package/dist/esm/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.js +43 -25
- 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 +14 -49
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnRecords.js +4 -4
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnStore.js +22 -116
- package/dist/esm/router/cloudflare/runtime/createSelfHostedCloudflareSigningWorker.js +1 -2
- package/dist/esm/router/cloudflare/runtime/walletConsoleTenantRootLineage.js +11 -2
- package/dist/esm/router/cloudflare/runtime/walletGateway.js +1 -1
- package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneCurveExecution.js +5 -6
- package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneProtocolCommitter.js +2 -1
- package/dist/esm/router/cloudflare/signingLanes/cloudflareOrdinaryInactiveSignerMaterialReservation.js +48 -21
- package/dist/esm/router/cloudflare.js +11480 -12853
- 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/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/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 +3 -2
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationRequestScopedCloudflare.js +87 -132
- 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/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 +827 -0
- package/dist/esm/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.js +698 -0
- package/dist/esm/router/domains/signingOperations/routerAbNormalSigningAdmission.js +209 -0
- package/dist/esm/router/domains/signingOperations/routerAbNormalSigningAdmissionCore.js +16 -15
- package/dist/esm/router/domains/signingOperations/routerAbOperationStepUp.js +313 -0
- package/dist/esm/router/domains/signingOperations/routerAbPrivateSigningWorker.js +62 -2159
- package/dist/esm/router/domains/tenantRoot/tenantRootIdentityResolution.js +1 -1
- 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 +97 -150
- package/dist/esm/router/express.js +5967 -6410
- package/dist/esm/router/framework/http.js +1 -4
- package/dist/esm/router/framework/ror/normalize.js +1 -1
- package/dist/esm/router/framework/routerApiRouteSurface.js +1 -1
- 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 +1 -1
- package/dist/esm/router/transport/fetch/routes/deviceLinking.js +16 -18
- package/dist/esm/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.js +3 -5
- package/dist/esm/router/transport/fetch/routes/deviceManagement.js +15 -24
- 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 +4 -4
- package/dist/esm/router/transport/fetch/routes/syncAccount.js +4 -6
- package/dist/esm/router/transport/fetch/routes/syncAccountBootstrap.js +2 -2
- package/dist/esm/router/transport/fetch/routes/thresholdEcdsa.js +69 -23
- package/dist/esm/router/transport/fetch/routes/thresholdEd25519.js +52 -27
- 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/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 +8 -9
- package/dist/esm/shared-ts/src/device-linking/delegatedActivationPlan.js +3 -1
- 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 +3 -1
- 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 +6 -9
- 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 +5 -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 +5 -12
- 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/tenantRootOperationRecord.js +1 -1
- 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/emailOtpDomain.js +2 -2
- package/dist/esm/shared-ts/src/utils/exactRecord.js +44 -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 +4 -1170
- package/dist/esm/shared-ts/src/utils/registrationSignerPlan.js +429 -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/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 +7 -11
- 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 +1 -1
- package/dist/esm/threshold/session/signingSessionSeal/crypto/shamir3PassWasm.js +1 -1
- package/dist/esm/threshold/session/signingSessionSeal/idempotencyRecords.js +1 -2
- package/dist/esm/threshold/session/signingSessionSeal/options.js +1 -1
- package/dist/esm/threshold/session/signingSessionSeal/transport/shared.js +18 -55
- package/dist/esm/threshold/statusCodes.js +1 -1
- 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/esm/wasm/router_ab_ecdsa_signing_worker/pkg/router_ab_ecdsa_signing_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 +0 -8
- 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 +2 -1
- 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 +2 -5
- package/dist/types/shared-ts/src/device-linking/contracts.d.ts +8 -11
- 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 +3 -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 +9 -18
- 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 +0 -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 +2 -51
- 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 +15 -37
- 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/threshold/ecdsaDerivationRoleLocalBootstrap.d.ts +2 -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 +2 -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 +1 -2
- package/dist/types/shared-ts/src/utils/emailOtpDomain.d.ts +5 -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/exactRecord.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 +3 -2
- package/dist/types/shared-ts/src/utils/near.d.ts +2 -1
- package/dist/types/shared-ts/src/utils/nearRpcResults.d.ts +7 -7
- package/dist/types/shared-ts/src/utils/normalize.d.ts +0 -4
- package/dist/types/shared-ts/src/utils/registrationAuthMethodInput.d.ts +184 -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 +142 -0
- package/dist/types/shared-ts/src/utils/routerAbEcdsaDerivation.d.ts +21 -92
- package/dist/types/shared-ts/src/utils/routerAbEd25519Yao.d.ts +14 -99
- package/dist/types/shared-ts/src/utils/routerAbEd25519YaoDigests.d.ts +39 -0
- 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/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 +1 -7
- package/dist/types/shared-ts/src/utils/validation.d.ts +10 -10
- package/dist/types/shared-ts/src/utils/variant.d.ts +11 -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 +104 -0
- package/dist/types/shared-ts/src/utils/walletCapabilityBindings.d.ts +3 -7
- package/dist/types/shared-ts/src/utils/webauthnDeviceInfo.d.ts +3 -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/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/wallet-server/src/authorization/capabilityPolicy.d.ts +0 -1
- package/dist/types/wallet-server/src/authorization/domain.d.ts +25 -5
- package/dist/types/wallet-server/src/authorization/ecdsaWalletSessionAdmission.d.ts +37 -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 +52 -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 +4 -8
- 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 +1 -3
- package/dist/types/wallet-server/src/core/ThresholdService/validation.d.ts +14 -47
- 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 +7 -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/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 +7 -23
- 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 +3 -2
- package/dist/types/wallet-server/src/core/authService/emailOtpUnlock.d.ts +4 -3
- 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/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 +6 -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 +259 -0
- package/dist/types/wallet-server/src/core/deviceLinking/requestProof.d.ts +2 -2
- 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 +5 -4
- package/dist/types/wallet-server/src/core/rpcClients/near/NearClient.d.ts +10 -106
- 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 +3 -9
- 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/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 +0 -1
- package/dist/types/wallet-server/src/core/types.d.ts +3 -24
- 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/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 +10 -21
- package/dist/types/wallet-server/src/router/auth/commonRouterUtils.d.ts +5 -10
- 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 -2
- 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/authorization/authorizedOperationStatements.d.ts +30 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/d1AuthorizationStore.d.ts +45 -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 +57 -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 +4 -2
- 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 +2 -2
- 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 +2 -3
- 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 +3 -4
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.d.ts +9 -8
- 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/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 +5 -8
- 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 +15 -22
- 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 +3 -5
- 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 +3 -7
- package/dist/types/wallet-server/src/router/cloudflare/d1/webauthn/d1WebAuthnStore.d.ts +8 -19
- 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 +4 -4
- 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 +5 -5
- 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 -7
- 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 +165 -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 +360 -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 +165 -0
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbPrivateSigningWorker.d.ts +16 -702
- 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 +5 -4
- 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/authServicePort.d.ts +64 -61
- package/dist/types/wallet-server/src/router/framework/http.d.ts +0 -1
- package/dist/types/wallet-server/src/router/framework/ror/normalize.d.ts +2 -2
- 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 +2 -2
- 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 +7 -13
- package/dist/types/wallet-server/src/router/transport/fetch/routes/thresholdEcdsa.d.ts +3 -57
- 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 -6
- 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/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
|
@@ -7,6 +7,7 @@ import { decodeWebAuthnBase64UrlOrBase64, parseWebAuthnAuthenticationCredential,
|
|
|
7
7
|
import { nonNegativeSafeInteger, optionalNonNegativeInteger, parseD1BoundaryWalletId, parseD1BoundaryWalletIdResult, parseJsonObject } from "../auth/d1RouterApiAuthBoundary.js";
|
|
8
8
|
import { parseWebAuthnAuthenticatorRowDeviceInfo, webAuthnSyncWalletBindingFromCredentialBinding } from "./d1WebAuthnRecords.js";
|
|
9
9
|
import { d1HostIsWithinWebAuthnRpId } from "../wallet/d1WalletAuthMethodBoundary.js";
|
|
10
|
+
import { webAuthnAuthenticationFailure, webAuthnLoginEd25519, webAuthnSyncCredentialBinding } from "../../../../core/authService/webauthnVerificationOutcomes.js";
|
|
10
11
|
//#region src/router/cloudflare/d1/webauthn/d1WebAuthnAuthService.ts
|
|
11
12
|
function errorMessage(error) {
|
|
12
13
|
return error instanceof Error ? error.message : String(error || "");
|
|
@@ -398,41 +399,20 @@ var CloudflareD1WebAuthnAuthService = class {
|
|
|
398
399
|
code: "unknown_credential",
|
|
399
400
|
message: "Credential is not active for this wallet"
|
|
400
401
|
};
|
|
401
|
-
const
|
|
402
|
+
const verificationFailure = webAuthnAuthenticationFailure(await this.verifyWebAuthnAuthenticationLite({
|
|
402
403
|
userId: challenge.userId,
|
|
403
404
|
rpId: rpId.value,
|
|
404
405
|
expectedChallenge: challenge.challengeB64u,
|
|
405
406
|
webauthn_authentication: credential,
|
|
406
407
|
expected_origin: expectedOrigin
|
|
407
|
-
});
|
|
408
|
-
if (
|
|
409
|
-
ok: false,
|
|
410
|
-
verified: false,
|
|
411
|
-
code: verification.code || "not_verified",
|
|
412
|
-
message: verification.message || "Authentication verification failed"
|
|
413
|
-
};
|
|
408
|
+
}));
|
|
409
|
+
if (verificationFailure) return verificationFailure;
|
|
414
410
|
const binding = await this.webAuthnStore.readBindingByCredential({
|
|
415
411
|
rpId: challenge.rpId,
|
|
416
412
|
credentialIdB64u: credentialId.credentialIdB64u
|
|
417
413
|
});
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
const secondParticipantId = binding?.participantIds?.[1];
|
|
421
|
-
if (!binding) return {
|
|
422
|
-
ok: false,
|
|
423
|
-
verified: false,
|
|
424
|
-
code: "unknown_credential",
|
|
425
|
-
message: "Credential has no wallet binding"
|
|
426
|
-
};
|
|
427
|
-
const ed25519 = walletBinding && binding.publicKey && binding.relayerKeyId && firstParticipantId !== void 0 && secondParticipantId !== void 0 ? {
|
|
428
|
-
kind: "active",
|
|
429
|
-
nearAccountId: walletBinding.nearAccountId,
|
|
430
|
-
nearEd25519SigningKeyId: walletBinding.nearEd25519SigningKeyId,
|
|
431
|
-
signerSlot: walletBinding.signerSlot,
|
|
432
|
-
publicKey: binding.publicKey,
|
|
433
|
-
relayerKeyId: binding.relayerKeyId,
|
|
434
|
-
participantIds: [firstParticipantId, secondParticipantId]
|
|
435
|
-
} : { kind: "absent" };
|
|
414
|
+
const loginSigner = webAuthnLoginEd25519(binding, binding ? webAuthnSyncWalletBindingFromCredentialBinding(binding) : null);
|
|
415
|
+
if (!loginSigner.ok) return loginSigner;
|
|
436
416
|
return {
|
|
437
417
|
ok: true,
|
|
438
418
|
verified: true,
|
|
@@ -441,7 +421,7 @@ var CloudflareD1WebAuthnAuthService = class {
|
|
|
441
421
|
credentialIdB64u: credentialId.credentialIdB64u,
|
|
442
422
|
walletAuthMethodId: activeMethod.walletAuthMethodId,
|
|
443
423
|
walletAuthorityId: activeMethod.walletAuthorityId,
|
|
444
|
-
ed25519
|
|
424
|
+
ed25519: loginSigner.ed25519
|
|
445
425
|
};
|
|
446
426
|
} catch (error) {
|
|
447
427
|
return {
|
|
@@ -481,22 +461,12 @@ var CloudflareD1WebAuthnAuthService = class {
|
|
|
481
461
|
code: credentialId.code,
|
|
482
462
|
message: credentialId.message
|
|
483
463
|
};
|
|
484
|
-
const
|
|
464
|
+
const syncBinding = webAuthnSyncCredentialBinding(await this.webAuthnStore.readBindingByCredential({
|
|
485
465
|
rpId: challenge.rpId,
|
|
486
466
|
credentialIdB64u: credentialId.credentialIdB64u
|
|
487
|
-
});
|
|
488
|
-
if (!
|
|
489
|
-
|
|
490
|
-
verified: false,
|
|
491
|
-
code: "unknown_credential",
|
|
492
|
-
message: "Credential is not registered on this relay"
|
|
493
|
-
};
|
|
494
|
-
if (challenge.expectedUserId && binding.userId !== challenge.expectedUserId) return {
|
|
495
|
-
ok: false,
|
|
496
|
-
verified: false,
|
|
497
|
-
code: "unknown_credential",
|
|
498
|
-
message: `Credential is not registered for account ${challenge.expectedUserId}`
|
|
499
|
-
};
|
|
467
|
+
}), challenge);
|
|
468
|
+
if (!syncBinding.ok) return syncBinding;
|
|
469
|
+
const binding = syncBinding.binding;
|
|
500
470
|
const activeMethod = await this.walletAuthMethodStore.getPasskeyV2({
|
|
501
471
|
rpId: challenge.rpId,
|
|
502
472
|
credentialIdB64u: credentialId.credentialIdB64u
|
|
@@ -521,19 +491,14 @@ var CloudflareD1WebAuthnAuthService = class {
|
|
|
521
491
|
code: "internal",
|
|
522
492
|
message: `Stored sync credential binding rpId is invalid: ${rpId.error.message}`
|
|
523
493
|
};
|
|
524
|
-
const
|
|
494
|
+
const verificationFailure = webAuthnAuthenticationFailure(await this.verifyWebAuthnAuthenticationLite({
|
|
525
495
|
userId: binding.userId,
|
|
526
496
|
rpId: rpId.value,
|
|
527
497
|
expectedChallenge: challenge.challengeB64u,
|
|
528
498
|
webauthn_authentication: credential,
|
|
529
499
|
expected_origin: expectedOrigin
|
|
530
|
-
});
|
|
531
|
-
if (
|
|
532
|
-
ok: false,
|
|
533
|
-
verified: false,
|
|
534
|
-
code: verification.code || "not_verified",
|
|
535
|
-
message: verification.message || "Authentication verification failed"
|
|
536
|
-
};
|
|
500
|
+
}));
|
|
501
|
+
if (verificationFailure) return verificationFailure;
|
|
537
502
|
const authenticator = await this.webAuthnStore.readAuthenticator({
|
|
538
503
|
userId: binding.userId,
|
|
539
504
|
credentialIdB64u: credentialId.credentialIdB64u
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { parsePasskeyEnvelopeId, parseWalletAuthMethodId, parseWalletAuthorityId, parseWalletId, parseWalletRecoveryOperationId, parseWebAuthnCredentialIdB64u, parseWebAuthnRpId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
|
-
import { parseEnvelopeRevision } from "../../../../shared-ts/src/passkey-custody/primitives.js";
|
|
4
|
-
import { parseWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
5
|
-
import { parseWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/registrationIntent.js";
|
|
6
|
-
import { parseWebAuthnAuthenticatorDeviceInfoJson } from "../../../../shared-ts/src/utils/webauthnDeviceInfo.js";
|
|
7
3
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
8
4
|
import "../../../../shared-ts/src/utils/validation.js";
|
|
5
|
+
import { parseEnvelopeRevision } from "../../../../shared-ts/src/passkey-custody/primitives.js";
|
|
9
6
|
import { normalizeRuntimePolicyScope } from "../../../../shared-ts/src/threshold/signingRootScope.js";
|
|
7
|
+
import { parseWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
8
|
+
import { parseWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
9
|
+
import { parseWebAuthnAuthenticatorDeviceInfoJson } from "../../../../shared-ts/src/utils/webauthnDeviceInfo.js";
|
|
10
10
|
import "../../../../shared-ts/src/passkey-custody/index.js";
|
|
11
11
|
import { parseRecoveryCodeReservationId } from "../../../../shared-ts/src/wallet-recovery/recoveryCodeReservation.js";
|
|
12
12
|
import { nonNegativeSafeInteger, optionalNonNegativeInteger, positiveInteger } from "../auth/d1RouterApiAuthBoundary.js";
|
|
@@ -1,83 +1,35 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
2
2
|
import "../../../../shared-ts/src/utils/validation.js";
|
|
3
|
+
import { prepareD1TenantStatement } from "../../../../core/d1TenantStore.js";
|
|
4
|
+
import { INSERT_WEBAUTHN_AUTHENTICATOR_SQL, UPSERT_WEBAUTHN_AUTHENTICATOR_SQL, webAuthnAuthenticatorRows, webAuthnChallengeRows, webAuthnCredentialBindingRows } from "../../../../core/webAuthnD1Statements.js";
|
|
3
5
|
import { prepareD1WebAuthnCredentialBindingInsertStatement } from "../../../../core/WebAuthnCredentialBindingStore.js";
|
|
4
6
|
import { parseWebAuthnAuthenticator, parseWebAuthnBinding, parseWebAuthnLoginChallengeRecord, parseWebAuthnRecoveryRegistrationChallengeRecord, parseWebAuthnSyncChallengeRecord } from "./d1WebAuthnRecords.js";
|
|
5
7
|
//#region src/router/cloudflare/d1/webauthn/d1WebAuthnStore.ts
|
|
8
|
+
function prepareAuthenticatorStatement(sql, input) {
|
|
9
|
+
return input.database.prepare(sql).bind(input.scope.namespace, input.scope.orgId, input.scope.projectId, input.scope.envId, input.userId, input.record.credentialIdB64u, input.record.credentialPublicKeyB64u, input.record.counter, input.record.createdAtMs, input.record.updatedAtMs, JSON.stringify(input.record.deviceInfo));
|
|
10
|
+
}
|
|
6
11
|
function prepareD1WebAuthnAuthenticatorPutStatement(input) {
|
|
7
|
-
return
|
|
8
|
-
namespace,
|
|
9
|
-
org_id,
|
|
10
|
-
project_id,
|
|
11
|
-
env_id,
|
|
12
|
-
user_id,
|
|
13
|
-
credential_id_b64u,
|
|
14
|
-
credential_public_key_b64u,
|
|
15
|
-
counter,
|
|
16
|
-
created_at_ms,
|
|
17
|
-
updated_at_ms,
|
|
18
|
-
device_info_json
|
|
19
|
-
)
|
|
20
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
21
|
-
ON CONFLICT (namespace, org_id, project_id, env_id, user_id, credential_id_b64u)
|
|
22
|
-
DO UPDATE SET
|
|
23
|
-
credential_public_key_b64u = EXCLUDED.credential_public_key_b64u,
|
|
24
|
-
counter = MAX(webauthn_authenticators.counter, EXCLUDED.counter),
|
|
25
|
-
created_at_ms = MIN(webauthn_authenticators.created_at_ms, EXCLUDED.created_at_ms),
|
|
26
|
-
updated_at_ms = MAX(webauthn_authenticators.updated_at_ms, EXCLUDED.updated_at_ms),
|
|
27
|
-
device_info_json = EXCLUDED.device_info_json`).bind(input.scope.namespace, input.scope.orgId, input.scope.projectId, input.scope.envId, input.userId, input.record.credentialIdB64u, input.record.credentialPublicKeyB64u, input.record.counter, input.record.createdAtMs, input.record.updatedAtMs, JSON.stringify(input.record.deviceInfo));
|
|
12
|
+
return prepareAuthenticatorStatement(UPSERT_WEBAUTHN_AUTHENTICATOR_SQL, input);
|
|
28
13
|
}
|
|
29
14
|
/** Insert-only variant used by recovery promotion. A credential collision must
|
|
30
15
|
* abort the surrounding envelope/code transaction instead of reassigning an
|
|
31
16
|
* existing authenticator's public key. */
|
|
32
17
|
function prepareD1WebAuthnAuthenticatorInsertStatement(input) {
|
|
33
|
-
return
|
|
34
|
-
namespace,
|
|
35
|
-
org_id,
|
|
36
|
-
project_id,
|
|
37
|
-
env_id,
|
|
38
|
-
user_id,
|
|
39
|
-
credential_id_b64u,
|
|
40
|
-
credential_public_key_b64u,
|
|
41
|
-
counter,
|
|
42
|
-
created_at_ms,
|
|
43
|
-
updated_at_ms,
|
|
44
|
-
device_info_json
|
|
45
|
-
)
|
|
46
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).bind(input.scope.namespace, input.scope.orgId, input.scope.projectId, input.scope.envId, input.userId, input.record.credentialIdB64u, input.record.credentialPublicKeyB64u, input.record.counter, input.record.createdAtMs, input.record.updatedAtMs, JSON.stringify(input.record.deviceInfo));
|
|
18
|
+
return prepareAuthenticatorStatement(INSERT_WEBAUTHN_AUTHENTICATOR_SQL, input);
|
|
47
19
|
}
|
|
48
20
|
var CloudflareD1WebAuthnStore = class {
|
|
49
21
|
constructor(input) {
|
|
22
|
+
this.prepare = (sql, values) => prepareD1TenantStatement(this.database, this.scope, sql, values);
|
|
50
23
|
this.database = input.database;
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
24
|
+
this.scope = {
|
|
25
|
+
namespace: input.namespace,
|
|
26
|
+
orgId: input.orgId,
|
|
27
|
+
projectId: input.projectId,
|
|
28
|
+
envId: input.envId
|
|
29
|
+
};
|
|
55
30
|
}
|
|
56
31
|
async writeChallenge(input) {
|
|
57
|
-
await this.prepare
|
|
58
|
-
namespace,
|
|
59
|
-
org_id,
|
|
60
|
-
project_id,
|
|
61
|
-
env_id,
|
|
62
|
-
challenge_id,
|
|
63
|
-
challenge_kind,
|
|
64
|
-
record_json,
|
|
65
|
-
created_at_ms,
|
|
66
|
-
expires_at_ms
|
|
67
|
-
)
|
|
68
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
69
|
-
ON CONFLICT (namespace, org_id, project_id, env_id, challenge_id)
|
|
70
|
-
DO UPDATE SET
|
|
71
|
-
challenge_kind = EXCLUDED.challenge_kind,
|
|
72
|
-
record_json = EXCLUDED.record_json,
|
|
73
|
-
created_at_ms = EXCLUDED.created_at_ms,
|
|
74
|
-
expires_at_ms = EXCLUDED.expires_at_ms`, [
|
|
75
|
-
input.challengeId,
|
|
76
|
-
input.challengeKind,
|
|
77
|
-
JSON.stringify(input.record),
|
|
78
|
-
input.createdAtMs,
|
|
79
|
-
input.expiresAtMs
|
|
80
|
-
]).run();
|
|
32
|
+
await webAuthnChallengeRows.upsert(this.prepare, input).run();
|
|
81
33
|
}
|
|
82
34
|
async consumeLoginChallenge(challengeId) {
|
|
83
35
|
return parseWebAuthnLoginChallengeRecord((await this.consumeChallenge({
|
|
@@ -120,25 +72,12 @@ var CloudflareD1WebAuthnStore = class {
|
|
|
120
72
|
]);
|
|
121
73
|
}
|
|
122
74
|
async readAuthenticator(input) {
|
|
123
|
-
return parseWebAuthnAuthenticator(await this.prepare
|
|
124
|
-
FROM webauthn_authenticators
|
|
125
|
-
WHERE namespace = ?
|
|
126
|
-
AND org_id = ?
|
|
127
|
-
AND project_id = ?
|
|
128
|
-
AND env_id = ?
|
|
129
|
-
AND user_id = ?
|
|
130
|
-
AND credential_id_b64u = ?
|
|
131
|
-
LIMIT 1`, [input.userId, input.credentialIdB64u]).first());
|
|
75
|
+
return parseWebAuthnAuthenticator(await webAuthnAuthenticatorRows.select(this.prepare, input.userId, input.credentialIdB64u).first());
|
|
132
76
|
}
|
|
133
77
|
async writeAuthenticator(input) {
|
|
134
78
|
await prepareD1WebAuthnAuthenticatorPutStatement({
|
|
135
79
|
database: this.database,
|
|
136
|
-
scope:
|
|
137
|
-
namespace: this.namespace,
|
|
138
|
-
orgId: this.orgId,
|
|
139
|
-
projectId: this.projectId,
|
|
140
|
-
envId: this.envId
|
|
141
|
-
},
|
|
80
|
+
scope: this.scope,
|
|
142
81
|
userId: input.userId,
|
|
143
82
|
record: input.record
|
|
144
83
|
}).run();
|
|
@@ -146,12 +85,7 @@ var CloudflareD1WebAuthnStore = class {
|
|
|
146
85
|
prepareAuthenticatorInsertStatement(input) {
|
|
147
86
|
return prepareD1WebAuthnAuthenticatorInsertStatement({
|
|
148
87
|
database: this.database,
|
|
149
|
-
scope:
|
|
150
|
-
namespace: this.namespace,
|
|
151
|
-
orgId: this.orgId,
|
|
152
|
-
projectId: this.projectId,
|
|
153
|
-
envId: this.envId
|
|
154
|
-
},
|
|
88
|
+
scope: this.scope,
|
|
155
89
|
userId: input.userId,
|
|
156
90
|
record: input.record
|
|
157
91
|
});
|
|
@@ -159,12 +93,7 @@ var CloudflareD1WebAuthnStore = class {
|
|
|
159
93
|
prepareCredentialBindingInsertStatement(record) {
|
|
160
94
|
return prepareD1WebAuthnCredentialBindingInsertStatement({
|
|
161
95
|
database: this.database,
|
|
162
|
-
scope:
|
|
163
|
-
namespace: this.namespace,
|
|
164
|
-
orgId: this.orgId,
|
|
165
|
-
projectId: this.projectId,
|
|
166
|
-
envId: this.envId
|
|
167
|
-
},
|
|
96
|
+
scope: this.scope,
|
|
168
97
|
record
|
|
169
98
|
});
|
|
170
99
|
}
|
|
@@ -178,18 +107,10 @@ var CloudflareD1WebAuthnStore = class {
|
|
|
178
107
|
AND env_id = ?
|
|
179
108
|
AND user_id = ?
|
|
180
109
|
AND credential_id_b64u = ?
|
|
181
|
-
AND counter < ?`).bind(input.newCounter, input.updatedAtMs, this.namespace, this.orgId, this.projectId, this.envId, input.userId, input.credentialIdB64u, input.newCounter).run();
|
|
110
|
+
AND counter < ?`).bind(input.newCounter, input.updatedAtMs, this.scope.namespace, this.scope.orgId, this.scope.projectId, this.scope.envId, input.userId, input.credentialIdB64u, input.newCounter).run();
|
|
182
111
|
}
|
|
183
112
|
async readBindingByCredential(input) {
|
|
184
|
-
return parseWebAuthnBinding(await this.prepare(
|
|
185
|
-
FROM webauthn_credential_bindings
|
|
186
|
-
WHERE namespace = ?
|
|
187
|
-
AND org_id = ?
|
|
188
|
-
AND project_id = ?
|
|
189
|
-
AND env_id = ?
|
|
190
|
-
AND rp_id = ?
|
|
191
|
-
AND credential_id_b64u = ?
|
|
192
|
-
LIMIT 1`, [input.rpId, input.credentialIdB64u]).first() || {});
|
|
113
|
+
return parseWebAuthnBinding(await webAuthnCredentialBindingRows.select(this.prepare, input.rpId, input.credentialIdB64u).first() || {});
|
|
193
114
|
}
|
|
194
115
|
/** Resolves a credential without trusting a caller-supplied relying party. */
|
|
195
116
|
async readBindingByCredentialId(credentialIdB64u) {
|
|
@@ -240,22 +161,7 @@ var CloudflareD1WebAuthnStore = class {
|
|
|
240
161
|
return bindings;
|
|
241
162
|
}
|
|
242
163
|
async consumeChallenge(input) {
|
|
243
|
-
return await this.prepare
|
|
244
|
-
WHERE namespace = ?
|
|
245
|
-
AND org_id = ?
|
|
246
|
-
AND project_id = ?
|
|
247
|
-
AND env_id = ?
|
|
248
|
-
AND challenge_id = ?
|
|
249
|
-
AND challenge_kind = ?
|
|
250
|
-
AND expires_at_ms > ?
|
|
251
|
-
RETURNING record_json`, [
|
|
252
|
-
input.challengeId,
|
|
253
|
-
input.challengeKind,
|
|
254
|
-
Date.now()
|
|
255
|
-
]).first();
|
|
256
|
-
}
|
|
257
|
-
prepare(sql, values) {
|
|
258
|
-
return this.database.prepare(sql).bind(this.namespace, this.orgId, this.projectId, this.envId, ...values);
|
|
164
|
+
return await webAuthnChallengeRows.consume(this.prepare, input.challengeId, input.challengeKind, Date.now()).first();
|
|
259
165
|
}
|
|
260
166
|
};
|
|
261
167
|
//#endregion
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "../../../shared-ts/src/utils/validation.js";
|
|
2
1
|
import { coerceRouterLogger } from "../../framework/logger.js";
|
|
3
2
|
import { json, withCors } from "../../framework/http.js";
|
|
4
3
|
import { handleThresholdEcdsa } from "../../transport/fetch/routes/thresholdEcdsa.js";
|
|
@@ -45,7 +44,7 @@ function createSelfHostedCloudflareSigningRouter(service, opts = {}) {
|
|
|
45
44
|
};
|
|
46
45
|
if (effectiveOpts.ror) validateRouterApiRorOptions(effectiveOpts.ror);
|
|
47
46
|
const logger = coerceRouterLogger(effectiveOpts.logger);
|
|
48
|
-
const handler = async (request,
|
|
47
|
+
const handler = async (request, _env, cfCtx) => {
|
|
49
48
|
if (request.method.toUpperCase() === "OPTIONS") {
|
|
50
49
|
const res = new Response(null, { status: 204 });
|
|
51
50
|
withCors(res.headers, effectiveOpts, request);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { base64UrlEncode } from "../../../shared-ts/src/utils/base64.js";
|
|
1
2
|
import { deriveSigningRootId } from "../../../shared-ts/src/threshold/signingRootScope.js";
|
|
2
|
-
import { buildTenantRootIdentityFromAuthenticatedDeploymentV1 } from "../../../shared-ts/src/tenant-root/tenantRootIdentity.js";
|
|
3
|
+
import { buildTenantRootIdentityFromAuthenticatedDeploymentV1, encodeTenantRootIdentityV1 } from "../../../shared-ts/src/tenant-root/tenantRootIdentity.js";
|
|
3
4
|
import "../../../shared-ts/src/tenant-root/index.js";
|
|
4
5
|
//#region src/router/cloudflare/runtime/walletConsoleTenantRootLineage.ts
|
|
5
6
|
async function resolveRuntimeTenantRootLineage(environments, roots, scope) {
|
|
@@ -19,7 +20,15 @@ async function resolveRuntimeTenantRootLineage(environments, roots, scope) {
|
|
|
19
20
|
signingRootVersion: scope.signingRootVersion
|
|
20
21
|
});
|
|
21
22
|
if (!identity.ok) throw new Error("Resolved tenant-root environment identity is invalid");
|
|
22
|
-
|
|
23
|
+
const lineage = await roots.resolveActiveLineage(identity.value);
|
|
24
|
+
if (!lineage) return null;
|
|
25
|
+
const digest = await crypto.subtle.digest("SHA-256", encodeTenantRootIdentityV1(identity.value));
|
|
26
|
+
if (lineage.identityDigestB64u !== base64UrlEncode(digest)) throw new Error("Active tenant-root lineage differs from the resolved Console environment");
|
|
27
|
+
return {
|
|
28
|
+
...lineage,
|
|
29
|
+
identity: identity.value,
|
|
30
|
+
projectEnvironmentId: environment.id
|
|
31
|
+
};
|
|
23
32
|
}
|
|
24
33
|
function matchesRuntimeEnvironment(scope, environment) {
|
|
25
34
|
return environment.projectId === scope.projectId && environment.key === scope.envId && environment.signingRootVersion === scope.signingRootVersion && environment.status === "ACTIVE";
|
|
@@ -140,7 +140,7 @@ function createCloudflareWalletGatewayRouterV1(input) {
|
|
|
140
140
|
apiKeyUsageMeter: consoleOps.usageMeter,
|
|
141
141
|
orgProjectEnv: consoleOps.projectEnvironments,
|
|
142
142
|
routerAbNormalSigningAdmission: createRouterAbNormalSigningAdmissionAdapter(admissionStore),
|
|
143
|
-
routeExtensions: [createWalletConsoleRelayProxyExtensionV1(input.walletConsole)]
|
|
143
|
+
routeExtensions: [createWalletConsoleRelayProxyExtensionV1(input.walletConsole), ...input.routeExtensions ?? []]
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { buildMpcMaterialActivationRef, mpcMaterialActivationRefsEqual, parseMpcSigningWorkerRef } from "../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { base64UrlDecode
|
|
3
|
-
import { parseDigestB64u } from "../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
4
|
-
import { sha256Bytes } from "../../../shared-ts/src/utils/digests.js";
|
|
2
|
+
import { base64UrlDecode } from "../../../shared-ts/src/utils/base64.js";
|
|
3
|
+
import { parseDigestB64u, sha256DigestB64u } from "../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
5
4
|
import { base58Encode } from "../../../shared-ts/src/utils/base58.js";
|
|
6
5
|
import { routerAbMpcMaterialActivationRefToWire, sameRouterAbMpcMaterialActivationRef } from "../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
7
6
|
import { parseEcdsaLifecycleId } from "../../../shared-ts/src/utils/ecdsaCapabilityActivation.js";
|
|
@@ -448,7 +447,7 @@ async function identityFromProtocolReceiptV1(job, receipt) {
|
|
|
448
447
|
holderRecipientKeyDigestB64u: job.targetHolder.hpkePublicKeyDigestB64u,
|
|
449
448
|
serverRecipientKeyDigestB64u: job.targetSigningWorker.hpkePublicKeyDigestB64u,
|
|
450
449
|
transcriptHashB64u: parseDigestB64u(receipt.transcriptHashB64u),
|
|
451
|
-
protocolCommitReceiptDigestB64u:
|
|
450
|
+
protocolCommitReceiptDigestB64u: await sha256DigestB64u(encodeLaneProtocolCommitReceiptV1(receipt))
|
|
452
451
|
};
|
|
453
452
|
}
|
|
454
453
|
async function buildEd25519ActivationBindingV1(input) {
|
|
@@ -471,7 +470,7 @@ async function buildEd25519ActivationBindingV1(input) {
|
|
|
471
470
|
holderRecipientKeyDigestB64u: input.job.targetHolder.hpkePublicKeyDigestB64u,
|
|
472
471
|
serverRecipientKeyDigestB64u: input.job.targetSigningWorker.hpkePublicKeyDigestB64u,
|
|
473
472
|
transcriptHashB64u: parseDigestB64u(receipt.transcriptHashB64u),
|
|
474
|
-
protocolCommitReceiptDigestB64u:
|
|
473
|
+
protocolCommitReceiptDigestB64u: await sha256DigestB64u(encodeLaneProtocolCommitReceiptV1(receipt))
|
|
475
474
|
},
|
|
476
475
|
targetMaterialActivation: buildMpcMaterialActivationRef({
|
|
477
476
|
activationId: input.job.targetMaterialActivationId,
|
|
@@ -513,7 +512,7 @@ async function digestSigningWorkerLaneIdentityV1(identity) {
|
|
|
513
512
|
bytes.set(chunk, offset);
|
|
514
513
|
offset += chunk.length;
|
|
515
514
|
}
|
|
516
|
-
return
|
|
515
|
+
return sha256DigestB64u(bytes);
|
|
517
516
|
}
|
|
518
517
|
function u64Length(value) {
|
|
519
518
|
let remaining = BigInt(value);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual } from "../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseLaneProtocolCommitReceiptV1
|
|
2
|
+
import { parseLaneProtocolCommitReceiptV1 } from "../../../shared-ts/src/signing-lanes/rotationParsers.js";
|
|
3
3
|
import { LaneLifecycleApplicationService } from "../../../core/signingLanes/LaneLifecycleApplicationService.js";
|
|
4
|
+
import { parseRotatableSigningLaneJobV1 } from "../../../shared-ts/src/signing-lanes/rotationProtocolParsers.js";
|
|
4
5
|
//#region src/router/cloudflare/signingLanes/cloudflareLaneProtocolCommitter.ts
|
|
5
6
|
const ROUTER_AB_ED25519_YAO_LANE_EXECUTE_PATH_V1 = "/router-ab/internal/ed25519-yao/lane/execute";
|
|
6
7
|
const INTERNAL_SERVICE_AUTH_HEADER = "x-router-ab-internal-service-auth";
|
|
@@ -2,34 +2,43 @@ import { mpcMaterialActivationRefsEqual } from "../../../shared-ts/src/utils/dom
|
|
|
2
2
|
import { base64UrlDecode, base64UrlEncode } from "../../../shared-ts/src/utils/base64.js";
|
|
3
3
|
import { routerAbMpcMaterialActivationRefFromWire, routerAbMpcMaterialActivationRefToWire } from "../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
4
4
|
import { parseLinkedDeviceEcdsaSourceContributionBindingV1, parseLinkedDeviceEcdsaSourcePreservingActivationReceiptV1 } from "../../../shared-ts/src/device-linking/sourceContribution.js";
|
|
5
|
+
import { routerAbEd25519YaoTenantRootWireV1 } from "../../domains/ed25519Yao/routerAbEd25519YaoGatewayEnvelope.js";
|
|
5
6
|
import { createOrdinaryInactiveSignerMaterialReservationServiceV1, parseOrdinaryEcdsaSignerMaterialDeactivationResultV1, parseOrdinaryEcdsaSignerMaterialWorkerReservationV1, parseOrdinaryEd25519SignerMaterialDeactivationResultV1, parseOrdinaryEd25519SignerMaterialWorkerReservationV1, validateOrdinaryInactiveSignerMaterialDeactivationRequestV1, validateOrdinaryInactiveSignerMaterialReservationRequestV1 } from "../../../core/signingMaterial/ordinaryInactiveSignerMaterialReservation.js";
|
|
6
7
|
//#region src/router/cloudflare/signingLanes/cloudflareOrdinaryInactiveSignerMaterialReservation.ts
|
|
7
8
|
/** Source-preserving ordinary material paths implemented by the Cloudflare workers. */
|
|
8
9
|
const CLOUDFLARE_ROUTER_ED25519_YAO_SOURCE_PRESERVING_EXECUTE_PATH_V1 = "/router-ab/router/ed25519-yao/execute-source-preserving";
|
|
10
|
+
/** Marks an execution the Router may already have run as its replay. */
|
|
11
|
+
const ROUTER_AB_YAO_REPLAY_HEADER_V1 = "x-seams-yao-replay";
|
|
9
12
|
const CLOUDFLARE_SIGNING_WORKER_ECDSA_RESERVE_INACTIVE_SOURCE_PRESERVING_PATH_V1 = "/router-ab/signing-worker/ecdsa-derivation/reserve-inactive-source-preserving";
|
|
10
13
|
const CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_ACTIVATE_RESERVATION_PATH_V1 = "/router-ab/signing-worker/ed25519-yao/activate-reservation";
|
|
11
14
|
const CLOUDFLARE_SIGNING_WORKER_ECDSA_ACTIVATE_RESERVATION_PATH_V1 = "/router-ab/signing-worker/ecdsa-derivation/activate-reservation";
|
|
12
15
|
const CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_DEACTIVATE_RESERVATION_PATH_V1 = "/router-ab/signing-worker/ed25519-yao/deactivate-reservation";
|
|
13
16
|
const CLOUDFLARE_SIGNING_WORKER_ECDSA_DEACTIVATE_RESERVATION_PATH_V1 = "/router-ab/signing-worker/ecdsa-derivation/deactivate-reservation";
|
|
17
|
+
function signingWorkerWalletScopeWireV1(tenant, walletId) {
|
|
18
|
+
return {
|
|
19
|
+
org_id: tenant.orgId,
|
|
20
|
+
project_id: tenant.projectId,
|
|
21
|
+
project_environment_id: tenant.envId,
|
|
22
|
+
wallet_id: walletId
|
|
23
|
+
};
|
|
24
|
+
}
|
|
14
25
|
function createCloudflareLinkedDeviceEd25519SourcePreservingRouterEndpointV1(input) {
|
|
15
26
|
return { executeEd25519SourcePreservingV1: async (request) => {
|
|
16
|
-
const
|
|
27
|
+
const tenantRootWire = await routerAbEd25519YaoTenantRootWireV1(await input.resolveTenantRoot(request));
|
|
17
28
|
return await postRouterJsonRequestV1(input, CLOUDFLARE_ROUTER_ED25519_YAO_SOURCE_PRESERVING_EXECUTE_PATH_V1, {
|
|
18
29
|
source_binding: request.sourceBinding,
|
|
19
30
|
target: {
|
|
20
|
-
tenant_root:
|
|
21
|
-
identity_digest_b64u: tenantRoot.identityDigestB64u,
|
|
22
|
-
custody_lineage_b64u: tenantRoot.custodyLineageB64u
|
|
23
|
-
},
|
|
31
|
+
tenant_root: tenantRootWire,
|
|
24
32
|
application: request.applicationBinding,
|
|
25
33
|
participant_ids: request.participantIds,
|
|
26
34
|
target: {
|
|
35
|
+
operation: "registration",
|
|
27
36
|
binding: request.targetRequest.binding,
|
|
28
37
|
deriver_a_input: request.targetRequest.deriver_a_input,
|
|
29
38
|
deriver_b_input: request.targetRequest.deriver_b_input
|
|
30
39
|
}
|
|
31
40
|
}
|
|
32
|
-
}, "Ed25519 source-preserving Router execution");
|
|
41
|
+
}, "Ed25519 source-preserving Router execution", "replay");
|
|
33
42
|
} };
|
|
34
43
|
}
|
|
35
44
|
function createCloudflareOrdinaryInactiveSignerMaterialReservationEndpointV1(input) {
|
|
@@ -38,18 +47,19 @@ function createCloudflareOrdinaryInactiveSignerMaterialReservationEndpointV1(inp
|
|
|
38
47
|
return ed25519ReservationFromSourceContributionV1(request);
|
|
39
48
|
},
|
|
40
49
|
reserveInactiveEcdsaSignerMaterialV1: async (request) => {
|
|
41
|
-
return parseEcdsaReservationResponseV1(request, await postReservationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ECDSA_RESERVE_INACTIVE_SOURCE_PRESERVING_PATH_V1, ecdsaReservationRequestToWireV1(request), "ecdsa_secp256k1"));
|
|
50
|
+
return parseEcdsaReservationResponseV1(request, await postReservationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ECDSA_RESERVE_INACTIVE_SOURCE_PRESERVING_PATH_V1, ecdsaReservationRequestToWireV1(request, input.tenant), "ecdsa_secp256k1"));
|
|
42
51
|
}
|
|
43
52
|
};
|
|
44
53
|
}
|
|
45
54
|
function createCloudflareOrdinaryInactiveSignerMaterialActivationEndpointV1(input) {
|
|
46
55
|
return {
|
|
47
|
-
activateInactiveEd25519SignerMaterialV1: async (request) => await postActivationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_ACTIVATE_RESERVATION_PATH_V1, ed25519ActivationRequestToWireV1(request), "ed25519"),
|
|
48
|
-
activateInactiveEcdsaSignerMaterialV1: async (request) => await postActivationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ECDSA_ACTIVATE_RESERVATION_PATH_V1, ecdsaActivationRequestToWireV1(request), "ecdsa_secp256k1")
|
|
56
|
+
activateInactiveEd25519SignerMaterialV1: async (request) => await postActivationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_ACTIVATE_RESERVATION_PATH_V1, ed25519ActivationRequestToWireV1(request, input.tenant), "ed25519"),
|
|
57
|
+
activateInactiveEcdsaSignerMaterialV1: async (request) => await postActivationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ECDSA_ACTIVATE_RESERVATION_PATH_V1, ecdsaActivationRequestToWireV1(request, input.tenant), "ecdsa_secp256k1")
|
|
49
58
|
};
|
|
50
59
|
}
|
|
51
|
-
function ecdsaReservationRequestToWireV1(request) {
|
|
60
|
+
function ecdsaReservationRequestToWireV1(request, tenant) {
|
|
52
61
|
return {
|
|
62
|
+
scope: signingWorkerWalletScopeWireV1(tenant, String(request.plannedActivationRef.materialOwner)),
|
|
53
63
|
source_derivation: {
|
|
54
64
|
application_binding_digest_b64u: request.preparation.sourceDerivation.applicationBindingDigestB64u,
|
|
55
65
|
client_share_retry_counter: request.preparation.sourceDerivation.clientShareRetryCounter
|
|
@@ -75,15 +85,18 @@ function ed25519ReservationFromSourceContributionV1(request) {
|
|
|
75
85
|
serverMaterialReservationId: sourceContribution.reservationId
|
|
76
86
|
};
|
|
77
87
|
}
|
|
78
|
-
function ed25519ActivationRequestToWireV1(input) {
|
|
88
|
+
function ed25519ActivationRequestToWireV1(input, tenant) {
|
|
79
89
|
return {
|
|
90
|
+
scope: signingWorkerWalletScopeWireV1(tenant, input.sourceContribution.targetBinding.lifecycle.account_id),
|
|
80
91
|
binding: input.sourceContribution.targetBinding,
|
|
81
92
|
reservation_id: input.reservationId
|
|
82
93
|
};
|
|
83
94
|
}
|
|
84
|
-
function ecdsaActivationRequestToWireV1(input) {
|
|
95
|
+
function ecdsaActivationRequestToWireV1(input, tenant) {
|
|
96
|
+
const materialActivation = input.preparation.sourceContribution.binding.target.activation;
|
|
85
97
|
return {
|
|
86
|
-
|
|
98
|
+
scope: signingWorkerWalletScopeWireV1(tenant, String(materialActivation.materialOwner)),
|
|
99
|
+
material_activation: routerAbMpcMaterialActivationRefToWire(materialActivation),
|
|
87
100
|
reservation_id: input.reservationId
|
|
88
101
|
};
|
|
89
102
|
}
|
|
@@ -216,16 +229,27 @@ async function postSigningWorkerJsonRequestV1(input, path, body, operation) {
|
|
|
216
229
|
throw new Error(`${operation} returned invalid JSON`);
|
|
217
230
|
}
|
|
218
231
|
}
|
|
219
|
-
async function postRouterJsonRequestV1(input, path, body, operation) {
|
|
220
|
-
const
|
|
232
|
+
async function postRouterJsonRequestV1(input, path, body, operation, retryAfterTransportFailure = "none") {
|
|
233
|
+
const send = async (replay) => await input.fetch(new Request(`https://mpc-router.router-ab.internal${path}`, {
|
|
221
234
|
method: "POST",
|
|
222
235
|
headers: {
|
|
223
236
|
"content-type": "application/json",
|
|
224
|
-
"x-router-ab-internal-service-auth": input.internalServiceAuthSecret
|
|
237
|
+
"x-router-ab-internal-service-auth": input.internalServiceAuthSecret,
|
|
238
|
+
...replay ? { [ROUTER_AB_YAO_REPLAY_HEADER_V1]: "1" } : {}
|
|
225
239
|
},
|
|
226
240
|
body: JSON.stringify(body)
|
|
227
241
|
}));
|
|
228
|
-
|
|
242
|
+
let response;
|
|
243
|
+
try {
|
|
244
|
+
response = await send(false);
|
|
245
|
+
} catch (error) {
|
|
246
|
+
if (retryAfterTransportFailure === "none") throw error;
|
|
247
|
+
response = await send(true);
|
|
248
|
+
}
|
|
249
|
+
if (!response.ok) {
|
|
250
|
+
const reason = (await response.text().catch(() => "")).slice(0, 300);
|
|
251
|
+
throw new Error(`${operation} failed with HTTP ${response.status}: ${reason}`);
|
|
252
|
+
}
|
|
229
253
|
try {
|
|
230
254
|
return await response.json();
|
|
231
255
|
} catch {
|
|
@@ -234,18 +258,21 @@ async function postRouterJsonRequestV1(input, path, body, operation) {
|
|
|
234
258
|
}
|
|
235
259
|
function createCloudflareOrdinaryInactiveSignerMaterialDeactivationEndpointV1(input) {
|
|
236
260
|
return {
|
|
237
|
-
deactivateInactiveEd25519SignerMaterialV1: async ({ materialActivation }) => await postDeactivationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_DEACTIVATE_RESERVATION_PATH_V1, materialActivation, "ed25519"),
|
|
238
|
-
deactivateInactiveEcdsaSignerMaterialV1: async ({ materialActivation }) => await postDeactivationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ECDSA_DEACTIVATE_RESERVATION_PATH_V1, materialActivation, "ecdsa_secp256k1")
|
|
261
|
+
deactivateInactiveEd25519SignerMaterialV1: async ({ materialActivation }) => await postDeactivationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_DEACTIVATE_RESERVATION_PATH_V1, materialActivation, "ed25519", signingWorkerWalletScopeWireV1(input.tenant, String(materialActivation.materialOwner))),
|
|
262
|
+
deactivateInactiveEcdsaSignerMaterialV1: async ({ materialActivation }) => await postDeactivationRequestV1(input, CLOUDFLARE_SIGNING_WORKER_ECDSA_DEACTIVATE_RESERVATION_PATH_V1, materialActivation, "ecdsa_secp256k1", signingWorkerWalletScopeWireV1(input.tenant, String(materialActivation.materialOwner)))
|
|
239
263
|
};
|
|
240
264
|
}
|
|
241
|
-
async function postDeactivationRequestV1(input, path, materialActivation, keyFamily) {
|
|
265
|
+
async function postDeactivationRequestV1(input, path, materialActivation, keyFamily, scope) {
|
|
242
266
|
const response = await input.fetch(new Request(`https://signing-worker.router-ab.internal${path}`, {
|
|
243
267
|
method: "POST",
|
|
244
268
|
headers: {
|
|
245
269
|
"content-type": "application/json",
|
|
246
270
|
"x-router-ab-internal-service-auth": input.internalServiceAuthSecret
|
|
247
271
|
},
|
|
248
|
-
body: JSON.stringify({
|
|
272
|
+
body: JSON.stringify({
|
|
273
|
+
scope,
|
|
274
|
+
material_activation: routerAbMpcMaterialActivationRefToWire(materialActivation)
|
|
275
|
+
})
|
|
249
276
|
}));
|
|
250
277
|
if (!response.ok) throw new Error(`ordinary ${keyFamily} material deactivation failed with HTTP ${response.status}`);
|
|
251
278
|
let raw;
|