@seams/wallet-server 0.28.0 → 0.29.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 (80) hide show
  1. package/README.md +19 -4
  2. package/artifact-manifest.json +23 -13
  3. package/cloudflare-router-ab/build/deriver-a/build-stamp.json +1 -1
  4. package/cloudflare-router-ab/build/deriver-b/build-stamp.json +1 -1
  5. package/cloudflare-router-ab/build/router/build-stamp.json +1 -1
  6. package/cloudflare-router-ab/build/signing-worker/build-stamp.json +1 -1
  7. package/cloudflare-router-ab/build/tenant-root-control-plane/build-stamp.json +1 -1
  8. package/dist/esm/application-auth.js +2 -0
  9. package/dist/esm/auth/applicationAuth.js +85 -0
  10. package/dist/esm/auth/externalAuthService.js +58 -7
  11. package/dist/esm/auth/externalAuthStore.js +157 -21
  12. package/dist/esm/auth/externalOwnerOperations.js +82 -0
  13. package/dist/esm/cloud-host.js +4 -4
  14. package/dist/esm/core/nearRelayerAccountProvisioning.js +1 -1
  15. package/dist/esm/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.js +2 -0
  16. package/dist/esm/router/cloudflare/d1/auth/d1RecordedOwnerOperation.js +43 -0
  17. package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthService.js +22 -1
  18. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +1 -1
  19. package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.js +1 -1
  20. package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.js +1 -1
  21. package/dist/esm/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyRouteService.js +2 -2
  22. package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.js +2 -2
  23. package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.js +2 -2
  24. package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +9 -0
  25. package/dist/esm/router/cloudflare/d1/registration/d1WalletExecutionAuthority.js +9 -16
  26. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +43 -1
  27. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetup.js +12 -0
  28. package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetupExecution.js +1 -0
  29. package/dist/esm/router/cloudflare/d1/registration/registrationCompletionWrite.js +1 -0
  30. package/dist/esm/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.js +35 -0
  31. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodBoundary.js +1 -1
  32. package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodService.js +4 -3
  33. package/dist/esm/router/cloudflare.js +1785 -1489
  34. package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.js +2 -2
  35. package/dist/esm/router/domains/emailOtp/emailOtpRouteHandlers.js +1 -1
  36. package/dist/esm/router/domains/passkeyCustody/walletCustodyRegistrationCommit.js +1 -1
  37. package/dist/esm/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.js +35 -1
  38. package/dist/esm/router/domains/walletRegistration/walletRegistrationReservation.js +17 -2
  39. package/dist/esm/router/domains/walletRegistration/walletRegistrationRoutes.js +9 -1
  40. package/dist/esm/router/domains/walletUnlock/walletUnlockRouteHandlers.js +1 -1
  41. package/dist/esm/router/transport/fetch/routes/ecdsaOperationStepUpFactor.js +2 -2
  42. package/dist/esm/router/transport/fetch/routes/externalAuth.js +139 -32
  43. package/dist/esm/router/transport/fetch/routes/passkeyCustody.js +44 -304
  44. package/dist/esm/router/transport/fetch/routes/sessions.js +2 -2
  45. package/dist/esm/router/transport/fetch/routes/thresholdEd25519.js +2 -2
  46. package/dist/esm/router/transport/fetch/routes/walletRegistration.js +2 -2
  47. package/dist/esm/router/transport/fetch/walletOwnerOperationAuthorization.js +306 -0
  48. package/dist/esm/shared-ts/src/auth/externalAuth.js +87 -14
  49. package/dist/esm/shared-ts/src/authorization/index.js +1 -1
  50. package/dist/esm/shared-ts/src/authorization/{walletCustodyOperation.js → walletOwnerOperation.js} +4 -4
  51. package/dist/esm/shared-ts/src/wallet-recovery/index.js +3 -3
  52. package/dist/types/shared-ts/src/auth/externalAuth.d.ts +51 -8
  53. package/dist/types/shared-ts/src/authorization/index.d.ts +1 -1
  54. package/dist/types/shared-ts/src/authorization/walletOwnerOperation.d.ts +10 -0
  55. package/dist/types/shared-ts/src/utils/registrationEstablishedSession.d.ts +4 -0
  56. package/dist/types/shared-ts/src/utils/registrationIntent.d.ts +2 -0
  57. package/dist/types/shared-ts/src/utils/walletManagementProtocol.d.ts +1 -1
  58. package/dist/types/wallet-server/src/application-auth.d.ts +3 -0
  59. package/dist/types/wallet-server/src/auth/applicationAuth.d.ts +29 -0
  60. package/dist/types/wallet-server/src/auth/externalAuthService.d.ts +29 -10
  61. package/dist/types/wallet-server/src/auth/externalAuthStore.d.ts +60 -6
  62. package/dist/types/wallet-server/src/auth/externalOwnerOperations.d.ts +18 -0
  63. package/dist/types/wallet-server/src/cloud-host.d.ts +1 -1
  64. package/dist/types/wallet-server/src/core/threeRouteRegistrationContracts.d.ts +12 -0
  65. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.d.ts +5 -1
  66. package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RecordedOwnerOperation.d.ts +16 -0
  67. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.d.ts +1 -0
  68. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationSetup.d.ts +2 -0
  69. package/dist/types/wallet-server/src/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.d.ts +7 -1
  70. package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthMethodService.d.ts +1 -0
  71. package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.d.ts +2 -2
  72. package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbOperationStepUp.d.ts +1 -1
  73. package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationInputs.d.ts +1 -0
  74. package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationReservation.d.ts +11 -6
  75. package/dist/types/wallet-server/src/router/framework/authServicePort.d.ts +11 -0
  76. package/dist/types/wallet-server/src/router/transport/fetch/walletOwnerOperationAuthorization.d.ts +23 -0
  77. package/migrations/d1-signer/0086_application_auth.sql +67 -0
  78. package/migrations/d1-signer/0087_registration_without_session.sql +43 -0
  79. package/package.json +7 -2
  80. package/dist/types/shared-ts/src/authorization/walletCustodyOperation.d.ts +0 -10
