@seams/wallet-server 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/THIRD_PARTY_NOTICES.md +7 -1
  2. package/artifact-manifest.json +196 -41
  3. package/cloudflare-router-ab/build/deriver-a/build-stamp.json +1 -1
  4. package/cloudflare-router-ab/build/deriver-a/index.js +2 -2
  5. package/cloudflare-router-ab/build/deriver-a/index_bg.wasm +0 -0
  6. package/cloudflare-router-ab/build/deriver-b/build-stamp.json +1 -1
  7. package/cloudflare-router-ab/build/deriver-b/index.js +2 -2
  8. package/cloudflare-router-ab/build/deriver-b/index_bg.wasm +0 -0
  9. package/cloudflare-router-ab/build/local-tools/darwin-arm64/router_ab_local_init +0 -0
  10. package/cloudflare-router-ab/build/local-tools/darwin-x64/router_ab_local_init +0 -0
  11. package/cloudflare-router-ab/build/local-tools/linux-x64/router_ab_local_init +0 -0
  12. package/cloudflare-router-ab/build/router/build-stamp.json +1 -1
  13. package/cloudflare-router-ab/build/router/index.js +2 -2
  14. package/cloudflare-router-ab/build/router/index_bg.wasm +0 -0
  15. package/cloudflare-router-ab/build/signing-worker/build-stamp.json +1 -1
  16. package/cloudflare-router-ab/build/signing-worker/index.js +2 -2
  17. package/cloudflare-router-ab/build/signing-worker/index_bg.wasm +0 -0
  18. package/cloudflare-router-ab/build/tenant-root-control-plane/build-stamp.json +1 -1
  19. package/cloudflare-router-ab/build/tenant-root-control-plane/index.js +2 -2
  20. package/cloudflare-router-ab/build/tenant-root-control-plane/index_bg.wasm +0 -0
  21. package/cloudflare-router-ab/migrations/deriver-a/0019_wallet_object_addresses.sql +10 -0
  22. package/cloudflare-router-ab/migrations/deriver-b/0019_wallet_object_addresses.sql +10 -0
  23. package/cloudflare-router-ab/scripts/prepare-local-runtime-config.mjs +3 -117
  24. package/cloudflare-router-ab/wrangler.deriver-a.toml +0 -8
  25. package/cloudflare-router-ab/wrangler.deriver-b.toml +24 -8
  26. package/cloudflare-router-ab/wrangler.router.toml +0 -2
  27. package/cloudflare-router-ab/wrangler.signing-worker.toml +29 -0
  28. package/dist/esm/authorization/domain.js +3 -2
  29. package/dist/esm/authorization/ed25519WalletSessionAdmission.js +0 -0
  30. package/dist/esm/authorization/service.js +64 -36
  31. package/dist/esm/cloud-host.js +24 -19
  32. package/dist/esm/core/EmailOtpRecords.js +29 -6
  33. package/dist/esm/core/ThresholdService/routerAb/ecdsaDerivationPoolFillHandlers.js +2 -0
  34. package/dist/esm/core/ThresholdService/routerAb/ecdsaDerivationPresignBridge.js +10 -0
  35. package/dist/esm/core/ThresholdService/routerAb/internalServiceHttp.js +1 -0
  36. package/dist/esm/core/ThresholdService/validation.js +2 -2
  37. package/dist/esm/core/authService/nearPrivateKeySigning.js +1 -1
  38. package/dist/esm/core/authService/webauthn.js +1 -1
  39. package/dist/esm/core/d1Ed25519SignerRead.js +55 -0
  40. package/dist/esm/core/d1WalletStore.js +14 -11
  41. package/dist/esm/core/deviceLinking/linkedDeviceEmailOtpGrant.js +2 -2
  42. package/dist/esm/core/deviceLinking/linkedDeviceManagement.js +1 -1
  43. package/dist/esm/core/deviceLinking/linkedDeviceSessionRecord.js +2 -2
  44. package/dist/esm/core/emailOtpD1Statements.js +1 -0
  45. package/dist/esm/core/nearRelayerAccountProvisioning.js +1 -1
  46. package/dist/esm/core/routerAbSigning/RouterAbEcdsaPresignRuntime.js +4 -0
  47. package/dist/esm/core/signingLanes/WalletExecutionLaneProjection.js +1 -1
  48. package/dist/esm/core/signingMaterial/ordinaryInactiveSignerMaterialReservation.js +1 -0
  49. package/dist/esm/hosted-wallet-gateway.js +93 -10
  50. package/dist/esm/localHostedWalletGatewayHandler.js +12 -9
  51. package/dist/esm/localIntendedYaoSigningFault.js +2 -30
  52. package/dist/esm/localRegistrationSetupAuthority.js +8 -1
  53. package/dist/esm/router/auth/commonRouterUtils.js +17 -10
  54. package/dist/esm/router/auth/routerApiCredentialAuth.js +26 -7
  55. package/dist/esm/router/auth/walletRegistrationContext.js +49 -0
  56. package/dist/esm/router/auth/webAuthnCredentialCodecs.js +1 -1
  57. package/dist/esm/router/cloudflare/d1/auth/d1AuthorizationAssembly.js +4 -3
  58. package/dist/esm/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.js +2 -0
  59. package/dist/esm/router/cloudflare/d1/auth/d1EmailOtpRouteService.js +25 -0
  60. package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthConfig.js +14 -6
  61. package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthService.js +44 -40
  62. package/dist/esm/router/cloudflare/d1/auth/walletSessionCredentialReaders.js +17 -1
  63. package/dist/esm/router/cloudflare/d1/authorization/authorizedOperationStatements.js +35 -5
  64. package/dist/esm/router/cloudflare/d1/authorization/d1AuthorizationStore.js +258 -99
  65. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.js +31 -4
  66. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceOwnerAuthorizationProvider.js +1 -1
  67. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceRequestProofNonceStore.js +1 -1
  68. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionRecords.js +1 -1
  69. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.js +1 -1
  70. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetPlanner.js +1 -1
  71. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceVerifiedLinkBuilder.js +1 -1
  72. package/dist/esm/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoLifecycleDecisionStore.js +11 -2
  73. package/dist/esm/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoProductRegistrationPartitionedStateStore.js +100 -10
  74. package/dist/esm/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoStateWriteFence.js +92 -0
  75. package/dist/esm/router/cloudflare/d1/ed25519Yao/d1WalletCeremonyActivity.js +77 -0
  76. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeIssuer.js +14 -8
  77. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeStore.js +14 -8
  78. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeVerifier.js +3 -1
  79. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRateLimitStore.js +58 -38
  80. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.js +27 -20
  81. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +1 -0
  82. package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.js +1 -0
  83. package/dist/esm/router/cloudflare/d1/oidc/d1OidcBoundary.js +1 -1
  84. package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.js +18 -7
  85. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.js +75 -14
  86. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +1 -1
  87. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.js +49 -29
  88. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationSessionTransaction.js +28 -0
  89. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationSetupSupport.js +11 -1
  90. package/dist/esm/router/cloudflare/d1/registration/d1WalletExecutionAuthority.js +168 -0
  91. package/dist/esm/router/cloudflare/d1/registration/d1WalletOperationStore.js +53 -0
  92. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.js +83 -42
  93. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationInitialSession.js +33 -0
  94. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationPreparation.js +16 -0
  95. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationRead.js +58 -0
  96. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +439 -500
  97. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetup.js +1 -1
  98. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetupExecution.js +104 -90
  99. package/dist/esm/router/cloudflare/d1/registration/walletRegistrationEstablishedSessionIssuer.js +78 -44
  100. package/dist/esm/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.js +11 -35
  101. package/dist/esm/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.js +98 -39
  102. package/dist/esm/router/cloudflare/d1/versionedJson/d1VersionedJsonRecordStore.js +12 -9
  103. package/dist/esm/router/cloudflare/d1/wallet/authorizationSnapshotLayout.js +168 -0
  104. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAddSignerFinalizeRecord.js +1 -1
  105. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAddSignerService.js +15 -6
  106. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodService.js +3 -40
  107. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorityStore.js +54 -1
  108. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorizationCleanup.js +157 -0
  109. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorizationFreeze.js +56 -0
  110. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorizationHistory.js +238 -0
  111. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorizationIntake.js +287 -0
  112. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorizationSnapshot.js +295 -0
  113. package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationApprovals.js +140 -0
  114. package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationChallenges.js +170 -0
  115. package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationEmailOtp.js +60 -0
  116. package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationOwner.js +33 -0
  117. package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationOwnerRequest.js +74 -0
  118. package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationPasskey.js +77 -0
  119. package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationReadAccess.js +37 -0
  120. package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationSessions.js +97 -0
  121. package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationWriteBlock.js +133 -0
  122. package/dist/esm/router/cloudflare/d1/walletObjectAddresses.js +47 -0
  123. package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnAuthService.js +1 -1
  124. package/dist/esm/router/cloudflare/runtime/routerAbServiceBindings.js +32 -1
  125. package/dist/esm/router/cloudflare/runtime/staticWalletConsoleBinding.js +20 -8
  126. package/dist/esm/router/cloudflare/runtime/walletAuthorizationRelocationRoutes.js +488 -0
  127. package/dist/esm/router/cloudflare/runtime/walletConsoleOps.js +1 -1
  128. package/dist/esm/router/cloudflare/runtime/walletConsoleOpsClient.js +26 -6
  129. package/dist/esm/router/cloudflare/runtime/walletControlOps.js +3 -0
  130. package/dist/esm/router/cloudflare/runtime/walletGateway.js +1 -1
  131. package/dist/esm/router/cloudflare/runtime/walletObjectAddresses.js +105 -0
  132. package/dist/esm/router/cloudflare/runtime/walletPlacementRoutes.js +339 -0
  133. package/dist/esm/router/cloudflare/runtime/walletRelocationDeriver.js +244 -0
  134. package/dist/esm/router/cloudflare/runtime/walletRelocationEcdsa.js +212 -0
  135. package/dist/esm/router/cloudflare/runtime/walletRelocationEd25519.js +172 -0
  136. package/dist/esm/router/cloudflare/runtime/walletRelocationOps.js +183 -0
  137. package/dist/esm/router/cloudflare/runtime/walletRelocationPresign.js +185 -0
  138. package/dist/esm/router/cloudflare/runtime/walletRelocationSource.js +221 -0
  139. package/dist/esm/router/cloudflare/signingLanes/cloudflareOrdinaryInactiveSignerMaterialReservation.js +30 -8
  140. package/dist/esm/router/cloudflare-adaptor.js +8 -8
  141. package/dist/esm/router/cloudflare.js +34115 -32240
  142. package/dist/esm/router/domains/ecdsa/routerAbEcdsaStrictRegistration.js +35 -9
  143. package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoCapabilityCommit.js +42 -0
  144. package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration.js +32 -6
  145. package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitionedStateStore.js +61 -1
  146. package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPersistence.js +70 -3
  147. package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationRequestScopedRuntime.js +59 -87
  148. package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.js +52 -22
  149. package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExportRequestScopedCloudflare.js +10 -7
  150. package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery.js +108 -78
  151. package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryRequestScopedCloudflare.js +19 -5
  152. package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryWalletSessionAuthorization.js +71 -22
  153. package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoHttpRegistrationBackend.js +37 -25
  154. package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistration.js +3 -3
  155. package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationExecutionRecord.js +2 -1
  156. package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization.js +24 -3
  157. package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationRequestScopedCloudflare.js +4 -3
  158. package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationSideEffectBoundary.js +20 -7
  159. package/dist/esm/router/domains/ed25519Yao/routerAbEd25519YaoGatewayEnvelope.js +7 -1
  160. package/dist/esm/router/domains/emailOtp/emailOtpRouteHandlers.js +2 -2
  161. package/dist/esm/router/domains/passkeyCustody/passkeyCustodyEnvelopeRetrieval.js +1 -1
  162. package/dist/esm/router/domains/passkeyCustody/registrationCustodyOutcome.js +34 -18
  163. package/dist/esm/router/domains/passkeyCustody/walletCustodyRegistrationAdmission.js +2 -2
  164. package/dist/esm/router/domains/passkeyCustody/walletCustodyRegistrationCommit.js +16 -6
  165. package/dist/esm/router/domains/signingOperations/authorizedOperationWire.js +73 -0
  166. package/dist/esm/router/domains/signingOperations/ecdsaSigningResponse.js +31 -0
  167. package/dist/esm/router/domains/signingOperations/ed25519AuthorizedOperationReceipt.js +1 -1
  168. package/dist/esm/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.js +2 -1
  169. package/dist/esm/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.js +31 -121
  170. package/dist/esm/router/domains/signingOperations/routerAbNormalSigningAdmission.js +2 -93
  171. package/dist/esm/router/domains/signingOperations/routerAbPrivateSigningWorker.js +1 -1
  172. package/dist/esm/router/domains/signingOperations/signingPrepareSession.js +33 -0
  173. package/dist/esm/router/domains/walletRegistration/registrationSessionSeal.js +121 -0
  174. package/dist/esm/router/domains/walletRegistration/walletRegistrationReservation.js +4 -4
  175. package/dist/esm/router/domains/walletRegistration/walletRegistrationRoutes.js +46 -157
  176. package/dist/esm/router/domains/walletRegistration/walletRegistrationSetupPayload.js +1 -1
  177. package/dist/esm/router/express.js +764 -894
  178. package/dist/esm/router/framework/http.js +2 -1
  179. package/dist/esm/router/transport/fetch/createFetchRouter.js +2 -2
  180. package/dist/esm/router/transport/fetch/routes/auth.js +1 -1
  181. package/dist/esm/router/transport/fetch/routes/deviceLinking.js +3 -3
  182. package/dist/esm/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.js +2 -2
  183. package/dist/esm/router/transport/fetch/routes/ed25519AuthorizedOperationRevalidation.js +65 -0
  184. package/dist/esm/router/transport/fetch/routes/normalSigningRouterProxy.js +13 -3
  185. package/dist/esm/router/transport/fetch/routes/passkeyCustody.js +3 -3
  186. package/dist/esm/router/transport/fetch/routes/sessions.js +3 -2
  187. package/dist/esm/router/transport/fetch/routes/thresholdEcdsa.js +67 -130
  188. package/dist/esm/router/transport/fetch/routes/thresholdEd25519.js +76 -212
  189. package/dist/esm/router/transport/fetch/routes/walletExecutionLanePreflight.js +18 -41
  190. package/dist/esm/router/transport/fetch/routes/walletRegistration.js +6 -5
  191. package/dist/esm/router/transport/fetch/routes/webauthnAuthenticators.js +1 -1
  192. package/dist/esm/shared-ts/src/authorization/index.js +1 -1
  193. package/dist/esm/shared-ts/src/authorization/walletAuthority.js +2 -2
  194. package/dist/esm/shared-ts/src/device-linking/activeWalletSession.js +12 -2
  195. package/dist/esm/shared-ts/src/device-linking/digests.js +1 -1
  196. package/dist/esm/shared-ts/src/device-linking/ed25519ExportRoot.js +1 -1
  197. package/dist/esm/shared-ts/src/device-linking/index.js +1 -1
  198. package/dist/esm/shared-ts/src/device-linking/parsers.js +1 -1
  199. package/dist/esm/shared-ts/src/device-linking/sourceContribution.js +1 -1
  200. package/dist/esm/shared-ts/src/device-linking/wireFields.js +1 -1
  201. package/dist/esm/shared-ts/src/near/nearClient.js +1 -1
  202. package/dist/esm/shared-ts/src/signing-lanes/ownerContinuity.js +2 -2
  203. package/dist/esm/shared-ts/src/utils/ecdsaServerTiming.js +6 -1
  204. package/dist/esm/shared-ts/src/utils/emailOtpDomain.js +4 -2
  205. package/dist/esm/shared-ts/src/utils/routerAbEcdsaDerivation.js +1 -1
  206. package/dist/esm/shared-ts/src/utils/routerAbPublicKeyset.js +0 -27
  207. package/dist/esm/shared-ts/src/wallet-recovery/walletRecoveryEcdsaPossession.js +1 -1
  208. package/dist/esm/threshold/session/signingSessionSeal/options.js +1 -1
  209. package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
  210. package/dist/types/shared-ts/src/device-linking/activeWalletSession.d.ts +2 -1
  211. package/dist/types/shared-ts/src/device-linking/contracts.d.ts +10 -0
  212. package/dist/types/shared-ts/src/threshold/ed25519OperationFingerprint.d.ts +2 -1
  213. package/dist/types/shared-ts/src/utils/emailOtpDomain.d.ts +3 -1
  214. package/dist/types/shared-ts/src/utils/routerAbPublicKeyset.d.ts +0 -9
  215. package/dist/types/shared-ts/src/utils/walletManagementProtocol.d.ts +1 -1
  216. package/dist/types/wallet-server/src/authorization/domain.d.ts +17 -1
  217. package/dist/types/wallet-server/src/authorization/ecdsaWalletSessionAdmission.d.ts +1 -0
  218. package/dist/types/wallet-server/src/authorization/ed25519WalletSessionAdmission.d.ts +35 -0
  219. package/dist/types/wallet-server/src/authorization/ed25519WalletSessionAdmission.typecheck.d.ts +2 -0
  220. package/dist/types/wallet-server/src/authorization/service.d.ts +43 -5
  221. package/dist/types/wallet-server/src/authorization/sessionRouting.d.ts +2 -0
  222. package/dist/types/wallet-server/src/cloud-host.d.ts +7 -3
  223. package/dist/types/wallet-server/src/core/EmailOtpRecords.d.ts +2 -1
  224. package/dist/types/wallet-server/src/core/EmailOtpStores.d.ts +19 -5
  225. package/dist/types/wallet-server/src/core/ThresholdService/routerAb/ecdsaDerivationPoolFillHandlers.d.ts +1 -0
  226. package/dist/types/wallet-server/src/core/ThresholdService/routerAb/ecdsaDerivationPresignBridge.d.ts +6 -0
  227. package/dist/types/wallet-server/src/core/ThresholdService/routerAb/internalServiceHttp.d.ts +1 -0
  228. package/dist/types/wallet-server/src/core/d1Ed25519SignerRead.d.ts +17 -0
  229. package/dist/types/wallet-server/src/core/d1WalletStore.d.ts +6 -0
  230. package/dist/types/wallet-server/src/core/emailOtpD1Statements.d.ts +1 -0
  231. package/dist/types/wallet-server/src/core/routerAbSigning/RouterAbEcdsaPresignRuntime.d.ts +5 -1
  232. package/dist/types/wallet-server/src/core/signingMaterial/ordinaryInactiveSignerMaterialReservation.d.ts +1 -0
  233. package/dist/types/wallet-server/src/core/threeRouteRegistrationContracts.d.ts +14 -48
  234. package/dist/types/wallet-server/src/hosted-wallet-gateway.d.ts +4 -3
  235. package/dist/types/wallet-server/src/localIntendedYaoSigningFault.d.ts +1 -16
  236. package/dist/types/wallet-server/src/localRegistrationSetupAuthority.d.ts +1 -1
  237. package/dist/types/wallet-server/src/router/auth/commonRouterUtils.d.ts +7 -1
  238. package/dist/types/wallet-server/src/router/auth/routerApiCredentialAuth.d.ts +11 -3
  239. package/dist/types/wallet-server/src/router/auth/walletRegistrationContext.d.ts +8 -0
  240. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1AuthorizationAssembly.d.ts +1 -1
  241. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1EmailOtpRouteService.d.ts +16 -0
  242. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthConfig.d.ts +7 -4
  243. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthService.d.ts +4 -1
  244. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/walletSessionCredentialReaders.d.ts +7 -1
  245. package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/d1AuthorizationStore.d.ts +32 -1
  246. package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.d.ts +2 -0
  247. package/dist/types/wallet-server/src/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoLifecycleDecisionStore.d.ts +3 -1
  248. package/dist/types/wallet-server/src/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoProductRegistrationPartitionedStateStore.d.ts +1 -0
  249. package/dist/types/wallet-server/src/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoStateWriteFence.d.ts +8 -0
  250. package/dist/types/wallet-server/src/router/cloudflare/d1/ed25519Yao/d1WalletCeremonyActivity.d.ts +15 -0
  251. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeIssuer.d.ts +6 -1
  252. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeStore.d.ts +1 -0
  253. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeVerifier.d.ts +4 -1
  254. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpCounters.typecheck.d.ts +2 -0
  255. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRateLimitStore.d.ts +6 -29
  256. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.d.ts +21 -7
  257. package/dist/types/wallet-server/src/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.d.ts +17 -1
  258. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.d.ts +32 -7
  259. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.d.ts +16 -7
  260. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationSessionTransaction.d.ts +13 -0
  261. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationSetupSupport.d.ts +7 -0
  262. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletExecutionAuthority.d.ts +41 -0
  263. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletOperationStore.d.ts +28 -0
  264. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.d.ts +6 -9
  265. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationInitialSession.d.ts +17 -0
  266. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationPreparation.d.ts +12 -0
  267. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationRead.d.ts +43 -0
  268. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationService.d.ts +24 -45
  269. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationSetupExecution.d.ts +9 -4
  270. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/walletRegistrationEstablishedSessionIssuer.d.ts +42 -14
  271. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.d.ts +5 -4
  272. package/dist/types/wallet-server/src/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.d.ts +24 -1
  273. package/dist/types/wallet-server/src/router/cloudflare/d1/versionedJson/d1VersionedJsonRecordStore.d.ts +10 -4
  274. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/authorizationSnapshotLayout.d.ts +21 -0
  275. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAddSignerService.d.ts +3 -0
  276. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthMethodService.d.ts +3 -7
  277. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthorityStore.d.ts +8 -0
  278. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthorizationCleanup.d.ts +20 -0
  279. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthorizationFreeze.d.ts +12 -0
  280. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthorizationHistory.d.ts +20 -0
  281. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthorizationIntake.d.ts +29 -0
  282. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthorizationSnapshot.d.ts +31 -0
  283. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletRelocationApprovals.d.ts +49 -0
  284. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletRelocationChallenges.d.ts +47 -0
  285. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletRelocationEmailOtp.d.ts +25 -0
  286. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletRelocationOwner.d.ts +88 -0
  287. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletRelocationOwnerRequest.d.ts +37 -0
  288. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletRelocationPasskey.d.ts +12 -0
  289. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletRelocationReadAccess.d.ts +18 -0
  290. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletRelocationSessions.d.ts +23 -0
  291. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletRelocationWriteBlock.d.ts +16 -0
  292. package/dist/types/wallet-server/src/router/cloudflare/d1/walletObjectAddresses.d.ts +14 -0
  293. package/dist/types/wallet-server/src/router/cloudflare/runtime/routerAbServiceBindings.d.ts +13 -0
  294. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletAuthorizationRelocationRoutes.d.ts +21 -0
  295. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletConsoleOps.d.ts +1 -1
  296. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletConsoleOpsClient.d.ts +3 -3
  297. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletControlOps.d.ts +2 -1
  298. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletGateway.d.ts +3 -1
  299. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletObjectAddresses.d.ts +45 -0
  300. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletPlacementRoutes.d.ts +30 -0
  301. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletRelocationDeriver.d.ts +11 -0
  302. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletRelocationEcdsa.d.ts +7 -0
  303. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletRelocationEd25519.d.ts +7 -0
  304. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletRelocationOps.d.ts +11 -0
  305. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletRelocationPresign.d.ts +7 -0
  306. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletRelocationSource.d.ts +26 -0
  307. package/dist/types/wallet-server/src/router/cloudflare/signingLanes/cloudflareOrdinaryInactiveSignerMaterialReservation.d.ts +5 -0
  308. package/dist/types/wallet-server/src/router/domains/ecdsa/routerAbEcdsaStrictRegistration.d.ts +3 -0
  309. package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoCapabilityCommit.d.ts +7 -0
  310. package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration.d.ts +41 -7
  311. package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitionedStateStore.d.ts +33 -2
  312. package/dist/types/wallet-server/src/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.d.ts +12 -6
  313. package/dist/types/wallet-server/src/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery.d.ts +17 -9
  314. package/dist/types/wallet-server/src/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryWalletSessionAuthorization.d.ts +2 -0
  315. package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoHttpRegistrationBackend.d.ts +13 -14
  316. package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistration.d.ts +7 -3
  317. package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationExecutionRecord.d.ts +1 -0
  318. package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization.d.ts +6 -1
  319. package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationSideEffectBoundary.d.ts +11 -0
  320. package/dist/types/wallet-server/src/router/domains/ed25519Yao/routerAbEd25519YaoGatewayEnvelope.d.ts +12 -3
  321. package/dist/types/wallet-server/src/router/domains/passkeyCustody/registrationCustodyOutcome.d.ts +10 -6
  322. package/dist/types/wallet-server/src/router/domains/passkeyCustody/walletCustodyRegistrationAdmission.d.ts +10 -3
  323. package/dist/types/wallet-server/src/router/domains/passkeyCustody/walletCustodyRegistrationCommit.d.ts +12 -5
  324. package/dist/types/wallet-server/src/router/domains/signingOperations/authorizedOperationWire.d.ts +97 -0
  325. package/dist/types/wallet-server/src/router/domains/signingOperations/ecdsaSigningResponse.d.ts +13 -0
  326. package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbNormalSigningAdmission.d.ts +9 -206
  327. package/dist/types/wallet-server/src/router/domains/signingOperations/signingPrepareSession.d.ts +23 -0
  328. package/dist/types/wallet-server/src/router/domains/walletRegistration/registrationSessionSeal.d.ts +36 -0
  329. package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationInputs.d.ts +7 -7
  330. package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationReservation.d.ts +80 -6
  331. package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationRoutes.d.ts +15 -5
  332. package/dist/types/wallet-server/src/router/framework/apiCredentialPorts.d.ts +24 -0
  333. package/dist/types/wallet-server/src/router/framework/authServicePort.d.ts +21 -7
  334. package/dist/types/wallet-server/src/router/framework/routerApi.d.ts +3 -12
  335. package/dist/types/wallet-server/src/router/transport/fetch/routes/ed25519AuthorizedOperationRevalidation.d.ts +37 -0
  336. package/dist/types/wallet-server/src/router/transport/fetch/routes/thresholdEcdsa.d.ts +1 -17
  337. package/dist/types/wallet-server/src/storage/tenantRoute.d.ts +1 -1
  338. package/migrations/d1-signer/0049_wallet_relocation_challenges.sql +16 -0
  339. package/migrations/d1-signer/0050_wallet_relocation_approvals.sql +14 -0
  340. package/migrations/d1-signer/0051_wallet_relocation_email_otp.sql +92 -0
  341. package/migrations/d1-signer/0052_wallet_relocation_session_fences.sql +91 -0
  342. package/migrations/d1-signer/0053_wallet_hosted_history_import.sql +164 -0
  343. package/migrations/d1-signer/0054_wallet_authorization_freeze.sql +318 -0
  344. package/migrations/d1-signer/0055_wallet_authorization_snapshot.sql +120 -0
  345. package/migrations/d1-signer/0056_wallet_authorization_history_import.sql +424 -0
  346. package/migrations/d1-signer/0057_wallet_authorization_intake.sql +44 -0
  347. package/migrations/d1-signer/0058_wallet_ceremony_activity.sql +59 -0
  348. package/migrations/d1-signer/0059_wallet_authorization_activation.sql +45 -0
  349. package/migrations/d1-signer/0060_wallet_authorization_cleanup.sql +153 -0
  350. package/migrations/d1-signer/0061_wallet_session_operation_settlement.sql +28 -0
  351. package/migrations/d1-signer/0062_wallet_step_up_operation_settlement.sql +204 -0
  352. package/migrations/d1-signer/0063_wallet_operation_history_transfer.sql +466 -0
  353. package/migrations/d1-signer/0064_wallet_execution_generations.sql +93 -0
  354. package/migrations/d1-signer/0065_wallet_operation_execution_generation.sql +37 -0
  355. package/migrations/d1-signer/0066_regional_deployment_admission.sql +59 -0
  356. package/migrations/d1-signer/0067_registration_completion_decision.sql +12 -0
  357. package/migrations/d1-signer/0068_registration_cancellation_write_fence.sql +24 -0
  358. package/migrations/d1-signer/0069_cancelled_registration_session_fence.sql +11 -0
  359. package/migrations/d1-signer/0070_wallet_passkey_relocation.sql +369 -0
  360. package/migrations/d1-signer/0071_regional_wallet_otp_counters.sql +98 -0
  361. package/migrations/d1-signer/0072_linked_device_relocation_history.sql +899 -0
  362. package/migrations/d1-signer/0073_wallet_recovery_relocation.sql +86 -0
  363. package/migrations/d1-signer/0074_email_otp_relocation.sql +158 -0
  364. package/migrations/d1-signer/0075_wallet_authorization_return.sql +107 -0
  365. package/migrations/d1-signer/0076_wallet_relocation_write_block.sql +406 -0
  366. package/migrations/d1-signer/0077_wallet_object_addresses.sql +24 -0
  367. package/package.json +1 -1
  368. package/src/README.md +23 -1
  369. package/cloudflare-router-ab/scripts/local-key-material.mjs +0 -29
