@seams/wallet-server 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/THIRD_PARTY_NOTICES.md +1 -105
  2. package/artifact-manifest.json +21 -21
  3. package/cloudflare-router-ab/build/deriver-a/build-stamp.json +1 -1
  4. package/cloudflare-router-ab/build/deriver-a/index_bg.wasm +0 -0
  5. package/cloudflare-router-ab/build/deriver-b/build-stamp.json +1 -1
  6. package/cloudflare-router-ab/build/deriver-b/index_bg.wasm +0 -0
  7. package/cloudflare-router-ab/build/local-tools/darwin-arm64/router_ab_local_init +0 -0
  8. package/cloudflare-router-ab/build/local-tools/darwin-x64/router_ab_local_init +0 -0
  9. package/cloudflare-router-ab/build/local-tools/linux-x64/router_ab_local_init +0 -0
  10. package/cloudflare-router-ab/build/router/build-stamp.json +1 -1
  11. package/cloudflare-router-ab/build/router/index_bg.wasm +0 -0
  12. package/cloudflare-router-ab/build/signing-worker/build-stamp.json +1 -1
  13. package/cloudflare-router-ab/build/signing-worker/index_bg.wasm +0 -0
  14. package/cloudflare-router-ab/build/tenant-root-control-plane/build-stamp.json +1 -1
  15. package/cloudflare-router-ab/build/tenant-root-control-plane/index_bg.wasm +0 -0
  16. package/dist/esm/authorization/service.js +8 -0
  17. package/dist/esm/authorization/vaultProxyUse.js +2 -6
  18. package/dist/esm/cloud-host.js +4 -4
  19. package/dist/esm/core/IdentityStore.js +23 -110
  20. package/dist/esm/core/SessionService.js +7 -30
  21. package/dist/esm/core/ThresholdService/routerAbNormalSigningPolicy.js +3 -10
  22. package/dist/esm/core/ThresholdService/stores/WalletSessionStore.js +21 -97
  23. package/dist/esm/core/ThresholdService/stores/exportReplayGuard.js +7 -0
  24. package/dist/esm/core/WalletStore.js +4 -6
  25. package/dist/esm/core/authService/bytes.js +1 -4
  26. package/dist/esm/core/authService/emailOtpChallengeOperations.js +2 -5
  27. package/dist/esm/core/authService/emailOtpChallengeProof.js +9 -40
  28. package/dist/esm/core/authService/emailOtpChallengeVerification.js +19 -90
  29. package/dist/esm/core/authService/emailOtpChallenges.js +10 -45
  30. package/dist/esm/core/authService/emailOtpDelivery.js +10 -45
  31. package/dist/esm/core/authService/emailOtpEnrollment.js +9 -40
  32. package/dist/esm/core/authService/emailOtpGrant.js +9 -40
  33. package/dist/esm/core/authService/emailOtpRegistrationEnrollment.js +9 -40
  34. package/dist/esm/core/authService/emailOtpSeal.js +5 -20
  35. package/dist/esm/core/authService/emailOtpUnlock.js +20 -110
  36. package/dist/esm/core/authService/googleEmailOtpRegistration.js +28 -115
  37. package/dist/esm/core/authService/identity.js +5 -20
  38. package/dist/esm/core/authService/nearPublicKeyMetadata.js +6 -25
  39. package/dist/esm/core/authService/oidcVerification.js +22 -34
  40. package/dist/esm/core/authService/rateLimits.js +2 -5
  41. package/dist/esm/core/authService/thresholdEcdsaKeyInventory.js +2 -1
  42. package/dist/esm/core/authService/webauthn.js +37 -191
  43. package/dist/esm/core/authService/webauthnVerificationOutcomes.js +5 -24
  44. package/dist/esm/core/d1EcdsaSignerRead.js +76 -0
  45. package/dist/esm/core/d1IdentityStore.js +16 -75
  46. package/dist/esm/core/d1TenantStore.js +1 -1
  47. package/dist/esm/core/d1WalletStore.js +15 -25
  48. package/dist/esm/core/deviceLinking/linkedDeviceEmailOtpGrant.js +1 -5
  49. package/dist/esm/core/deviceLinking/linkedDeviceSessionApproval.js +1 -3
  50. package/dist/esm/core/deviceLinking/linkedDeviceSessionRecord.js +2 -8
  51. package/dist/esm/core/deviceLinking/requestProof.js +13 -4
  52. package/dist/esm/core/ecdsaMaterialReadSnapshot.js +85 -0
  53. package/dist/esm/core/nearRelayerAccountProvisioning.js +2 -5
  54. package/dist/esm/core/signingLanes/WalletExecutionLaneProjection.js +3 -6
  55. package/dist/esm/core/signingMaterial/ordinaryInactiveSignerMaterialReservation.js +2 -5
  56. package/dist/esm/core/storeBackends.js +1 -1
  57. package/dist/esm/core/thresholdEcdsaChainTarget.js +1 -3
  58. package/dist/esm/hosted-wallet-gateway.js +2 -2
  59. package/dist/esm/localHostedWalletGatewayHandler.js +13 -0
  60. package/dist/esm/localIntendedMaterialAdmissionFault.js +176 -0
  61. package/dist/esm/localIntendedPresignCancellation.js +44 -0
  62. package/dist/esm/router/auth/commonRouterUtils.js +24 -10
  63. package/dist/esm/router/auth/walletSessionFailure.js +2 -5
  64. package/dist/esm/router/auth/webAuthnCredentialCodecs.js +4 -15
  65. package/dist/esm/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.js +1 -0
  66. package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthBoundary.js +2 -6
  67. package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthService.js +5 -27
  68. package/dist/esm/router/cloudflare/d1/auth/walletSessionCredentialReaders.js +76 -0
  69. package/dist/esm/router/cloudflare/d1/authorization/authorizedOperationStatements.js +28 -21
  70. package/dist/esm/router/cloudflare/d1/authorization/d1AuthorizationStore.js +209 -44
  71. package/dist/esm/router/cloudflare/d1/authorization/d1VaultProxyStore.js +8 -12
  72. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.js +50 -8
  73. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.js +1 -1
  74. package/dist/esm/router/cloudflare/d1/deviceLinking/index.js +3 -3
  75. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeIssuer.js +12 -55
  76. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeService.js +17 -80
  77. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpDeliveryRuntime.js +6 -25
  78. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.js +12 -47
  79. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +24 -85
  80. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.js +7 -30
  81. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpServerSealRuntime.js +5 -20
  82. package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.js +23 -110
  83. package/dist/esm/router/cloudflare/d1/identity/d1IdentityService.js +9 -40
  84. package/dist/esm/router/cloudflare/d1/near/d1NearPublicKeyStore.js +3 -10
  85. package/dist/esm/router/cloudflare/d1/oidc/d1OidcBoundary.js +18 -91
  86. package/dist/esm/router/cloudflare/d1/oidc/d1OidcVerificationService.js +6 -30
  87. package/dist/esm/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyRouteService.js +4 -15
  88. package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.js +2 -7
  89. package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpRecords.js +9 -13
  90. package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.js +11 -50
  91. package/dist/esm/router/cloudflare/d1/registration/d1EvmFamilyEcdsaRegistrationBranch.js +5 -20
  92. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.js +4 -7
  93. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +2 -1
  94. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationIntentService.js +7 -30
  95. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +32 -22
  96. package/dist/esm/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.js +1 -4
  97. package/dist/esm/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.js +119 -25
  98. package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnAuthService.js +31 -168
  99. package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnRecords.js +6 -9
  100. package/dist/esm/router/cloudflare/durableObjects/thresholdStore.js +59 -66
  101. package/dist/esm/router/cloudflare/runtime/routerAbPrewarm.js +2 -2
  102. package/dist/esm/router/cloudflare/runtime/staticWalletConsoleBinding.js +5 -20
  103. package/dist/esm/router/cloudflare/runtime/tenantRootCreationGrant.js +2 -9
  104. package/dist/esm/router/cloudflare/runtime/walletControlOps.js +2 -1
  105. package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneCurveExecution.js +2 -1
  106. package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneProtocolCommitter.js +2 -2
  107. package/dist/esm/router/cloudflare.js +2146 -1802
  108. package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPersistence.js +5 -8
  109. package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryWalletSessionAuthorization.js +3 -6
  110. package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization.js +6 -25
  111. package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationSideEffectBoundary.js +39 -55
  112. package/dist/esm/router/domains/emailOtp/emailOtpRouteHandlers.js +15 -62
  113. package/dist/esm/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.js +83 -74
  114. package/dist/esm/router/domains/signingOperations/routerAbNormalSigningAdmission.js +1 -0
  115. package/dist/esm/router/domains/signingOperations/routerAbOperationStepUp.js +1 -0
  116. package/dist/esm/router/domains/signingOperations/walletExecutionAdmission.js +1 -4
  117. package/dist/esm/router/domains/tenantRoot/tenantRootIdentityResolution.js +7 -13
  118. package/dist/esm/router/domains/walletUnlock/walletUnlockRouteHandlers.js +41 -200
  119. package/dist/esm/router/express.js +317 -699
  120. package/dist/esm/router/framework/http.js +5 -1
  121. package/dist/esm/router/framework/runtimeSnapshotConsumer.js +8 -35
  122. package/dist/esm/router/transport/fetch/createFetchRouter.js +3 -6
  123. package/dist/esm/router/transport/fetch/routes/auth.js +9 -41
  124. package/dist/esm/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.js +5 -22
  125. package/dist/esm/router/transport/fetch/routes/nearPublicKeys.js +4 -16
  126. package/dist/esm/router/transport/fetch/routes/sessions.js +1 -0
  127. package/dist/esm/router/transport/fetch/routes/syncAccount.js +8 -36
  128. package/dist/esm/router/transport/fetch/routes/thresholdEcdsa.js +27 -79
  129. package/dist/esm/router/transport/fetch/routes/walletExecutionLanePreflight.js +4 -1
  130. package/dist/esm/router/transport/fetch/routes/webauthnAuthenticators.js +4 -16
  131. package/dist/esm/shared-ts/src/authorization/walletSignerActivationEquality.js +12 -0
  132. package/dist/esm/shared-ts/src/device-linking/committedSignerPackages.js +2 -5
  133. package/dist/esm/shared-ts/src/device-linking/delegatedActivationPlan.js +1 -5
  134. package/dist/esm/shared-ts/src/device-linking/ed25519ExportRoot.js +12 -16
  135. package/dist/esm/shared-ts/src/device-linking/sourceContribution.js +5 -8
  136. package/dist/esm/shared-ts/src/passkey-custody/primitives.js +5 -1
  137. package/dist/esm/shared-ts/src/signing-lanes/ownerContinuity.js +4 -8
  138. package/dist/esm/shared-ts/src/tenant-root/tenantRootIdentifier.js +12 -0
  139. package/dist/esm/shared-ts/src/tenant-root/tenantRootIdentity.js +2 -9
  140. package/dist/esm/shared-ts/src/tenant-root/tenantRootOperationRecord.js +1 -4
  141. package/dist/esm/shared-ts/src/utils/ecdsaKeyFactsInventory.js +2 -4
  142. package/dist/esm/shared-ts/src/utils/ecdsaServerTiming.js +0 -1
  143. package/dist/esm/shared-ts/src/utils/emailOtpDomain.js +3 -1
  144. package/dist/esm/shared-ts/src/utils/exactKeys.js +17 -0
  145. package/dist/esm/shared-ts/src/utils/failure.js +20 -0
  146. package/dist/esm/shared-ts/src/utils/registrationIntent.js +3 -12
  147. package/dist/esm/shared-ts/src/utils/registrationSignerPlan.js +2 -5
  148. package/dist/esm/shared-ts/src/utils/routerAbEcdsaDerivation.js +1 -1
  149. package/dist/esm/shared-ts/src/utils/routerAbEd25519Yao.js +1 -1
  150. package/dist/esm/shared-ts/src/utils/thresholdEcdsaChainTarget.js +9 -0
  151. package/dist/esm/shared-ts/src/wallet-recovery/walletRecoveryCommittedProjection.js +1 -4
  152. package/dist/esm/threshold/session/signingSessionSeal/crypto/cipher.js +10 -32
  153. package/dist/esm/threshold/session/signingSessionSeal/idempotencyBackends.js +3 -3
  154. package/dist/esm/threshold/session/signingSessionSeal/idempotencyRecords.js +3 -9
  155. package/dist/esm/threshold/session/signingSessionSeal/service.js +8 -35
  156. package/dist/esm/threshold/session/signingSessionSeal/transport/express.js +18 -94
  157. package/dist/esm/threshold/session/signingSessionSeal/transport/fetch.js +6 -30
  158. package/dist/esm/threshold/session/signingSessionSeal/transport/shared.js +5 -20
  159. package/dist/esm/wasm/evm_crypto/pkg/evm_crypto_bg.wasm +0 -0
  160. package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
  161. package/dist/types/shared-ts/src/authorization/delegatedAuthority.d.ts +2 -1
  162. package/dist/types/shared-ts/src/authorization/walletSessionIssuance.d.ts +9 -2
  163. package/dist/types/shared-ts/src/authorization/walletSignerActivationEquality.d.ts +4 -0
  164. package/dist/types/shared-ts/src/device-linking/committedSignerPackages.d.ts +3 -4
  165. package/dist/types/shared-ts/src/device-linking/contracts.d.ts +5 -63
  166. package/dist/types/shared-ts/src/device-linking/sourceContribution.d.ts +2 -0
  167. package/dist/types/shared-ts/src/passkey-custody/custodyEnvelope.d.ts +5 -12
  168. package/dist/types/shared-ts/src/passkey-custody/primitives.d.ts +9 -0
  169. package/dist/types/shared-ts/src/signing-lanes/execution.d.ts +11 -1
  170. package/dist/types/shared-ts/src/signing-lanes/ids.d.ts +1 -10
  171. package/dist/types/shared-ts/src/signing-lanes/rotation.d.ts +3 -5
  172. package/dist/types/shared-ts/src/tenant-root/tenantRootIdentifier.d.ts +3 -0
  173. package/dist/types/shared-ts/src/tenant-root/tenantRootOperationRecord.d.ts +2 -1
  174. package/dist/types/shared-ts/src/threshold/ecdsaDerivationRoleLocalBootstrap.d.ts +6 -0
  175. package/dist/types/shared-ts/src/threshold/signingRootScope.d.ts +1 -0
  176. package/dist/types/shared-ts/src/utils/ecdsaKeyFactsInventory.d.ts +2 -11
  177. package/dist/types/shared-ts/src/utils/eip1559TxWasmJson.d.ts +16 -0
  178. package/dist/types/shared-ts/src/utils/emailOtpDomain.d.ts +2 -0
  179. package/dist/types/shared-ts/src/utils/exactKeys.d.ts +11 -0
  180. package/dist/types/shared-ts/src/utils/failure.d.ts +12 -0
  181. package/dist/types/shared-ts/src/utils/jsonRpc.d.ts +3 -4
  182. package/dist/types/shared-ts/src/utils/nearRpcResults.d.ts +1 -0
  183. package/dist/types/shared-ts/src/utils/registrationAuthMethodInput.d.ts +3 -8
  184. package/dist/types/shared-ts/src/utils/registrationSignerPlan.d.ts +7 -19
  185. package/dist/types/shared-ts/src/utils/routerAbEcdsaDerivation.d.ts +3 -1
  186. package/dist/types/shared-ts/src/utils/routerAbEd25519Yao.d.ts +1 -0
  187. package/dist/types/shared-ts/src/utils/routerAbEd25519YaoDigests.d.ts +3 -4
  188. package/dist/types/shared-ts/src/utils/routerAbNormalSigningIdentity.d.ts +30 -8
  189. package/dist/types/shared-ts/src/utils/routerApiKeyAuth.d.ts +2 -0
  190. package/dist/types/shared-ts/src/utils/signingSessionSeal.d.ts +10 -11
  191. package/dist/types/shared-ts/src/utils/thresholdEcdsaChainTarget.d.ts +25 -0
  192. package/dist/types/shared-ts/src/utils/variant.d.ts +18 -0
  193. package/dist/types/shared-ts/src/utils/walletAuthMethodRecord.d.ts +3 -6
  194. package/dist/types/shared-ts/src/utils/webauthnDeviceInfo.d.ts +4 -2
  195. package/dist/types/shared-ts/src/wallet-recovery/recoveryEnvelopes.d.ts +3 -16
  196. package/dist/types/shared-ts/src/wallet-recovery/walletRecoveryPreparation.d.ts +15 -0
  197. package/dist/types/shared-ts/src/wallet-recovery/walletRecoveryTarget.d.ts +3 -4
  198. package/dist/types/wallet-server/src/authorization/domain.d.ts +13 -2
  199. package/dist/types/wallet-server/src/authorization/ecdsaWalletSessionAdmission.d.ts +27 -3
  200. package/dist/types/wallet-server/src/authorization/service.d.ts +19 -0
  201. package/dist/types/wallet-server/src/core/ThresholdService/stores/SessionStore.d.ts +2 -2
  202. package/dist/types/wallet-server/src/core/ThresholdService/stores/WalletSessionStore.d.ts +1 -1
  203. package/dist/types/wallet-server/src/core/ThresholdService/stores/exportReplayGuard.d.ts +3 -0
  204. package/dist/types/wallet-server/src/core/ThresholdService/validation.d.ts +8 -101
  205. package/dist/types/wallet-server/src/core/WebAuthnAuthenticatorStore.d.ts +8 -0
  206. package/dist/types/wallet-server/src/core/authService/bytes.d.ts +0 -1
  207. package/dist/types/wallet-server/src/core/authService/emailOtpChallenges.d.ts +2 -10
  208. package/dist/types/wallet-server/src/core/authService/emailOtpSeal.d.ts +1 -1
  209. package/dist/types/wallet-server/src/core/authService/emailOtpUnlock.d.ts +3 -10
  210. package/dist/types/wallet-server/src/core/d1EcdsaSignerRead.d.ts +39 -0
  211. package/dist/types/wallet-server/src/core/d1WalletStore.d.ts +10 -0
  212. package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceSessionRecord.d.ts +3 -4
  213. package/dist/types/wallet-server/src/core/ecdsaMaterialReadSnapshot.d.ts +19 -0
  214. package/dist/types/wallet-server/src/core/routerAbSigning/RouterAbNormalSigningRuntime.d.ts +3 -5
  215. package/dist/types/wallet-server/src/core/rpcClients/near/NearClient.d.ts +1 -2
  216. package/dist/types/wallet-server/src/core/signingLanes/WalletExecutionLaneProjection.d.ts +2 -11
  217. package/dist/types/wallet-server/src/core/signingLanes/signingWorkerLaneMaterialIdentity.d.ts +2 -19
  218. package/dist/types/wallet-server/src/core/thresholdEcdsaChainTarget.d.ts +3 -11
  219. package/dist/types/wallet-server/src/core/types.d.ts +2 -6
  220. package/dist/types/wallet-server/src/localIntendedMaterialAdmissionFault.d.ts +38 -0
  221. package/dist/types/wallet-server/src/localIntendedPresignCancellation.d.ts +4 -0
  222. package/dist/types/wallet-server/src/router/auth/authRequestValidation.d.ts +4 -9
  223. package/dist/types/wallet-server/src/router/auth/commonRouterUtils.d.ts +15 -1
  224. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthBoundary.d.ts +0 -1
  225. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthService.d.ts +1 -1
  226. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/walletSessionCredentialReaders.d.ts +9 -0
  227. package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/authorizedOperationStatements.d.ts +4 -0
  228. package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/d1AuthorizationStore.d.ts +10 -1
  229. package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.d.ts +19 -2
  230. package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionStore.d.ts +2 -6
  231. package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.d.ts +5 -8
  232. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpEnrollmentStore.d.ts +2 -8
  233. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRateLimitStore.d.ts +2 -9
  234. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.d.ts +5 -5
  235. package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpServerSealRuntime.d.ts +4 -14
  236. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.d.ts +2 -6
  237. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationService.d.ts +8 -6
  238. package/dist/types/wallet-server/src/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.d.ts +14 -1
  239. package/dist/types/wallet-server/src/router/cloudflare/d1/webauthn/d1WebAuthnRecords.d.ts +10 -39
  240. package/dist/types/wallet-server/src/router/cloudflare/runtime/walletConsoleOps.d.ts +8 -34
  241. package/dist/types/wallet-server/src/router/domains/ecdsa/thresholdEcdsaRequestValidation.d.ts +3 -15
  242. package/dist/types/wallet-server/src/router/domains/ed25519Yao/session/routerAbEd25519YaoWalletSession.d.ts +9 -50
  243. package/dist/types/wallet-server/src/router/domains/passkeyCustody/walletRecoveryKeyManifest.d.ts +1 -13
  244. package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.d.ts +8 -9
  245. package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbNormalSigningAdmission.d.ts +13 -0
  246. package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbOperationStepUp.d.ts +3 -4
  247. package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbPrivateSigningWorker.d.ts +7 -16
  248. package/dist/types/wallet-server/src/router/domains/syncAccount/syncAccountRequestValidation.d.ts +2 -7
  249. package/dist/types/wallet-server/src/router/framework/apiCredentialPorts.d.ts +3 -1
  250. package/dist/types/wallet-server/src/router/framework/authServicePort.d.ts +25 -4
  251. package/dist/types/wallet-server/src/router/framework/http.d.ts +1 -0
  252. package/dist/types/wallet-server/src/router/framework/ror/normalize.d.ts +1 -9
  253. package/dist/types/wallet-server/src/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.d.ts +3 -6
  254. package/dist/types/wallet-server/src/router/transport/fetch/routes/syncAccountBootstrap.d.ts +3 -5
  255. package/dist/types/wallet-server/src/router/transport/fetch/routes/thresholdEcdsa.d.ts +0 -1
  256. package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/idempotencyRecords.d.ts +1 -2
  257. package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/signingSessionSeal.types.d.ts +6 -8
  258. package/package.json +1 -1
  259. package/dist/esm/wasm/router_ab_ecdsa_signing_worker/pkg/router_ab_ecdsa_signing_worker_bg.wasm +0 -0