@@ -0,0 +1,82 @@
1
+ import { externalAuthFailure, serializeExternalIdentity } from "../shared-ts/src/auth/externalAuth.js";
2
+ import { computeWalletOwnerAdminChallengeDigest } from "../shared-ts/src/authorization/walletOwnerOperation.js";
3
+ //#region src/auth/externalOwnerOperations.ts
4
+ async function readExternalOwnerOperation(input) {
5
+ const attempt = input.phase === "prepare" ? await input.store.prepareOwnerChallenge(input.binding) : await input.store.readOwnerAttempt(input.binding);
6
+ if (!attempt) return externalAuthFailure("access_denied");
7
+ if (attempt.challenge.kind !== "ready") return externalAuthFailure("access_denied");
8
+ if (attempt.status === "verified" && attempt.challenge.expiresAtMs <= input.binding.nowMs) return externalAuthFailure("expired");
9
+ const identity = serializeExternalIdentity(attempt.identity);
10
+ let operation;
11
+ let payload;
12
+ switch (attempt.purpose) {
13
+ case "associate":
14
+ operation = "external_identity_associate";
15
+ payload = {
16
+ attemptId: attempt.attemptId,
17
+ identity,
18
+ originBinding: attempt.originBinding,
19
+ revision: attempt.trustRevision,
20
+ expiresAtMs: attempt.challenge.expiresAtMs
21
+ };
22
+ break;
23
+ case "unlink":
24
+ operation = "external_identity_unlink";
25
+ payload = {
26
+ attemptId: attempt.attemptId,
27
+ associationId: attempt.associationId,
28
+ identity,
29
+ originBinding: attempt.originBinding,
30
+ revision: attempt.trustRevision,
31
+ expiresAtMs: attempt.challenge.expiresAtMs
32
+ };
33
+ break;
34
+ default: return assertNever(attempt);
35
+ }
36
+ const challengeB64u = await computeWalletOwnerAdminChallengeDigest({
37
+ walletId: attempt.walletId,
38
+ operation,
39
+ payload,
40
+ requestOrigin: input.requestOrigin
41
+ });
42
+ return {
43
+ ok: true,
44
+ value: {
45
+ attempt,
46
+ operation,
47
+ payload,
48
+ challengeB64u
49
+ }
50
+ };
51
+ }
52
+ function externalOwnerChallenge(operation) {
53
+ const attempt = operation.attempt;
54
+ if (attempt.challenge.kind !== "ready") throw new Error("Owner challenge is not prepared");
55
+ switch (attempt.purpose) {
56
+ case "associate": return {
57
+ kind: "associate",
58
+ walletId: attempt.walletId,
59
+ attemptId: attempt.attemptId,
60
+ identity: attempt.identity,
61
+ challengeB64u: operation.challengeB64u,
62
+ expiresAtMs: attempt.challenge.expiresAtMs
63
+ };
64
+ case "unlink": return {
65
+ kind: "unlink",
66
+ walletId: attempt.walletId,
67
+ attemptId: attempt.attemptId,
68
+ associationId: attempt.associationId,
69
+ identity: attempt.identity,
70
+ challengeB64u: operation.challengeB64u,
71
+ expiresAtMs: attempt.challenge.expiresAtMs
72
+ };
73
+ default: return assertNever(attempt);
74
+ }
75
+ }
76
+ function assertNever(value) {
77
+ throw new Error(`Unsupported external owner operation: ${String(value)}`);
78
+ }
79
+ //#endregion
80
+ export { externalOwnerChallenge, readExternalOwnerOperation };
81
+
82
+ //# sourceMappingURL=externalOwnerOperations.js.map
@@ -3,7 +3,7 @@ import { ensureLeadingSlash, normalizeBoundedPositiveInteger, normalizeLowercase
3
3
  import { isObject, isPlainObject } from "./shared-ts/src/utils/validation.js";
4
4
  import { base64UrlDecode, base64UrlEncode } from "./shared-ts/src/utils/base64.js";
5
5
  import { sha256Bytes } from "./shared-ts/src/utils/digests.js";
6
- import { parseExternalAuthConfiguration } from "./shared-ts/src/auth/externalAuth.js";
6
+ import { parseExternalAuthConfiguration, parseExternalAuthProvider } from "./shared-ts/src/auth/externalAuth.js";
7
7
  import "./shared-ts/src/utils/encoders.js";
8
8
  import { CloudflareD1OidcJwksCache, parseBooleanJwtClaim, parseCacheControlMaxAgeSec, parseGoogleJwks, parseJwtAud, parseRs256JwtForVerification, validateGoogleIdTokenClaims, verifyRs256JwtSignature } from "./router/cloudflare/d1/oidc/d1OidcBoundary.js";
9
9
  import { verifyGoogleOidcToken } from "./router/cloudflare/d1/oidc/googleOidcToken.js";
@@ -15,6 +15,8 @@ import { computeLinkedDeviceSessionClaimDigestV1 } from "./shared-ts/src/device-
15
15
  import { WalletLifecycleLocator } from "./authorization/lifecycleRouting.js";
16
16
  import { secureRandomBase36, secureRandomBase64Url } from "./shared-ts/src/utils/secureRandomId.js";
17
17
  import { digestOpaqueValue } from "./authorization/service.js";
18
+ import { webAuthnCredentialIdB64uFromCredential } from "./router/auth/webAuthnCredentialCodecs.js";
19
+ import { routeError, routeJson, toFetchRouteResponse } from "./router/framework/routeResponses.js";
18
20
  import { extractBearerCredential, extractRouterApiEnvironmentId, normalizeSourceIp, resolveRequestOriginRateLimitKeyFromFetchHeaders, resolveSourceIpFromFetchHeaders } from "./router/auth/routerApiKeyAuth.js";
19
21
  import { SessionService, buildCorsOrigins, normalizeCorsOrigin, parseCsvList } from "./core/SessionService.js";
20
22
  import { ROUTER_AB_TRACE_ID_HEADER_V1 } from "./shared-ts/src/utils/routerAbTraceContext.js";
@@ -37,7 +39,6 @@ import { LocalRegistrationSetupAuthority } from "./localRegistrationSetupAuthori
37
39
  import { createWalletRegistrationContextResolver, unavailableRegistrationContext, walletRegistrationContext } from "./router/auth/walletRegistrationContext.js";
38
40
  import { publishableKeyRoutePrincipal, resolvePublishableKeyApiCredentialAuth, resolveSecretKeyApiCredentialAuth, resolveWalletRegistrationContext } from "./router/auth/routerApiCredentialAuth.js";
39
41
  import { enforceRoutePolicy } from "./router/framework/enforceRoutePolicy.js";
40
- import { routeError, routeJson, toFetchRouteResponse } from "./router/framework/routeResponses.js";
41
42
  import { parseWalletRegistrationSetupRequest } from "./router/domains/walletRegistration/walletRegistrationRoutes.js";
42
43
  import { applyRouteMetering } from "./router/framework/applyRouteMetering.js";
43
44
  import { InMemoryRouterAbNormalSigningAdmissionStore, abusePrincipalKey, createInMemoryRouterAbNormalSigningAdmissionAdapter, createInMemoryRouterAbNormalSigningAdmissionStore, createRouterAbNormalSigningAdmissionAdapter, runtimePolicyScopeKey } from "./router/domains/signingOperations/routerAbNormalSigningAdmissionCore.js";
@@ -47,7 +48,6 @@ import { coerceRouterLogger } from "./router/framework/logger.js";
47
48
  import { buildTenantRootIdentityFromAuthenticatedDeploymentV1, encodeTenantRootIdentityV1 } from "./shared-ts/src/tenant-root/tenantRootIdentity.js";
48
49
  import { WALLET_CONSOLE_OPS_BASE_PATH_V1, WALLET_CONSOLE_OP_PATHS_V1, WALLET_CONSOLE_SERVICE_ORIGIN_V1, decodeWalletConsoleTenantRootActiveLineageRequestV1, decodeWalletConsoleTenantRootActiveLineageResponseV1 } from "./router/cloudflare/runtime/walletConsoleOps.js";
49
50
  import { createWalletConsoleOpsClient, parseWalletRegistrationContextResponse } from "./router/cloudflare/runtime/walletConsoleOpsClient.js";
50
- import { webAuthnCredentialIdB64uFromCredential } from "./router/auth/webAuthnCredentialCodecs.js";
51
51
  import { deriveRecoveryCodeLocatorV1FromBytes, parseRecoveryCodeLocatorV1 } from "./shared-ts/src/wallet-recovery/recoveryCodeLocator.js";
52
52
  import { evaluateRouterAbNormalSigningAdmission } from "./router/domains/signingOperations/routerAbNormalSigningAdmission.js";
53
53
  import { authenticateRouterAbWalletOperationStepUpIdentity } from "./router/domains/signingOperations/routerAbOperationStepUp.js";
@@ -132,4 +132,4 @@ import { handleRouterAbEd25519YaoRecoveryRequestScopedCloudflareV1 } from "./rou
132
132
  import { RouterAbEd25519YaoRecoveryWalletSessionAuthorizationAdapter } from "./router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryWalletSessionAuthorization.js";
133
133
  import { keccak256Bytes } from "./shared-ts/src/utils/keccak.js";
134
134
  import { decodeEvmBlockHeader, decodeEvmTransactionByHash, decodeEvmTransactionCall, decodeEvmTransactionReceipt, parseRpcHexQuantity } from "./shared-ts/src/utils/evmRpcResults.js";
135
- 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, parseExternalAuthConfiguration, 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, resumeRegistrationDirectoryPublicationsV1, 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 };
135
+ 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, parseExternalAuthConfiguration, parseExternalAuthProvider, 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, resumeRegistrationDirectoryPublicationsV1, 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 };
@@ -4,9 +4,9 @@ import { sha256Bytes } from "../shared-ts/src/utils/digests.js";
4
4
  import { failure } from "../shared-ts/src/utils/failure.js";