@@ -9,6 +9,7 @@ export type RouterAbEcdsaOwnerWalletScope = {
9
9
  readonly walletId: string;
10
10
  };
11
11
  export type RouterAbEcdsaDerivationPoolFillBinding = {
12
+ readonly ownershipGeneration: number;
12
13
  readonly walletId: string;
13
14
  readonly relayerKeyId: string;
14
15
  readonly keyHandle: string;
@@ -6,6 +6,7 @@ export type RouterAbEcdsaDerivationPresignaturePoolFillAuth = {
6
6
  };
7
7
  export type RouterAbEcdsaPresignAuthorityV1 = {
8
8
  readonly kind: 'owner_wallet_session';
9
+ readonly ownership_generation: number;
9
10
  readonly wallet_scope: {
10
11
  readonly org_id: string;
11
12
  readonly project_id: string;
@@ -14,6 +15,7 @@ export type RouterAbEcdsaPresignAuthorityV1 = {
14
15
  };
15
16
  } | {
16
17
  readonly kind: 'operation_step_up';
18
+ readonly ownership_generation: number;
17
19
  readonly wallet_scope: {
18
20
  readonly org_id: string;
19
21
  readonly project_id: string;
@@ -91,6 +93,8 @@ export declare function stepRouterAbEcdsaPresignSession(input: {
91
93
  * uses a separate private-worker route from the owner pool-fill protocol.
92
94
  */
93
95
  export declare function startRouterAbLinkedDeviceEcdsaPresignSession(input: {
96
+ ownershipGeneration: number;
97
+ walletScope: RouterAbEcdsaPresignAuthorityV1['wallet_scope'];
94
98
  signingWorkerBaseUrl: string;
95
99
  request: Record<string, unknown>;
96
100
  materialSource: Record<string, unknown>;
@@ -100,6 +104,8 @@ export declare function startRouterAbLinkedDeviceEcdsaPresignSession(input: {
100
104
  fetchImpl: typeof fetch;
101
105
  }): Promise<RouterAbEcdsaPresignSessionHttpResult>;
102
106
  export declare function stepRouterAbLinkedDeviceEcdsaPresignSession(input: {
107
+ ownershipGeneration: number;
108
+ walletScope: RouterAbEcdsaPresignAuthorityV1['wallet_scope'];
103
109
  signingWorkerBaseUrl: string;
104
110
  request: Record<string, unknown>;
105
111
  materialSource: Record<string, unknown>;
@@ -26,6 +26,7 @@ export declare function postRouterAbInternalServiceJson(input: {
26
26
  body: unknown;
27
27
  authSecret: string;
28
28
  fetchImpl: typeof fetch;
29
+ headers?: Readonly<Record<string, string>>;
29
30
  onServerTiming?: (header: string | null) => void;
30
31
  }): Promise<RouterAbInternalServiceJsonResult>;
31
32
  export {};
@@ -0,0 +1,17 @@
1
+ import type { WalletId } from '../../../shared-ts/src/utils/domainIds';
2
+ import { type RouterAbMpcMaterialActivationRefWire } from '../../../shared-ts/src/utils/routerAbNormalSigningIdentity';
3
+ import type { WalletEd25519SignerRecord } from './WalletStore';
4
+ import { type RouterAbEd25519YaoActiveCapabilityLookupV1 } from '../router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery';
5
+ /** Signer rows read with a Wallet Session; a failure surfaces after session validation. */
6
+ export declare class Ed25519SignerRead {
7
+ #private;
8
+ private readonly walletId;
9
+ private readonly activation;
10
+ private readonly capabilities;
11
+ private constructor();
12
+ static fromRows(walletId: WalletId, activation: RouterAbMpcMaterialActivationRefWire, rows: unknown, capabilityPartition: unknown): Ed25519SignerRead;
13
+ resolveActiveCapability(input: RouterAbEd25519YaoActiveCapabilityLookupV1): import("../router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery").RouterAbEd25519YaoActiveCapabilityLookupResultV1 | null;
14
+ /** The session wallet's signer for the activation this read selected, or null. */
15
+ resolve(walletId: WalletId, activation: RouterAbMpcMaterialActivationRefWire): WalletEd25519SignerRecord | null;
16
+ }
17
+ //# sourceMappingURL=d1Ed25519SignerRead.d.ts.map
@@ -28,6 +28,12 @@ export type D1WalletStoreScope = {
28
28
  };
29
29
  export declare const WALLET_STORE_D1_SCHEMA_SQL: readonly ["\n CREATE TABLE IF NOT EXISTS wallets (\n namespace TEXT NOT NULL,\n org_id TEXT NOT NULL,\n project_id TEXT NOT NULL,\n env_id TEXT NOT NULL,\n wallet_id TEXT NOT NULL,\n record_json TEXT NOT NULL,\n created_at_ms INTEGER NOT NULL,\n updated_at_ms INTEGER NOT NULL,\n PRIMARY KEY (namespace, org_id, project_id, env_id, wallet_id),\n CHECK (length(wallet_id) > 0),\n CHECK (json_valid(record_json)),\n CHECK (created_at_ms >= 0),\n CHECK (updated_at_ms >= created_at_ms),\n CHECK (COALESCE(json_extract(record_json, '$.version') = 'wallet_v1', 0)),\n CHECK (COALESCE(json_extract(record_json, '$.walletId') = wallet_id, 0))\n )\n ", "\n CREATE TABLE IF NOT EXISTS wallet_signers (\n namespace TEXT NOT NULL,\n org_id TEXT NOT NULL,\n project_id TEXT NOT NULL,\n env_id TEXT NOT NULL,\n wallet_id TEXT NOT NULL,\n signer_family TEXT NOT NULL,\n signer_id TEXT NOT NULL,\n chain_target_key TEXT,\n record_json TEXT NOT NULL,\n created_at_ms INTEGER NOT NULL,\n updated_at_ms INTEGER NOT NULL,\n PRIMARY KEY (\n namespace,\n org_id,\n project_id,\n env_id,\n wallet_id,\n signer_family,\n signer_id\n ),\n CHECK (length(wallet_id) > 0),\n CHECK (signer_family IN ('ed25519', 'ecdsa')),\n CHECK (length(signer_id) > 0),\n CHECK (json_valid(record_json)),\n CHECK (created_at_ms >= 0),\n CHECK (updated_at_ms >= created_at_ms),\n CHECK (COALESCE(json_extract(record_json, '$.walletId') = wallet_id, 0)),\n CHECK (COALESCE(json_extract(record_json, '$.signerId') = signer_id, 0)),\n CHECK (\n (\n signer_family = 'ed25519'\n AND chain_target_key IS NULL\n AND substr(signer_id, 1, 8) = 'ed25519:'\n AND COALESCE(\n json_extract(record_json, '$.version') = 'wallet_signer_ed25519_v1',\n 0\n )\n )\n OR\n (\n signer_family = 'ecdsa'\n AND chain_target_key IS NOT NULL\n AND length(chain_target_key) > 0\n AND signer_id = 'ecdsa:' || chain_target_key\n AND COALESCE(\n json_extract(record_json, '$.version') = 'wallet_signer_ecdsa_v1',\n 0\n )\n AND COALESCE(json_extract(record_json, '$.chainTargetKey') = chain_target_key, 0)\n )\n )\n )\n ", "\n CREATE INDEX IF NOT EXISTS wallet_signers_wallet_idx\n ON wallet_signers (namespace, org_id, project_id, env_id, wallet_id, signer_family)\n ", "\n CREATE INDEX IF NOT EXISTS wallet_signers_chain_target_idx\n ON wallet_signers (\n namespace,\n org_id,\n project_id,\n env_id,\n signer_family,\n chain_target_key\n )\n ", "\n CREATE TABLE IF NOT EXISTS wallet_ecdsa_pending_session_activations (\n namespace TEXT NOT NULL,\n org_id TEXT NOT NULL,\n project_id TEXT NOT NULL,\n env_id TEXT NOT NULL,\n wallet_id TEXT NOT NULL,\n lifecycle_id TEXT NOT NULL,\n request_id TEXT NOT NULL,\n record_json TEXT NOT NULL,\n expires_at_ms INTEGER NOT NULL,\n PRIMARY KEY (\n namespace,\n org_id,\n project_id,\n env_id,\n wallet_id,\n lifecycle_id,\n request_id\n ),\n CHECK (json_valid(record_json)),\n CHECK (expires_at_ms > 0)\n )\n "];
30
30
  export declare function ensureWalletStoreD1Schema(options: D1WalletStoreSchemaOptions): Promise<void>;
31
+ /** Where an Ed25519 signer row names the material activation it serves. */
32
+ export declare const ED25519_SIGNER_ACTIVATION_ID_PATH = "$.activeYaoCapability.admissionRequest.scope.material_activation.activation_id";
33
+ /** The wallet's signer for one material activation, among the rows that name its id. */
34
+ export declare function selectWalletEd25519Signer(rows: readonly {
35
+ readonly record_json?: unknown;
36
+ }[], walletId: string, materialActivation: RouterAbMpcMaterialActivationRefWire): WalletEd25519SignerRecord | null;
31
37
  export declare function parseWalletEd25519SignerRecord(raw: unknown): WalletEd25519SignerRecord | null;
32
38
  export declare function prepareD1WalletPutSubjectStatement(input: {
33
39
  readonly database: D1DatabaseLike;
@@ -5,6 +5,7 @@ export type ScopedD1Prepare = (sql: string, values: readonly unknown[]) => D1Pre
5
5
  /** Statements on `email_otp_challenges`. */
6
6
  export declare const emailOtpChallengeRows: {
7
7
  insert: (prepare: ScopedD1Prepare, record: EmailOtpChallengeRecord) => D1PreparedStatementLike;
8
+ insertIfAbsent: (prepare: ScopedD1Prepare, record: EmailOtpChallengeRecord) => D1PreparedStatementLike;
8
9
  delete: (prepare: ScopedD1Prepare, challengeId: string) => D1PreparedStatementLike;
9
10
  };
10
11
  /** Statements on `email_otp_grants`. */
@@ -1,5 +1,5 @@
1
1
  import { RouterAbEcdsaDerivationPoolFillHandlers } from '../ThresholdService/routerAb/ecdsaDerivationPoolFillHandlers';
2
- import { type RouterAbLinkedDeviceEcdsaExportShareHttpResult, type RouterAbEcdsaPresignSessionHttpResult } from '../ThresholdService/routerAb/ecdsaDerivationPresignBridge';
2
+ import { type RouterAbLinkedDeviceEcdsaExportShareHttpResult, type RouterAbEcdsaPresignSessionHttpResult, type RouterAbEcdsaPresignAuthorityV1 } from '../ThresholdService/routerAb/ecdsaDerivationPresignBridge';
3
3
  import type { RouterAbEcdsaSigningWorkerExportShareBindingV1 } from '../../../../shared-ts/src/utils/routerAbEcdsaDerivation';
4
4
  import type { RouterAbConfiguredSigningWorkerPrivateTransport } from './RouterAbNormalSigningRuntime';
5
5
  export type RouterAbEcdsaPresignRuntimeConfig = {
@@ -28,12 +28,16 @@ export declare class RouterAbEcdsaPresignRuntime {
28
28
  initializePoolFill(input: RouterAbEcdsaPresignInitInput): Promise<RouterAbEcdsaPresignInitResult>;
29
29
  advancePoolFill(input: RouterAbEcdsaPresignStepInput): Promise<RouterAbEcdsaPresignStepResult>;
30
30
  initializeLinkedDevicePresign(input: {
31
+ readonly ownershipGeneration: number;
32
+ readonly walletScope: RouterAbEcdsaPresignAuthorityV1['wallet_scope'];
31
33
  readonly request: Record<string, unknown>;
32
34
  readonly materialSource: Record<string, unknown>;
33
35
  readonly presignSessionId: string;
34
36
  readonly expiresAtMs: number;
35
37
  }): Promise<RouterAbEcdsaPresignSessionHttpResult>;
36
38
  advanceLinkedDevicePresign(input: {
39
+ readonly ownershipGeneration: number;
40
+ readonly walletScope: RouterAbEcdsaPresignAuthorityV1['wallet_scope'];
37
41
  readonly request: Record<string, unknown>;
38
42
  readonly materialSource: Record<string, unknown>;
39
43
  readonly presignSessionId: string;
@@ -76,6 +76,7 @@ export type OrdinaryEd25519SignerMaterialReservationRequestV1 = OrdinarySignerMa
76
76
  export type OrdinaryEcdsaSignerMaterialReservationRequestV1 = OrdinarySignerMaterialReservationRequestV1<'ecdsa_secp256k1'>;
77
77
  export type OrdinaryInactiveSignerMaterialReservationRequestV1 = OrdinaryEd25519SignerMaterialReservationRequestV1 | OrdinaryEcdsaSignerMaterialReservationRequestV1;
78
78
  type OrdinarySignerMaterialReservationRequestV1<F extends OrdinarySignerFamilyV1> = {
79
+ readonly ownershipGeneration: number;
79
80
  readonly kind: OrdinaryRequestKindByFamilyV1[F];
80
81
  readonly keyFamily: F;
81
82
  readonly signer: OrdinarySignerByFamilyV1[F];
@@ -1,3 +1,4 @@
1
+ import type { WalletSessionHome } from '../../../shared-ts/src/device-linking/contracts';
1
2
  import type { ActiveWalletAuthMethodRecordV2 } from '../../../shared-ts/src/utils/walletAuthMethodRecord';
2
3
  import type { WalletRegistrationEcdsaPreparePayload, WalletRegistrationFinalizeSuccess, WalletRegistrationStartRequest, WalletRegistrationStartResponse, WalletRegistrationEcdsaActivationResponse, WalletRegistrationEcdsaWalletKey, WalletRegistrationEd25519YaoPublicResult, WalletRegistrationRouteDiagnostics } from './registrationContracts';
3
4
  import type { WalletRegistrationFinalizeAuthMethod } from '../../../shared-ts/src/utils/registrationContracts';
@@ -10,6 +11,7 @@ import type { RegistrationAuthority } from '../../../shared-ts/src/utils/registr
10
11
  import type { WalletAuthAuthority } from '../../../shared-ts/src/utils/walletAuthAuthority';
11
12
  import type { WalletCustodyRegistrationOutcome } from '../../../shared-ts/src/passkey-custody';
12
13
  import type { DigestB64u } from '../../../shared-ts/src/utils/canonicalPrimitives';
14
+ import type { RouterAbEd25519YaoActivationAdmissionReceiptV1 } from '../../../shared-ts/src/utils/routerAbEd25519Yao';
13
15
  import type { ThresholdEd25519AuthorityScope, EcdsaDerivationServerBootstrapResponse } from './types';
14
16
  import type { StoredWalletRegistrationNearEd25519YaoAuthorizedBranch, StoredWalletRegistrationPreparedContext } from './RegistrationCeremonyStore';
15
17
  /**
@@ -100,14 +102,7 @@ export type WalletRegistrationSessionCommitReceiptV2 = {
100
102
  readonly kind: 'error';
101
103
  readonly error: WalletRegistrationRouteErrorV2;
102
104
  };
103
- } | (WalletRegistrationSessionCommitReceiptMetadataV2 & {
104
- readonly committed: {
105
- readonly kind: 'near_pending';
106
- readonly nearProvisioning: {
107
- readonly status: 'near_pending';
108
- };
109
- };
110
- }) | (WalletRegistrationSessionCommitReadyBaseV2 & {
105
+ } | (WalletRegistrationSessionCommitReadyBaseV2 & {
111
106
  readonly committed: WalletRegistrationEcdsaReadyCommitV2;
112
107
  }) | (WalletRegistrationSessionCommitReadyBaseV2 & {
113
108
  readonly committed: {
@@ -158,6 +153,7 @@ export type WalletRegistrationRouteErrorV2 = {
158
153
  * both methods.
159
154
  */
160
155
  type WalletRegistrationSetupSuccessBase = {
156
+ readonly home: WalletSessionHome;
161
157
  ok: true;
162
158
  registrationCeremonyId: string;
163
159
  walletId: string;
@@ -192,9 +188,9 @@ export type WalletRegistrationSetupResponseV2 = (WalletRegistrationSetupSuccessB
192
188
  * `ed25519` field: a mixed plan always carries its deferred NEAR work, and an
193
189
  * ECDSA-only plan has no arm to omit.
194
190
  *
195
- * The NEAR work is deferred, not pending-in-progress. The client starts it
196
- * asynchronously and must not await it: the wallet is usable on ECDSA alone,
197
- * and blocking registration on Yao is the coupling this refactor removes.
191
+ * Mixed wallets defer NEAR work because their ECDSA signer is already usable.
192
+ * NEAR-only wallets receive an admitted Yao session and complete it before
193
+ * finalization.
198
194
  */
199
195
  type WalletRegistrationRespondSignerPlanV2 = {
200
196
  kind: 'evm_family_ecdsa';
@@ -206,19 +202,14 @@ type WalletRegistrationRespondSignerPlanV2 = {
206
202
  /** Authority-bound admission, derived here because the proof now exists. */
207
203
  ed25519: RespondEd25519DeferredWorkV2;
208
204
  } | {
209
- /**
210
- * Ed25519-only: no ECDSA leg ran, so there is no proof bundle — `ecdsa`
211
- * is `never`, not an empty object.
212
- *
213
- * The admission is deferred, exactly as on a mixed plan. Yao being the
214
- * wallet's sole signer is not a reason to block on it: the client starts
215
- * the computation and calls activate without awaiting it, and the wallet
216
- * exists in `near_pending` until Yao produces its signer. There is
217
- * deliberately no second, blocking Yao lifecycle.
218
- */
205
+ /** The client completes Yao and recovery backup before committing this wallet. */
219
206
  kind: 'near_ed25519';
220
207
  ecdsa?: never;
221
- ed25519: RespondEd25519DeferredWorkV2;
208
+ ed25519: {
209
+ readonly status: 'admitted';
210
+ readonly admissionRequest: RespondEd25519DeferredWorkV2['admissionRequest'];
211
+ readonly admissionReceipt: RouterAbEd25519YaoActivationAdmissionReceiptV1<'registration'>;
212
+ };
222
213
  };
223
214
  /** Exact A/B role bundles, unchanged from the derivation respond leg. */
224
215
  type RespondEcdsaProofBundles = {
@@ -253,32 +244,7 @@ type ActivateEcdsaTerminalPayload = EcdsaFinalizeSuccess['ecdsa'] & {
253
244
  activation: EcdsaActivationSuccess['ecdsa']['activation'];
254
245
  bootstrap: EcdsaActivationSuccess['ecdsa']['bootstrap'];
255
246
  };
256
- type Ed25519FinalizeSuccess = Extract<WalletRegistrationFinalizeSuccess, {
257
- kind: 'near_ed25519';
258
- }>;
259
247
  type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never;
260
- /**
261
- * Activate's Ed25519-only terminal result: a wallet that exists and cannot
262
- * yet sign.
263
- *
264
- * Activate does not wait for Yao. It persists the wallet, profile, and
265
- * authentication state plus the `near_pending` provisioning record, and that
266
- * pending response is the committed terminal projection, and a retry
267
- * reconstructs that projection from the receipt. Every field that only
268
- * completed Yao can produce is `never`, so a caller cannot read a signer, a
269
- * resolved account, or a key identity that does not exist yet. The wallet
270
- * becomes signable when deferred Yao reaches `near_ready`.
271
- */
272
- export type WalletRegistrationActivateEd25519PendingV2 = DistributiveOmit<Ed25519FinalizeSuccess, 'ed25519' | 'resolvedAccount' | 'accountProvisioning' | 'authorityScope' | 'foundingAuthority' | 'foundingAuthMethod' | 'custodyKeyManifestDigestB64u'> & {
273
- nearProvisioning: {
274
- status: 'near_pending';
275
- };
276
- ed25519?: never;
277
- resolvedAccount?: never;
278
- accountProvisioning?: never;
279
- authorityScope?: never;
280
- ecdsa?: never;
281
- };
282
248
  export type WalletRegistrationActivateResponseV2 = (DistributiveOmit<EcdsaFinalizeSuccess, 'ecdsa'> & {
283
249
  ecdsa: ActivateEcdsaTerminalPayload;
284
250
  registrationEstablishedSession: RegistrationEstablishedSessionResultV2;
@@ -286,7 +252,7 @@ export type WalletRegistrationActivateResponseV2 = (DistributiveOmit<EcdsaFinali
286
252
  nearProvisioning?: {
287
253
  status: 'near_pending';
288
254
  };
289
- }) | WalletRegistrationActivateEd25519PendingV2 | WalletRegistrationRouteErrorV2;
255
+ }) | WalletRegistrationRouteErrorV2;
290
256
  type ActivateSuccessV2 = Exclude<WalletRegistrationActivateResponseV2, WalletRegistrationRouteErrorV2>;
291
257
  export type WalletRegistrationActivateRouteResponseV2 = ActivateSuccessV2 | WalletRegistrationRouteErrorV2;
292
258
  type WalletRegistrationNearProvisioningFinalizeSuccessV2 = Extract<WalletRegistrationFinalizeSuccess, {
@@ -1,3 +1,4 @@
1
+ import type { WalletRegistrationContextResolver } from './router/framework/apiCredentialPorts';
1
2
  import type { WalletLifecycleRoutingPublisher } from './authorization/lifecycleRouting';
2
3
  import { type D1DatabaseLike } from './cloud-host';
3
4
  import { type WalletConsoleServiceBinding } from './cloud-host';
@@ -78,8 +79,8 @@ export interface CloudflareD1GatewayEnv extends CloudflareD1GatewayBaseEnv {
78
79
  readonly WALLET_CONSOLE: WalletConsoleServiceBinding;
79
80
  }
80
81
  export interface HostedWalletGatewayDependenciesV1 {
82
+ readonly registrationContext?: WalletRegistrationContextResolver;
81
83
  readonly identityStore?: CloudflareD1RouterApiAuthServiceOptions['identityStore'];
82
- readonly emailOtpRateLimitCounter?: CloudflareD1RouterApiAuthServiceOptions['emailOtpRateLimitCounter'];
83
84
  readonly googleRegistrationAttempts?: CloudflareD1RouterApiAuthServiceOptions['googleRegistrationAttempts'];
84
85
  readonly sessionRouting?: CloudflareD1RouterApiAuthServiceOptions['sessionRouting'];
85
86
  readonly lifecycleRouting?: WalletLifecycleRoutingPublisher;
@@ -102,12 +103,12 @@ export declare function createStagingEd25519YaoBackend(env: CloudflareD1GatewayB
102
103
  * stay on the Wallet Console deployment until policy/sponsorship resolution
103
104
  * operations join the binding.
104
105
  */
105
- export declare function createHostedWalletGatewayCompositionV1(env: CloudflareD1GatewayEnv, dependencies?: HostedWalletGatewayDependenciesV1): Promise<{
106
+ export declare function createHostedWalletGatewayCompositionV1(env: CloudflareD1GatewayEnv, dependencies?: HostedWalletGatewayDependenciesV1, background?: CfExecutionContext | null): Promise<{
106
107
  handler: FetchHandler;
107
108
  service: import("./cloud-host").CloudflareD1RouterApiAuthService;
108
109
  session: import("./cloud-host").SessionAdapter;
109
110
  }>;
110
- export declare function createSplitGatewayRouterHandler(env: CloudflareD1GatewayEnv, dependencies?: HostedWalletGatewayDependenciesV1): Promise<FetchHandler>;
111
+ export declare function createSplitGatewayRouterHandler(env: CloudflareD1GatewayEnv, dependencies?: HostedWalletGatewayDependenciesV1, background?: CfExecutionContext | null): Promise<FetchHandler>;
111
112
  export declare function handleSplitGatewayWalletRuntimeRequest(request: Request, env: CloudflareD1GatewayEnv & WalletControlRuntimeBindings, dependencies?: HostedWalletGatewayDependenciesV1): Promise<Response | null>;
112
113
  export declare function readWalletRuntimeIdentities(env: CloudflareD1GatewayEnv, input: WalletRuntimeWalletIdentityRequest): Promise<WalletRuntimeWalletIdentitiesResult>;
113
114
  export declare function handleSplitGatewayRequest(request: Request, env: CloudflareD1GatewayEnv, ctx: CfExecutionContext, dependencies?: HostedWalletGatewayDependenciesV1): Promise<Response>;
@@ -11,15 +11,8 @@ export declare const ROUTER_AB_ED25519_SIGNING_FINALIZE_PATH_V1 = "/router-ab/ed
11
11
  * authorized but not yet made. The Gateway's answer is a refusal.
12
12
  * - `release_signing_finalize` sends a kept finalize to the Router again,
13
13
  * exactly, and answers with the Router's reply.
14
- * - `arm_signing_worker_hold` asks the SigningWorker to hold the next NEAR
15
- * finalize of the wallet the body names after it signs and before it
16
- * commits, until its activation is retired: a finalize that loaded its
17
- * material just before a recovery promoted. Dev builds of the Workers D1
18
- * SigningWorker only; the wallet object and the VM SigningWorker sign and
19
- * commit in one step.
20
- * - `read_signing_worker_hold` reads that hold's state.
21
14
  */
22
- type LocalIntendedYaoSigningFaultModeV1 = 'capture_signing_finalize' | 'withhold_signing_finalize' | 'release_signing_finalize' | 'arm_signing_worker_hold' | 'read_signing_worker_hold';
15
+ type LocalIntendedYaoSigningFaultModeV1 = 'capture_signing_finalize' | 'withhold_signing_finalize' | 'release_signing_finalize';
23
16
  export declare function parseLocalIntendedYaoSigningFaultModeV1(value: string | null): LocalIntendedYaoSigningFaultModeV1 | null;
24
17
  export declare function parseLocalIntendedYaoSigningFaultTokenV1(value: string | null): string | null;
25
18
  /** The Gateway's Router binding, keeping the first NEAR finalize it carries. */
@@ -37,14 +30,6 @@ export declare class LocalIntendedYaoSigningFaultControllerV1 {
37
30
  export declare function releaseLocalIntendedYaoSigningFinalizeV1(router: {
38
31
  fetch(request: Request): Promise<Response>;
39
32
  }, token: string): Promise<Response>;
40
- /**
41
- * Arms or reads the SigningWorker's hold on one wallet's next NEAR finalize,
42
- * with the Gateway's own SigningWorker credential, and answers with the
43
- * SigningWorker's reply.
44
- */
45
- export declare function commandLocalIntendedSigningWorkerHoldV1(signingWorker: {
46
- fetch(request: Request): Promise<Response>;
47
- }, credential: string | undefined, mode: 'arm_signing_worker_hold' | 'read_signing_worker_hold', body: unknown): Promise<Response>;
48
33
  export declare function requestWithoutLocalIntendedYaoSigningFaultHeadersV1(request: Request): Request;
49
34
  export declare function responseWithLocalIntendedYaoSigningFaultOutcomeV1(response: Response, outcome: string): Response;
50
35
  export {};
@@ -8,6 +8,6 @@ export declare class LocalRegistrationSetupAuthority implements WalletRegistrati
8
8
  constructor(database: D1DatabaseLike, scope: D1TenantScope);
9
9
  reserve(input: WalletRegistrationSetupInput): Promise<WalletRegistrationSetupReservationResult>;
10
10
  admitHome(input: Parameters<WalletRegistrationReservationAuthority['admitHome']>[0]): Promise<Awaited<ReturnType<WalletRegistrationReservationAuthority['admitHome']>>>;
11
- complete(input: Parameters<WalletRegistrationReservationAuthority['complete']>[0]): Promise<Awaited<ReturnType<WalletRegistrationReservationAuthority['admitHome']>>>;
11
+ complete(input: Parameters<WalletRegistrationReservationAuthority['complete']>[0]): Promise<Awaited<ReturnType<WalletRegistrationReservationAuthority['complete']>>>;
12
12
  }
13
13
  //# sourceMappingURL=localRegistrationSetupAuthority.d.ts.map
@@ -1,5 +1,6 @@
1
- import type { D1EcdsaAdmissionPolicyRead } from '../cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore';
1
+ import type { D1EcdsaAdmissionPolicyRead, D1Ed25519AdmissionPolicyRead } from '../cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore';
2
2
  import type { EcdsaMaterialRead } from '../../core/d1EcdsaSignerRead';
3
+ import type { Ed25519SignerRead } from '../../core/d1Ed25519SignerRead';
3
4
  import type { ThresholdRuntimePolicyScope } from '../../core/types';
4
5
  import type { RouterApiAuthorizationSessionService } from '../framework/authServicePort';
5
6
  import type { RouterApiWalletSessionAuthorizationV2AdmissionContext, RouterApiWalletSessionExactOperationContext, RouterApiWalletSessionAuthorizationV2ExhaustedCandidateContext } from '../framework/authServicePort';
@@ -84,6 +85,9 @@ export type ThresholdEd25519SessionInputs = {
84
85
  readonly curve: 'ed25519';
85
86
  }>;
86
87
  readonly context: RouterApiWalletSessionAuthorizationV2AdmissionContext;
88
+ /** The session wallet's signer and policy rows, read in the session's statement. */
89
+ readonly signerRead: Ed25519SignerRead;
90
+ readonly policyRead: D1Ed25519AdmissionPolicyRead;
87
91
  } | AuthorizeErr;
88
92
  export declare function validateRouterAbEd25519WalletSessionInputs(input: {
89
93
  headers: Record<string, string | string[] | undefined>;
@@ -92,6 +96,8 @@ export declare function validateRouterAbEd25519WalletSessionInputs(input: {
92
96
  operationKind: Extract<WalletSessionAuthorizationV2RequestedOperation, {
93
97
  readonly keyFamily: 'ed25519';
94
98
  }>['operationKind'];
99
+ /** The material the request names; the session must admit exactly this activation. */
100
+ materialActivation: import('../../../../shared-ts/src/utils/routerAbNormalSigningIdentity').RouterAbMpcMaterialActivationRefWire;
95
101
  }): Promise<ThresholdEd25519SessionInputs>;
96
102
  export type ThresholdEcdsaSessionInputs = {
97
103
  readonly ok: true;
@@ -1,18 +1,21 @@
1
- import { type RoutePolicyResolutionResult } from '../framework/enforceRoutePolicy';
1
+ import { type RoutePolicyResolutionResult, type RoutePolicyResolutionFailure } from '../framework/enforceRoutePolicy';
2
2
  import type { RouterApiKeyAuthAdapter, RouterApiPublishableKeyAuthAdapter } from '../framework/routerApi';
3
+ import type { RouterApiKeyPrincipal, WalletRegistrationContextResolver, WalletRegistrationContextResult } from '../framework/apiCredentialPorts';
3
4
  import type { HeaderRecord } from '../framework/routeExecutionContext';
4
5
  import type { RouteDefinition } from '../framework/routeDefinitions';
5
- interface ResolvePublishableKeyApiCredentialAuthInput {
6
+ interface PublishableKeyRequestInput {
6
7
  environmentId?: string | null;
7
8
  headers: HeaderRecord;
8
9
  missingEnvironmentMessage: string;
9
10
  missingOriginMessage: string;
10
11
  missingPublishableKeyMessage: string;
11
12
  origin?: string;
12
- publishableKeyAuth: RouterApiPublishableKeyAuthAdapter;
13
13
  route: RouteDefinition;
14
14
  routeAuthNotConfiguredMessage: string;
15
15
  }
16
+ interface ResolvePublishableKeyApiCredentialAuthInput extends PublishableKeyRequestInput {
17
+ publishableKeyAuth: RouterApiPublishableKeyAuthAdapter;
18
+ }
16
19
  interface ResolveSecretKeyApiCredentialAuthInput {
17
20
  apiKeyAuth?: RouterApiKeyAuthAdapter | null;
18
21
  headers: HeaderRecord;
@@ -20,7 +23,12 @@ interface ResolveSecretKeyApiCredentialAuthInput {
20
23
  sourceIp?: string;
21
24
  routeAuthNotConfiguredMessage: string;
22
25
  }
26
+ export declare function resolveWalletRegistrationContext(input: PublishableKeyRequestInput & {
27
+ registrationContext: WalletRegistrationContextResolver;
28
+ registration: Parameters<WalletRegistrationContextResolver['resolve']>[0]['registration'];
29
+ }): Promise<WalletRegistrationContextResult | RoutePolicyResolutionFailure>;
23
30
  export declare function resolvePublishableKeyApiCredentialAuth(input: ResolvePublishableKeyApiCredentialAuthInput): Promise<RoutePolicyResolutionResult>;
31
+ export declare function publishableKeyRoutePrincipal(principal: RouterApiKeyPrincipal): Promise<RoutePolicyResolutionResult>;
24
32
  export declare function resolveSecretKeyApiCredentialAuth(input: ResolveSecretKeyApiCredentialAuthInput): Promise<RoutePolicyResolutionResult>;
25
33
  export {};
26
34
  //# sourceMappingURL=routerApiCredentialAuth.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { RouterApiKeyPrincipal, RouterApiProjectEnvironment, RouterApiProjectEnvironmentResolver, RouterApiPublishableKeyAuthAdapter, RouterApiPublishableKeyAuthRequest, WalletRegistrationContextResult } from '../framework/apiCredentialPorts';
2
+ export declare function unavailableRegistrationContext(): WalletRegistrationContextResult;
3
+ /** Join the authenticated credential to its exact active environment at the boundary. */
4
+ export declare function walletRegistrationContext(input: RouterApiPublishableKeyAuthRequest, principal: RouterApiKeyPrincipal, environment: RouterApiProjectEnvironment): WalletRegistrationContextResult;
5
+ export declare function createWalletRegistrationContextResolver(auth: RouterApiPublishableKeyAuthAdapter, environments: RouterApiProjectEnvironmentResolver): {
6
+ resolve: (input: RouterApiPublishableKeyAuthRequest) => Promise<WalletRegistrationContextResult>;
7
+ };
8
+ //# sourceMappingURL=walletRegistrationContext.d.ts.map
@@ -12,7 +12,7 @@ export declare function createD1AuthorizationAssembly(options: D1AuthorizationSt
12
12
  authorizationStore: CloudflareD1AuthorizationStore;
13
13
  authorizationService: AuthorizationService;
14
14
  };
15
- export declare function createD1WalletCustodyStore(options: NormalizedCloudflareD1RouterApiAuthServiceOptions): CloudflareD1WalletCustodyCommitStore;
15
+ export declare function createD1WalletCustodyStore(options: NormalizedCloudflareD1RouterApiAuthServiceOptions, walletAuthMethodStore: D1WalletAuthMethodStore): CloudflareD1WalletCustodyCommitStore;
16
16
  export declare function createD1WebAuthnAssembly(options: NormalizedCloudflareD1RouterApiAuthServiceOptions, walletAuthMethodStore: D1WalletAuthMethodStore, walletManifestSource: D1WebAuthnWalletManifestSource): {
17
17
  webAuthnStore: CloudflareD1WebAuthnStore;
18
18
  webAuthnAuthService: CloudflareD1WebAuthnAuthService;
@@ -0,0 +1,16 @@
1
+ import type { RouterApiServiceBag } from '../../../framework/authServicePort';
2
+ import type { CloudflareD1EmailOtpServerSealRuntime } from '../emailOtp/d1EmailOtpServerSealRuntime';
3
+ import type { CloudflareD1EmailOtpChallengeService } from '../emailOtp/d1EmailOtpChallengeService';
4
+ import type { CloudflareD1EmailOtpRecoveryService } from '../emailOtp/d1EmailOtpRecoveryService';
5
+ import type { CloudflareD1GoogleEmailOtpSessionResolver } from '../emailOtp/d1GoogleEmailOtpSessionResolver';
6
+ import type { CloudflareD1OidcVerificationService } from '../oidc/d1OidcVerificationService';
7
+ type D1EmailOtpRouteServiceAssembly = {
8
+ readonly emailOtpServerSeal: CloudflareD1EmailOtpServerSealRuntime;
9
+ readonly emailOtpChallengeService: CloudflareD1EmailOtpChallengeService;
10
+ readonly emailOtpRecoveryService: CloudflareD1EmailOtpRecoveryService;
11
+ readonly googleEmailOtpSessions: CloudflareD1GoogleEmailOtpSessionResolver;
12
+ readonly oidcVerification: CloudflareD1OidcVerificationService;
13
+ };
14
+ export declare function createD1EmailOtpRouteService(assembly: D1EmailOtpRouteServiceAssembly): RouterApiServiceBag['emailOtp'];
15
+ export {};
16
+ //# sourceMappingURL=d1EmailOtpRouteService.d.ts.map
@@ -2,14 +2,14 @@ import type { LinkedDeviceBootstrapStore } from '../../../../core/deviceLinking/
2
2
  import type { LinkedDeviceRequestProofNonceStoreV1 } from '../../../../core/deviceLinking/requestProof';
3
3
  import type { WebAuthnSyncChallengeStore } from '../../../../core/WebAuthnSyncChallengeStore';
4
4
  import type { PasskeyCredentialClaims } from '../../../../core/passkeyCredentialClaims';
5
- import type { EmailOtpRateLimitCounter } from '../emailOtp/d1EmailOtpRateLimitStore';
6
5
  import type { GoogleEmailOtpRegistrationAttemptStore } from '../emailOtp/d1GoogleEmailOtpRegistrationAttemptStore';
7
6
  import type { IdentityStore } from '../../../../core/IdentityStore';
8
7
  import type { WalletLifecycleRoutingPublisher } from '../../../../authorization/lifecycleRouting';
9
8
  import type { WalletRecoveryRoutingPublisher } from '../../../../authorization/recoveryRouting';
10
9
  import type { WalletSessionRoutingPublisher } from '../../../../authorization/sessionRouting';
11
10
  import type { WalletRegistrationSetupDispatcher } from '../../../framework/registrationSetupDispatch';
12
- import type { WalletRegistrationReservationAuthority } from '../../../domains/walletRegistration/walletRegistrationReservation';
11
+ import type { RegistrationWalletStarter, WalletExecutionAuthority, WalletRegistrationReservationAuthority } from '../../../domains/walletRegistration/walletRegistrationReservation';
12
+ import { D1WalletExecutionAuthority } from '../registration/d1WalletExecutionAuthority';
13
13
  import type { LinkedDevicePasskeyTargetConfigurationFieldsV1 } from '../../../../../../shared-ts/src/device-linking/contracts';
14
14
  import type { WalletEmailOtpChannel } from '../../../../../../shared-ts/src/utils/emailOtpDomain';
15
15
  import type { EmailOtpChallengeAction, EmailOtpChallengeOperation } from '../../../../core/EmailOtpStores';
@@ -109,7 +109,6 @@ export type CloudflareD1GithubOAuthConfig = {
109
109
  };
110
110
  export interface CloudflareD1RouterApiAuthServiceOptions {
111
111
  readonly identityStore?: IdentityStore;
112
- readonly emailOtpRateLimitCounter?: EmailOtpRateLimitCounter;
113
112
  readonly credentialClaims?: PasskeyCredentialClaims;
114
113
  readonly linkedDeviceBootstrap?: LinkedDeviceBootstrapStore;
115
114
  readonly linkedDeviceProofNonces?: LinkedDeviceRequestProofNonceStoreV1;
@@ -120,6 +119,7 @@ export interface CloudflareD1RouterApiAuthServiceOptions {
120
119
  readonly recoveryRouting?: WalletRecoveryRoutingPublisher;
121
120
  readonly registrationSetupDispatcher?: WalletRegistrationSetupDispatcher;
122
121
  readonly registrationAuthority?: WalletRegistrationReservationAuthority;
122
+ readonly startRegistrationWallets?: RegistrationWalletStarter;
123
123
  readonly database: D1DatabaseLike;
124
124
  readonly namespace: string;
125
125
  readonly orgId: string;
@@ -194,7 +194,10 @@ export type EmailOtpServerSealRuntimeConfig = {
194
194
  readonly configured: false;
195
195
  readonly message: string;
196
196
  };
197
- export type NormalizedCloudflareD1RouterApiAuthServiceOptions = Omit<CloudflareD1RouterApiAuthServiceOptions, 'relayerAccount' | 'relayerPublicKey' | 'relayerPrivateKey' | 'nearRpcUrl' | 'accountInitialBalance' | 'implicitNearAccountTestFundingEnabled' | 'googleOidcClientId' | 'emailOtpServerSeal' | 'emailOtpDeliveryMode' | 'emailOtpRuntimeProfile' | 'emailOtpDemoAllowedOrigins' | 'emailOtpDeliveryProvider' | 'emailOtpDevOutboxEnabled' | 'emailOtpProduction' | 'emailOtpChallengeTtlMs' | 'emailOtpGrantTtlMs' | 'emailOtpMaxAttempts' | 'emailOtpLockoutTtlMs' | 'emailOtpCodeLength' | 'emailOtpMaxActiveChallengesPerContext' | 'emailOtpChallengeRateLimitMax' | 'emailOtpChallengeRateLimitWindowMs' | 'emailOtpVerifyRateLimitMax' | 'emailOtpVerifyRateLimitWindowMs' | 'emailOtpGrantRateLimitMax' | 'emailOtpGrantRateLimitWindowMs' | 'emailOtpGoogleRegistrationAttemptRateLimitMax' | 'emailOtpGoogleRegistrationAttemptRateLimitWindowMs' | 'routerAbEcdsaPresignRuntime'> & {
197
+ export type NormalizedCloudflareD1RouterApiAuthServiceOptions = Omit<CloudflareD1RouterApiAuthServiceOptions, 'registrationAuthority' | 'relayerAccount' | 'relayerPublicKey' | 'relayerPrivateKey' | 'nearRpcUrl' | 'accountInitialBalance' | 'implicitNearAccountTestFundingEnabled' | 'googleOidcClientId' | 'emailOtpServerSeal' | 'emailOtpDeliveryMode' | 'emailOtpRuntimeProfile' | 'emailOtpDemoAllowedOrigins' | 'emailOtpDeliveryProvider' | 'emailOtpDevOutboxEnabled' | 'emailOtpProduction' | 'emailOtpChallengeTtlMs' | 'emailOtpGrantTtlMs' | 'emailOtpMaxAttempts' | 'emailOtpLockoutTtlMs' | 'emailOtpCodeLength' | 'emailOtpMaxActiveChallengesPerContext' | 'emailOtpChallengeRateLimitMax' | 'emailOtpChallengeRateLimitWindowMs' | 'emailOtpVerifyRateLimitMax' | 'emailOtpVerifyRateLimitWindowMs' | 'emailOtpGrantRateLimitMax' | 'emailOtpGrantRateLimitWindowMs' | 'emailOtpGoogleRegistrationAttemptRateLimitMax' | 'emailOtpGoogleRegistrationAttemptRateLimitWindowMs' | 'routerAbEcdsaPresignRuntime'> & {
198
+ /** The host's registration authority, with this home's execution state around it. */
199
+ readonly registrationAuthority?: D1WalletExecutionAuthority;
200
+ readonly walletExecution: WalletExecutionAuthority;
198
201
  readonly relayerAccount?: string;
199
202
  readonly relayerPublicKey?: string;
200
203
  readonly relayerPrivateKey?: string;
@@ -1,9 +1,12 @@
1
+ import type { WalletRelocationEmailOtpServices } from '../wallet/d1WalletRelocationEmailOtp';
1
2
  import { type ExecuteSignedDelegateRequest, type ExecuteSignedDelegateResult } from '../../../../delegateAction';
2
3
  import { type RouterApiServiceBag } from '../../../framework/authServicePort';
3
- import { type CloudflareD1RouterApiAuthServiceOptions } from './d1RouterApiAuthConfig';
4
+ import { type CloudflareD1RouterApiAuthServiceOptions, type NormalizedCloudflareD1RouterApiAuthServiceOptions } from './d1RouterApiAuthConfig';
4
5
  import { D1LinkedDeviceAuthorityInstallServiceV1 } from '../deviceLinking/d1LinkedDeviceAuthorityInstallService';
5
6
  export type { CloudflareD1EmailOtpDeliveryProvider, CloudflareD1EmailOtpDeliveryProviderInput, CloudflareD1EmailOtpDeliveryProviderResult, CloudflareD1EmailOtpServerSealConfig, CloudflareD1LinkedDeviceAuthorityInstallationOptionsV1, CloudflareD1LinkedDeviceCompositionOptionsV1, CloudflareD1LinkedDeviceManagementOptionsV1, CloudflareD1LinkedDeviceSessionOptionsV1, CloudflareD1RouterApiAuthServiceOptions, } from './d1RouterApiAuthConfig';
6
7
  export type CloudflareD1RouterApiAuthService = Omit<RouterApiServiceBag, 'thresholdRuntime'> & {
8
+ readonly walletExecution: NormalizedCloudflareD1RouterApiAuthServiceOptions['walletExecution'];
9
+ readonly relocationEmailOtp: WalletRelocationEmailOtpServices;
7
10
  readonly thresholdRuntime: RouterApiServiceBag['thresholdRuntime'];
8
11
  readonly executeSignedDelegate: (input: ExecuteSignedDelegateRequest) => Promise<ExecuteSignedDelegateResult>;
9
12
  readonly linkedDeviceEd25519AuthorityReader?: LinkedDeviceEd25519AuthorityReader;
@@ -1,8 +1,14 @@
1
1
  import type { AuthorizationService } from '../../../../authorization/service';
2
- import type { RouterApiWalletSessionAuthorizationV2AdmissionContext, RouterApiWalletSessionAuthorizationV2ExhaustedCandidateContext, RouterApiWalletSessionSigningCandidate } from '../../../framework/authServicePort';
2
+ import type { RouterApiEd25519WalletSessionSigningRead, RouterApiWalletSessionAuthorizationV2AdmissionContext, RouterApiWalletSessionAuthorizationV2ExhaustedCandidateContext, RouterApiWalletSessionSigningCandidate } from '../../../framework/authServicePort';
3
3
  type CredentialInput = Parameters<AuthorizationService['readWalletSessionAdmissionSnapshotByOperationCredential']>[0];
4
4
  type AdmissionSnapshotReader = Pick<AuthorizationService, 'readWalletSessionAdmissionSnapshotByOperationCredential'>;
5
5
  export declare function readActiveWalletSessionCredential(service: AdmissionSnapshotReader, input: CredentialInput): Promise<RouterApiWalletSessionAuthorizationV2AdmissionContext | null>;
6
+ /**
7
+ * The active session with its wallet's Ed25519 signer and policy rows. An
8
+ * exhausted session throws, as the plain credential read does: its caller
9
+ * resolves the exhausted candidate separately.
10
+ */
11
+ export declare function readEd25519WalletSessionSigningRead(service: Pick<AuthorizationService, 'readEd25519WalletSessionAdmissionSnapshotByOperationCredential'>, input: Parameters<AuthorizationService['readEd25519WalletSessionAdmissionSnapshotByOperationCredential']>[0]): Promise<RouterApiEd25519WalletSessionSigningRead | null>;
6
12
  export declare function readWalletSessionSigningCandidate(service: Pick<AuthorizationService, 'readEcdsaWalletSessionAdmissionSnapshotByOperationCredential'>, input: Parameters<AuthorizationService['readEcdsaWalletSessionAdmissionSnapshotByOperationCredential']>[0]): Promise<RouterApiWalletSessionSigningCandidate | null>;
7
13
  export declare function readExhaustedWalletSessionCredential(service: Pick<AuthorizationService, 'readExactWalletSessionStatusSnapshotByOperationCredential'>, input: CredentialInput): Promise<RouterApiWalletSessionAuthorizationV2ExhaustedCandidateContext | null>;
8
14
  export {};
@@ -1,6 +1,8 @@
1
- import type { EcdsaWalletSessionAdmissionRead } from '../../../../authorization/service';
1
+ import type { EcdsaWalletSessionAdmissionRead, Ed25519WalletSessionAdmissionRead, DirectWalletSessionCommitPurpose } from '../../../../authorization/service';
2
+ import type { D1RegistrationCommitBatch } from '../registration/d1WalletRegistrationCommitStore';
2
3
  import type { RouterAbMpcMaterialActivationRefWire } from '../../../../../../shared-ts/src/utils/routerAbNormalSigningIdentity';
3
4
  import type { EcdsaWalletSessionAdmissionInput, EcdsaWalletSessionAdmissionResult, EcdsaWalletSessionResolutionResult, PinnedOwnerWalletScope } from '../../../../authorization/ecdsaWalletSessionAdmission';
5
+ import type { Ed25519WalletSessionAdmissionInput, Ed25519WalletSessionAdmissionResult, Ed25519WalletSessionResolutionInput, Ed25519WalletSessionResolutionResult } from '../../../../authorization/ed25519WalletSessionAdmission';
4
6
  import { type MpcMaterialActivationRef, type WalletAuthorityId, type WalletAuthMethodId, type WalletId } from '../../../../../../shared-ts/src/utils/domainIds';
5
7
  import { type AuthorizedOperationId, type TenantId } from '../../../../../../shared-ts/src/authorization/capabilityKinds';
6
8
  import type { AuthorizedOperation, AuthorizedOperationInput, IssuedWalletSessionAuthorizationV2, LiveWalletSessionAuthorizationProjectionV2, WalletSessionAuthorizationV2, ActiveWalletSessionQuota, PersistedActiveWalletSessionAuthorizationV2, DirectV2CommitResult, WalletSessionAuthorizationV2MintLookup, WalletSessionAuthorizationV2MintRead, AuthorizedOperationReplayResponse, CompletedCapabilityOperationResult, IssuedHostedWalletSeamsSessionExchangeV2, RedeemHostedWalletSeamsSessionExchangeV2Input, PersistedHostedWalletSeamsSessionExchangeV2Result, ExactWalletSessionQuotaProjectionV1, ExactWalletSessionStatusV2, ExactWalletSessionStatusSnapshotV2, WalletSessionAdmissionSnapshotV2, WalletSessionExactOperationContext, ResolvedHostedWalletSessionOperationCredentialV2, VerifiedAuthorizationEvidenceSet, VerifiedOwnerProof } from '../../../../authorization/domain';
@@ -72,11 +74,19 @@ export declare class CloudflareD1AuthorizationStore implements AuthorizationSess
72
74
  commitDirectWalletSessionAuthorizationV2(input: {
73
75
  readonly persisted: PersistedActiveWalletSessionAuthorizationV2;
74
76
  }): Promise<DirectV2CommitResult>;
77
+ readWalletSessionIssuanceGeneration(walletId: WalletId): Promise<number>;
78
+ private prepareWalletSessionIssuanceGenerationRead;
75
79
  /** The service validates the committed winner against its caller-specific replay contract. */
76
80
  commitDirectReplayableWalletSessionAuthorizationV2(input: {
77
81
  readonly persisted: PersistedActiveWalletSessionAuthorizationV2;
82
+ readonly purpose: DirectWalletSessionCommitPurpose;
83
+ }): Promise<DirectV2CommitResult>;
84
+ commitRegistrationWalletSessionAuthorizationV2(commitWallet: (executeBatch: D1RegistrationCommitBatch) => Promise<void>, input: {
85
+ readonly persisted: PersistedActiveWalletSessionAuthorizationV2;
86
+ readonly purpose: DirectWalletSessionCommitPurpose;
78
87
  }): Promise<DirectV2CommitResult>;
79
88
  private commitDirectWalletSessionAuthorizationV2WithMode;
89
+ private prepareRegistrationSessionCompletion;
80
90
  /**
81
91
  * Builds the one batch used by direct issuance. Every predecessor mutation
82
92
  * is gated by the candidate identity check, so a same-mint replay leaves
@@ -99,6 +109,7 @@ export declare class CloudflareD1AuthorizationStore implements AuthorizationSess
99
109
  readonly promotionAtMs: number;
100
110
  }): readonly [D1PreparedStatementLike, D1PreparedStatementLike, D1PreparedStatementLike];
101
111
  readWalletSessionAuthorizationV2ByMint(input: WalletSessionAuthorizationV2MintLookup): Promise<WalletSessionAuthorizationV2MintRead | null>;
112
+ private prepareWalletSessionAuthorizationV2ByMintRead;
102
113
  readLiveWalletSessionAuthorizationProjectionV2(input: {
103
114
  readonly expected: WalletSessionAuthorizationV2;
104
115
  readonly nowMs: number;
@@ -142,6 +153,17 @@ export declare class CloudflareD1AuthorizationStore implements AuthorizationSess
142
153
  readonly nowMs: number;
143
154
  readonly materialActivation: RouterAbMpcMaterialActivationRefWire;
144
155
  }): Promise<EcdsaWalletSessionAdmissionRead | null>;
156
+ /**
157
+ * The session with the Ed25519 signer and the policy rows its admission
158
+ * needs, in one statement. The signer and the policy are those of the
159
+ * session's own wallet, whatever wallet the request names.
160
+ */
161
+ readEd25519WalletSessionAdmissionSnapshotByOperationCredential(input: {
162
+ readonly tenantId: WalletSessionAuthorizationV2['tenantId'];
163
+ readonly tokenHash: import('../../../../../../shared-ts/src/utils/canonicalPrimitives').DigestB64u;
164
+ readonly nowMs: number;
165
+ readonly materialActivation: RouterAbMpcMaterialActivationRefWire;
166
+ }): Promise<Ed25519WalletSessionAdmissionRead | null>;
145
167
  readWalletSessionExactOperationContextByCredential(input: {
146
168
  readonly tenantId: WalletSessionAuthorizationV2['tenantId'];
147
169
  readonly tokenHash: import('../../../../../../shared-ts/src/utils/canonicalPrimitives').DigestB64u;
@@ -203,7 +225,16 @@ export declare class CloudflareD1AuthorizationStore implements AuthorizationSess
203
225
  readonly material?: AuthorizedOperationMaterialScope;
204
226
  }): Promise<AuthorizedOperationAdmissionResult>;
205
227
  resolveEcdsaWalletSessionOperation(input: EcdsaWalletSessionAdmissionInput): Promise<EcdsaWalletSessionResolutionResult>;
228
+ /**
229
+ * The stored operation answers for itself: its own grant must still be
230
+ * active, as when a finalize request admitted it again.
231
+ */
232
+ resolveEd25519WalletSessionOperation(input: Ed25519WalletSessionResolutionInput): Promise<Ed25519WalletSessionResolutionResult>;
233
+ private pinExistingWalletSessionOperation;
206
234
  admitEcdsaWalletSessionOperation(input: EcdsaWalletSessionAdmissionInput): Promise<EcdsaWalletSessionAdmissionResult>;
235
+ admitEd25519WalletSessionOperation(input: Ed25519WalletSessionAdmissionInput): Promise<Ed25519WalletSessionAdmissionResult>;
236
+ /** A live operation's owner scope comes from the row its own admission read back. */
237
+ private pinWalletSessionAdmission;
207
238
  private admitAuthorizedOperationRecord;
208
239
  completeAuthorizedOperation(input: {
209
240
  readonly operation: AuthorizedOperation;
@@ -41,6 +41,7 @@ type WorkerOrdinarySignerMaterialReservationPreparationV1 = {
41
41
  /** The only worker authority mutation accepted by the linked-device cutover. */
42
42
  export type OrdinaryInactiveSignerMaterialActivationPortV1 = {
43
43
  activateOrdinaryInactiveSignerMaterialV1(input: {
44
+ readonly ownershipGeneration: number;
44
45
  readonly keyFamily: 'ed25519' | 'ecdsa_secp256k1';
45
46
  readonly reservationId: string;
46
47
  readonly materialActivation: MpcMaterialActivationRef;
@@ -199,6 +200,7 @@ export type InstalledLinkedDeviceEcdsaAuthorityProjectionV1 = {
199
200
  readonly activatedAtMs: number;
200
201
  };
201
202
  type ServerReservationRecordV1<F extends 'ed25519' | 'ecdsa_secp256k1'> = {
203
+ readonly ownershipGeneration: number;
202
204
  readonly reservationId: string;
203
205
  readonly preparation: Extract<WorkerOrdinarySignerMaterialReservationPreparationV1, {
204
206
  readonly keyFamily: F;