@seams/wallet-server 0.10.2 → 0.12.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 (106) hide show
  1. package/THIRD_PARTY_NOTICES.md +33 -1812
  2. package/artifact-manifest.json +28 -28
  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/scripts/start-local-role-workers.mjs +3 -0
  22. package/cloudflare-router-ab/scripts/start-local-wallet-system.mjs +3 -0
  23. package/dist/esm/cloud-host.js +7 -7
  24. package/dist/esm/core/ThresholdService/kv.js +1 -218
  25. package/dist/esm/hosted-wallet-gateway.js +1 -1
  26. package/dist/esm/index.js +3 -4
  27. package/dist/esm/localHostedWalletGatewayHandler.js +17 -11
  28. package/dist/esm/localIntendedYaoFault.js +34 -3
  29. package/dist/esm/localIntendedYaoRecoveryFault.js +19 -16
  30. package/dist/esm/localIntendedYaoSigningFault.js +31 -16
  31. package/dist/esm/router/auth/routerApiKeyAuth.js +1 -13
  32. package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthService.js +3 -3
  33. package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceOwnerAuthorizationProvider.js +1 -1
  34. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.js +1 -1
  35. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +1 -1
  36. package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.js +1 -1
  37. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.js +19 -0
  38. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +5 -5
  39. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.js +5 -2
  40. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationSetupSupport.js +7 -1
  41. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.js +29 -4
  42. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationRead.js +6 -3
  43. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +51 -29
  44. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetupExecution.js +23 -7
  45. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAddSignerFinalizeRecord.js +1 -1
  46. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAddSignerService.js +2 -2
  47. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodService.js +3 -3
  48. package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnAuthService.js +1 -1
  49. package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnRecords.js +1 -1
  50. package/dist/esm/router/cloudflare-adaptor.js +2 -3
  51. package/dist/esm/router/cloudflare.js +2470 -2515
  52. package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration.js +1 -1
  53. package/dist/esm/router/domains/walletRegistration/walletRegistrationRoutes.js +39 -32
  54. package/dist/esm/router/framework/registrationSetupDispatch.js +11 -3
  55. package/dist/esm/router/framework/routeResponses.js +1 -5
  56. package/dist/esm/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.js +1 -1
  57. package/dist/esm/router/transport/fetch/routes/passkeyCustody.js +2 -2
  58. package/dist/esm/router/transport/fetch/routes/thresholdEd25519.js +51 -24
  59. package/dist/esm/shared-ts/src/utils/validation.js +5 -1
  60. package/dist/esm/threshold/session/signingSessionSeal/guards/backends.js +2 -98
  61. package/dist/esm/threshold/session/signingSessionSeal/idempotencyBackends.js +2 -69
  62. package/dist/esm/threshold/session/signingSessionSeal/index.js +3 -4
  63. package/dist/esm/wasm/evm_crypto/pkg/evm_crypto_bg.wasm +0 -0
  64. package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
  65. package/dist/esm/wasm/shamir3pass_runtime/pkg/shamir3pass_runtime_bg.wasm +0 -0
  66. package/dist/types/wallet-server/src/cloud-host.d.ts +1 -0
  67. package/dist/types/wallet-server/src/core/ThresholdService/kv.d.ts +0 -29
  68. package/dist/types/wallet-server/src/localHostedWalletGatewayHandler.d.ts +1 -1
  69. package/dist/types/wallet-server/src/localIntendedYaoFault.d.ts +13 -3
  70. package/dist/types/wallet-server/src/localIntendedYaoRecoveryFault.d.ts +4 -2
  71. package/dist/types/wallet-server/src/localIntendedYaoSigningFault.d.ts +4 -2
  72. package/dist/types/wallet-server/src/router/auth/routerApiKeyAuth.d.ts +0 -8
  73. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.d.ts +2 -0
  74. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.d.ts +1 -0
  75. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationSetupSupport.d.ts +2 -0
  76. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.d.ts +25 -5
  77. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationRead.d.ts +15 -0
  78. package/dist/types/wallet-server/src/router/cloudflare-adaptor.d.ts +1 -3
  79. package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationInputs.d.ts +2 -0
  80. package/dist/types/wallet-server/src/router/framework/routeResponses.d.ts +0 -2
  81. package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/guards/backends.d.ts +1 -16
  82. package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/idempotencyBackends.d.ts +1 -16
  83. package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/index.d.ts +5 -6
  84. package/package.json +2 -9
  85. package/src/README.md +5 -3
  86. package/dist/esm/router/cloudflare/runtime/createSelfHostedCloudflareSigningWorker.js +0 -93
  87. package/dist/esm/router/express-adaptor.js +0 -84
  88. package/dist/esm/router/express.js +0 -26400
  89. package/dist/esm/router/node/nodeHostedWalletGateway.js +0 -64
  90. package/dist/esm/router/node/nodeHostedWalletGatewayCheck.js +0 -163
  91. package/dist/esm/router/node/nodeHostedWalletGatewayMain.js +0 -120
  92. package/dist/esm/router/node/nodeHttp.js +0 -79
  93. package/dist/esm/router/node/nodeSqlite.js +0 -43
  94. package/dist/esm/router/node/signerSqlMigrations.js +0 -48
  95. package/dist/esm/storage/syncSqlite.js +0 -79
  96. package/dist/esm/threshold/session/signingSessionSeal/transport/express.js +0 -75
  97. package/dist/types/wallet-server/src/router/cloudflare/runtime/createSelfHostedCloudflareSigningWorker.d.ts +0 -23
  98. package/dist/types/wallet-server/src/router/express-adaptor.d.ts +0 -22
  99. package/dist/types/wallet-server/src/router/node/nodeHostedWalletGateway.d.ts +0 -34
  100. package/dist/types/wallet-server/src/router/node/nodeHostedWalletGatewayCheck.d.ts +0 -21
  101. package/dist/types/wallet-server/src/router/node/nodeHostedWalletGatewayMain.d.ts +0 -2
  102. package/dist/types/wallet-server/src/router/node/nodeHttp.d.ts +0 -13
  103. package/dist/types/wallet-server/src/router/node/nodeSqlite.d.ts +0 -22
  104. package/dist/types/wallet-server/src/router/node/signerSqlMigrations.d.ts +0 -20
  105. package/dist/types/wallet-server/src/storage/syncSqlite.d.ts +0 -28
  106. package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/transport/express.d.ts +0 -12
@@ -26,12 +26,15 @@ import { RouterAbEcdsaPresignRuntime, parseRouterAbEcdsaPresignRuntimeConfig } f
26
26
  import { registrationPreparationIdFromString } from "./core/types.js";
27
27
  import { ActionType } from "./shared-ts/src/near/actions.js";
28
28
  import { enforceDelegatePolicy, executeSignedDelegateWithRelayer, normalizeHashToBytes, validateDelegateExpiryAndNonce } from "./delegateAction/index.js";
29
+ import { parseWalletRegistrationSetupReservation, proposeWalletRegistrationSetup, walletRegistrationSetupRequestDigest } from "./router/domains/walletRegistration/walletRegistrationReservation.js";
30
+ import { LocalRegistrationSetupAuthority } from "./localRegistrationSetupAuthority.js";
29
31
  import { createWalletRegistrationContextResolver, unavailableRegistrationContext, walletRegistrationContext } from "./router/auth/walletRegistrationContext.js";
30
- import { extractBearerCredential, extractRouterApiEnvironmentId, normalizeSourceIp, resolveRequestOriginRateLimitKeyFromExpressRequest, resolveRequestOriginRateLimitKeyFromFetchHeaders, resolveSourceIpFromExpressRequest, resolveSourceIpFromFetchHeaders } from "./router/auth/routerApiKeyAuth.js";
32
+ import { ROUTER_AB_TRACE_ID_HEADER_V1 } from "./shared-ts/src/utils/routerAbTraceContext.js";
33
+ import { createRouterAbEcdsaEd25519CeremonyTokenIssuer, createRouterAbEcdsaStrictPostRegistrationPort, createRouterAbEcdsaStrictRegistrationPort, parseRouterAbEcdsaEd25519PrivateJwk, parseRouterAbEcdsaStrictRegistrationTopology, parseStoredRouterAbEcdsaPendingActivationV1, routerAbEcdsaStrictRegistrationFactsBindingJson, routerAbEcdsaStrictRegistrationRequestBindingJson, routerAbEcdsaStrictRegistrationRequestMatchesFacts } from "./router/domains/ecdsa/routerAbEcdsaStrictRegistration.js";
34
+ import { extractBearerCredential, extractRouterApiEnvironmentId, normalizeSourceIp, resolveRequestOriginRateLimitKeyFromFetchHeaders, resolveSourceIpFromFetchHeaders } from "./router/auth/routerApiKeyAuth.js";
31
35
  import { publishableKeyRoutePrincipal, resolvePublishableKeyApiCredentialAuth, resolveSecretKeyApiCredentialAuth, resolveWalletRegistrationContext } from "./router/auth/routerApiCredentialAuth.js";
32
36
  import { enforceRoutePolicy } from "./router/framework/enforceRoutePolicy.js";
33
- import { routeError, routeJson, sendExpressRouteResponse, toFetchRouteResponse } from "./router/framework/routeResponses.js";
34
- import { ROUTER_AB_TRACE_ID_HEADER_V1 } from "./shared-ts/src/utils/routerAbTraceContext.js";
37
+ import { routeError, routeJson, toFetchRouteResponse } from "./router/framework/routeResponses.js";
35
38
  import { parseWalletRegistrationSetupRequest } from "./router/domains/walletRegistration/walletRegistrationRoutes.js";
36
39
  import { applyRouteMetering } from "./router/framework/applyRouteMetering.js";
37
40
  import { InMemoryRouterAbNormalSigningAdmissionStore, abusePrincipalKey, createInMemoryRouterAbNormalSigningAdmissionAdapter, createInMemoryRouterAbNormalSigningAdmissionStore, createRouterAbNormalSigningAdmissionAdapter, runtimePolicyScopeKey } from "./router/domains/signingOperations/routerAbNormalSigningAdmissionCore.js";