@@ -1,18 +1,9 @@
1
- import { type SigningLaneRecord, type WalletKeyRecord } from '../../../../shared-ts/src/signing-lanes';
2
- import { type DigestB64u } from '../../../../shared-ts/src/utils/canonicalPrimitives';
1
+ import { type OwnerWalletExecutionLaneProjectionV1 } from '../../../../shared-ts/src/signing-lanes';
3
2
  import type { MpcMaterialActivationRef, ProviderSubject, WalletAuthMethodId, WalletId } from '../../../../shared-ts/src/utils/domainIds';
4
3
  import { type WalletAuthMethodRecordV2 } from '../../../../shared-ts/src/utils/walletAuthMethodRecord';
5
4
  import { type WalletAuthAuthorityRef } from '../../../../shared-ts/src/utils/walletAuthAuthority';
6
5
  import type { WalletSignerRecord } from '../WalletStore';
7
- export type ActiveOwnerWalletExecutionLaneProjection = {
8
- readonly kind: 'active_owner_wallet_execution_lane_projection_v1';
9
- readonly walletKey: WalletKeyRecord;
10
- readonly lane: Extract<SigningLaneRecord, {
11
- readonly laneKind: 'owner_passkey' | 'owner_email_otp';
12
- }>;
13
- readonly materialActivation: MpcMaterialActivationRef;
14
- readonly verifiedActivationReceiptDigestB64u: DigestB64u;
15
- };
6
+ export type ActiveOwnerWalletExecutionLaneProjection = OwnerWalletExecutionLaneProjectionV1;
16
7
  type WalletExecutionLaneProjectionRefusalReason = 'auth_method_missing' | 'auth_method_ambiguous' | 'auth_method_inactive' | 'auth_method_mismatch' | 'signer_missing' | 'signer_ambiguous' | 'signer_conflict' | 'signer_invalid';