5
5
  import { base58Encode } from "../shared-ts/src/utils/base58.js";
6
6
  import "../shared-ts/src/utils/encoders.js";
7
+ import { errorMessage } from "../shared-ts/src/utils/errors.js";
7
8
  import { ActionType, validateActionArgsWasm } from "../shared-ts/src/near/actions.js";
8
9
  import { deriveImplicitNearAccountIdFromEd25519PublicKey, parseImplicitNearAccountId, parseNamedNearAccountId } from "../shared-ts/src/utils/near.js";
9
- import { errorMessage } from "../shared-ts/src/utils/errors.js";
10
10
  import { threshold_ed25519_build_near_tx_unsigned_borsh, threshold_ed25519_decode_signed_near_tx_borsh, threshold_ed25519_finalize_near_tx_from_signature } from "../wasm/near_signer/pkg/wasm_signer_worker.js";
11
11
  import { toPublicKeyStringFromSecretKey } from "./nearKeys.js";
12
12
  import { requireFinalizeNearTxFromSignatureOutput, requireSingleUnsignedNearTxBorshOutput, signNearDigestWithSecretKey } from "./authService/nearPrivateKeySigning.js";
@@ -1,10 +1,12 @@
1
1
  import { parseTenantId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
2
+ import { resolveRecordedPasskeyOwnerOperation } from "./d1RecordedOwnerOperation.js";
2
3
  //#region src/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.ts
3
4
  function createD1AuthorizedOperationRouteService(assembly) {
4
5
  const tenantId = parseTenantId(assembly.options.orgId);
5
6
  if (!tenantId.ok) throw new Error(`orgId cannot identify an authorization tenant: ${tenantId.error.message}`);
6
7
  return {
7
8
  tenantId: tenantId.value,
9
+ resolveRecordedPasskeyOwnerOperation: resolveRecordedPasskeyOwnerOperation.bind(null, assembly, tenantId.value),
8
10
  resolveEcdsaWalletSessionOperation: assembly.authorizationStore.resolveEcdsaWalletSessionOperation.bind(assembly.authorizationStore),
9
11
  admitEcdsaWalletSessionOperation: assembly.authorizationStore.admitEcdsaWalletSessionOperation.bind(assembly.authorizationStore),
10
12
  admitEd25519WalletSessionOperation: assembly.authorizationStore.admitEd25519WalletSessionOperation.bind(assembly.authorizationStore),
@@ -0,0 +1,43 @@
1
+ import { CAPABILITY_KINDS } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
2
+ import { walletAuthAuthorityRef } from "../../../../shared-ts/src/utils/walletAuthAuthority.js";
3
+ //#region src/router/cloudflare/d1/auth/d1RecordedOwnerOperation.ts
4
+ /** A continuation uses only the factor digest and exact operation recorded after owner verification. */
5
+ async function resolveRecordedPasskeyOwnerOperation(source, tenantId, input) {
6
+ const operation = await source.authorizationService.readAuthorizedOperationById({
7
+ tenantId,
8
+ authorizedOperationId: input.authorizedOperationId
9
+ });
10
+ if (!operation || operation.authorization.kind !== "verified_step_up" || operation.quota.kind !== "quota_neutral" || operation.operation.operation.capabilityKind !== CAPABILITY_KINDS.nearEd25519MpcSigning) return null;
11
+ const scope = source.options;
12
+ const evidence = await scope.database.prepare(`SELECT authority_digest, expires_at_ms
13
+ FROM verified_wallet_operation_evidence_sets
14
+ WHERE namespace = ? AND org_id = ? AND project_id = ? AND env_id = ?
15
+ AND tenant_id = ? AND wallet_id = ? AND principal_id = ?
16
+ AND evidence_set_digest = ? AND request_origin = ? AND audience = ?
17
+ AND lane_digest = ? AND intent_digest = ? AND display_digest = ?
18
+ AND capability_kind = ? AND operation_kind = ?
19
+ AND verified_at_ms <= ? AND expires_at_ms > ? AND assurance = 'step_up'
20
+ LIMIT 1`).bind(scope.namespace, scope.orgId, scope.projectId, scope.envId, tenantId, input.walletId, operation.operation.principalId, operation.authorization.evidenceSetDigest, input.requestOrigin, input.requestOrigin, operation.operation.digests.laneDigest, operation.operation.digests.intentDigest, operation.operation.digests.displayDigest, operation.operation.operation.capabilityKind, operation.operation.operation.operationKind, input.nowMs, input.nowMs).first();
21
+ if (!evidence || typeof evidence.authority_digest !== "string" || typeof evidence.expires_at_ms !== "number") return null;
22
+ const methods = await source.walletAuthMethodStore.listForWalletV2({ walletId: input.walletId });
23
+ for (const method of methods) {
24
+ if (method.kind !== "passkey" || method.status !== "active") continue;
25
+ const resolved = await source.walletAuthMethods.resolveActivePasskeyAuthorityForVerifiedCredential({
26
+ walletId: input.walletId,
27
+ rpId: method.rpId,
28
+ credentialIdB64u: method.credentialIdB64u
29
+ });
30
+ if (!resolved.ok) continue;
31
+ if ((await walletAuthAuthorityRef({ authority: resolved.authority })).authorityDigest !== evidence.authority_digest) continue;
32
+ return {
33
+ operation,
34
+ authority: resolved.authority,
35
+ expiresAtMs: evidence.expires_at_ms
36
+ };
37
+ }
38
+ return null;
39
+ }
40
+ //#endregion
41
+ export { resolveRecordedPasskeyOwnerOperation };
42
+
43
+ //# sourceMappingURL=d1RecordedOwnerOperation.js.map
@@ -5,12 +5,12 @@ import { ExternalAuthService } from "../../../../auth/externalAuthService.js";
5
5
  import { ExternalAuthStore } from "../../../../auth/externalAuthStore.js";
6
6
  import { parseDeviceId, parsePrincipalId, parseTenantId, parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
7
7
  import { parseRouterAbEcdsaRegistrationActivationReceiptV1 } from "../../../../shared-ts/src/utils/routerAbEcdsaDerivation.js";
8
+ import { parseWebAuthnAuthenticationCredential } from "../../../auth/webAuthnCredentialCodecs.js";
8
9
  import { D1WalletStore } from "../../../../core/d1WalletStore.js";
9
10
  import { D1WalletAuthMethodStore } from "../../../../core/d1WalletAuthMethodStore.js";
10
11
  import { normalizeLogger } from "../../../../core/logger.js";
11
12
  import { executeSignedDelegateWithRelayer } from "../../../../delegateAction/index.js";
12
13
  import { parseWalletUnlockIssuanceRejectionCode } from "../../../framework/authServicePort.js";
13
- import { parseWebAuthnAuthenticationCredential } from "../../../auth/webAuthnCredentialCodecs.js";
14
14
  import { resolveActiveOwnerWalletExecutionLane, resolveWalletAuthMethodIdForAuthority } from "../../../../core/signingLanes/WalletExecutionLaneProjection.js";
15
15
  import { DEFAULT_WALLET_SESSION_TTL_MS, LINKED_DEVICE_WALLET_SESSION_TTL_MS } from "../../../../shared-ts/src/threshold/sessionPolicy.js";
16
16
  import { createDeviceLinkingOwnerRequestAuthenticatorV1 } from "../../../transport/fetch/routes/deviceLinkingOwnerAuthorization.js";
@@ -475,6 +475,27 @@ function parseWalletRegistrationSessionCommitReceipt(raw) {
475
475
  function parseWalletRegistrationSessionCommitReceiptCommitted(raw, receipt) {
476
476
  const record = toRecordValue(raw);
477
477
  if (!record || typeof record.kind !== "string") return null;
478
+ if (record.kind === "near_owner_ready") {
479
+ if (!hasExactKeys(record, [
480
+ "kind",
481
+ "expectedOrigin",
482
+ "response"
483
+ ])) return null;
484
+ const response = parseD1WalletRegistrationFinalizeReplayResponse(record.response);
485
+ if (!response?.ok || response.kind !== "near_ed25519") return null;
486
+ let expectedOrigin;
487
+ try {
488
+ expectedOrigin = new URL(String(record.expectedOrigin)).origin;
489
+ } catch {
490
+ return null;
491
+ }
492
+ if (expectedOrigin !== record.expectedOrigin) return null;
493
+ return {
494
+ kind: "near_owner_ready",
495
+ expectedOrigin,
496
+ response
497
+ };
498
+ }
478
499
  if (record.kind === "ecdsa_ready") {
479
500
  if (!hasExactKeys(record, [
480
501
  "kind",
@@ -2,8 +2,8 @@ import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/
2
2
  import { failedVerification, failure } from "../../../../shared-ts/src/utils/failure.js";
3
3
  import { parseD1BoundaryWalletIdResult } from "../auth/d1RouterApiAuthBoundary.js";
4
4
  import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
5
- import { validateSecp256k1PublicKey33, verifySecp256k1RecoverableSignatureAgainstPublicKey33 } from "../../../../core/ThresholdService/evmCryptoWasm.js";
6
5
  import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
6
+ import { validateSecp256k1PublicKey33, verifySecp256k1RecoverableSignatureAgainstPublicKey33 } from "../../../../core/ThresholdService/evmCryptoWasm.js";
7
7
  import { bytesEqual, clampedEmailOtpUnlockTtlMs, decodeFixedBase64Url, emailOtpUnlockChallengeRecord } from "./d1EmailOtpRecords.js";
8
8
  //#region src/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.ts
9
9
  function errorMessage(error) {
@@ -1,7 +1,7 @@
1
1
  import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
2
2
  import { failure } from "../../../../shared-ts/src/utils/failure.js";
3
- import { validateSecp256k1PublicKey33 } from "../../../../core/ThresholdService/evmCryptoWasm.js";
4
3
  import { emailOtpDeviceEnrollmentId } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
4
+ import { validateSecp256k1PublicKey33 } from "../../../../core/ThresholdService/evmCryptoWasm.js";
5
5
  import { validateEmailOtpEnrollmentMaterial } from "./d1EmailOtpRecords.js";
6
6
  //#region src/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.ts
7
7
  function parseEmailOtpEnrollmentMaterialBoundaryInput(value) {
@@ -3,8 +3,8 @@ import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/
3
3
  import { failure } from "../../../../shared-ts/src/utils/failure.js";
4
4
  import { parseD1BoundaryWalletId, parseD1BoundaryWalletIdResult } from "../auth/d1RouterApiAuthBoundary.js";
5
5
  import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
6
- import { createServerAllocatedWalletId } from "../../../../shared-ts/src/utils/registrationIds.js";
7
6
  import { hashEmailOtpOperationBinding } from "../../../domains/emailOtp/emailOtpSessionRouteHelpers.js";
7
+ import { createServerAllocatedWalletId } from "../../../../shared-ts/src/utils/registrationIds.js";
8
8
  import { abandonedGoogleEmailOtpRegistrationAttemptRecord, expiredGoogleEmailOtpRegistrationAttemptRecord, googleEmailOtpRegistrationOfferForResponse, requireRuntimePolicyScope } from "./d1GoogleEmailOtpRegistrationRecords.js";
9
9
  import { googleEmailOtpStaleIdentityMapping, hasDifferentWalletIdentitySubject } from "../identity/d1IdentityRecords.js";
10
10
  //#region src/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.ts
@@ -6,10 +6,10 @@ import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilit
6
6
  import { isActiveRecoveredWalletAuthorityV1, walletAuthorityDigestsMatchV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
7
7
  import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
8
8
  import { PASSKEY_PRF_FIRST_SALT_V1, PASSKEY_PRF_SECOND_SALT_V1 } from "../../../../shared-ts/src/utils/signingSessionSeal.js";
9
- import { isHostWithinRpId, originHostnameOrEmpty } from "../../../../core/authService/webauthnOidcHelpers.js";
9
+ import { deriveRecoveryCodeLocatorV1FromBytes } from "../../../../shared-ts/src/wallet-recovery/recoveryCodeLocator.js";
10
10
  import { buildWalletRecoveryBackupAcknowledgementV1, walletRecoveryBackupIsOutstanding } from "../../../../shared-ts/src/wallet-recovery/backupAcknowledgement.js";
11
11
  import "../../../../shared-ts/src/wallet-recovery/recoveryCodes.js";
12
- import { deriveRecoveryCodeLocatorV1FromBytes } from "../../../../shared-ts/src/wallet-recovery/recoveryCodeLocator.js";
12
+ import { isHostWithinRpId, originHostnameOrEmpty } from "../../../../core/authService/webauthnOidcHelpers.js";
13
13
  import { buildWebAuthnRecoveryContinuityAnchorRecord } from "../webauthn/d1WebAuthnRecords.js";
14
14
  import { buildWalletRecoveryCommittedProjectionV1 } from "../../../../shared-ts/src/wallet-recovery/walletRecoveryCommittedProjection.js";
15
15
  import { envelopeFactorRef } from "./d1PasskeyCustodyEnvelopeStore.js";
@@ -4,15 +4,15 @@ import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
4
4
  import { buildDelegatedWalletAuthorityV1, buildFullOwnerDelegatedWalletAuthorityV1, sameDelegatedWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
5
5
  import { sameWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
6
6
  import { sameVerifiedActiveWalletAuthorityV1, walletAuthorityDigestsMatchV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
7
+ import { WALLET_EMAIL_OTP_ACTIONS, emailOtpDeviceEnrollmentId } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
7
8
  import { D1WalletAuthMethodStore } from "../../../../core/d1WalletAuthMethodStore.js";
8
9
  import { parsePasskeyCustodyEnvelopeRecord } from "../../../../shared-ts/src/passkey-custody/custodyEnvelope.js";
9
10
  import "../../../../shared-ts/src/passkey-custody/index.js";
10
- import { WALLET_EMAIL_OTP_ACTIONS, emailOtpDeviceEnrollmentId } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
11
+ import { parseRecoveryCodeLocatorV1 } from "../../../../shared-ts/src/wallet-recovery/recoveryCodeLocator.js";
11
12
  import { parseDerivedWalletRecoveryKeyId } from "../../../../shared-ts/src/wallet-recovery/recoveryKeyId.js";
12
13
  import { parseWalletRecoveryBackupAcknowledgementV1 } from "../../../../shared-ts/src/wallet-recovery/backupAcknowledgement.js";
13
14
  import "../../../../shared-ts/src/wallet-recovery/recoveryCodes.js";
14
15
  import { parseWalletRecoveryEnvelopeSetRecord } from "../../../../shared-ts/src/wallet-recovery/walletRecoveryEnvelopeSet.js";
15
- import { parseRecoveryCodeLocatorV1 } from "../../../../shared-ts/src/wallet-recovery/recoveryCodeLocator.js";
16
16
  import { reservePasskeyCredential } from "../../../../core/passkeyCredentialClaims.js";
17
17
  import { prepareD1WebAuthnCredentialBindingInsertStatement } from "../../../../core/WebAuthnCredentialBindingStore.js";
18
18
  import { prepareD1WebAuthnAuthenticatorInsertStatement } from "../webauthn/d1WebAuthnStore.js";
@@ -5,9 +5,9 @@ import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimit
5
5
  import { failure } from "../../../../shared-ts/src/utils/failure.js";
6
6
  import "../../../../shared-ts/src/utils/encoders.js";
7
7
  import { buildWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
8
- import { consumeReservedRecoveryCode } from "../../../../shared-ts/src/wallet-recovery/recoveryCodeReservation.js";
9
- import { hashEmailOtpOperationBinding } from "../../../domains/emailOtp/emailOtpSessionRouteHelpers.js";
10
8
  import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS, WALLET_EMAIL_OTP_UNLOCK_OPERATION } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
9
+ import { hashEmailOtpOperationBinding } from "../../../domains/emailOtp/emailOtpSessionRouteHelpers.js";
10
+ import { consumeReservedRecoveryCode } from "../../../../shared-ts/src/wallet-recovery/recoveryCodeReservation.js";
11
11
  import { sealEmailOtpFactorSecretForWorker } from "../../../domains/emailOtp/emailOtpRouteHandlers.js";
12
12
  import { markWalletRecoveryGoogleEmailOtpAttemptIssued, markWalletRecoveryGoogleEmailOtpAttemptVerified, sameWalletRecoveryGoogleEmailOtpFinalizationInputV1, walletRecoveryGoogleEmailOtpFinalizationInput } from "./d1WalletRecoveryGoogleEmailOtpRecords.js";
13
13
  import { buildWalletRecoveryEcdsaPossessionChallengesV1, resolveWalletRecoveryKeyManifestV1, verifyWalletRecoveryKeyActivationsV1 } from "../../../domains/passkeyCustody/walletRecoveryKeyManifest.js";
@@ -49,6 +49,7 @@ function buildRegistrationIntent(input) {
49
49
  const foundingWalletAuthMethodId = input.foundingWalletAuthMethodId;
50
50
  if (input.runtimePolicyScope) return {
51
51
  version: "registration_intent_v1",
52
+ completion: input.completion,
52
53
  walletId: input.walletId,
53
54
  authMethod: input.authMethod,
54
55
  signerSelection: input.signerSelection,
@@ -58,6 +59,7 @@ function buildRegistrationIntent(input) {
58
59
  };
59
60
  return {
60
61
  version: "registration_intent_v1",
62
+ completion: input.completion,
61
63
  walletId: input.walletId,
62
64
  authMethod: input.authMethod,
63
65
  signerSelection: input.signerSelection,
@@ -139,6 +141,7 @@ function parseD1RegistrationIntent(raw) {
139
141
  if (record.runtimePolicyScope !== void 0 && !runtimePolicyScope) return null;
140
142
  if (runtimePolicyScope) return {
141
143
  version: "registration_intent_v1",
144
+ completion: parsePersistedRegistrationCompletion(record.completion),
142
145
  walletId,
143
146
  authMethod,
144
147
  signerSelection: signerSelection.value,
@@ -148,6 +151,7 @@ function parseD1RegistrationIntent(raw) {
148
151
  };
149
152
  return {
150
153
  version: "registration_intent_v1",
154
+ completion: parsePersistedRegistrationCompletion(record.completion),
151
155
  walletId,
152
156
  authMethod,
153
157
  signerSelection: signerSelection.value,
@@ -2046,6 +2050,11 @@ function safeInteger(raw) {
2046
2050
  function unreachableAddAuthMethodInput(value) {
2047
2051
  throw new Error(`Unhandled add-auth-method input kind: ${String(value)}`);
2048
2052
  }
2053
+ function parsePersistedRegistrationCompletion(raw) {
2054
+ if (raw === void 0 || raw === "wallet_session") return "wallet_session";
2055
+ if (raw === "owner_operations") return "owner_operations";
2056
+ throw new Error("Stored registration completion is invalid");
2057
+ }
2049
2058
  //#endregion
2050
2059
  export { buildAddAuthMethodIntent, buildAddSignerIntent, buildD1EcdsaWalletKeysFromBootstrap, buildD1WalletEcdsaSignerRecords, buildD1WalletRecord, buildRegistrationIntent, deriveEvmFamilySigningKeySlotId, inferRuntimePolicyScopeFromSigningRoot, intentScopeMetadata, normalizeThresholdEcdsaChainTargets, parseD1AddSignerIntent, parseD1EcdsaDerivationServerBootstrapResponse, parseD1RuntimePolicyScope, parseD1StoredAddAuthMethodIntent, parseD1StoredAddSignerAuth, parseD1StoredAddSignerIntent, parseD1StoredWalletAddAuthMethodCeremony, parseD1StoredWalletAddAuthMethodFinalizeReplay, parseD1StoredWalletAddSignerCeremony, parseD1StoredWalletAddSignerFinalizeReplay, parseD1StoredWalletRegistrationCeremony, parseD1WalletAddSignerFinalizeTerminalResponse, parseD1WalletRegistrationCommittedInstallationProjection, parseD1WalletRegistrationFinalizeReplayResponse, parseWalletIdForIntent, positiveIntegerArraysEqual, runtimePolicyScopeMatches, thresholdEcdsaChainTargetsEqual };
2051
2060
 
@@ -1,5 +1,6 @@
1
1
  import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
2
2
  import { prepareD1TenantStatement } from "../../../../core/d1TenantStore.js";
3
+ import { parseRegistrationSessionPublication } from "../../../domains/walletRegistration/walletRegistrationReservation.js";
3
4
  //#region src/router/cloudflare/d1/registration/d1WalletExecutionAuthority.ts
4
5
  /** The finalize response normally delivers first; the scheduled resumption waits this long. */
5
6
  const DIRECTORY_PUBLICATION_FIRST_RETRY_MS = 6e4;
@@ -91,20 +92,18 @@ var D1WalletExecutionAuthority = class {
91
92
  const publication = {
92
93
  walletId: input.registration.walletId,
93
94
  ceremonyId: input.registration.ceremonyId,
94
- digest: input.session.digest,
95
- expiresAtMs: input.session.expiresAtMs,
95
+ session: input.session,
96
96
  attempts: 0
97
97
  };
98
98
  return {
99
99
  statements: [...this.prepareState(input.registration, "active"), prepareD1TenantStatement(this.database, this.scope, `INSERT INTO wallet_registration_directory_publications
100
100
  (namespace, org_id, project_id, env_id, wallet_id, ceremony_id,
101
- session_digest, session_expires_at_ms, next_attempt_at_ms)
102
- VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9)
101
+ session_json, next_attempt_at_ms)
102
+ VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)
103
103
  ON CONFLICT DO NOTHING`, [
104
104
  publication.walletId,
105
105
  publication.ceremonyId,
106
- publication.digest,
107
- publication.expiresAtMs,
106
+ JSON.stringify(publication.session),
108
107
  Date.now() + DIRECTORY_PUBLICATION_FIRST_RETRY_MS
109
108
  ])],
110
109
  publish: async () => {
@@ -118,7 +117,7 @@ var D1WalletExecutionAuthority = class {
118
117
  }
119
118
  /** Sends the publications that are due, oldest first, one at a time. */
120
119
  async resumeDirectoryPublications(input) {
121
- const due = await prepareD1TenantStatement(this.database, this.scope, `SELECT wallet_id, ceremony_id, session_digest, session_expires_at_ms, attempts
120
+ const due = await prepareD1TenantStatement(this.database, this.scope, `SELECT wallet_id, ceremony_id, session_json, attempts
122
121
  FROM wallet_registration_directory_publications
123
122
  WHERE namespace = ?1 AND org_id = ?2 AND project_id = ?3 AND env_id = ?4
124
123
  AND state = 'pending' AND next_attempt_at_ms <= ?5
@@ -133,8 +132,7 @@ var D1WalletExecutionAuthority = class {
133
132
  const outcome = await this.deliver({
134
133
  walletId: row.wallet_id,
135
134
  ceremonyId: row.ceremony_id,
136
- digest: row.session_digest,
137
- expiresAtMs: row.session_expires_at_ms,
135
+ session: parseRegistrationSessionPublication(JSON.parse(row.session_json), row.wallet_id),
138
136
  attempts: row.attempts
139
137
  });
140
138
  delivered[outcome] += 1;
@@ -148,12 +146,7 @@ var D1WalletExecutionAuthority = class {
148
146
  ceremonyId: publication.ceremonyId,
149
147
  walletId: publication.walletId,
150
148
  outcome: "established",
151
- session: {
152
- kind: "credential",
153
- walletId: publication.walletId,
154
- digest: publication.digest,
155
- expiresAtMs: publication.expiresAtMs
156
- }
149
+ session: publication.session
157
150
  });
158
151
  } catch (error) {
159
152
  console.warn("[wallet-registration] directory publication deferred", error);
@@ -194,7 +187,7 @@ var D1WalletExecutionAuthority = class {
194
187
  }
195
188
  /** The state update with its guard. The guard reads the row count of the update before it. */
196
189
  prepareState(input, state) {
197
- return [prepareD1TenantStatement(this.database, this.scope, `UPDATE wallet_execution_generations SET state = ?7
190
+ return [prepareD1TenantStatement(this.database, this.scope, `UPDATE wallet_execution_generations SET state = ?7, registration_completion = CASE WHEN ?7 = 'active' THEN 'established' ELSE registration_completion END
198
191
  WHERE namespace = ?1 AND org_id = ?2 AND project_id = ?3 AND env_id = ?4
199
192
  AND wallet_id = ?5 AND origin = 'registration' AND origin_id = ?6
200
193
  AND state IN ('registering', ?7)`, [
@@ -2167,7 +2167,13 @@ var CloudflareD1WalletRegistrationService = class {
2167
2167
  expectedOrigin: ownerProofContext.expectedOrigin,
2168
2168
  expiresAtMs: args.input.authorization.kind === "wallet_session" ? args.setupClaims.expiresAtMs : ownerProofContext.expiresAtMs
2169
2169
  });
2170
- const initialSessionPlan = sessionPredecessor.kind === "ed25519_only" && !registrationSignerBranchesFromPlan(source.ceremony.signerPlan).evmFamilyEcdsa ? {
2170
+ const completion = source.kind === "stored_ceremony" ? source.ceremony.intent.completion : "wallet_session";
2171
+ if (completion === "owner_operations" && args.input.onSessionCommitted) return unissuedRegistrationCommit({
2172
+ ok: false,
2173
+ code: "invalid_body",
2174
+ message: "Owner-operation registration cannot seal a Wallet Session"
2175
+ });
2176
+ const initialSessionPlan = completion === "wallet_session" && sessionPredecessor.kind === "ed25519_only" && !registrationSignerBranchesFromPlan(source.ceremony.signerPlan).evmFamilyEcdsa ? {
2171
2177
  kind: "initial_near",
2172
2178
  store: this.registrationSessionStore,
2173
2179
  request: {
@@ -2202,6 +2208,31 @@ var CloudflareD1WalletRegistrationService = class {
2202
2208
  message: "NEAR provisioning committed a non-NEAR branch"
2203
2209
  });
2204
2210
  }
2211
+ if (completion === "owner_operations") {
2212
+ if (!this.registrationAuthority) throw new Error("Registration home completion is unavailable");
2213
+ const custody = await execution.custody;
2214
+ return {
2215
+ kind: "owner_registered",
2216
+ expectedOrigin: ownerProofContext.expectedOrigin,
2217
+ response: {
2218
+ ...finalized,
2219
+ walletCustody: custody.outcome,
2220
+ registrationEstablishedSession: {
2221
+ kind: "owner_operations",
2222
+ walletId: finalized.walletId
2223
+ }
2224
+ },
2225
+ custodyWrite: custody.kind === "prepared" ? custody.write : null,
2226
+ activation: this.registrationAuthority.prepareEstablished({
2227
+ registration: {
2228
+ ceremonyId: args.input.registrationCeremonyId,
2229
+ walletId: finalized.walletId,
2230
+ state: "registering"
2231
+ },
2232
+ session: { kind: "none" }
2233
+ })
2234
+ };
2235
+ }
2205
2236
  if (!this.registrationAuthority) throw new Error("Registration home completion is unavailable");
2206
2237
  const [issuance, custody] = await Promise.allSettled([recordRegistrationPromiseTiming({
2207
2238
  sink: args.serverTiming,
@@ -2306,6 +2337,16 @@ var CloudflareD1WalletRegistrationService = class {
2306
2337
  async replayWalletRegistrationNearProvisioningCommit(receipt) {
2307
2338
  if (receipt.operation !== "near_provisioning") throw new Error("Registration NEAR provisioning receipt operation is invalid");
2308
2339
  if (receipt.committed.kind === "error") return replayedRegistrationCommit(receipt.committed.error);
2340
+ if (receipt.committed.kind === "near_owner_ready") {
2341
+ const response = receipt.committed.response;
2342
+ return replayedRegistrationCommit({
2343
+ ...response,
2344
+ registrationEstablishedSession: {
2345
+ kind: "owner_operations",
2346
+ walletId: response.walletId
2347
+ }
2348
+ });
2349
+ }
2309
2350
  if (receipt.committed.kind !== "near_ready") throw new Error("Registration NEAR provisioning receipt branch is invalid");
2310
2351
  if (!isRegistrationNearReadyReceipt(receipt)) throw new Error("Registration NEAR provisioning receipt branch is invalid");
2311
2352
  const authMethod = registrationReplayAuthMethodFields(receipt);
@@ -2530,6 +2571,7 @@ var CloudflareD1WalletRegistrationService = class {
2530
2571
  nowMs: Date.now()
2531
2572
  })
2532
2573
  }), waitUntil ? void 0 : cleanup]);
2574
+ if (committed.registrationEstablishedSession.kind === "owner_operations") throw new Error("A Wallet Session continuation cannot complete owner-only registration");
2533
2575
  const tokens = committed.registrationEstablishedSession.session.tokens;
2534
2576
  if (!current || tokens.kind !== "near_ed25519_and_evm_family_ecdsa") throw new Error("NEAR continuation Wallet Session is no longer active");
2535
2577
  recordRegistrationServerTiming(serverTiming, "near_finalize_total", totalStartedAtMs);
@@ -51,8 +51,20 @@ function normalizeWalletRegistrationSetupRequest(request) {
51
51
  code: "invalid_body",
52
52
  message: "authMethod is required"
53
53
  };
54
+ const completion = request.completion;
55
+ if (completion !== "wallet_session" && completion !== "owner_operations") return {
56
+ ok: false,
57
+ code: "invalid_body",
58
+ message: "Registration completion is required"
59
+ };
60
+ if (completion === "owner_operations" && (signerSelection.value.signers.length !== 1 || signerSelection.value.signers[0]?.kind !== "near_ed25519" || authMethod.kind !== "passkey")) return {
61
+ ok: false,
62
+ code: "invalid_body",
63
+ message: "Owner-operation onboarding requires a NEAR-only wallet and a wallet-origin passkey"
64
+ };
54
65
  return {
55
66
  ok: true,
67
+ completion,
56
68
  signerSelection: signerSelection.value,
57
69
  authMethod
58
70
  };
@@ -97,6 +97,7 @@ async function completeReservedRegistrationSetup(input, dependencies, admitted,
97
97
  if (!signingRootId) return walletRegistrationSetupError("invalid_body", "registration requires a signing root");
98
98
  const registrationOperation = reservation;
99
99
  const intent = buildRegistrationIntent({
100
+ completion: normalized.completion,
100
101
  nonceB64u: registrationCeremonyId.slice(4),
101
102
  walletId: wallet.walletId,
102
103
  authMethod: normalized.authMethod,
@@ -4,6 +4,7 @@ function registrationCommitCompletionWrite(execution) {
4
4
  switch (execution.kind) {
5
5
  case "unissued":
6
6
  case "replayed": return null;
7
+ case "owner_registered":
7
8
  case "session_issued":
8
9
  case "session_issued_with_installation_projection":
9
10
  if (!execution.custodyWrite) return execution.activation;