@@ -84,7 +87,6 @@ import { buildRouterAbEd25519YaoAddSignerAdmissionRequestV1, buildRouterAbEd2551
84
87
  import { RouterAbEd25519YaoHttpRegistrationBackend, createRouterAbEd25519YaoHttpRegistrationBackendFromEnv, parseRouterAbEd25519YaoActivationKeysetFromEnvV1, parseRouterAbEd25519YaoRegistrationRouterAnswerV1 } from "./router/domains/ed25519Yao/registration/routerAbEd25519YaoHttpRegistrationBackend.js";
85
88
  import { StaticCloudflareTenantStorageRouteResolver, createCloudflareTenantStorageRoute, createSignerD1DoStorageTarget, createStaticCloudflareTenantStorageRouteResolver, createStaticCloudflareTenantStorageRouteResolverFromBindings, tenantStorageRouteBackendFamily, tenantStorageRouteDiagnostic } from "./storage/tenantRoute.js";
86
89
  import { createInMemoryRouterApiRuntimeSnapshotConsumer, validateRuntimeSnapshotExpectation } from "./router/framework/runtimeSnapshotConsumer.js";
87
- import { createSelfHostedCloudflareSigningRouter, createSelfHostedCloudflareSigningWorker } from "./router/cloudflare/runtime/createSelfHostedCloudflareSigningWorker.js";
88
90
  import { CloudflareDurableObjectVersionedJsonRecordStore, CloudflareVersionedJsonRecordStoreError, createCloudflareDurableObjectVersionedJsonRecordStore } from "./router/cloudflare/durableObjects/versionedJsonRecordStore.js";
89
91
  import { CloudflareD1VersionedJsonRecordStore, CloudflareD1VersionedJsonRecordStoreError, createCloudflareD1VersionedJsonRecordStore } from "./router/cloudflare/d1/versionedJson/d1VersionedJsonRecordStore.js";
90
92
  import { createRouterAbEd25519YaoCeremonyStateStoreV1, encodeRouterAbEd25519YaoProductRegistrationStateV1, parseRouterAbEd25519YaoCeremonyKeyV1, parseRouterAbEd25519YaoProductRegistrationStateJsonV1, resolveRouterAbEd25519YaoCeremonyKeyFromRequestV1 } from "./router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPersistence.js";
@@ -103,12 +105,10 @@ import { CloudflareD1OidcJwksCache, parseBooleanJwtClaim, parseCacheControlMaxAg
103
105
  import { createSigningSessionSealOptions, parseSigningSessionSealRootConfig } from "./threshold/session/signingSessionSeal/options.js";
104
106
  import { normalizeD1RouterApiAuthOptions, normalizeLinkedDevicePasskeyTargetConfigurationV1, parseBooleanFlag, requireD1RouterApiAuthScopeString } from "./router/cloudflare/d1/auth/d1RouterApiAuthConfig.js";
105
107
  import { decodeJsonRpcEnvelope } from "./shared-ts/src/utils/jsonRpc.js";
106
- import { createRouterAbEcdsaEd25519CeremonyTokenIssuer, createRouterAbEcdsaStrictPostRegistrationPort, createRouterAbEcdsaStrictRegistrationPort, parseRouterAbEcdsaEd25519PrivateJwk, parseRouterAbEcdsaStrictRegistrationTopology, parseStoredRouterAbEcdsaPendingActivationV1, routerAbEcdsaStrictRegistrationFactsBindingJson, routerAbEcdsaStrictRegistrationRequestBindingJson, routerAbEcdsaStrictRegistrationRequestMatchesFacts } from "./router/domains/ecdsa/routerAbEcdsaStrictRegistration.js";
107
108
  import { parseGoogleEmailOtpRegistrationAttemptRecord, parseGoogleEmailOtpRegistrationOfferCandidates, requireRuntimePolicyScope } from "./router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationRecords.js";
108
109
  import { CloudflareD1GoogleEmailOtpRegistrationAttemptStore } from "./router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationAttemptStore.js";
109
110
  import { D1IdentityStore } from "./core/d1IdentityStore.js";
110
111
  import { verifyGoogleOidcToken } from "./router/cloudflare/d1/oidc/googleOidcToken.js";
111
- import { parseWalletRegistrationSetupReservation, proposeWalletRegistrationSetup, walletRegistrationSetupRequestDigest } from "./router/domains/walletRegistration/walletRegistrationReservation.js";
112
112
  import { D1LinkedDeviceEd25519ExportRootStoreV1 } from "./router/cloudflare/d1/deviceLinking/d1LinkedDeviceEd25519ExportRootStore.js";
113
113
  import { D1LinkedDeviceRequestProofNonceStoreV1 } from "./router/cloudflare/d1/deviceLinking/d1LinkedDeviceRequestProofNonceStore.js";
114
114
  import { createD1LinkedDeviceSessionServiceV1 } from "./router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionService.js";
@@ -131,4 +131,4 @@ import { handleRouterAbEd25519YaoRecoveryRequestScopedCloudflareV1 } from "./rou
131
131
  import { RouterAbEd25519YaoRecoveryWalletSessionAuthorizationAdapter } from "./router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryWalletSessionAuthorization.js";
132
132
  import { keccak256Bytes } from "./shared-ts/src/utils/keccak.js";
133
133
  import { decodeEvmBlockHeader, decodeEvmTransactionByHash, decodeEvmTransactionCall, decodeEvmTransactionReceipt, parseRpcHexQuantity } from "./shared-ts/src/utils/evmRpcResults.js";
134
- export { API_CREDENTIAL_ROUTE_SCOPES, API_CREDENTIAL_TYPES, ActionType, CLOUDFLARE_ROUTER_ED25519_YAO_SOURCE_PRESERVING_EXECUTE_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ECDSA_ACTIVATE_RESERVATION_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ECDSA_DEACTIVATE_RESERVATION_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ECDSA_RESERVE_INACTIVE_SOURCE_PRESERVING_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_ACTIVATE_RESERVATION_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_DEACTIVATE_RESERVATION_PATH_V1, CloudflareD1AuthorizationStore, CloudflareD1GoogleEmailOtpRegistrationAttemptStore, CloudflareD1OidcJwksCache, CloudflareD1RouterAbEd25519YaoCapabilityPersistence, CloudflareD1RouterAbNormalSigningAdmissionStore, CloudflareD1VaultProxyStore, CloudflareD1VersionedJsonRecordStore, CloudflareD1VersionedJsonRecordStoreError, CloudflareD1WebAuthnAuthService, CloudflareD1WebAuthnStore, CloudflareDurableObjectVersionedJsonRecordStore, CloudflareOrdinaryInactiveSignerMaterialDeactivationWorkerV1, CloudflareOrdinaryInactiveSignerMaterialReservationWorkerV1, CloudflareVersionedJsonRecordStoreError, CrossSiteSessionCookieAdapter, D1IdentityStore, D1LinkedDeviceAuthorityInstallServiceV1, D1LinkedDeviceEd25519ExportRootStoreV1, D1LinkedDeviceRequestProofNonceStoreV1, D1LinkedDeviceSessionStoreV1, D1LinkedDeviceSourceContributionPreparationPlannerV1, D1LinkedDeviceTargetAuthenticatorStoreV1, D1LinkedDeviceTargetCredentialProviderV1, D1LinkedDeviceTargetPlannerV1, D1WalletAuthMethodStore, D1WalletObjectAddresses, D1WalletStore, D1_BATCH_CAS_GUARD_SQL, DEFAULT_SESSION_COOKIE_NAME, DEFAULT_WALLET_CONSOLE_SIGNED_DELEGATE_ROUTE_V1, DEFAULT_WALLET_CONSOLE_SPONSORED_EVM_CALL_ROUTE_V1, DEFAULT_WALLET_SESSION_REMAINING_USES, DEFAULT_WALLET_SESSION_TTL_MS, ED25519_SIGNER_ACTIVATION_ID_PATH, InMemoryRouterAbEd25519YaoExportService, InMemoryRouterAbEd25519YaoExportStateV1, InMemoryRouterAbEd25519YaoRegistrationIntentAuthorizationAdapter, InMemoryRouterAbEd25519YaoRegistrationService, InMemoryRouterAbNormalSigningAdmissionStore, LINKED_DEVICE_OWNER_AUTHORIZATION_PATH_V1, LinkedDeviceRetiredTargetRegistrationShapeErrorV1, LinkedDeviceSourceFamilyUnavailableErrorV1, LinkedDeviceWebAuthnRegistrationVerifierV1, MAX_WALLET_SESSION_REMAINING_USES, MAX_WALLET_SESSION_TTL_MS, PUBLIC_PROOF_TYPES, ROUTER_AB_ECDSA_DERIVATION_PRIVATE_SIGNING_PATHS, ROUTER_AB_ED25519_PRIVATE_SIGNING_PATHS, ROUTER_AB_ED25519_YAO_CAPABILITY_REPLACEMENT_TABLE_V1, ROUTER_AB_ED25519_YAO_EXPORT_ADMISSION_PATH_V1, ROUTER_AB_ED25519_YAO_EXPORT_EXECUTE_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_ACTIVATE_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_ADMISSION_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_EXECUTE_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_STATUS_PATH_V1, ROUTER_AB_ED25519_YAO_REGISTRATION_ADMISSION_PATH_V1, ROUTER_AB_ED25519_YAO_REGISTRATION_EXECUTE_PATH_V1, ROUTER_AB_ED25519_YAO_SHARED_STATE_RECORD_KEY_V1, ROUTER_AB_ED25519_YAO_WARM_RECOVERY_BOOTSTRAP_PATH_V1, ROUTER_AB_MPC_ROUTER_ORIGIN, ROUTER_AB_PUBLIC_KEYSET_PATH, ROUTER_AB_PUBLIC_KEYSET_VERSION_V2, ROUTER_AB_PUBLIC_KEYSET_WELL_KNOWN_PATH, ROUTER_AB_SIGNING_WORKER_ORIGIN, ROUTER_AB_TRACE_ID_HEADER_V1, ROUTER_API_CREDENTIAL_SCOPES, ROUTE_SERVICE_KEYS, RouterAbEcdsaPresignRuntime, RouterAbEd25519YaoExportOwnerProofAuthorizationAdapter, RouterAbEd25519YaoHttpRegistrationBackend, RouterAbEd25519YaoRecoveryWalletSessionAuthorizationAdapter, SESSION_CAS_GUARD_SQL, SessionService, StaticCloudflareTenantStorageRouteResolver, UnavailableOrdinaryInactiveSignerMaterialDeactivationWorkerV1, UnavailableOrdinaryInactiveSignerMaterialReservationWorkerV1, WALLET_AUTH_METHOD_D1_STORE, WALLET_AUTH_METHOD_STORE_D1_SCHEMA_SQL, WALLET_AUTH_METHOD_STORE_D1_SCHEMA_V2_SQL, WALLET_CONSOLE_API_WALLET_DETAIL_PREFIX_V1, WALLET_CONSOLE_OPS_BASE_PATH_V1, WALLET_CONSOLE_OP_PATHS_V1, WALLET_CONSOLE_SERVICE_ORIGIN_V1, WALLET_CONSOLE_SIGNED_DELEGATE_ROUTE_ID_V1, WALLET_CONSOLE_SPONSORED_EVM_CALL_ROUTE_ID_V1, WALLET_CONTROL_AUTH_MARKER_V1, WALLET_CONTROL_BASE_PATH_V1, WALLET_CONTROL_SERVICE_ORIGIN_V1, WALLET_RUNTIME_OPS_BASE_PATH_V1, WALLET_RUNTIME_OP_PATHS_V1, WALLET_RUNTIME_SERVICE_ORIGIN_V1, WALLET_STORE_D1_SCHEMA_SQL, WalletHomeCustodyBinding, WalletLifecycleLocator, WalletObjectAddressSnapshot, WalletPlacementRoutes, abusePrincipalKey, addSecp256k1PublicKeys33, admitD1EstablishedWalletHome, admitRouterAbEcdsaReusableWalletSessionOperation, applyRouteMetering, assertUniqueRouterApiRouteDefinitions, authenticateDeviceLinkingOwnerWalletSessionRequestV1, authenticateRouterAbEcdsaOperationStepUp, authenticateRouterAbWalletOperationStepUp, authenticateRouterAbWalletOperationStepUpIdentity, authorizeRouterAbEcdsaDerivationNormalSigningRoute, authorizeRouterAbEd25519NormalSigningRoute, base64UrlDecode, base64UrlEncode, bindWalletAuthMethodIdentity, bindWalletAuthMethodIdentityV2, buildCorsOrigins, buildRouterAbEcdsaDerivationPrivateSigningWorkerBody, buildRouterAbEcdsaOwnerOperationStepUpPreparation, buildRouterAbEd25519OwnerOperationStepUpPreparation, buildRouterAbEd25519PrivateSigningWorkerBody, buildRouterAbEd25519YaoAddSignerAdmissionRequestV1, buildRouterAbEd25519YaoProductAdmissionRequestV1, buildTenantRootIdentityFromAuthenticatedDeploymentV1, buildVerifiedLinkInputV1, buildVerifiedTargetFactorV1, buildWalletEcdsaSignerRecord, claimRouterAbEcdsaOperationStepUp, coerceLogger, coerceRouterLogger, completeRouterAbEcdsaOperation, computeEip1559TxHash, computeLinkedDeviceSessionClaimDigestV1, computeRouterAbEd25519NormalSigningAdmissionMaterial, computeVerifiedTargetFactorVerificationDigestV1, createCloudflareD1RouterAbNormalSigningAdmissionStore, createCloudflareD1RouterApiAuthService, createCloudflareD1VersionedJsonRecordStore, createCloudflareDurableObjectVersionedJsonRecordStore, createCloudflareLinkedDeviceEd25519SourcePreservingRouterEndpointV1, createCloudflareOrdinaryInactiveSignerMaterialActivationEndpointV1, createCloudflareOrdinaryInactiveSignerMaterialActivationPortV1, createCloudflareOrdinaryInactiveSignerMaterialDeactivationEndpointV1, createCloudflareOrdinaryInactiveSignerMaterialDeactivationPortV1, createCloudflareOrdinaryInactiveSignerMaterialReservationEndpointV1, createCloudflareOrdinaryInactiveSignerMaterialReservationServiceV1, createCloudflareRouter, createCloudflareTenantStorageRoute, createCloudflareWalletGatewayRouterV1, createD1LinkedDeviceOwnerAuthorizationMetadataSourceV1, createD1LinkedDeviceOwnerAuthorizationProviderV1, createD1LinkedDeviceOwnerSourceChildReaderV1, createD1LinkedDeviceRouteServiceV1, createD1LinkedDeviceSessionServiceV1, createD1LinkedDeviceSourceContributionPreparationPlannerV1, createD1LinkedDeviceVerifiedLinkSourceReaderV1, createDeviceLinkingOwnerRequestAuthenticatorV1, createEd25519SessionAdapter, createInMemoryRouterAbNormalSigningAdmissionAdapter, createInMemoryRouterAbNormalSigningAdmissionStore, createInMemoryRouterApiRuntimeSnapshotConsumer, createRouterAbEcdsaEd25519CeremonyTokenIssuer, createRouterAbEcdsaStrictPostRegistrationPort, createRouterAbEcdsaStrictRegistrationPort, createRouterAbEd25519YaoCeremonyStateStoreV1, createRouterAbEd25519YaoExportModule, createRouterAbEd25519YaoHttpRegistrationBackendFromEnv, createRouterAbEd25519YaoMaterialActivationRefV1, createRouterAbEd25519YaoProductRegistrationCompositionFromPortsV1, createRouterAbEd25519YaoProductRegistrationPartitionedStateStoreFromD1V1, createRouterAbEd25519YaoProductRegistrationPartitionedStateStoreV1, createRouterAbEd25519YaoProductRegistrationRequestScopedRuntimeV1, createRouterAbEd25519YaoProductRegistrationRuntimeV1, createRouterAbEd25519YaoProductRegistrationStateFromPartsV1, createRouterAbEd25519YaoProductRegistrationStateV1, createRouterAbEd25519YaoRegistrationModule, createRouterAbNormalSigningAdmissionAdapter, createRouterAbServiceBindingFetch, createRouterApiModule, createRouterApiRouteDefinitions, createSelfHostedCloudflareSigningRouter, createSelfHostedCloudflareSigningWorker, createSignerD1DoStorageTarget, createSigningSessionSealOptions, createStaticCloudflareTenantStorageRouteResolver, createStaticCloudflareTenantStorageRouteResolverFromBindings, createStaticWalletConsoleBindingV1, createUnavailableOrdinaryInactiveSignerMaterialDeactivationPortV1, createUnavailableOrdinaryInactiveSignerMaterialReservationWorkerV1, createWalletConsoleOpsClient, createWalletConsoleRelayProxyExtensionV1, createWalletControlClientBindings, createWalletRegistrationContextResolver, createWalletRuntimeOpsHandler, d1ChangedRows, d1Integer, d1Number, decideRouterAbEcdsaOwnerOperationAuthorization, decideRouterAbEd25519OwnerOperationAuthorization, decodeEvmBlockHeader, decodeEvmTransactionByHash, decodeEvmTransactionCall, decodeEvmTransactionReceipt, decodeJsonRpcEnvelope, decodeWalletConsoleTenantRootActiveLineageRequestV1, decodeWalletConsoleTenantRootActiveLineageResponseV1, defineRoute, defineRouteExtension, deriveJwtExpiresAtIso, deriveRecoveryCodeLocatorV1FromBytes, digestOpaqueValue, encodeEip1559SignedTxFromSignature65, encodeRouterAbEd25519YaoProductRegistrationPartitionRecordV1, encodeRouterAbEd25519YaoProductRegistrationStateV1, encodeSessionJsonSegment, encodeTenantRootIdentityV1, enforceDelegatePolicy, enforceRoutePolicy, ensureEvmCryptoWasm, ensureLeadingSlash, ensureWalletAuthMethodStoreD1Schema, ensureWalletStoreD1Schema, evaluateRouterAbNormalSigningAdmission, executeRouterAbEd25519YaoAdmittedRegistrationV1, executeSignedDelegateWithRelayer, extractBearerCredential, extractRouterApiEnvironmentId, findRouteDefinitionById, findRouteDefinitionForRequest, formatD1ExecStatement, getRouterApiRouteExtensionDefinitions, getRouterApiRouteExtensionRoutes, getRouterApiRouteExtensionsForTransport, handleRouterAbEcdsaDerivationNormalSigningRouteCore, handleRouterAbEd25519YaoExportRequestScopedCloudflareV1, handleRouterAbEd25519YaoRecoveryRequestScopedCloudflareV1, handleRouterAbEd25519YaoRegistrationRequestScopedCloudflareV1, handleStaticWalletConsoleRequestV1, handleWalletControlRequest, headersToRecord, isD1DatabaseLike, isObject, isPlainObject, json, jsonFailure, keccak256Bytes, linkedDeviceSignerManifestsEqualV1, linkedDeviceX25519RecipientPublicKeyB64uV1, loadCloudflareSignerWasmModule, matchesRouteDefinitionRequest, mergeRouterAbEd25519YaoProductRegistrationStatePartitionV1, mintRouterAbEd25519YaoRegistrationIdentityV1, normalizeBoundedPositiveInteger, normalizeCorsOrigin, normalizeD1RouterApiAuthOptions, normalizeHashToBytes, normalizeLinkedDevicePasskeyTargetConfigurationV1, normalizeLogger, normalizeLowercaseString, normalizeSessionString, normalizeSessionTtlSeconds, normalizeSourceIp, normalizeTrimmedString, normalizeWalletAuthMethod, normalizeWalletAuthMethodV2, parseBooleanFlag, parseBooleanJwtClaim, parseCacheControlMaxAgeSec, parseCsvList, parseD1JsonArrayColumn, parseD1JsonColumn, parseD1JsonObjectColumn, parseD1LinkedDeviceSessionRowV1, parseD1LinkedDeviceSessionTranscriptRowV1, parseGoogleEmailOtpRegistrationAttemptRecord, parseGoogleEmailOtpRegistrationOfferCandidates, parseGoogleJwks, parseGoogleLoginVerifyRequest, parseInstalledEcdsaCustodySnapshotV1, parseJwtAud, parseLinkedDeviceSessionRecordV1, parseOrgId, parseRecoveryCodeLocatorV1, parseRouterAbEcdsaEd25519PrivateJwk, parseRouterAbEcdsaPresignRuntimeConfig, parseRouterAbEcdsaStrictRegistrationTopology, parseRouterAbEd25519NormalSigningScopeV2, parseRouterAbEd25519OperationStepUpScope, parseRouterAbEd25519YaoActivationKeysetFromEnvV1, parseRouterAbEd25519YaoCeremonyKeyV1, parseRouterAbEd25519YaoExportAdmissionEnvelopeV1, parseRouterAbEd25519YaoExportExecuteEnvelopeV1, parseRouterAbEd25519YaoProductRegistrationPartitionRecordJsonV1, parseRouterAbEd25519YaoProductRegistrationPartitionRecordV1, parseRouterAbEd25519YaoProductRegistrationStateJsonV1, parseRouterAbEd25519YaoProductRegistrationStateV1, parseRouterAbEd25519YaoRegistrationAdmissionReadV1, parseRouterAbEd25519YaoRegistrationRouterAnswerV1, parseRouterAbEd25519YaoTenantRootWireV1, parseRouterAbOperationStepUpOperation, parseRouterAbPublicKeysetV2, parseRpcHexQuantity, parseRs256JwtForVerification, parseSessionJwt, parseSigningSessionSealRootConfig, parseStaticWalletConsoleBindingConfigV1, parseStoredRouterAbEcdsaPendingActivationV1, parseWalletEd25519SignerRecord, parseWalletId, parseWalletRecoveryOperationId, parseWalletRegistrationContextResponse, parseWalletRegistrationSetupRequest, parseWalletRegistrationSetupReservation, parseWalletRuntimeExecuteSignedDelegateRequest, parseWalletRuntimeExecuteSignedDelegateResponse, parseWalletRuntimeExecuteSignedDelegateResult, parseWalletRuntimeRelayerAccount, parseWalletRuntimeWalletIdentitiesResult, parseWalletRuntimeWalletIdentityRequest, parseWebAuthnRpId, parseWebAuthnSyncChallengeRecord, partitionRouterAbEd25519YaoProductRegistrationStateV1, postRouterAbSigningWorkerJson, prepareD1TenantStatement, prepareD1WalletAuthMethodInsertStatement, prepareD1WalletAuthMethodPutStatement, prepareD1WalletAuthMethodV2PutStatement, prepareD1WalletPutSignerStatement, prepareD1WalletPutSubjectStatement, prepareD1WebAuthnAuthenticatorInsertStatement, prepareD1WebAuthnAuthenticatorPutStatement, projectRouterAbEd25519YaoExactWalletSession, proposeWalletRegistrationSetup, publishableKeyRoutePrincipal, queryD1All, queryD1One, randomTenantRootCreationGrantBytesV1, readD1LinkedDeviceEcdsaSourceV1, readD1LinkedDeviceEd25519SourceV1, readEnvironmentCsv, readEnvironmentString, readJson, registrationPreparationIdFromString, requireD1RouterApiAuthScopeString, requireEnvironmentString, requireNormalizedSessionString, requireRuntimePolicyScope, resolveFreshRouterAbEcdsaMaterialActivation, resolvePublishableKeyApiCredentialAuth, resolveRequestOriginRateLimitKeyFromExpressRequest, resolveRequestOriginRateLimitKeyFromFetchHeaders, resolveRouterAbEd25519YaoCeremonyKeyFromRequestV1, resolveRuntimeTenantRootLineage, resolveSecretKeyApiCredentialAuth, resolveSourceIpFromExpressRequest, resolveSourceIpFromFetchHeaders, resolveWalletRegistrationContext, routeError, routeJson, routerAbEcdsaAtomicAuthorizationConfigured, routerAbEcdsaOperationInProgressResult, routerAbEcdsaOwnerOperationFailureResult, routerAbEcdsaRecordedResponse, routerAbEcdsaReplayHttpResponse, routerAbEcdsaReplayResult, routerAbEcdsaReplayUnavailableResult, routerAbEcdsaStrictRegistrationFactsBindingJson, routerAbEcdsaStrictRegistrationRequestBindingJson, routerAbEcdsaStrictRegistrationRequestMatchesFacts, routerAbEd25519OwnerOperationFailureResult, routerAbEd25519YaoAdmittedRegistrationAuthorityV1, routerAbEd25519YaoPartitionedStateAfterStoredCommitV1, routerAbEd25519YaoPersistedCapabilityMatchesLookupV1, routerAbEd25519YaoRegistrationExecutionTimingEntriesV1, routerAbEd25519YaoRegistrationSigningRootIdV1, routerAbEd25519YaoTenantRootWireV1, runRouterAbEd25519YaoProductRegistrationRequestScopedV1, runRouterAbEd25519YaoRegistrationSideEffectV1, runRouterAbEd25519YaoRegistrationTwoPhaseV1, runRouterAbPrewarmScheduledV1, runtimePolicyScopeKey, sameRouterAbEd25519YaoSharedStateCanonicalEncodingV1, secp256k1PrivateKey32ToPublicKey33, secp256k1PublicKey33ToEthereumAddress, secureRandomBase36, secureRandomBase64Url, selectWalletEd25519Signer, sendExpressRouteResponse, sessionJwtTimeClaims, sha256Bytes, sha256BytesSync, signSecp256k1Recoverable, signTenantRootCreationGrantV1, tenantRootIdentityDigestB64uV1, tenantStorageRouteBackendFamily, tenantStorageRouteDiagnostic, toFetchRouteResponse, normalizeOptionalTrimmedString as toOptionalTrimmedString, toResponse, toSessionArrayBufferCopy, unavailableRegistrationContext, validateDelegateExpiryAndNonce, validateGoogleIdTokenClaims, validateRuntimeSnapshotExpectation, validateSecp256k1PublicKey33, verifyGoogleOidcToken, verifyRs256JwtSignature, verifySecp256k1Bip340SignatureAgainstPublicKey33, verifySecp256k1RecoverableSignatureAgainstPublicKey33, walletAuthMethodId, walletAuthMethodV2Id, walletConsoleApiWalletGetRouteDefinitionV1, walletConsoleApiWalletListRouteDefinitionV1, walletConsoleApiWalletSearchRouteDefinitionV1, walletConsoleRelayRouteDefinitionsV1, walletConsoleSignedDelegateRouteDefinitionV1, walletConsoleSponsoredEvmCallRouteDefinitionV1, walletObjectIdentity, walletRegistrationContext, walletRegistrationSetupRequestDigest, webAuthnCredentialIdB64uFromCredential, withCors };
134
+ export { API_CREDENTIAL_ROUTE_SCOPES, API_CREDENTIAL_TYPES, ActionType, CLOUDFLARE_ROUTER_ED25519_YAO_SOURCE_PRESERVING_EXECUTE_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ECDSA_ACTIVATE_RESERVATION_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ECDSA_DEACTIVATE_RESERVATION_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ECDSA_RESERVE_INACTIVE_SOURCE_PRESERVING_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_ACTIVATE_RESERVATION_PATH_V1, CLOUDFLARE_SIGNING_WORKER_ED25519_YAO_DEACTIVATE_RESERVATION_PATH_V1, CloudflareD1AuthorizationStore, CloudflareD1GoogleEmailOtpRegistrationAttemptStore, CloudflareD1OidcJwksCache, CloudflareD1RouterAbEd25519YaoCapabilityPersistence, CloudflareD1RouterAbNormalSigningAdmissionStore, CloudflareD1VaultProxyStore, CloudflareD1VersionedJsonRecordStore, CloudflareD1VersionedJsonRecordStoreError, CloudflareD1WebAuthnAuthService, CloudflareD1WebAuthnStore, CloudflareDurableObjectVersionedJsonRecordStore, CloudflareOrdinaryInactiveSignerMaterialDeactivationWorkerV1, CloudflareOrdinaryInactiveSignerMaterialReservationWorkerV1, CloudflareVersionedJsonRecordStoreError, CrossSiteSessionCookieAdapter, D1IdentityStore, D1LinkedDeviceAuthorityInstallServiceV1, D1LinkedDeviceEd25519ExportRootStoreV1, D1LinkedDeviceRequestProofNonceStoreV1, D1LinkedDeviceSessionStoreV1, D1LinkedDeviceSourceContributionPreparationPlannerV1, D1LinkedDeviceTargetAuthenticatorStoreV1, D1LinkedDeviceTargetCredentialProviderV1, D1LinkedDeviceTargetPlannerV1, D1WalletAuthMethodStore, D1WalletObjectAddresses, D1WalletStore, D1_BATCH_CAS_GUARD_SQL, DEFAULT_SESSION_COOKIE_NAME, DEFAULT_WALLET_CONSOLE_SIGNED_DELEGATE_ROUTE_V1, DEFAULT_WALLET_CONSOLE_SPONSORED_EVM_CALL_ROUTE_V1, DEFAULT_WALLET_SESSION_REMAINING_USES, DEFAULT_WALLET_SESSION_TTL_MS, ED25519_SIGNER_ACTIVATION_ID_PATH, InMemoryRouterAbEd25519YaoExportService, InMemoryRouterAbEd25519YaoExportStateV1, InMemoryRouterAbEd25519YaoRegistrationIntentAuthorizationAdapter, InMemoryRouterAbEd25519YaoRegistrationService, InMemoryRouterAbNormalSigningAdmissionStore, LINKED_DEVICE_OWNER_AUTHORIZATION_PATH_V1, LinkedDeviceRetiredTargetRegistrationShapeErrorV1, LinkedDeviceSourceFamilyUnavailableErrorV1, LinkedDeviceWebAuthnRegistrationVerifierV1, LocalRegistrationSetupAuthority, MAX_WALLET_SESSION_REMAINING_USES, MAX_WALLET_SESSION_TTL_MS, PUBLIC_PROOF_TYPES, ROUTER_AB_ECDSA_DERIVATION_PRIVATE_SIGNING_PATHS, ROUTER_AB_ED25519_PRIVATE_SIGNING_PATHS, ROUTER_AB_ED25519_YAO_CAPABILITY_REPLACEMENT_TABLE_V1, ROUTER_AB_ED25519_YAO_EXPORT_ADMISSION_PATH_V1, ROUTER_AB_ED25519_YAO_EXPORT_EXECUTE_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_ACTIVATE_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_ADMISSION_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_EXECUTE_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_STATUS_PATH_V1, ROUTER_AB_ED25519_YAO_REGISTRATION_ADMISSION_PATH_V1, ROUTER_AB_ED25519_YAO_REGISTRATION_EXECUTE_PATH_V1, ROUTER_AB_ED25519_YAO_SHARED_STATE_RECORD_KEY_V1, ROUTER_AB_ED25519_YAO_WARM_RECOVERY_BOOTSTRAP_PATH_V1, ROUTER_AB_MPC_ROUTER_ORIGIN, ROUTER_AB_PUBLIC_KEYSET_PATH, ROUTER_AB_PUBLIC_KEYSET_VERSION_V2, ROUTER_AB_PUBLIC_KEYSET_WELL_KNOWN_PATH, ROUTER_AB_SIGNING_WORKER_ORIGIN, ROUTER_AB_TRACE_ID_HEADER_V1, ROUTER_API_CREDENTIAL_SCOPES, ROUTE_SERVICE_KEYS, RouterAbEcdsaPresignRuntime, RouterAbEd25519YaoExportOwnerProofAuthorizationAdapter, RouterAbEd25519YaoHttpRegistrationBackend, RouterAbEd25519YaoRecoveryWalletSessionAuthorizationAdapter, SESSION_CAS_GUARD_SQL, SessionService, StaticCloudflareTenantStorageRouteResolver, UnavailableOrdinaryInactiveSignerMaterialDeactivationWorkerV1, UnavailableOrdinaryInactiveSignerMaterialReservationWorkerV1, WALLET_AUTH_METHOD_D1_STORE, WALLET_AUTH_METHOD_STORE_D1_SCHEMA_SQL, WALLET_AUTH_METHOD_STORE_D1_SCHEMA_V2_SQL, WALLET_CONSOLE_API_WALLET_DETAIL_PREFIX_V1, WALLET_CONSOLE_OPS_BASE_PATH_V1, WALLET_CONSOLE_OP_PATHS_V1, WALLET_CONSOLE_SERVICE_ORIGIN_V1, WALLET_CONSOLE_SIGNED_DELEGATE_ROUTE_ID_V1, WALLET_CONSOLE_SPONSORED_EVM_CALL_ROUTE_ID_V1, WALLET_CONTROL_AUTH_MARKER_V1, WALLET_CONTROL_BASE_PATH_V1, WALLET_CONTROL_SERVICE_ORIGIN_V1, WALLET_RUNTIME_OPS_BASE_PATH_V1, WALLET_RUNTIME_OP_PATHS_V1, WALLET_RUNTIME_SERVICE_ORIGIN_V1, WALLET_STORE_D1_SCHEMA_SQL, WalletHomeCustodyBinding, WalletLifecycleLocator, WalletObjectAddressSnapshot, WalletPlacementRoutes, abusePrincipalKey, addSecp256k1PublicKeys33, admitD1EstablishedWalletHome, admitRouterAbEcdsaReusableWalletSessionOperation, applyRouteMetering, assertUniqueRouterApiRouteDefinitions, authenticateDeviceLinkingOwnerWalletSessionRequestV1, authenticateRouterAbEcdsaOperationStepUp, authenticateRouterAbWalletOperationStepUp, authenticateRouterAbWalletOperationStepUpIdentity, authorizeRouterAbEcdsaDerivationNormalSigningRoute, authorizeRouterAbEd25519NormalSigningRoute, base64UrlDecode, base64UrlEncode, bindWalletAuthMethodIdentity, bindWalletAuthMethodIdentityV2, buildCorsOrigins, buildRouterAbEcdsaDerivationPrivateSigningWorkerBody, buildRouterAbEcdsaOwnerOperationStepUpPreparation, buildRouterAbEd25519OwnerOperationStepUpPreparation, buildRouterAbEd25519PrivateSigningWorkerBody, buildRouterAbEd25519YaoAddSignerAdmissionRequestV1, buildRouterAbEd25519YaoProductAdmissionRequestV1, buildTenantRootIdentityFromAuthenticatedDeploymentV1, buildVerifiedLinkInputV1, buildVerifiedTargetFactorV1, buildWalletEcdsaSignerRecord, claimRouterAbEcdsaOperationStepUp, coerceLogger, coerceRouterLogger, completeRouterAbEcdsaOperation, computeEip1559TxHash, computeLinkedDeviceSessionClaimDigestV1, computeRouterAbEd25519NormalSigningAdmissionMaterial, computeVerifiedTargetFactorVerificationDigestV1, createCloudflareD1RouterAbNormalSigningAdmissionStore, createCloudflareD1RouterApiAuthService, createCloudflareD1VersionedJsonRecordStore, createCloudflareDurableObjectVersionedJsonRecordStore, createCloudflareLinkedDeviceEd25519SourcePreservingRouterEndpointV1, createCloudflareOrdinaryInactiveSignerMaterialActivationEndpointV1, createCloudflareOrdinaryInactiveSignerMaterialActivationPortV1, createCloudflareOrdinaryInactiveSignerMaterialDeactivationEndpointV1, createCloudflareOrdinaryInactiveSignerMaterialDeactivationPortV1, createCloudflareOrdinaryInactiveSignerMaterialReservationEndpointV1, createCloudflareOrdinaryInactiveSignerMaterialReservationServiceV1, createCloudflareRouter, createCloudflareTenantStorageRoute, createCloudflareWalletGatewayRouterV1, createD1LinkedDeviceOwnerAuthorizationMetadataSourceV1, createD1LinkedDeviceOwnerAuthorizationProviderV1, createD1LinkedDeviceOwnerSourceChildReaderV1, createD1LinkedDeviceRouteServiceV1, createD1LinkedDeviceSessionServiceV1, createD1LinkedDeviceSourceContributionPreparationPlannerV1, createD1LinkedDeviceVerifiedLinkSourceReaderV1, createDeviceLinkingOwnerRequestAuthenticatorV1, createEd25519SessionAdapter, createInMemoryRouterAbNormalSigningAdmissionAdapter, createInMemoryRouterAbNormalSigningAdmissionStore, createInMemoryRouterApiRuntimeSnapshotConsumer, createRouterAbEcdsaEd25519CeremonyTokenIssuer, createRouterAbEcdsaStrictPostRegistrationPort, createRouterAbEcdsaStrictRegistrationPort, createRouterAbEd25519YaoCeremonyStateStoreV1, createRouterAbEd25519YaoExportModule, createRouterAbEd25519YaoHttpRegistrationBackendFromEnv, createRouterAbEd25519YaoMaterialActivationRefV1, createRouterAbEd25519YaoProductRegistrationCompositionFromPortsV1, createRouterAbEd25519YaoProductRegistrationPartitionedStateStoreFromD1V1, createRouterAbEd25519YaoProductRegistrationPartitionedStateStoreV1, createRouterAbEd25519YaoProductRegistrationRequestScopedRuntimeV1, createRouterAbEd25519YaoProductRegistrationRuntimeV1, createRouterAbEd25519YaoProductRegistrationStateFromPartsV1, createRouterAbEd25519YaoProductRegistrationStateV1, createRouterAbEd25519YaoRegistrationModule, createRouterAbNormalSigningAdmissionAdapter, createRouterAbServiceBindingFetch, createRouterApiModule, createRouterApiRouteDefinitions, createSignerD1DoStorageTarget, createSigningSessionSealOptions, createStaticCloudflareTenantStorageRouteResolver, createStaticCloudflareTenantStorageRouteResolverFromBindings, createStaticWalletConsoleBindingV1, createUnavailableOrdinaryInactiveSignerMaterialDeactivationPortV1, createUnavailableOrdinaryInactiveSignerMaterialReservationWorkerV1, createWalletConsoleOpsClient, createWalletConsoleRelayProxyExtensionV1, createWalletControlClientBindings, createWalletRegistrationContextResolver, createWalletRuntimeOpsHandler, d1ChangedRows, d1Integer, d1Number, decideRouterAbEcdsaOwnerOperationAuthorization, decideRouterAbEd25519OwnerOperationAuthorization, decodeEvmBlockHeader, decodeEvmTransactionByHash, decodeEvmTransactionCall, decodeEvmTransactionReceipt, decodeJsonRpcEnvelope, decodeWalletConsoleTenantRootActiveLineageRequestV1, decodeWalletConsoleTenantRootActiveLineageResponseV1, defineRoute, defineRouteExtension, deriveJwtExpiresAtIso, deriveRecoveryCodeLocatorV1FromBytes, digestOpaqueValue, encodeEip1559SignedTxFromSignature65, encodeRouterAbEd25519YaoProductRegistrationPartitionRecordV1, encodeRouterAbEd25519YaoProductRegistrationStateV1, encodeSessionJsonSegment, encodeTenantRootIdentityV1, enforceDelegatePolicy, enforceRoutePolicy, ensureEvmCryptoWasm, ensureLeadingSlash, ensureWalletAuthMethodStoreD1Schema, ensureWalletStoreD1Schema, evaluateRouterAbNormalSigningAdmission, executeRouterAbEd25519YaoAdmittedRegistrationV1, executeSignedDelegateWithRelayer, extractBearerCredential, extractRouterApiEnvironmentId, findRouteDefinitionById, findRouteDefinitionForRequest, formatD1ExecStatement, getRouterApiRouteExtensionDefinitions, getRouterApiRouteExtensionRoutes, getRouterApiRouteExtensionsForTransport, handleRouterAbEcdsaDerivationNormalSigningRouteCore, handleRouterAbEd25519YaoExportRequestScopedCloudflareV1, handleRouterAbEd25519YaoRecoveryRequestScopedCloudflareV1, handleRouterAbEd25519YaoRegistrationRequestScopedCloudflareV1, handleStaticWalletConsoleRequestV1, handleWalletControlRequest, headersToRecord, isD1DatabaseLike, isObject, isPlainObject, json, jsonFailure, keccak256Bytes, linkedDeviceSignerManifestsEqualV1, linkedDeviceX25519RecipientPublicKeyB64uV1, loadCloudflareSignerWasmModule, matchesRouteDefinitionRequest, mergeRouterAbEd25519YaoProductRegistrationStatePartitionV1, mintRouterAbEd25519YaoRegistrationIdentityV1, normalizeBoundedPositiveInteger, normalizeCorsOrigin, normalizeD1RouterApiAuthOptions, normalizeHashToBytes, normalizeLinkedDevicePasskeyTargetConfigurationV1, normalizeLogger, normalizeLowercaseString, normalizeSessionString, normalizeSessionTtlSeconds, normalizeSourceIp, normalizeTrimmedString, normalizeWalletAuthMethod, normalizeWalletAuthMethodV2, parseBooleanFlag, parseBooleanJwtClaim, parseCacheControlMaxAgeSec, parseCsvList, parseD1JsonArrayColumn, parseD1JsonColumn, parseD1JsonObjectColumn, parseD1LinkedDeviceSessionRowV1, parseD1LinkedDeviceSessionTranscriptRowV1, parseGoogleEmailOtpRegistrationAttemptRecord, parseGoogleEmailOtpRegistrationOfferCandidates, parseGoogleJwks, parseGoogleLoginVerifyRequest, parseInstalledEcdsaCustodySnapshotV1, parseJwtAud, parseLinkedDeviceSessionRecordV1, parseOrgId, parseRecoveryCodeLocatorV1, parseRouterAbEcdsaEd25519PrivateJwk, parseRouterAbEcdsaPresignRuntimeConfig, parseRouterAbEcdsaStrictRegistrationTopology, parseRouterAbEd25519NormalSigningScopeV2, parseRouterAbEd25519OperationStepUpScope, parseRouterAbEd25519YaoActivationKeysetFromEnvV1, parseRouterAbEd25519YaoCeremonyKeyV1, parseRouterAbEd25519YaoExportAdmissionEnvelopeV1, parseRouterAbEd25519YaoExportExecuteEnvelopeV1, parseRouterAbEd25519YaoProductRegistrationPartitionRecordJsonV1, parseRouterAbEd25519YaoProductRegistrationPartitionRecordV1, parseRouterAbEd25519YaoProductRegistrationStateJsonV1, parseRouterAbEd25519YaoProductRegistrationStateV1, parseRouterAbEd25519YaoRegistrationAdmissionReadV1, parseRouterAbEd25519YaoRegistrationRouterAnswerV1, parseRouterAbEd25519YaoTenantRootWireV1, parseRouterAbOperationStepUpOperation, parseRouterAbPublicKeysetV2, parseRpcHexQuantity, parseRs256JwtForVerification, parseSessionJwt, parseSigningSessionSealRootConfig, parseStaticWalletConsoleBindingConfigV1, parseStoredRouterAbEcdsaPendingActivationV1, parseWalletEd25519SignerRecord, parseWalletId, parseWalletRecoveryOperationId, parseWalletRegistrationContextResponse, parseWalletRegistrationSetupRequest, parseWalletRegistrationSetupReservation, parseWalletRuntimeExecuteSignedDelegateRequest, parseWalletRuntimeExecuteSignedDelegateResponse, parseWalletRuntimeExecuteSignedDelegateResult, parseWalletRuntimeRelayerAccount, parseWalletRuntimeWalletIdentitiesResult, parseWalletRuntimeWalletIdentityRequest, parseWebAuthnRpId, parseWebAuthnSyncChallengeRecord, partitionRouterAbEd25519YaoProductRegistrationStateV1, postRouterAbSigningWorkerJson, prepareD1TenantStatement, prepareD1WalletAuthMethodInsertStatement, prepareD1WalletAuthMethodPutStatement, prepareD1WalletAuthMethodV2PutStatement, prepareD1WalletPutSignerStatement, prepareD1WalletPutSubjectStatement, prepareD1WebAuthnAuthenticatorInsertStatement, prepareD1WebAuthnAuthenticatorPutStatement, projectRouterAbEd25519YaoExactWalletSession, proposeWalletRegistrationSetup, publishableKeyRoutePrincipal, queryD1All, queryD1One, randomTenantRootCreationGrantBytesV1, readD1LinkedDeviceEcdsaSourceV1, readD1LinkedDeviceEd25519SourceV1, readEnvironmentCsv, readEnvironmentString, readJson, registrationPreparationIdFromString, requireD1RouterApiAuthScopeString, requireEnvironmentString, requireNormalizedSessionString, requireRuntimePolicyScope, resolveFreshRouterAbEcdsaMaterialActivation, resolvePublishableKeyApiCredentialAuth, resolveRequestOriginRateLimitKeyFromFetchHeaders, resolveRouterAbEd25519YaoCeremonyKeyFromRequestV1, resolveRuntimeTenantRootLineage, resolveSecretKeyApiCredentialAuth, resolveSourceIpFromFetchHeaders, resolveWalletRegistrationContext, routeError, routeJson, routerAbEcdsaAtomicAuthorizationConfigured, routerAbEcdsaOperationInProgressResult, routerAbEcdsaOwnerOperationFailureResult, routerAbEcdsaRecordedResponse, routerAbEcdsaReplayHttpResponse, routerAbEcdsaReplayResult, routerAbEcdsaReplayUnavailableResult, routerAbEcdsaStrictRegistrationFactsBindingJson, routerAbEcdsaStrictRegistrationRequestBindingJson, routerAbEcdsaStrictRegistrationRequestMatchesFacts, routerAbEd25519OwnerOperationFailureResult, routerAbEd25519YaoAdmittedRegistrationAuthorityV1, routerAbEd25519YaoPartitionedStateAfterStoredCommitV1, routerAbEd25519YaoPersistedCapabilityMatchesLookupV1, routerAbEd25519YaoRegistrationExecutionTimingEntriesV1, routerAbEd25519YaoRegistrationSigningRootIdV1, routerAbEd25519YaoTenantRootWireV1, runRouterAbEd25519YaoProductRegistrationRequestScopedV1, runRouterAbEd25519YaoRegistrationSideEffectV1, runRouterAbEd25519YaoRegistrationTwoPhaseV1, runRouterAbPrewarmScheduledV1, runtimePolicyScopeKey, sameRouterAbEd25519YaoSharedStateCanonicalEncodingV1, secp256k1PrivateKey32ToPublicKey33, secp256k1PublicKey33ToEthereumAddress, secureRandomBase36, secureRandomBase64Url, selectWalletEd25519Signer, sessionJwtTimeClaims, sha256Bytes, sha256BytesSync, signSecp256k1Recoverable, signTenantRootCreationGrantV1, tenantRootIdentityDigestB64uV1, tenantStorageRouteBackendFamily, tenantStorageRouteDiagnostic, toFetchRouteResponse, normalizeOptionalTrimmedString as toOptionalTrimmedString, toResponse, toSessionArrayBufferCopy, unavailableRegistrationContext, validateDelegateExpiryAndNonce, validateGoogleIdTokenClaims, validateRuntimeSnapshotExpectation, validateSecp256k1PublicKey33, verifyGoogleOidcToken, verifyRs256JwtSignature, verifySecp256k1Bip340SignatureAgainstPublicKey33, verifySecp256k1RecoverableSignatureAgainstPublicKey33, walletAuthMethodId, walletAuthMethodV2Id, walletConsoleApiWalletGetRouteDefinitionV1, walletConsoleApiWalletListRouteDefinitionV1, walletConsoleApiWalletSearchRouteDefinitionV1, walletConsoleRelayRouteDefinitionsV1, walletConsoleSignedDelegateRouteDefinitionV1, walletConsoleSponsoredEvmCallRouteDefinitionV1, walletObjectIdentity, walletRegistrationContext, walletRegistrationSetupRequestDigest, webAuthnCredentialIdB64uFromCredential, withCors };
@@ -80,224 +80,7 @@ var UpstashRedisRestClient = class {
80
80
  return readResult(json);
81
81
  }
82
82
  };
83
- function concatBytes(a, b) {
84
- if (!a.length) return b;
85
- if (!b.length) return a;
86
- const out = new Uint8Array(a.length + b.length);
87
- out.set(a, 0);
88
- out.set(b, a.length);
89
- return out;
90
- }
91
- function encodeRespArray(args) {
92
- const encoder = new TextEncoder();
93
- const parts = [];
94
- parts.push(`*${args.length}\r\n`);
95
- for (const arg of args) {
96
- const s = String(arg);
97
- const len = encoder.encode(s).length;
98
- parts.push(`$${len}\r\n${s}\r\n`);
99
- }
100
- return encoder.encode(parts.join(""));
101
- }
102
- function parseLine(buf, start) {
103
- for (let i = start; i + 1 < buf.length; i++) if (buf[i] === 13 && buf[i + 1] === 10) return {
104
- line: new TextDecoder().decode(buf.slice(start, i)),
105
- next: i + 2
106
- };
107
- return null;
108
- }
109
- function parseOneResp(buf) {
110
- if (!buf.length) return null;
111
- const prefix = buf[0];
112
- const head = parseLine(buf, 1);
113
- if (!head) return null;
114
- const { line, next } = head;
115
- if (prefix === 43) return {
116
- value: {
117
- type: "simple",
118
- value: line
119
- },
120
- rest: buf.slice(next)
121
- };
122
- if (prefix === 45) return {
123
- value: {
124
- type: "error",
125
- value: line
126
- },
127
- rest: buf.slice(next)
128
- };
129
- if (prefix === 58) {
130
- const n = Number(line);
131
- return {
132
- value: {
133
- type: "integer",
134
- value: Number.isFinite(n) ? n : 0
135
- },
136
- rest: buf.slice(next)
137
- };
138
- }
139
- if (prefix === 36) {
140
- const len = Number(line);
141
- if (len === -1) return {
142
- value: {
143
- type: "bulk",
144
- value: null
145
- },
146
- rest: buf.slice(next)
147
- };
148
- if (!Number.isFinite(len) || len < 0) return {
149
- value: {
150
- type: "error",
151
- value: `Invalid bulk length: ${line}`
152
- },
153
- rest: buf.slice(next)
154
- };
155
- const end = next + len;
156
- if (buf.length < end + 2) return null;
157
- return {
158
- value: {
159
- type: "bulk",
160
- value: new TextDecoder().decode(buf.slice(next, end))
161
- },
162
- rest: buf.slice(end + 2)
163
- };
164
- }
165
- return {
166
- value: {
167
- type: "error",
168
- value: `Unsupported RESP prefix ${prefix}`
169
- },
170
- rest: new Uint8Array(0)
171
- };
172
- }
173
- var RedisTcpClient = class {
174
- constructor(redisUrl) {
175
- this.socket = null;
176
- this.buffer = new Uint8Array(0);
177
- this.pending = [];
178
- this.connecting = null;
179
- this.url = new URL(redisUrl);
180
- }
181
- async ensureConnected() {
182
- if (this.socket) return;
183
- if (this.connecting) return this.connecting;
184
- this.connecting = this.connect();
185
- try {
186
- await this.connecting;
187
- } finally {
188
- this.connecting = null;
189
- }
190
- }
191
- async connect() {
192
- const isTls = this.url.protocol === "rediss:";
193
- const host = this.url.hostname;
194
- const port = Number(this.url.port || (isTls ? 6380 : 6379));
195
- const password = this.url.password ? decodeURIComponent(this.url.password) : "";
196
- const db = (() => {
197
- const p = this.url.pathname.replace(/^\//, "");
198
- if (!p) return null;
199
- const n = Number(p);
200
- return Number.isFinite(n) ? n : null;
201
- })();
202
- const socket = isTls ? (await import("node:tls")).connect({
203
- host,
204
- port,
205
- servername: host
206
- }) : (await import("node:net")).connect({
207
- host,
208
- port
209
- });
210
- await new Promise((resolve, reject) => {
211
- socket.once("error", reject);
212
- socket.once(isTls ? "secureConnect" : "connect", () => resolve());
213
- });
214
- socket.on("data", (chunk) => {
215
- const next = new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
216
- this.buffer = concatBytes(this.buffer, next);
217
- this.drain();
218
- });
219
- socket.on("error", (err) => {
220
- this.failAll(err);
221
- this.socket = null;
222
- });
223
- socket.on("close", () => {
224
- this.failAll(/* @__PURE__ */ new Error("Redis socket closed"));
225
- this.socket = null;
226
- });
227
- this.socket = socket;
228
- if (password) {
229
- const authResp = await this.send(["AUTH", password]);
230
- if (authResp.type === "error") throw new Error(`Redis AUTH failed: ${authResp.value}`);
231
- }
232
- if (db !== null && db !== 0) {
233
- const sel = await this.send(["SELECT", String(db)]);
234
- if (sel.type === "error") throw new Error(`Redis SELECT failed: ${sel.value}`);
235
- }
236
- }
237
- drain() {
238
- while (this.pending.length) {
239
- const parsed = parseOneResp(this.buffer);
240
- if (!parsed) return;
241
- this.buffer = parsed.rest;
242
- this.pending.shift().resolve(parsed.value);
243
- }
244
- }
245
- failAll(err) {
246
- const list = this.pending.splice(0);
247
- for (const job of list) job.reject(err);
248
- }
249
- async send(args) {
250
- await this.ensureConnected();
251
- if (!this.socket) throw new Error("Redis socket not connected");
252
- const payload = encodeRespArray(args);
253
- const resp = new Promise((resolve, reject) => {
254
- this.pending.push({
255
- resolve,
256
- reject
257
- });
258
- });
259
- this.socket.write(payload);
260
- return resp;
261
- }
262
- };
263
- async function redisGetJson(client, key) {
264
- const raw = await redisGetRaw(client, key);
265
- return raw ? tryParseJson(raw) : null;
266
- }
267
- async function redisGetRaw(client, key) {
268
- const resp = await client.send(["GET", key]);
269
- if (resp.type === "bulk") {
270
- if (!resp.value) return null;
271
- return resp.value;
272
- }
273
- if (resp.type === "error") throw new Error(`Redis GET error: ${resp.value}`);
274
- return null;
275
- }
276
- async function redisDel(client, key) {
277
- const resp = await client.send(["DEL", key]);
278
- if (resp.type === "error") throw new Error(`Redis DEL error: ${resp.value}`);
279
- }
280
- async function redisSetJson(client, key, value, ttlMs) {
281
- if (ttlMs === void 0) {
282
- const resp = await client.send([
283
- "SET",
284
- key,
285
- JSON.stringify(value)
286
- ]);
287
- if (resp.type === "error") throw new Error(`Redis SET error: ${resp.value}`);
288
- return;
289
- }
290
- const ttlSeconds = Math.max(1, Math.ceil(Math.max(0, Number(ttlMs) || 0) / 1e3));
291
- const resp = await client.send([
292
- "SET",
293
- key,
294
- JSON.stringify(value),
295
- "EX",
296
- String(ttlSeconds)
297
- ]);
298
- if (resp.type === "error") throw new Error(`Redis SET error: ${resp.value}`);
299
- }
300
83
  //#endregion
301
- export { RedisTcpClient, UpstashRedisRestClient, redisDel, redisGetJson, redisSetJson };
84
+ export { UpstashRedisRestClient };
302
85
 
303
86
  //# sourceMappingURL=kv.js.map
@@ -9,6 +9,7 @@ import { D1WalletStore } from "./core/d1WalletStore.js";
9
9
  import { D1WalletAuthMethodStore } from "./core/d1WalletAuthMethodStore.js";
10
10
  import { WALLET_OBJECT_ADDRESSES_HEADER, WALLET_OBJECT_IDENTITY_HEADER, walletObjectIdentity, walletObjectIdentityHeaders } from "./router/cloudflare/runtime/walletObjectAddresses.js";
11
11
  import { RouterAbEcdsaPresignRuntime } from "./core/routerAbSigning/RouterAbEcdsaPresignRuntime.js";
12
+ import { createRouterAbEcdsaEd25519CeremonyTokenIssuer, createRouterAbEcdsaStrictPostRegistrationPort, createRouterAbEcdsaStrictRegistrationPort, parseRouterAbEcdsaEd25519PrivateJwk, parseRouterAbEcdsaStrictRegistrationTopology } from "./router/domains/ecdsa/routerAbEcdsaStrictRegistration.js";
12
13
  import { buildTenantRootIdentityFromAuthenticatedDeploymentV1, decodeTenantRootIdentityWireV1 } from "./shared-ts/src/tenant-root/tenantRootIdentity.js";
13
14
  import "./shared-ts/src/tenant-root/index.js";
14
15
  import { createWalletConsoleOpsClient } from "./router/cloudflare/runtime/walletConsoleOpsClient.js";
@@ -32,7 +33,6 @@ import { createCloudflareLinkedDeviceEd25519SourcePreservingRouterEndpointV1, cr
32
33
  import { CloudflareD1RouterAbEd25519YaoCapabilityPersistence } from "./router/cloudflare/d1/ed25519Yao/d1Ed25519YaoCapabilityPersistence.js";
33
34
  import { warmSigningSessionSealRuntime } from "./threshold/session/signingSessionSeal/crypto/shamir3PassWasm.js";
34
35
  import { createSigningSessionSealOptions } from "./threshold/session/signingSessionSeal/options.js";
35
- import { createRouterAbEcdsaEd25519CeremonyTokenIssuer, createRouterAbEcdsaStrictPostRegistrationPort, createRouterAbEcdsaStrictRegistrationPort, parseRouterAbEcdsaEd25519PrivateJwk, parseRouterAbEcdsaStrictRegistrationTopology } from "./router/domains/ecdsa/routerAbEcdsaStrictRegistration.js";
36
36
  import { D1LinkedDeviceTargetCredentialProviderV1 } from "./router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.js";
37
37
  import { createD1LinkedDeviceOwnerSourceChildReaderV1 } from "./router/cloudflare/d1/deviceLinking/d1LinkedDeviceOwnerAuthorizationProvider.js";
38
38
  import { createCloudflareD1RouterApiAuthService } from "./router/cloudflare/d1/auth/d1RouterApiAuthService.js";
package/dist/esm/index.js CHANGED
@@ -30,11 +30,10 @@ import "./core/IdentityStore.js";
30
30
  import "./core/WalletAuthMethodStore.js";
31
31
  import { parseBool, requireEnvVar } from "./core/config.js";
32
32
  import { createInMemorySigningSessionSealIdempotencyStore } from "./threshold/session/signingSessionSeal/idempotency.js";
33
- import { createRedisTcpSigningSessionSealRateLimiter, createUpstashSigningSessionSealRateLimiter, resolveSigningSessionSealRateLimitFromEnv } from "./threshold/session/signingSessionSeal/guards/backends.js";
34
- import { createRedisTcpSigningSessionSealIdempotencyStore, createUpstashSigningSessionSealIdempotencyStore, resolveSigningSessionSealIdempotencyFromEnv } from "./threshold/session/signingSessionSeal/idempotencyBackends.js";
35
- import { registerSigningSessionSealRoutes } from "./threshold/session/signingSessionSeal/transport/express.js";
33
+ import { createUpstashSigningSessionSealRateLimiter } from "./threshold/session/signingSessionSeal/guards/backends.js";
34
+ import { createUpstashSigningSessionSealIdempotencyStore } from "./threshold/session/signingSessionSeal/idempotencyBackends.js";
36
35
  import "./threshold/session/signingSessionSeal/index.js";
37
36
  import { StaticRorOriginsProvider } from "./router/framework/ror/staticProvider.js";
38
37
  import { createRorOptions } from "./router/framework/ror/options.js";
39
38
  import "./router/framework/ror/index.js";
40
- export { AUTHORIZED_OPERATION_REPLAY_BODY_MAX_BYTES, AuthorizationService, CloudflareD1RouterAbNormalSigningAdmissionStore, D1IdentityStore, D1WalletAuthMethodStore, D1WalletStore, IDENTITY_STORE_D1_SCHEMA_SQL, InMemoryRouterAbNormalSigningAdmissionStore, LocalWorkerVaultProxyGateway, OrdinaryInactiveSignerMaterialReservationServiceV1, RouterAbEcdsaPresignRuntime, SessionService, StaticCloudflareTenantStorageRouteResolver, StaticRorOriginsProvider, VaultProxyUseService, WALLET_AUTH_METHOD_STORE_D1_SCHEMA_SQL, WALLET_STORE_D1_SCHEMA_SQL, authorizeSigningSessionSealRequest, authorizedOperationReplayBodyInit, buildActiveWalletSessionQuota, buildAuthorizedOperation, buildCorsOrigins, buildExactWalletSessionQuotaProjectionV1, buildPersistedActiveWalletSessionAuthorizationV2, buildSigningSessionSealApplyPath, buildSigningSessionSealRemovePath, buildVaultProxyUseOperation, buildWalletEcdsaSignerRecord, buildWalletEd25519SignerId, buildWalletSessionAuthorizationV2, buildWalletSessionCapabilitySubjectsV1, composeSigningSessionSealGuards, computeAuthorizedOperationResultDigest, computeEip1559TxHash, createCloudflareD1RouterAbNormalSigningAdmissionStore, createCloudflareTenantStorageRoute, createInMemoryRouterAbNormalSigningAdmissionAdapter, createInMemoryRouterAbNormalSigningAdmissionStore, createInMemorySigningSessionSealIdempotencyStore, createInMemorySigningSessionSealRateLimiter, createOrdinaryInactiveSignerMaterialReservationServiceV1, createPassthroughSigningSessionSealCipherAdapter, createRedisTcpSigningSessionSealIdempotencyStore, createRedisTcpSigningSessionSealRateLimiter, createRorOptions, createRouterAbNormalSigningAdmissionAdapter, createRouterApiModule, createSignerD1DoStorageTarget, createSigningSessionSealAuditLogger, createSigningSessionSealCipherAdapter, createSigningSessionSealOptions, createSigningSessionSealRateLimitGuard, createSigningSessionSealRoutesOptions, createSigningSessionSealService, createSigningSessionSealShamir3PassCipherAdapter, createStaticCloudflareTenantStorageRouteResolver, createStaticCloudflareTenantStorageRouteResolverFromBindings, createUpstashSigningSessionSealIdempotencyStore, createUpstashSigningSessionSealRateLimiter, createVaultProxyUseRouteExtension, digestOpaqueValue, encodeEip1559SignedTxFromSignature65, encodeSigningSessionSealServerLockContext, ensureEvmCryptoWasm, ensureIdentityStoreD1Schema, ensureWalletAuthMethodStoreD1Schema, ensureWalletStoreD1Schema, exactWalletSessionCapabilitySubjectsResolveAuthority, formatSigningSessionSealKeyVersionForWire, handleSigningSessionSealRoutes, normalizeRorHost, normalizeWalletAuthMethod, parseAuthorizedOperationReplayResponse, parseBool, parseCsvList, parseHostedWalletSeamsSessionExchangeCode, parseHostedWalletSeamsSessionExchangeNonce, parseHostedWalletSessionCredentialId, parseHostedWalletSessionOperationCredentialToken, parseHostedWalletSessionOperationCredentialV1, parseMpcWalletSigningQuotaId, parseOrdinaryEcdsaSignerMaterialDeactivationResultV1, parseOrdinaryEcdsaSignerMaterialWorkerReservationV1, parseOrdinaryEd25519SignerMaterialDeactivationResultV1, parseOrdinaryEd25519SignerMaterialWorkerReservationV1, parsePrimaryWalletSessionOperationCredentialToken, parseSessionOrigin, parseSigningSessionSealApplyBody, parseSigningSessionSealKeyVersion, parseSigningSessionSealRemoveBody, parseSigningSessionSealRootConfig, parseVaultProxyDestination, parseVerifiedOwnerProofId, parseWalletSessionAuthorizationV2, parseWalletSessionId, projectActiveWalletSession, projectExactWalletSessionAuthorizationV1, registerSigningSessionSealRoutes, registrationPreparationIdFromString, requireEnvVar, resolveRorRpId, resolveSigningSessionSealBasePath, resolveSigningSessionSealIdempotencyFromEnv, resolveSigningSessionSealRateLimitFromEnv, sanitizeRorOrigins, secp256k1PrivateKey32ToPublicKey33, secp256k1PublicKey33ToEthereumAddress, signSecp256k1Recoverable, signingSessionSealAuthorizeStatusCode, signingSessionSealStatusCode, tenantStorageRouteBackendFamily, tenantStorageRouteDiagnostic, validateOrdinaryInactiveSignerMaterialDeactivationRequestV1, validateOrdinaryInactiveSignerMaterialReservationRequestV1, validateRouterApiRorOptions, walletSessionAuthorizationV2RecordsEqual, walletSessionCapabilitySubjectsV1Equal };
39
+ export { AUTHORIZED_OPERATION_REPLAY_BODY_MAX_BYTES, AuthorizationService, CloudflareD1RouterAbNormalSigningAdmissionStore, D1IdentityStore, D1WalletAuthMethodStore, D1WalletStore, IDENTITY_STORE_D1_SCHEMA_SQL, InMemoryRouterAbNormalSigningAdmissionStore, LocalWorkerVaultProxyGateway, OrdinaryInactiveSignerMaterialReservationServiceV1, RouterAbEcdsaPresignRuntime, SessionService, StaticCloudflareTenantStorageRouteResolver, StaticRorOriginsProvider, VaultProxyUseService, WALLET_AUTH_METHOD_STORE_D1_SCHEMA_SQL, WALLET_STORE_D1_SCHEMA_SQL, authorizeSigningSessionSealRequest, authorizedOperationReplayBodyInit, buildActiveWalletSessionQuota, buildAuthorizedOperation, buildCorsOrigins, buildExactWalletSessionQuotaProjectionV1, buildPersistedActiveWalletSessionAuthorizationV2, buildSigningSessionSealApplyPath, buildSigningSessionSealRemovePath, buildVaultProxyUseOperation, buildWalletEcdsaSignerRecord, buildWalletEd25519SignerId, buildWalletSessionAuthorizationV2, buildWalletSessionCapabilitySubjectsV1, composeSigningSessionSealGuards, computeAuthorizedOperationResultDigest, computeEip1559TxHash, createCloudflareD1RouterAbNormalSigningAdmissionStore, createCloudflareTenantStorageRoute, createInMemoryRouterAbNormalSigningAdmissionAdapter, createInMemoryRouterAbNormalSigningAdmissionStore, createInMemorySigningSessionSealIdempotencyStore, createInMemorySigningSessionSealRateLimiter, createOrdinaryInactiveSignerMaterialReservationServiceV1, createPassthroughSigningSessionSealCipherAdapter, createRorOptions, createRouterAbNormalSigningAdmissionAdapter, createRouterApiModule, createSignerD1DoStorageTarget, createSigningSessionSealAuditLogger, createSigningSessionSealCipherAdapter, createSigningSessionSealOptions, createSigningSessionSealRateLimitGuard, createSigningSessionSealRoutesOptions, createSigningSessionSealService, createSigningSessionSealShamir3PassCipherAdapter, createStaticCloudflareTenantStorageRouteResolver, createStaticCloudflareTenantStorageRouteResolverFromBindings, createUpstashSigningSessionSealIdempotencyStore, createUpstashSigningSessionSealRateLimiter, createVaultProxyUseRouteExtension, digestOpaqueValue, encodeEip1559SignedTxFromSignature65, encodeSigningSessionSealServerLockContext, ensureEvmCryptoWasm, ensureIdentityStoreD1Schema, ensureWalletAuthMethodStoreD1Schema, ensureWalletStoreD1Schema, exactWalletSessionCapabilitySubjectsResolveAuthority, formatSigningSessionSealKeyVersionForWire, handleSigningSessionSealRoutes, normalizeRorHost, normalizeWalletAuthMethod, parseAuthorizedOperationReplayResponse, parseBool, parseCsvList, parseHostedWalletSeamsSessionExchangeCode, parseHostedWalletSeamsSessionExchangeNonce, parseHostedWalletSessionCredentialId, parseHostedWalletSessionOperationCredentialToken, parseHostedWalletSessionOperationCredentialV1, parseMpcWalletSigningQuotaId, parseOrdinaryEcdsaSignerMaterialDeactivationResultV1, parseOrdinaryEcdsaSignerMaterialWorkerReservationV1, parseOrdinaryEd25519SignerMaterialDeactivationResultV1, parseOrdinaryEd25519SignerMaterialWorkerReservationV1, parsePrimaryWalletSessionOperationCredentialToken, parseSessionOrigin, parseSigningSessionSealApplyBody, parseSigningSessionSealKeyVersion, parseSigningSessionSealRemoveBody, parseSigningSessionSealRootConfig, parseVaultProxyDestination, parseVerifiedOwnerProofId, parseWalletSessionAuthorizationV2, parseWalletSessionId, projectActiveWalletSession, projectExactWalletSessionAuthorizationV1, registrationPreparationIdFromString, requireEnvVar, resolveRorRpId, resolveSigningSessionSealBasePath, sanitizeRorOrigins, secp256k1PrivateKey32ToPublicKey33, secp256k1PublicKey33ToEthereumAddress, signSecp256k1Recoverable, signingSessionSealAuthorizeStatusCode, signingSessionSealStatusCode, tenantStorageRouteBackendFamily, tenantStorageRouteDiagnostic, validateOrdinaryInactiveSignerMaterialDeactivationRequestV1, validateOrdinaryInactiveSignerMaterialReservationRequestV1, validateRouterApiRorOptions, walletSessionAuthorizationV2RecordsEqual, walletSessionCapabilitySubjectsV1Equal };
@@ -1,10 +1,11 @@
1
1
  import { requireCanonicalString } from "./shared-ts/src/utils/validation.js";
2
2
  import "./shared-ts/src/utils/routerAbEd25519Yao.js";
3
+ import { D1RegistrationCeremonyRecordStore } from "./router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.js";
4
+ import { LocalRegistrationSetupAuthority } from "./localRegistrationSetupAuthority.js";
3
5
  import { WALLET_CONSOLE_OP_PATHS_V1 } from "./router/cloudflare/runtime/walletConsoleOps.js";
4
6
  import { WalletHomeCustodyBinding } from "./router/cloudflare/runtime/routerAbServiceBindings.js";
5
7
  import { createStaticWalletConsoleBindingV1, parseStaticWalletConsoleBindingConfigV1 } from "./router/cloudflare/runtime/staticWalletConsoleBinding.js";
6
8
  import { handleSplitGatewayRequest } from "./hosted-wallet-gateway.js";
7
- import { LocalRegistrationSetupAuthority } from "./localRegistrationSetupAuthority.js";
8
9
  import { localPresignCancellationProbe } from "./localIntendedPresignCancellation.js";
9
10
  import { LOCAL_INTENDED_YAO_FAULT_HEADER_V1, LOCAL_INTENDED_YAO_FAULT_TOKEN_HEADER_V1, LocalIntendedYaoFaultControllerV1, parseLocalIntendedYaoFaultModeV1, parseLocalIntendedYaoFaultTokenV1, requestWithoutLocalIntendedYaoFaultHeadersV1, responseWithLocalIntendedYaoFaultOutcomeV1 } from "./localIntendedYaoFault.js";
10
11
  import { localMaterialAdmissionFault } from "./localIntendedMaterialAdmissionFault.js";
@@ -101,7 +102,7 @@ async function handleEcdsaRespondFault(request, env, ctx, dependencies, fault, e
101
102
  /**
102
103
  * The local Gateway: the hosted Gateway handler plus the intended-suite
103
104
  * transport faults, which a request arms with local-only headers. The local
104
- * Worker and the local Node host both serve through this.
105
+ * Worker serves through this handler.
105
106
  */
106
107
  async function handleLocalHostedWalletGatewayRequestV1(request, env, ctx, dependencies) {
107
108
  const config = parseStaticWalletConsoleBindingConfigV1(JSON.parse(env.WALLET_LOCAL_DEPLOYMENT_JSON));
@@ -122,6 +123,11 @@ async function handleLocalHostedWalletGatewayRequestV1(request, env, ctx, depend
122
123
  SIGNING_WORKER: new WalletHomeCustodyBinding(env.SIGNING_WORKER, "US", env.SIGNER_DB, tenantScope.namespace, null),
123
124
  WALLET_CONSOLE: createStaticWalletConsoleBindingV1(config)
124
125
  };
126
+ const faultStorage = new D1RegistrationCeremonyRecordStore({
127
+ database: env.SIGNER_DB,
128
+ scope: tenantScope,
129
+ keyPrefix: "local-intended:"
130
+ });
125
131
  const canceledPresign = await localPresignCancellationProbe(request, gatewayEnv, ctx, dependencies);
126
132
  if (canceledPresign) return canceledPresign;
127
133
  const ecdsaFault = request.headers.get(ECDSA_RESPOND_FAULT_HEADER);
@@ -131,10 +137,10 @@ async function handleLocalHostedWalletGatewayRequestV1(request, env, ctx, depend
131
137
  if (ecdsaFinalizeMode !== null || ecdsaFinalizeToken !== null) return await handleEcdsaFinalizeFault(request, gatewayEnv, ctx, dependencies, ecdsaFinalizeMode, ecdsaFinalizeToken);
132
138
  const yaoRecoveryMode = request.headers.get(LOCAL_INTENDED_YAO_RECOVERY_FAULT_HEADER_V1);
133
139
  const yaoRecoveryToken = request.headers.get(LOCAL_INTENDED_YAO_RECOVERY_FAULT_TOKEN_HEADER_V1);
134
- if (yaoRecoveryMode !== null || yaoRecoveryToken !== null) return await handleYaoRecoveryFault(request, gatewayEnv, ctx, dependencies, yaoRecoveryMode, yaoRecoveryToken);
140
+ if (yaoRecoveryMode !== null || yaoRecoveryToken !== null) return await handleYaoRecoveryFault(request, gatewayEnv, ctx, dependencies, yaoRecoveryMode, yaoRecoveryToken, faultStorage);
135
141
  const yaoSigningMode = request.headers.get(LOCAL_INTENDED_YAO_SIGNING_FAULT_HEADER_V1);
136
142
  const yaoSigningToken = request.headers.get(LOCAL_INTENDED_YAO_SIGNING_FAULT_TOKEN_HEADER_V1);
137
- if (yaoSigningMode !== null || yaoSigningToken !== null) return await handleYaoSigningFault(request, gatewayEnv, ctx, dependencies, yaoSigningMode, yaoSigningToken);
143
+ if (yaoSigningMode !== null || yaoSigningToken !== null) return await handleYaoSigningFault(request, gatewayEnv, ctx, dependencies, yaoSigningMode, yaoSigningToken, faultStorage);
138
144
  const yaoExportMode = request.headers.get(LOCAL_INTENDED_YAO_EXPORT_FAULT_HEADER_V1);
139
145
  const yaoExportToken = request.headers.get(LOCAL_INTENDED_YAO_EXPORT_FAULT_TOKEN_HEADER_V1);
140
146
  if (yaoExportMode !== null || yaoExportToken !== null) return await handleYaoExportFault(request, gatewayEnv, ctx, dependencies, yaoExportMode, yaoExportToken);
@@ -167,7 +173,7 @@ async function handleLocalHostedWalletGatewayRequestV1(request, env, ctx, depend
167
173
  const token = parseLocalIntendedYaoFaultTokenV1(rawToken);
168
174
  const url = new URL(request.url);
169
175
  if (url.protocol !== "http:" || url.hostname !== "127.0.0.1" || url.pathname !== "/router-ab/ed25519/yao/registration/execute" && url.pathname !== REGISTRATION_RESPOND_PATH || request.method !== "POST" || !mode || !token) return Response.json({ code: "invalid_intended_yao_fault" }, { status: 400 });
170
- const controller = new LocalIntendedYaoFaultControllerV1(gatewayEnv.MPC_ROUTER.fetch.bind(gatewayEnv.MPC_ROUTER));
176
+ const controller = new LocalIntendedYaoFaultControllerV1(gatewayEnv.MPC_ROUTER.fetch.bind(gatewayEnv.MPC_ROUTER), ctx.waitUntil.bind(ctx));
171
177
  controller.arm(mode);
172
178
  return responseWithLocalIntendedYaoFaultOutcomeV1(await handleSplitGatewayRequest(sanitizedRequest, {
173
179
  ...gatewayEnv,
@@ -195,13 +201,13 @@ async function handleLinkExecuteFault(request, env, ctx, dependencies, rawMode,
195
201
  * every reply after the Router ran it, or keeps it from the Router, or sends
196
202
  * a kept one to the Router now. Local only.
197
203
  */
198
- async function handleYaoRecoveryFault(request, env, ctx, dependencies, rawMode, rawToken) {
204
+ async function handleYaoRecoveryFault(request, env, ctx, dependencies, rawMode, rawToken, storage) {
199
205
  const mode = parseLocalIntendedYaoRecoveryFaultModeV1(rawMode);
200
206
  const token = parseLocalIntendedYaoRecoveryFaultTokenV1(rawToken);
201
207
  const url = new URL(request.url);
202
208
  if (url.protocol !== "http:" || url.hostname !== "127.0.0.1" || url.pathname !== "/router-ab/ed25519/yao/recovery/execute" || request.method !== "POST" || !mode || !token) return Response.json({ code: "invalid_intended_yao_recovery_fault" }, { status: 400 });
203
- if (mode === "release_router_recovery_execute") return await releaseLocalIntendedYaoRecoveryExecuteV1(env.MPC_ROUTER, token);
204
- const controller = new LocalIntendedYaoRecoveryFaultControllerV1(env.MPC_ROUTER.fetch.bind(env.MPC_ROUTER), mode, token);
209
+ if (mode === "release_router_recovery_execute") return await releaseLocalIntendedYaoRecoveryExecuteV1(env.MPC_ROUTER, token, storage);
210
+ const controller = new LocalIntendedYaoRecoveryFaultControllerV1(env.MPC_ROUTER.fetch.bind(env.MPC_ROUTER), mode, token, storage);
205
211
  return responseWithLocalIntendedYaoRecoveryFaultOutcomeV1(await handleSplitGatewayRequest(requestWithoutLocalIntendedYaoRecoveryFaultHeadersV1(request), {
206
212
  ...env,
207
213
  MPC_ROUTER: controller
@@ -260,13 +266,13 @@ async function handleYaoFinalizeFault(request, env, ctx, dependencies, rawMode,
260
266
  * run or withheld, or sends a kept one to the Router again: a request
261
267
  * authorized before a recovery, arriving after it. Local only.
262
268
  */
263
- async function handleYaoSigningFault(request, env, ctx, dependencies, rawMode, rawToken) {
269
+ async function handleYaoSigningFault(request, env, ctx, dependencies, rawMode, rawToken, storage) {
264
270
  const mode = parseLocalIntendedYaoSigningFaultModeV1(rawMode);
265
271
  const token = parseLocalIntendedYaoSigningFaultTokenV1(rawToken);
266
272
  const url = new URL(request.url);
267
273
  if (url.protocol !== "http:" || url.hostname !== "127.0.0.1" || url.pathname !== "/router-ab/ed25519/sign" || request.method !== "POST" || !mode || !token) return Response.json({ code: "invalid_intended_yao_signing_fault" }, { status: 400 });
268
- if (mode === "release_signing_finalize") return await releaseLocalIntendedYaoSigningFinalizeV1(env.MPC_ROUTER, token);
269
- const controller = new LocalIntendedYaoSigningFaultControllerV1(env.MPC_ROUTER.fetch.bind(env.MPC_ROUTER), mode, token);
274
+ if (mode === "release_signing_finalize") return await releaseLocalIntendedYaoSigningFinalizeV1(env.MPC_ROUTER, token, storage);
275
+ const controller = new LocalIntendedYaoSigningFaultControllerV1(env.MPC_ROUTER.fetch.bind(env.MPC_ROUTER), mode, token, storage);
270
276
  return responseWithLocalIntendedYaoSigningFaultOutcomeV1(await handleSplitGatewayRequest(requestWithoutLocalIntendedYaoSigningFaultHeadersV1(request), {
271
277
  ...env,
272
278
  MPC_ROUTER: controller
@@ -1,3 +1,4 @@
1
+ import { assertString, requireArray, requireRecord } from "./shared-ts/src/utils/validation.js";
1
2
  import "./shared-ts/src/utils/routerAbTraceContext.js";
2
3
  //#region src/localIntendedYaoFault.ts
3
4
  const LOCAL_INTENDED_YAO_FAULT_HEADER_V1 = "x-seams-intended-yao-fault-v1";
@@ -15,7 +16,8 @@ function equalRequestBytes(left, right) {
15
16
  function parseLocalIntendedYaoFaultModeV1(value) {
16
17
  switch (value) {
17
18
  case "drop_router_response_once":
18
- case "return_terminal_burned_once": return value;
19
+ case "return_terminal_burned_once":
20
+ case "answer_retryable_while_running_once": return value;
19
21
  default: return null;
20
22
  }
21
23
  }
@@ -26,9 +28,25 @@ function parseLocalIntendedYaoFaultTokenV1(value) {
26
28
  function isLocalIntendedYaoFaultTokenV1(value) {
27
29
  return !!value && LOCAL_INTENDED_YAO_FAULT_TOKEN_PATTERN_V1.test(value);
28
30
  }
31
+ /** Reconstructs a local fault request from its persisted boundary value. */
32
+ function parseLocalIntendedKeptRouterRequestV1(value) {
33
+ const record = requireRecord(value, "Kept Router request");
34
+ const headers = new Headers();
35
+ for (const value of requireArray(record.headers, "Kept Router headers")) {
36
+ const pair = requireArray(value, "Kept Router header");
37
+ if (pair.length !== 2) throw new Error("Kept Router header must contain a name and value");
38
+ headers.append(assertString(pair[0], "header name"), assertString(pair[1], "header value"));
39
+ }
40
+ return new Request(assertString(record.url, "Kept Router URL"), {
41
+ method: "POST",
42
+ headers,
43
+ body: assertString(record.body, "Kept Router body")
44
+ });
45
+ }
29
46
  var LocalIntendedYaoFaultControllerV1 = class {
30
- constructor(baseFetch) {
47
+ constructor(baseFetch, keepRunning) {
31
48
  this.baseFetch = baseFetch;
49
+ this.keepRunning = keepRunning;
32
50
  this.state = { kind: "idle" };
33
51
  }
34
52
  arm(mode) {
@@ -82,6 +100,19 @@ var LocalIntendedYaoFaultControllerV1 = class {
82
100
  }
83
101
  }
84
102
  async handleArmedExecute(request, mode) {
103
+ if (mode === "answer_retryable_while_running_once") {
104
+ const running = this.baseFetch.call(globalThis, request);
105
+ this.keepRunning(running.then((response) => response.arrayBuffer()));
106
+ this.state = {
107
+ kind: "proved",
108
+ proof: "execution_left_running"
109
+ };
110
+ return Response.json({
111
+ status: "recoverable_failure",
112
+ code: "conflicting_pair",
113
+ retry_after_ms: 100
114
+ });
115
+ }
85
116
  if (mode === "return_terminal_burned_once") {
86
117
  const headers = new Headers(request.headers);
87
118
  headers.set(LOCAL_INTENDED_ROUTER_BURN_HEADER_V1, "burned");
@@ -171,6 +202,6 @@ function responseWithLocalIntendedYaoFaultOutcomeV1(response, outcome, token) {
171
202
  });
172
203
  }
173
204
  //#endregion
174
- export { LOCAL_INTENDED_YAO_FAULT_HEADER_V1, LOCAL_INTENDED_YAO_FAULT_TOKEN_HEADER_V1, LocalIntendedYaoFaultControllerV1, isLocalIntendedYaoFaultTokenV1, parseLocalIntendedYaoFaultModeV1, parseLocalIntendedYaoFaultTokenV1, requestWithoutLocalIntendedYaoFaultHeadersV1, responseWithLocalIntendedYaoFaultOutcomeV1 };
205
+ export { LOCAL_INTENDED_YAO_FAULT_HEADER_V1, LOCAL_INTENDED_YAO_FAULT_TOKEN_HEADER_V1, LocalIntendedYaoFaultControllerV1, isLocalIntendedYaoFaultTokenV1, parseLocalIntendedKeptRouterRequestV1, parseLocalIntendedYaoFaultModeV1, parseLocalIntendedYaoFaultTokenV1, requestWithoutLocalIntendedYaoFaultHeadersV1, responseWithLocalIntendedYaoFaultOutcomeV1 };
175
206
 
176
207
  //# sourceMappingURL=localIntendedYaoFault.js.map
@@ -1,10 +1,12 @@
1
- import { isLocalIntendedYaoFaultTokenV1 } from "./localIntendedYaoFault.js";
1
+ import { isPlainObject } from "./shared-ts/src/utils/validation.js";
2
+ import { isLocalIntendedYaoFaultTokenV1, parseLocalIntendedKeptRouterRequestV1 } from "./localIntendedYaoFault.js";
2
3
  //#region src/localIntendedYaoRecoveryFault.ts
3
4
  const LOCAL_INTENDED_YAO_RECOVERY_FAULT_HEADER_V1 = "x-seams-intended-yao-recovery-fault-v1";
4
5
  const LOCAL_INTENDED_YAO_RECOVERY_FAULT_TOKEN_HEADER_V1 = "x-seams-intended-yao-recovery-fault-token-v1";
5
6
  const LOCAL_INTENDED_YAO_FAULT_PROOF_HEADER_V1 = "x-seams-intended-yao-fault-proof-v1";
6
7
  const ROUTER_AB_YAO_EXECUTE_PATH_V1 = "/router-ab/router/ed25519-yao/execute";
7
- const keptRecoveryExecutes = /* @__PURE__ */ new Map();
8
+ const KEPT_RECOVERY_SCOPE = "recovery-execute";
9
+ const KEPT_RECOVERY_TTL_MS = 600 * 1e3;
8
10
  function parseLocalIntendedYaoRecoveryFaultModeV1(value) {
9
11
  switch (value) {
10
12
  case "lose_router_recovery_replies":
@@ -18,10 +20,11 @@ function parseLocalIntendedYaoRecoveryFaultTokenV1(value) {
18
20
  }
19
21
  /** The Gateway's Router binding, faulting every call to a recovery execution. */
20
22
  var LocalIntendedYaoRecoveryFaultControllerV1 = class {
21
- constructor(baseFetch, mode, token) {
23
+ constructor(baseFetch, mode, token, storage) {
22
24
  this.baseFetch = baseFetch;
23
25
  this.mode = mode;
24
26
  this.token = token;
27
+ this.storage = storage;
25
28
  this.executed = false;
26
29
  this.failed = false;
27
30
  this.kept = false;
@@ -30,17 +33,22 @@ var LocalIntendedYaoRecoveryFaultControllerV1 = class {
30
33
  const request = new Request(input, init);
31
34
  if (request.method !== "POST" || new URL(request.url).pathname !== ROUTER_AB_YAO_EXECUTE_PATH_V1) return await this.baseFetch.call(globalThis, request);
32
35
  if (this.mode === "withhold_router_recovery_execute") {
33
- if (!keptRecoveryExecutes.has(this.token)) keptRecoveryExecutes.set(this.token, {
34
- url: request.url,
35
- headers: [...request.headers],
36
- body: await request.clone().text()
36
+ await this.storage.insertOrRead({
37
+ scope: KEPT_RECOVERY_SCOPE,
38
+ id: this.token,
39
+ value: {
40
+ url: request.url,
41
+ headers: [...request.headers],
42
+ body: await request.clone().text()
43
+ },
44
+ expiresAtMs: Date.now() + KEPT_RECOVERY_TTL_MS
37
45
  });
38
46
  this.kept = true;
39
47
  throw new Error("Local intended Yao recovery fault withheld the Router execution");
40
48
  }
41
49
  const response = await this.baseFetch.call(globalThis, request);
42
50
  const answer = await response.clone().json().catch(() => null);
43
- if (response.ok && typeof answer === "object" && answer !== null && answer.status === "succeeded") this.executed = true;
51
+ if (response.ok && isPlainObject(answer) && answer.status === "succeeded") this.executed = true;
44
52
  else this.failed = true;
45
53
  throw new Error("Local intended Yao recovery fault lost the Router reply");
46
54
  }
@@ -67,15 +75,10 @@ var LocalIntendedYaoRecoveryFaultControllerV1 = class {
67
75
  }
68
76
  };
69
77
  /** Sends the execution kept under `token` to the Router, exactly. */
70
- async function releaseLocalIntendedYaoRecoveryExecuteV1(router, token) {
71
- const kept = keptRecoveryExecutes.get(token);
78
+ async function releaseLocalIntendedYaoRecoveryExecuteV1(router, token, storage) {
79
+ const kept = await storage.take(KEPT_RECOVERY_SCOPE, token);
72
80
  if (!kept) return Response.json({ code: "intended_recovery_execute_missing" }, { status: 404 });
73
- keptRecoveryExecutes.delete(token);
74
- const reply = await router.fetch(new Request(kept.url, {
75
- method: "POST",
76
- headers: kept.headers.map(([name, value]) => [name, value]),
77
- body: kept.body
78
- }));
81
+ const reply = await router.fetch(parseLocalIntendedKeptRouterRequestV1(kept));
79
82
  return Response.json({
80
83
  status: reply.status,
81
84
  body: await reply.text()