17
8
  export type WalletExecutionLaneProjectionResult = {
18
9
  readonly kind: 'projected';
@@ -1,21 +1,4 @@
1
- import type { LaneEnrollmentId, LaneOperationId, LaneShareEpoch, SigningLaneId, WalletKeyId } from '../../../../shared-ts/src/signing-lanes';
2
- import type { DigestB64u } from '../../../../shared-ts/src/utils/canonicalPrimitives';
3
- import type { MpcMaterialActivationId, WalletId } from '../../../../shared-ts/src/utils/domainIds';
4
- export type SigningWorkerLaneMaterialIdentityV1<TKeyFamily extends 'ed25519' | 'ecdsa_secp256k1' = 'ed25519' | 'ecdsa_secp256k1'> = {
5
- readonly operationId: LaneOperationId;
6
- readonly enrollmentId: LaneEnrollmentId;
7
- readonly walletId: WalletId;
8
- readonly walletKeyId: WalletKeyId;
9
- readonly targetLaneId: SigningLaneId;
10
- readonly targetLaneShareEpoch: LaneShareEpoch;
11
- readonly targetMaterialActivationId: MpcMaterialActivationId;
12
- readonly keyFamily: TKeyFamily;
13
- readonly holderParticipantBindingDigestB64u: DigestB64u;
14
- readonly signingWorkerParticipantBindingDigestB64u: DigestB64u;
15
- readonly holderRecipientKeyDigestB64u: DigestB64u;
16
- readonly serverRecipientKeyDigestB64u: DigestB64u;
17
- readonly transcriptHashB64u: DigestB64u;
18
- readonly protocolCommitReceiptDigestB64u: DigestB64u;
19
- };
1
+ import type { SigningWorkerLaneMaterialIdentityV1 as SharedSigningWorkerLaneMaterialIdentityV1 } from '../../../../shared-ts/src/signing-lanes';
2
+ export type SigningWorkerLaneMaterialIdentityV1<TKeyFamily extends 'ed25519' | 'ecdsa_secp256k1' = 'ed25519' | 'ecdsa_secp256k1'> = Readonly<SharedSigningWorkerLaneMaterialIdentityV1<TKeyFamily>>;
20
3
  export type EcdsaSigningWorkerLaneMaterialIdentityV1 = SigningWorkerLaneMaterialIdentityV1<'ecdsa_secp256k1'>;
21
4
  //# sourceMappingURL=signingWorkerLaneMaterialIdentity.d.ts.map
@@ -1,14 +1,6 @@
1
- export type ThresholdEcdsaChainTarget = {
2
- kind: 'evm';
3
- namespace: 'eip155';
4
- chainId: number;
5
- networkSlug?: string;
6
- } | {
7
- kind: 'tempo';
8
- chainId: number;
9
- networkSlug?: string;
10
- };
1
+ import { thresholdEcdsaChainTargetKey, type ThresholdEcdsaChainTargetWire } from '../../../shared-ts/src/utils/thresholdEcdsaChainTarget';
2
+ export { thresholdEcdsaChainTargetKey };
3
+ export type ThresholdEcdsaChainTarget = ThresholdEcdsaChainTargetWire;
11
4
  export declare function thresholdEcdsaChainTargetFromValue(value: unknown): ThresholdEcdsaChainTarget | null;
12
- export declare function thresholdEcdsaChainTargetKey(target: ThresholdEcdsaChainTarget): string;
13
5
  export declare function thresholdEcdsaChainTargetsEqual(left: ThresholdEcdsaChainTarget, right: ThresholdEcdsaChainTarget): boolean;
14
6
  //# sourceMappingURL=thresholdEcdsaChainTarget.d.ts.map
@@ -3,7 +3,7 @@ import type { InitInput } from '../../../../wasm/near_signer/pkg/wasm_signer_wor
3
3
  import type { Logger } from './logger';
4
4
  import type { Ed25519AuthorityScope } from '../../../shared-ts/src/threshold/sessionPolicy';
5
5
  import type { RuntimePolicyScope } from '../../../shared-ts/src/threshold/signingRootScope';
6
- import type { EcdsaClientRootPublicKey33B64u, DerivationClientSharePublicKey33B64u, EcdsaDerivationRelayerPublicKey33B64u } from '../../../shared-ts/src/threshold/ecdsaDerivationRoleLocalBootstrap';
6
+ import type { EcdsaClientRootPublicKey33B64u, DerivationClientSharePublicKey33B64u, EcdsaDerivationRoleLocalPublicIdentity } from '../../../shared-ts/src/threshold/ecdsaDerivationRoleLocalBootstrap';
7
7
  import type { RouterAbEd25519NormalSigningState } from '../../../shared-ts/src/utils/signingSessionSeal';
8
8
  import type { RouterAbEcdsaDerivationNormalSigningScopeV1, RouterAbEcdsaDerivationNormalSigningStateV1 } from '../../../shared-ts/src/utils/routerAbEcdsaDerivation';
9
9
  import type { WalletAuthAuthority } from '../../../shared-ts/src/utils/walletAuthAuthority';
@@ -544,11 +544,7 @@ export type EcdsaDerivationRouteResult<T> = {
544
544
  };
545
545
  export type EcdsaDerivationRoleLocalFormatVersion = 'ecdsa-derivation-role-local';
546
546
  export type EcdsaDerivationKeyScope = 'evm-family';
547
- export interface EcdsaDerivationPublicIdentity {
548
- derivationClientSharePublicKey33B64u: DerivationClientSharePublicKey33B64u;
549
- relayerPublicKey33B64u: EcdsaDerivationRelayerPublicKey33B64u;
550
- groupPublicKey33B64u: string;
551
- ethereumAddress: string;
547
+ export interface EcdsaDerivationPublicIdentity extends EcdsaDerivationRoleLocalPublicIdentity {
552
548
  }
553
549
  export interface EcdsaDerivationClientRootProof {
554
550
  version: 'ecdsa-derivation:role-local:first-bootstrap-root-proof:v2';
@@ -0,0 +1,38 @@
1
+ import type { D1DatabaseLike, D1PreparedStatementLike, D1ResultLike } from './storage/tenantRoute';
2
+ type Mode = 'canonical_claim' | 'canonical_existing' | 'linked_claim' | 'linked_existing';
3
+ type Role = 'material' | 'claim' | 'existing';
4
+ type LocalMaterialAdmissionFault = {
5
+ readonly database: LocalMaterialAdmissionFaultDatabase;
6
+ readonly request: Request;
7
+ readonly token: string;
8
+ };
9
+ export declare function localMaterialAdmissionFault(request: Request, database: D1DatabaseLike): LocalMaterialAdmissionFault | Response | null;
10
+ /** Retire material after resolution and before one admission statement, then restore it. */
11
+ declare class LocalMaterialAdmissionFaultDatabase implements D1DatabaseLike {
12
+ private readonly base;
13
+ private readonly mode;
14
+ private scope;
15
+ private state;
16
+ constructor(base: D1DatabaseLike, mode: Mode);
17
+ prepare(query: string): D1PreparedStatementLike;
18
+ captureScope(values: readonly unknown[]): void;
19
+ batch<T = unknown>(statements: readonly D1PreparedStatementLike[]): Promise<readonly T[]>;
20
+ exec(query: string): Promise<unknown>;
21
+ first<T>(statement: FaultStatement, columnName: string | undefined): Promise<T | null>;
22
+ private shouldRetire;
23
+ private execute;
24
+ response(response: Response, token: string): Response;
25
+ private target;
26
+ }
27
+ declare class FaultStatement implements D1PreparedStatementLike {
28
+ private readonly database;
29
+ readonly inner: D1PreparedStatementLike;
30
+ readonly role: Role;
31
+ constructor(database: LocalMaterialAdmissionFaultDatabase, inner: D1PreparedStatementLike, role: Role);
32
+ bind(...values: readonly unknown[]): D1PreparedStatementLike;
33
+ first<T = unknown>(columnName?: string): Promise<T | null>;
34
+ all<T = unknown>(): Promise<D1ResultLike<T>>;
35
+ run<T = unknown>(): Promise<D1ResultLike<T>>;
36
+ }
37
+ export {};
38
+ //# sourceMappingURL=localIntendedMaterialAdmissionFault.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { type CloudflareD1GatewayEnv, type HostedWalletGatewayDependenciesV1 } from './hosted-wallet-gateway';
2
+ import type { CfExecutionContext } from './router/cloudflare/runtime/cloudflare.types';
3
+ export declare function localPresignCancellationProbe(request: Request, env: CloudflareD1GatewayEnv, ctx: CfExecutionContext, dependencies: HostedWalletGatewayDependenciesV1 | undefined): Promise<Response | null>;
4
+ //# sourceMappingURL=localIntendedPresignCancellation.d.ts.map
@@ -15,7 +15,7 @@ type PasskeyLoginOptionsRequest = {
15
15
  rp_id: string;
16
16
  ttl_ms?: number;
17
17
  };
18
- type PasskeyLoginVerifyRequest = {
18
+ export type PasskeyVerifyRequest = {
19
19
  challengeId: string;
20
20
  webauthn_authentication: WebAuthnAuthenticationCredential;
21
21
  expected_origin: string;
@@ -34,19 +34,14 @@ type GoogleLoginVerifyRequest = {
34
34
  */
35
35
  restartRegistrationOffer: boolean;
36
36
  };
37
- export type AuthPasskeyStepUpRequest = {
38
- challengeId: string;
39
- webauthn_authentication: WebAuthnAuthenticationCredential;
40
- expected_origin: string;
41
- };
42
37
  type AuthLinkIdentityRequest = {
43
38
  provider: 'google';
44
39
  idToken: string;
45
- stepUp: AuthPasskeyStepUpRequest;
40
+ stepUp: PasskeyVerifyRequest;
46
41
  };
47
42
  type AuthUnlinkIdentityRequest = {
48
43
  subject: string;
49
- stepUp: AuthPasskeyStepUpRequest;
44
+ stepUp: PasskeyVerifyRequest;
50
45
  };
51
46
  type AuthIdentityMutationRequest = {
52
47
  kind: 'link';
@@ -75,7 +70,7 @@ export declare function parsePasskeyLoginOptionsRequest(raw: unknown): AuthRoute
75
70
  export declare function parsePasskeyLoginVerifyRequest(input: {
76
71
  body: unknown;
77
72
  origin: unknown;
78
- }): AuthRouteParseResult<PasskeyLoginVerifyRequest>;
73
+ }): AuthRouteParseResult<PasskeyVerifyRequest>;
79
74
  export declare function parseGoogleLoginVerifyRequest(raw: unknown): AuthRouteParseResult<GoogleLoginVerifyRequest>;
80
75
  export declare function parseAuthIdentityMutationRequest(input: {
81
76
  pathname: unknown;
@@ -1,6 +1,8 @@
1
+ import type { D1EcdsaAdmissionPolicyRead } from '../cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore';
2
+ import type { EcdsaMaterialRead } from '../../core/d1EcdsaSignerRead';
1
3
  import type { ThresholdRuntimePolicyScope } from '../../core/types';
2
4
  import type { RouterApiAuthorizationSessionService } from '../framework/authServicePort';
3
- import type { RouterApiWalletSessionAuthorizationV2AdmissionContext, RouterApiWalletSessionExactOperationContext } from '../framework/authServicePort';
5
+ import type { RouterApiWalletSessionAuthorizationV2AdmissionContext, RouterApiWalletSessionExactOperationContext, RouterApiWalletSessionAuthorizationV2ExhaustedCandidateContext } from '../framework/authServicePort';
4
6
  import type { RouterApiProjectEnvironmentResolver, RouterApiPublishableKeyAuthAdapter } from '../framework/routerApi';
5
7
  import { type WalletSessionFailureCode } from './walletSessionFailure';
6
8
  import { type WalletSessionAuthorizationV2AdministrationAdmissionResult, type WalletSessionAuthorizationV2AdministrationOperation, type WalletSessionAuthorizationV2AdmissionResult, type WalletSessionAuthorizationV2RequestedOperation } from '../domains/signingOperations/walletExecutionAdmission';
@@ -93,11 +95,22 @@ export declare function validateRouterAbEd25519WalletSessionInputs(input: {
93
95
  }): Promise<ThresholdEd25519SessionInputs>;
94
96
  export type ThresholdEcdsaSessionInputs = {
95
97
  readonly ok: true;
98
+ readonly materialRead: EcdsaMaterialRead;
99
+ readonly policyRead: D1EcdsaAdmissionPolicyRead;
96
100
  readonly kind: 'wallet_session_operation_credential_v1';
97
101
  readonly admission: Extract<WalletSessionOperationCredentialAdmission, {
98
102
  readonly curve: 'ecdsa';
99
103
  }>;
100
104
  readonly context: RouterApiWalletSessionAuthorizationV2AdmissionContext;
105
+ readonly candidate?: never;
106
+ } | {
107
+ readonly ok: true;
108
+ readonly materialRead: EcdsaMaterialRead;
109
+ readonly policyRead: D1EcdsaAdmissionPolicyRead;
110
+ readonly kind: 'wallet_session_operation_credential_exhausted_candidate_v1';
111
+ readonly candidate: RouterApiWalletSessionAuthorizationV2ExhaustedCandidateContext;
112
+ readonly admission?: never;
113
+ readonly context?: never;
101
114
  } | AuthorizeErr;
102
115
  export declare function validateEcdsaPreprocessingSession(input: {
103
116
  readonly headers: Record<string, string | string[] | undefined>;
@@ -117,6 +130,7 @@ export declare function validateEcdsaPreprocessingSession(input: {
117
130
  }>['materialActivation'];
118
131
  }>;
119
132
  export declare function validateRouterAbEcdsaDerivationWalletSessionInputs(input: {
133
+ materialActivation: import('../../../../shared-ts/src/utils/routerAbNormalSigningIdentity').RouterAbMpcMaterialActivationRefWire;
120
134
  headers: Record<string, string | string[] | undefined>;
121
135
  authorizationSessions: RouterApiAuthorizationSessionService | null | undefined;
122
136
  nowMs?: () => number;
@@ -23,7 +23,6 @@ type D1MutationResultLike = {
23
23
  };
24
24
  export declare function parseD1NonNegativeCount(input: unknown): number;
25
25
  export declare function d1MutationChanges(result: D1MutationResultLike): number;
26
- export declare function toArrayBufferCopy(bytes: Uint8Array): ArrayBuffer;
27
26
  export declare function sha256BytesPortable(input: Uint8Array): Promise<Uint8Array>;
28
27
  export {};
29
28
  //# sourceMappingURL=d1RouterApiAuthBoundary.d.ts.map
@@ -8,6 +8,6 @@ export type CloudflareD1RouterApiAuthService = Omit<RouterApiServiceBag, 'thresh
8
8
  readonly executeSignedDelegate: (input: ExecuteSignedDelegateRequest) => Promise<ExecuteSignedDelegateResult>;
9
9
  readonly linkedDeviceEd25519AuthorityReader?: LinkedDeviceEd25519AuthorityReader;
10
10
  };
11
- type LinkedDeviceEd25519AuthorityReader = Pick<D1LinkedDeviceAuthorityInstallServiceV1, 'readInstalledEd25519AuthorityByIdentityV1' | 'readInstalledEd25519AuthorityByMaterialActivationV1' | 'readInstalledEcdsaAuthorityByMaterialActivationV1' | 'readInstalledEcdsaAuthorityChainByMaterialActivationV1'>;
11
+ type LinkedDeviceEd25519AuthorityReader = Pick<D1LinkedDeviceAuthorityInstallServiceV1, 'readInstalledEd25519AuthorityByIdentityV1' | 'readInstalledEd25519AuthorityByMaterialActivationV1' | 'readInstalledEcdsaAuthorityByMaterialActivationV1' | 'readInstalledEcdsaCustodySnapshotV1'>;
12
12
  export declare function createCloudflareD1RouterApiAuthService(input: CloudflareD1RouterApiAuthServiceOptions): CloudflareD1RouterApiAuthService;
13
13
  //# sourceMappingURL=d1RouterApiAuthService.d.ts.map
@@ -0,0 +1,9 @@
1
+ import type { AuthorizationService } from '../../../../authorization/service';
2
+ import type { RouterApiWalletSessionAuthorizationV2AdmissionContext, RouterApiWalletSessionAuthorizationV2ExhaustedCandidateContext, RouterApiWalletSessionSigningCandidate } from '../../../framework/authServicePort';
3
+ type CredentialInput = Parameters<AuthorizationService['readWalletSessionAdmissionSnapshotByOperationCredential']>[0];
4
+ type AdmissionSnapshotReader = Pick<AuthorizationService, 'readWalletSessionAdmissionSnapshotByOperationCredential'>;
5
+ export declare function readActiveWalletSessionCredential(service: AdmissionSnapshotReader, input: CredentialInput): Promise<RouterApiWalletSessionAuthorizationV2AdmissionContext | null>;
6
+ export declare function readWalletSessionSigningCandidate(service: Pick<AuthorizationService, 'readEcdsaWalletSessionAdmissionSnapshotByOperationCredential'>, input: Parameters<AuthorizationService['readEcdsaWalletSessionAdmissionSnapshotByOperationCredential']>[0]): Promise<RouterApiWalletSessionSigningCandidate | null>;
7
+ export declare function readExhaustedWalletSessionCredential(service: Pick<AuthorizationService, 'readExactWalletSessionStatusSnapshotByOperationCredential'>, input: CredentialInput): Promise<RouterApiWalletSessionAuthorizationV2ExhaustedCandidateContext | null>;
8
+ export {};
9
+ //# sourceMappingURL=walletSessionCredentialReaders.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { EcdsaMaterialReadSnapshot } from '../../../../core/ecdsaMaterialReadSnapshot';
1
2
  import type { AuthorizedOperation } from '../../../../authorization/domain';
2
3
  import type { AuthorizedOperationMaterialScope } from '../../../../authorization/service';
3
4
  import type { D1WalletStoreScope } from '../../../../core/d1WalletStore';
@@ -19,6 +20,7 @@ export declare function prepareAuthorizedOperationAdmissionRead(input: {
19
20
  readonly tenantId: TenantId;
20
21
  readonly operationFingerprintDigest: CapabilityOperationFingerprintDigest;
21
22
  readonly nowMs: number;
23
+ readonly materialSnapshot: EcdsaMaterialReadSnapshot | null;
22
24
  }): D1PreparedStatementLike;
23
25
  export declare function prepareAuthorizedOperationInsert(input: {
24
26
  readonly database: D1DatabaseLike;
@@ -26,5 +28,7 @@ export declare function prepareAuthorizedOperationInsert(input: {
26
28
  readonly walletSignerScope: D1WalletStoreScope;
27
29
  readonly operation: AuthorizedOperation;
28
30
  readonly material: AuthorizedOperationMaterialScope | null;
31
+ readonly materialSnapshot: EcdsaMaterialReadSnapshot | null;
32
+ readonly existingOperation: 'reject' | 'preserve';
29
33
  }): D1PreparedStatementLike;
30
34
  //# sourceMappingURL=authorizedOperationStatements.d.ts.map
@@ -1,4 +1,6 @@
1
- import type { EcdsaWalletSessionAdmissionInput, EcdsaWalletSessionAdmissionResult, PinnedOwnerWalletScope } from '../../../../authorization/ecdsaWalletSessionAdmission';
1
+ import type { EcdsaWalletSessionAdmissionRead } from '../../../../authorization/service';
2
+ import type { RouterAbMpcMaterialActivationRefWire } from '../../../../../../shared-ts/src/utils/routerAbNormalSigningIdentity';
3
+ import type { EcdsaWalletSessionAdmissionInput, EcdsaWalletSessionAdmissionResult, EcdsaWalletSessionResolutionResult, PinnedOwnerWalletScope } from '../../../../authorization/ecdsaWalletSessionAdmission';
2
4
  import { type MpcMaterialActivationRef, type WalletAuthorityId, type WalletAuthMethodId, type WalletId } from '../../../../../../shared-ts/src/utils/domainIds';
3
5
  import { type AuthorizedOperationId, type TenantId } from '../../../../../../shared-ts/src/authorization/capabilityKinds';
4
6
  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';
@@ -134,6 +136,12 @@ export declare class CloudflareD1AuthorizationStore implements AuthorizationSess
134
136
  readonly tokenHash: import('../../../../../../shared-ts/src/utils/canonicalPrimitives').DigestB64u;
135
137
  readonly nowMs: number;
136
138
  }): Promise<WalletSessionAdmissionSnapshotV2 | null>;
139
+ readEcdsaWalletSessionAdmissionSnapshotByOperationCredential(input: {
140
+ readonly tenantId: WalletSessionAuthorizationV2['tenantId'];
141
+ readonly tokenHash: import('../../../../../../shared-ts/src/utils/canonicalPrimitives').DigestB64u;
142
+ readonly nowMs: number;
143
+ readonly materialActivation: RouterAbMpcMaterialActivationRefWire;
144
+ }): Promise<EcdsaWalletSessionAdmissionRead | null>;
137
145
  readWalletSessionExactOperationContextByCredential(input: {
138
146
  readonly tenantId: WalletSessionAuthorizationV2['tenantId'];
139
147
  readonly tokenHash: import('../../../../../../shared-ts/src/utils/canonicalPrimitives').DigestB64u;
@@ -194,6 +202,7 @@ export declare class CloudflareD1AuthorizationStore implements AuthorizationSess
194
202
  readonly operation: AuthorizedOperationInput;
195
203
  readonly material?: AuthorizedOperationMaterialScope;
196
204
  }): Promise<AuthorizedOperationAdmissionResult>;
205
+ resolveEcdsaWalletSessionOperation(input: EcdsaWalletSessionAdmissionInput): Promise<EcdsaWalletSessionResolutionResult>;
197
206
  admitEcdsaWalletSessionOperation(input: EcdsaWalletSessionAdmissionInput): Promise<EcdsaWalletSessionAdmissionResult>;
198
207
  private admitAuthorizedOperationRecord;
199
208
  completeAuthorizedOperation(input: {
@@ -1,3 +1,6 @@
1
+ import { EcdsaMaterialReadSnapshot } from '../../../../core/ecdsaMaterialReadSnapshot';
2
+ import { type EcdsaMaterialReadSource } from '../../../../core/d1EcdsaSignerRead';
3
+ import type { WalletEcdsaSignerRecord } from '../../../../core/WalletStore';
1
4
  import type { ActiveWalletAuthorityV1 } from '../../../../../../shared-ts/src/authorization/walletAuthority';
2
5
  import { type LinkDeviceSessionId, type MpcMaterialActivationRef, type WalletAuthMethodId, type WalletAuthorityId, type WalletId } from '../../../../../../shared-ts/src/utils/domainIds';
3
6
  import { type DeviceId } from '../../../../../../shared-ts/src/authorization/capabilityKinds';
@@ -20,6 +23,11 @@ import type { AuthorizationService } from '../../../../authorization/service';
20
23
  import { type PersistedActiveWalletSessionAuthorizationV2, type IssuedWalletSessionAuthorizationV2 } from '../../../../authorization/domain';
21
24
  import { type DigestB64u } from '../../../../../../shared-ts/src/utils/canonicalPrimitives';
22
25
  import type { CloudflareD1EmailOtpRegistrationEnrollmentFinalizer } from '../emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer';
26
+ export type InstalledEcdsaCustodySnapshotV1 = {
27
+ readonly readSnapshot: EcdsaMaterialReadSnapshot;
28
+ readonly chain: readonly InstalledLinkedDeviceEcdsaAuthorityProjectionV1[];
29
+ readonly signers: readonly WalletEcdsaSignerRecord[];
30
+ };
23
31
  type ExactSigner = ExactAdministeredSignerV1;
24
32
  type ListWalletEd25519SignersV1 = (walletId: WalletId) => Promise<readonly WalletEd25519SignerRecord[]>;
25
33
  type WorkerOrdinarySignerMaterialReservationPreparationV1 = {
@@ -226,10 +234,11 @@ export declare class D1LinkedDeviceAuthorityInstallServiceV1 {
226
234
  readonly walletId: WalletId;
227
235
  readonly materialActivation: MpcMaterialActivationRef;
228
236
  }): Promise<InstalledLinkedDeviceEcdsaAuthorityProjectionV1 | null>;
229
- readInstalledEcdsaAuthorityChainByMaterialActivationV1(input: {
237
+ readInstalledEcdsaCustodySnapshotV1(input: {
238
+ readonly source: EcdsaMaterialReadSource;
230
239
  readonly walletId: WalletId;
231
240
  readonly materialActivation: MpcMaterialActivationRef;
232
- }): Promise<readonly InstalledLinkedDeviceEcdsaAuthorityProjectionV1[]>;
241
+ }): Promise<InstalledEcdsaCustodySnapshotV1 | null>;
233
242
  private readVerifiedEcdsaInstallations;
234
243
  readActivationCleanupReceiptV1(input: {
235
244
  readonly linkSessionId: LinkDeviceSessionId;
@@ -264,7 +273,15 @@ export declare class D1LinkedDeviceAuthorityInstallServiceV1 {
264
273
  private readInstallation;
265
274
  private readInstallationByAuthority;
266
275
  private readInstallationsByWallet;
276
+ private prepareInstallationsByWalletRead;
267
277
  }
278
+ export declare function parseInstalledEcdsaCustodySnapshotV1(input: {
279
+ readonly scope: D1LinkedDeviceAuthorityInstallServiceOptionsV1['scope'];
280
+ readonly walletId: WalletId;
281
+ readonly materialActivation: MpcMaterialActivationRef;
282
+ readonly installations: unknown;
283
+ readonly signers: unknown;
284
+ }): Promise<InstalledEcdsaCustodySnapshotV1 | null>;
268
285
  /**
269
286
  * The installed Ed25519 authority of a linked device, read from Gateway SQL
270
287
  * alone: a linked device approving another link names its own binding as the
@@ -5,12 +5,8 @@ import { type LinkedDeviceSessionMutationResultV1, type LinkedDeviceSessionRecor
5
5
  import { type LinkDeviceSessionId } from '../../../../../../shared-ts/src/signing-lanes/ids';
6
6
  import type { DigestB64u } from '../../../../../../shared-ts/src/utils/canonicalPrimitives';
7
7
  import type { WalletAuthorityId, WalletId } from '../../../../../../shared-ts/src/utils/domainIds';
8
- export type D1LinkedDeviceSessionScopeV1 = {
9
- readonly namespace: string;
10
- readonly orgId: string;
11
- readonly projectId: string;
12
- readonly envId: string;
13
- };
8
+ import type { D1TenantScope } from '../../../../core/d1TenantStore';
9
+ export type D1LinkedDeviceSessionScopeV1 = D1TenantScope;
14
10
  export type D1LinkedDeviceSessionStoreOptionsV1 = {
15
11
  readonly database: D1DatabaseLike;
16
12
  readonly scope: D1LinkedDeviceSessionScopeV1;
@@ -6,6 +6,7 @@ import type { LinkedDeviceSessionRecordV1 } from '../../../../core/deviceLinking
6
6
  import type { DeviceLinkingTargetCredentialProviderV1, LinkedDeviceTargetPreparationResultV1 } from '../../../../router/transport/fetch/routes/deviceLinking';
7
7
  import { type D1LinkedDeviceSessionScopeV1 } from './d1LinkedDeviceSessionStore';
8
8
  import { type VerifiedLinkSourceReadV1, type VerifiedLinkSourceReaderV1 } from './d1LinkedDeviceVerifiedLinkBuilder';
9
+ import type { ReadonlyExclusiveUnion } from '../../../../../../shared-ts/src/utils/variant';
9
10
  export type VerifiedLinkedDeviceWebAuthnCredentialV1 = {
10
11
  readonly credentialIdB64u: string;
11
12
  readonly credentialPublicKeyB64u: string;
@@ -36,15 +37,13 @@ export type VerifiedLinkedDeviceEmailOtpGrantV1 = (VerifiedLinkedDeviceEmailOtpG
36
37
  * per target factor. A Passkey commit cannot carry a grant and an Email OTP
37
38
  * commit cannot carry WebAuthn material.
38
39
  */
39
- export type VerifiedLinkedDeviceTargetFactorEvidenceV1 = {
40
+ export type VerifiedLinkedDeviceTargetFactorEvidenceV1 = ReadonlyExclusiveUnion<{
40
41
  readonly kind: 'passkey_prf';
41
42
  readonly credential: VerifiedLinkedDeviceWebAuthnCredentialV1;
42
- readonly grant?: never;
43
43
  } | {
44
44
  readonly kind: 'email_otp';
45
45
  readonly grant: VerifiedLinkedDeviceEmailOtpGrantV1;
46
- readonly credential?: never;
47
- };
46
+ }>;
48
47
  /**
49
48
  * The complete registered-target replay record. It is kept as one payload so
50
49
  * a retry can finish the session CAS without rereading mutable source state.
@@ -171,15 +170,13 @@ export declare class D1LinkedDeviceTargetCredentialProviderV1 implements DeviceL
171
170
  readonly session: LinkedDeviceSessionRecordV1;
172
171
  readonly approval: LinkedDeviceApprovalV1;
173
172
  readonly requestedAtMs: number;
174
- } & ({
173
+ } & ReadonlyExclusiveUnion<{
175
174
  readonly access: 'create_or_replay';
176
175
  readonly expectedOrigin: string;
177
176
  readonly deliveryRecipientPublicKey65B64u: string;
178
177
  } | {
179
178
  readonly access: 'replay_only';
180
- readonly expectedOrigin?: never;
181
- readonly deliveryRecipientPublicKey65B64u?: never;
182
- })): Promise<LinkedDeviceTargetPreparationResultV1>;
179
+ }>): Promise<LinkedDeviceTargetPreparationResultV1>;
183
180
  registerTargetCredentialV1(input: {
184
181
  readonly registration: LinkedDeviceTargetCredentialRegistrationV1;
185
182
  readonly preparation: LinkedDeviceTargetPreparationV1;
@@ -1,15 +1,9 @@
1
1
  import type { EmailOtpAuthStateRecord, EmailOtpWalletEnrollmentRecord } from '../../../../core/EmailOtpStores';
2
2
  import { type ScopedD1Prepare } from '../../../../core/emailOtpD1Statements';
3
3
  import type { D1PreparedStatementLike } from '../../../../storage/tenantRoute';
4
+ import type { EmailOtpAuthStateReadResult as CoreEmailOtpAuthStateReadResult } from '../../../../core/authService/emailOtpEnrollment';
4
5
  import { type EmailOtpAuthStatePatch } from './d1EmailOtpRecords';
5
- export type EmailOtpAuthStateReadResult = {
6
- readonly ok: true;
7
- readonly state: EmailOtpAuthStateRecord | null;
8
- } | {
9
- readonly ok: false;
10
- readonly code: string;
11
- readonly message: string;
12
- };
6
+ export type EmailOtpAuthStateReadResult = Readonly<CoreEmailOtpAuthStateReadResult>;
13
7
  export declare class CloudflareD1EmailOtpEnrollmentStore {
14
8
  private readonly prepare;
15
9
  constructor(input: {
@@ -1,4 +1,5 @@
1
1
  import type { ScopedD1Prepare } from '../../../../core/emailOtpD1Statements';
2
+ import type { RateLimitResult } from '../../../../core/authService/rateLimits';
2
3
  import type { EmailOtpRateLimitPolicy } from '../auth/d1RouterApiAuthConfig';
3
4
  import { type EmailOtpRateLimitScope } from './d1EmailOtpRecords';
4
5
  type EmailOtpRateLimitPolicies = {
@@ -13,15 +14,7 @@ type EmailOtpRateLimitConsumeInput = {
13
14
  readonly orgId?: string;
14
15
  readonly clientIp?: string;
15
16
  };
16
- type EmailOtpRateLimitConsumeResult = {
17
- readonly ok: true;
18
- } | {
19
- readonly ok: false;
20
- readonly code: 'rate_limited';
21
- readonly message: string;
22
- readonly retryAfterMs?: number;
23
- readonly resetAtMs?: number;
24
- };
17
+ type EmailOtpRateLimitConsumeResult = Readonly<RateLimitResult>;
25
18
  export declare class CloudflareD1EmailOtpRateLimitStore {
26
19
  private readonly prepare;
27
20
  private readonly rateLimits;
@@ -1,7 +1,8 @@
1
- import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS } from '../../../../../../shared-ts/src/utils/emailOtpDomain';
2
- import type { EmailOtpAuthStateRecord, EmailOtpChallengeOperation, EmailOtpChallengeRecord, EmailOtpGrantAction, EmailOtpGrantRecord, EmailOtpLoginChallengeOperation, EmailOtpUnlockChallengeRecord, EmailOtpWalletEnrollmentRecord } from '../../../../core/EmailOtpStores';
3
- export type EmailOtpChallengeIssueAction = typeof WALLET_EMAIL_OTP_ACTIONS.login | typeof WALLET_EMAIL_OTP_ACTIONS.registration | typeof WALLET_EMAIL_OTP_ACTIONS.recoveryBootstrap | typeof WALLET_EMAIL_OTP_ACTIONS.deviceLink;
4
- export type EmailOtpRateLimitScope = 'challenge' | 'verify' | 'grant' | 'googleRegistrationAttempt';
1
+ import { EMAIL_OTP_CHANNEL } from '../../../../../../shared-ts/src/utils/emailOtpDomain';
2
+ import type { EmailOtpAuthStateRecord, EmailOtpChallengeAction, EmailOtpChallengeOperation, EmailOtpChallengeRecord, EmailOtpGrantAction, EmailOtpGrantRecord, EmailOtpLoginChallengeOperation, EmailOtpUnlockChallengeRecord, EmailOtpWalletEnrollmentRecord } from '../../../../core/EmailOtpStores';
3
+ import type { EmailOtpRateLimitScope } from '../../../../core/authService/emailOtpConfig';
4
+ export type EmailOtpChallengeIssueAction = EmailOtpChallengeAction;
5
+ export type { EmailOtpRateLimitScope };
5
6
  export type EmailOtpAuthStatePatch = {
6
7
  readonly otpFailureCount?: number | null;
7
8
  readonly lastOtpFailureAtMs?: number | null;
@@ -183,5 +184,4 @@ export declare function emailOtpChallengePurposeIsValid(input: {
183
184
  readonly action: EmailOtpChallengeIssueAction;
184
185
  readonly operation: EmailOtpChallengeOperation;
185
186
  }): boolean;
186
- export {};
187
187
  //# sourceMappingURL=d1EmailOtpRecords.d.ts.map
@@ -1,22 +1,12 @@
1
1
  import type { EmailOtpServerSealRuntimeConfig } from '../auth/d1RouterApiAuthConfig';
2
- type EmailOtpServerSealInput = {
3
- readonly wrappedCiphertext?: unknown;
4
- };
5
- type EmailOtpServerSealResult = {
6
- readonly ok: true;
7
- readonly ciphertext: string;
8
- readonly enrollmentSealKeyVersion: string;
9
- } | {
10
- readonly ok: false;
11
- readonly code: string;
12
- readonly message: string;
13
- };
2
+ import type { EmailOtpServerSealRequest, EmailOtpServerSealResult as CoreEmailOtpServerSealResult } from '../../../../core/authService/emailOtpSeal';
3
+ type EmailOtpServerSealResult = Readonly<CoreEmailOtpServerSealResult>;
14
4
  export declare class CloudflareD1EmailOtpServerSealRuntime {
15
5
  private readonly config;
16
6
  private readonly cipherResult;
17
7
  constructor(config: EmailOtpServerSealRuntimeConfig);
18
- removeEmailOtpServerSeal(input: EmailOtpServerSealInput): Promise<EmailOtpServerSealResult>;
19
- applyEmailOtpServerSeal(input: EmailOtpServerSealInput): Promise<EmailOtpServerSealResult>;
8
+ removeEmailOtpServerSeal(input: EmailOtpServerSealRequest): Promise<EmailOtpServerSealResult>;
9
+ applyEmailOtpServerSeal(input: EmailOtpServerSealRequest): Promise<EmailOtpServerSealResult>;
20
10
  private runServerSealOperation;
21
11
  private createCipher;
22
12
  }
@@ -1,10 +1,6 @@
1
1
  import type { D1DatabaseLike, D1PreparedStatementLike } from '../../../../storage/tenantRoute';
2
- export type D1RegistrationCeremonyRecordScope = {
3
- readonly namespace: string;
4
- readonly orgId: string;
5
- readonly projectId: string;
6
- readonly envId: string;
7
- };
2
+ import type { D1TenantScope } from '../../../../core/d1TenantStore';
3
+ export type D1RegistrationCeremonyRecordScope = D1TenantScope;
8
4
  type D1RegistrationCeremonyRecordStoreOptions = {
9
5
  readonly database: D1DatabaseLike;
10
6
  readonly scope: D1RegistrationCeremonyRecordScope;
@@ -1,3 +1,6 @@
1
+ import type { EcdsaMaterialActivationReadInput } from '../../../../core/d1EcdsaSignerRead';
2
+ import type { EcdsaMaterialReadSnapshot } from '../../../../core/ecdsaMaterialReadSnapshot';
3
+ import type { InstalledEcdsaCustodySnapshotV1 } from '../deviceLinking/d1LinkedDeviceAuthorityInstallService';
1
4
  import type { VerifiedNearRegistrationContinuationV1 } from '../../../domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization';
2
5
  import { type DeviceId, type TenantId } from '../../../../../../shared-ts/src/authorization/capabilityKinds';
3
6
  import type { AuthorizationService } from '../../../../authorization/service';
@@ -55,10 +58,11 @@ type D1LinkedDeviceEd25519AuthorityReaderV1 = {
55
58
  readonly authorityId: WalletAuthorityId;
56
59
  readonly walletAuthMethodId: WalletAuthMethodId;
57
60
  }) => Promise<InstalledLinkedDeviceEcdsaAuthorityProjectionV1 | null>;
58
- readInstalledEcdsaAuthorityChainByMaterialActivationV1(input: {
61
+ readInstalledEcdsaCustodySnapshotV1(input: {
62
+ readonly source: EcdsaMaterialActivationReadInput['source'];
59
63
  readonly walletId: WalletId;
60
64
  readonly materialActivation: MpcMaterialActivationRef;
61
- }): Promise<readonly InstalledLinkedDeviceEcdsaAuthorityProjectionV1[]>;
65
+ }): Promise<InstalledEcdsaCustodySnapshotV1 | null>;
62
66
  };
63
67
  export type D1WalletRegistrationOperationPreparedV1 = {
64
68
  readonly kind: 'd1_wallet_registration_operation_prepared_v1';
@@ -176,11 +180,9 @@ export declare class CloudflareD1WalletRegistrationService {
176
180
  readonly code: 'not_found' | 'internal';
177
181
  readonly message: string;
178
182
  }>;
179
- resolveEcdsaMaterialActivation(input: {
180
- readonly walletId: string;
181
- readonly materialActivation: RouterAbMpcMaterialActivationRefWire;
182
- }): Promise<{
183
+ resolveEcdsaMaterialActivation(input: EcdsaMaterialActivationReadInput): Promise<{
183
184
  readonly ok: true;
185
+ readonly readSnapshot: EcdsaMaterialReadSnapshot;
184
186
  readonly materialActivation: RouterAbMpcMaterialActivationRefWire;
185
187
  readonly keyHandle: string;
186
188
  readonly relayerKeyId: string;
@@ -1,4 +1,4 @@
1
- import type { RuntimePolicyScope } from '../../../../../../shared-ts/src/threshold/signingRootScope';
1
+ import { type RuntimePolicyScope } from '../../../../../../shared-ts/src/threshold/signingRootScope';
2
2
  import type { D1DatabaseLike } from '../../../../storage/tenantRoute';
3
3
  import type { RouterAbNormalSigningAdmissionInput } from '../../../domains/signingOperations/routerAbNormalSigningAdmission';
4
4
  import type { RouterAbNormalSigningAbuseDecision, RouterAbNormalSigningAdmissionStore, RouterAbNormalSigningProjectPolicyDecision, RouterAbNormalSigningPolicyDecision } from '../../../domains/signingOperations/routerAbNormalSigningAdmissionCore';
@@ -21,4 +21,17 @@ export declare class CloudflareD1RouterAbNormalSigningAdmissionStore implements
21
21
  private deleteRecord;
22
22
  }
23
23
  export declare function createCloudflareD1RouterAbNormalSigningAdmissionStore(options: CloudflareD1RouterAbNormalSigningAdmissionStoreOptions): CloudflareD1RouterAbNormalSigningAdmissionStore;
24
+ export declare class D1EcdsaAdmissionPolicyRead {
25
+ #private;
26
+ private readonly database;
27
+ private readonly namespace;
28
+ private readonly walletId;
29
+ private readonly activationId;
30
+ private constructor();
31
+ static fromRows(database: D1DatabaseLike, namespace: string, walletId: string, activationId: string, rows: unknown): D1EcdsaAdmissionPolicyRead;
32
+ resolve(database: D1DatabaseLike, namespace: string, input: RouterAbNormalSigningAdmissionInput & {
33
+ readonly curve: 'ecdsa';
34
+ }): RouterAbNormalSigningPolicyDecision | null;
35
+ }
36
+ export declare const ECDSA_CREDENTIAL_POLICY_PROJECTION = "\n (WITH candidates AS (\n SELECT DISTINCT json_extract(signer.record_json, '$.runtimePolicyScope') AS scope_json\n FROM wallet_signers AS signer\n WHERE signer.namespace = session.namespace AND signer.org_id = session.org_id\n AND signer.project_id = session.project_id AND signer.env_id = session.env_id\n AND signer.wallet_id = session.wallet_id AND signer.signer_family = 'ecdsa'\n AND json_valid(signer.record_json)\n ), scopes AS (\n SELECT scope_json,\n json_extract(scope_json, '$.orgId') AS org_id,\n json_extract(scope_json, '$.projectId') AS project_id,\n json_extract(scope_json, '$.envId') AS env_id,\n json_extract(scope_json, '$.signingRootVersion') AS signing_root_version,\n json_extract(scope_json, '$.orgId') || char(31) ||\n json_extract(scope_json, '$.projectId') || char(31) ||\n json_extract(scope_json, '$.envId') || char(31) ||\n json_extract(scope_json, '$.signingRootVersion') AS project_key\n FROM candidates\n )\n SELECT json_group_array(json_object(\n 'scope_json', scopes.scope_json,\n 'project_key', project.record_key, 'project_decision', project.decision,\n 'project_retry_after_ms', project.retry_after_ms,\n 'abuse_key', abuse.record_key, 'abuse_decision', abuse.decision,\n 'abuse_retry_after_ms', abuse.retry_after_ms))\n FROM scopes\n LEFT JOIN router_ab_normal_signing_admission_records AS project\n ON project.namespace = session.namespace AND project.org_id = scopes.org_id\n AND project.project_id = scopes.project_id AND project.env_id = scopes.env_id\n AND project.signing_root_version = scopes.signing_root_version\n AND project.record_kind = 'project_policy' AND project.record_key = scopes.project_key\n LEFT JOIN router_ab_normal_signing_admission_records AS abuse\n ON abuse.namespace = session.namespace AND abuse.org_id = scopes.org_id\n AND abuse.project_id = scopes.project_id AND abuse.env_id = scopes.env_id\n AND abuse.signing_root_version = scopes.signing_root_version\n AND abuse.record_kind = 'abuse'\n AND abuse.record_key = scopes.project_key || char(31) || session.wallet_id || char(31) ||\n 'material_activation:' || ? || char(31) || 'ecdsa'\n ) AS ecdsa_policy_records_json,";
24
37
  //# sourceMappingURL=d1RouterAbNormalSigningAdmissionStore.d.ts.map