@seams/wallet 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/LICENSE.md +201 -0
  2. package/THIRD_PARTY_NOTICES.md +15095 -0
  3. package/dist/.build-inputs.sha256 +1 -1
  4. package/dist/esm/SeamsWeb/signingSurface/BrowserSigningSurface.js +7 -14
  5. package/dist/esm/core/signingEngine/flows/signEvmFamily/signingFlow.js +2 -1
  6. package/dist/esm/core/signingEngine/flows/signNear/signNear.js +16 -30
  7. package/dist/esm/core/signingEngine/flows/signNear/signTransactions.js +102 -80
  8. package/dist/esm/core/signingEngine/session/identity/exactWalletSessionReader.js +2 -27
  9. package/dist/esm/core/signingEngine/uiConfirm/handlers/flows/signing.js +1 -1
  10. package/dist/esm/react/SeamsWeb/signingSurface/BrowserSigningSurface.js +7 -14
  11. package/dist/esm/react/core/signingEngine/flows/signEvmFamily/signingFlow.js +2 -1
  12. package/dist/esm/react/core/signingEngine/flows/signNear/signNear.js +16 -30
  13. package/dist/esm/react/core/signingEngine/flows/signNear/signTransactions.js +102 -80
  14. package/dist/esm/react/core/signingEngine/session/identity/exactWalletSessionReader.js +2 -27
  15. package/dist/esm/react/core/signingEngine/uiConfirm/handlers/flows/signing.js +1 -1
  16. package/dist/esm/sdk/{display-rIXVrumh.js → display-CV_FRBAv.js} +1 -1
  17. package/dist/esm/sdk/export-private-key-viewer.js +8804 -55
  18. package/dist/esm/sdk/halo-border.js +8887 -8
  19. package/dist/{public/sdk/host-BqwEYhX0.js → esm/sdk/host-saeh9CWY.js} +2 -2
  20. package/dist/esm/sdk/passkey-halo-loading.js +8850 -27
  21. package/dist/{public/sdk/registrationPreparationPreload-u3ruCmpF.js → esm/sdk/registrationPreparationPreload-9iIiVEzP.js} +2 -2
  22. package/dist/esm/sdk/router_ab_ed25519_yao_client_bg.wasm +0 -0
  23. package/dist/esm/sdk/{runtime-auth-Da9yQyaD.js → runtime-auth-CqJzUZit.js} +3 -3
  24. package/dist/esm/sdk/{runtime-device-link-DNlzlwrr.js → runtime-device-link-BDex3l39.js} +2 -2
  25. package/dist/{public/sdk/runtime-ecdsa-tempo-B7dBVcCI.js → esm/sdk/runtime-ecdsa-tempo-CV2jjenL.js} +2 -2
  26. package/dist/{public/sdk/runtime-email-otp-CckVQZJC.js → esm/sdk/runtime-email-otp-CRXxFJfB.js} +2 -2
  27. package/dist/{public/sdk/runtime-export-WAiBwZL_.js → esm/sdk/runtime-export-DDRRvQHJ.js} +2 -2
  28. package/dist/esm/sdk/{runtime-near-DBJ4KfFv.js → runtime-near-DOmJffsR.js} +2 -2
  29. package/dist/{public/sdk/runtime-preferences-DmH7eMHH.js → esm/sdk/runtime-preferences-CPxDZqxr.js} +2 -2
  30. package/dist/esm/sdk/{runtime-recovery-kPgl9nTT.js → runtime-recovery-wZqjlB5u.js} +2 -2
  31. package/dist/esm/sdk/{runtimeContext-BorCgXo5.js → runtimeContext-D73F6HOf.js} +18 -50
  32. package/dist/{public/sdk/runtimeLoader-BKQjNgXO.js → esm/sdk/runtimeLoader-DzuoDxql.js} +9 -9
  33. package/dist/{public/sdk/signEvmFamily-CwJEkCP7.js → esm/sdk/signEvmFamily-CIlzzMEd.js} +3 -3
  34. package/dist/esm/sdk/{signEvmFamilyWithUiConfirmForTempo-DtF2dEhK.js → signEvmFamilyWithUiConfirmForTempo-LNMzIdPa.js} +2 -2
  35. package/dist/esm/sdk/{signEvmWithUiConfirm-CeDL-vEX.js → signEvmWithUiConfirm-C4vBAKpE.js} +1 -1
  36. package/dist/esm/sdk/{signNear-B04A4qzs.js → signNear-d9Xz3SDg.js} +118 -110
  37. package/dist/esm/sdk/{signatureUses-BsYpH81W.js → signatureUses-Dg0S52Mp.js} +2 -1
  38. package/dist/{public/sdk/signerLoader-BhF6IFbD.js → esm/sdk/signerLoader-DVlqSMOs.js} +2 -2
  39. package/dist/esm/sdk/tx-confirm-ui.js +9568 -206
  40. package/dist/esm/sdk/w3a-tx-confirmer.js +8335 -206
  41. package/dist/esm/sdk/wallet-iframe-host-ecdsa.js +1 -1
  42. package/dist/esm/sdk/wallet-iframe-host-full.js +1 -1
  43. package/dist/esm/sdk/wallet-iframe-host-near.js +1 -1
  44. package/dist/esm/sdk/wallet-iframe-host-runtime.js +1 -1
  45. package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker.js +4 -4
  46. package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
  47. package/dist/esm/wasm/router_ab_ecdsa_client/pkg/router_ab_ecdsa_client_bg.wasm +0 -0
  48. package/dist/esm/wasm/router_ab_ed25519_yao_client/pkg/router_ab_ed25519_yao_client_bg.wasm +0 -0
  49. package/dist/public/headers.manifest.json +1 -1
  50. package/dist/public/sdk/{display-rIXVrumh.js → display-CV_FRBAv.js} +1 -1
  51. package/dist/public/sdk/export-private-key-viewer.js +8804 -55
  52. package/dist/public/sdk/halo-border.js +8887 -8
  53. package/dist/{esm/sdk/host-BqwEYhX0.js → public/sdk/host-saeh9CWY.js} +2 -2
  54. package/dist/public/sdk/passkey-halo-loading.js +8850 -27
  55. package/dist/{esm/sdk/registrationPreparationPreload-u3ruCmpF.js → public/sdk/registrationPreparationPreload-9iIiVEzP.js} +2 -2
  56. package/dist/public/sdk/router_ab_ed25519_yao_client_bg.wasm +0 -0
  57. package/dist/public/sdk/{runtime-auth-Da9yQyaD.js → runtime-auth-CqJzUZit.js} +3 -3
  58. package/dist/public/sdk/{runtime-device-link-DNlzlwrr.js → runtime-device-link-BDex3l39.js} +2 -2
  59. package/dist/{esm/sdk/runtime-ecdsa-tempo-B7dBVcCI.js → public/sdk/runtime-ecdsa-tempo-CV2jjenL.js} +2 -2
  60. package/dist/{esm/sdk/runtime-email-otp-CckVQZJC.js → public/sdk/runtime-email-otp-CRXxFJfB.js} +2 -2
  61. package/dist/{esm/sdk/runtime-export-WAiBwZL_.js → public/sdk/runtime-export-DDRRvQHJ.js} +2 -2
  62. package/dist/public/sdk/{runtime-near-DBJ4KfFv.js → runtime-near-DOmJffsR.js} +2 -2
  63. package/dist/{esm/sdk/runtime-preferences-DmH7eMHH.js → public/sdk/runtime-preferences-CPxDZqxr.js} +2 -2
  64. package/dist/public/sdk/{runtime-recovery-kPgl9nTT.js → runtime-recovery-wZqjlB5u.js} +2 -2
  65. package/dist/public/sdk/{runtimeContext-BorCgXo5.js → runtimeContext-D73F6HOf.js} +18 -50
  66. package/dist/{esm/sdk/runtimeLoader-BKQjNgXO.js → public/sdk/runtimeLoader-DzuoDxql.js} +9 -9
  67. package/dist/{esm/sdk/signEvmFamily-CwJEkCP7.js → public/sdk/signEvmFamily-CIlzzMEd.js} +3 -3
  68. package/dist/public/sdk/{signEvmFamilyWithUiConfirmForTempo-DtF2dEhK.js → signEvmFamilyWithUiConfirmForTempo-LNMzIdPa.js} +2 -2
  69. package/dist/public/sdk/{signEvmWithUiConfirm-CeDL-vEX.js → signEvmWithUiConfirm-C4vBAKpE.js} +1 -1
  70. package/dist/public/sdk/{signNear-B04A4qzs.js → signNear-d9Xz3SDg.js} +118 -110
  71. package/dist/public/sdk/{signatureUses-BsYpH81W.js → signatureUses-Dg0S52Mp.js} +2 -1
  72. package/dist/{esm/sdk/signerLoader-BhF6IFbD.js → public/sdk/signerLoader-DVlqSMOs.js} +2 -2
  73. package/dist/public/sdk/tx-confirm-ui.js +9568 -206
  74. package/dist/public/sdk/w3a-tx-confirmer.js +8335 -206
  75. package/dist/public/sdk/wallet-iframe-host-ecdsa.js +1 -1
  76. package/dist/public/sdk/wallet-iframe-host-full.js +1 -1
  77. package/dist/public/sdk/wallet-iframe-host-near.js +1 -1
  78. package/dist/public/sdk/wallet-iframe-host-runtime.js +1 -1
  79. package/dist/public/sdk/workers/device-linking-key.worker.js +8603 -3
  80. package/dist/public/sdk/workers/ecdsa-derivation-client.worker.js +12320 -1
  81. package/dist/public/sdk/workers/ecdsa-online-client.worker.js +623 -1
  82. package/dist/public/sdk/workers/ecdsa-presign-client.worker.js +1276 -1
  83. package/dist/public/sdk/workers/email-otp.worker.js +15653 -7
  84. package/dist/public/sdk/workers/email_otp_runtime.js +39 -3
  85. package/dist/public/sdk/workers/email_otp_runtime_bg.wasm +0 -0
  86. package/dist/public/sdk/workers/evm-crypto.worker.js +1157 -5
  87. package/dist/public/sdk/workers/evm_crypto.wasm +0 -0
  88. package/dist/public/sdk/workers/evm_crypto_bg.wasm +0 -0
  89. package/dist/public/sdk/workers/near-signer.worker.js +1631 -2
  90. package/dist/public/sdk/workers/near_signer.wasm +0 -0
  91. package/dist/public/sdk/workers/passkey-confirm.worker.js +606 -1
  92. package/dist/public/sdk/workers/passkey-mpc-export.worker.js +5406 -2
  93. package/dist/public/sdk/workers/passkey-mpc-session.worker.js +1717 -1
  94. package/dist/public/sdk/workers/router_ab_ecdsa_client_bg.wasm +0 -0
  95. package/dist/public/sdk/workers/router_ab_ed25519_yao_client_bg.wasm +0 -0
  96. package/dist/public/sdk/workers/shamir3pass.worker.js +874 -4
  97. package/dist/public/sdk/workers/shamir3pass_runtime.js +84 -31
  98. package/dist/public/sdk/workers/shamir3pass_runtime_bg.wasm +0 -0
  99. package/dist/public/sdk/workers/tempo-signer.worker.js +987 -5
  100. package/dist/public/sdk/workers/tempo_signer.wasm +0 -0
  101. package/dist/public/sdk/workers/tempo_signer_bg.wasm +0 -0
  102. package/dist/public/sdk/workers/wallet-custody-ceremony.worker.js +55 -1244
  103. package/dist/public/sdk/workers/wallet_custody_ceremony_bg.wasm +0 -0
  104. package/dist/public/sdk/workers/wasm_signer_worker_bg.wasm +0 -0
  105. package/dist/public/wallet-assets.manifest.json +44 -44
  106. package/dist/types/wallet/src/SeamsWeb/signingSurface/BrowserSigningSurface.d.ts +4 -4
  107. package/dist/types/wallet/src/core/signingEngine/session/identity/exactWalletSessionReader.d.ts +1 -9
  108. package/dist/workers/device-linking-key.worker.js +8603 -3
  109. package/dist/workers/ecdsa-derivation-client.worker.js +12320 -1
  110. package/dist/workers/ecdsa-online-client.worker.js +623 -1
  111. package/dist/workers/ecdsa-presign-client.worker.js +1276 -1
  112. package/dist/workers/email-otp.worker.js +15653 -7
  113. package/dist/workers/email_otp_runtime.js +39 -3
  114. package/dist/workers/email_otp_runtime_bg.wasm +0 -0
  115. package/dist/workers/evm-crypto.worker.js +1157 -5
  116. package/dist/workers/evm_crypto.wasm +0 -0
  117. package/dist/workers/evm_crypto_bg.wasm +0 -0
  118. package/dist/workers/near-signer.worker.js +1631 -2
  119. package/dist/workers/near_signer.wasm +0 -0
  120. package/dist/workers/passkey-confirm.worker.js +606 -1
  121. package/dist/workers/passkey-mpc-export.worker.js +5406 -2
  122. package/dist/workers/passkey-mpc-session.worker.js +1717 -1
  123. package/dist/workers/router_ab_ecdsa_client_bg.wasm +0 -0
  124. package/dist/workers/router_ab_ed25519_yao_client_bg.wasm +0 -0
  125. package/dist/workers/shamir3pass.worker.js +874 -4
  126. package/dist/workers/shamir3pass_runtime.js +84 -31
  127. package/dist/workers/shamir3pass_runtime_bg.wasm +0 -0
  128. package/dist/workers/tempo-signer.worker.js +987 -5
  129. package/dist/workers/tempo_signer.wasm +0 -0
  130. package/dist/workers/tempo_signer_bg.wasm +0 -0
  131. package/dist/workers/wallet-custody-ceremony.worker.js +55 -1244
  132. package/dist/workers/wallet_custody_ceremony_bg.wasm +0 -0
  133. package/dist/workers/wasm_signer_worker_bg.wasm +0 -0
  134. package/package.json +5 -2
  135. package/LICENSE +0 -21
@@ -1 +1 @@
1
- 9e6339642b68ce46bda1fabd01c5f6377195e50758961179b1f43feb0d24fafb
1
+ b5b2bc0f0d923ec728dc7382b6332ea8ed424a567a5c77e1979ed72c282ee2b0
@@ -71,7 +71,7 @@ import { reconcileTempoNonceLane, reportTempoBroadcastAccepted, reportTempoBroad
71
71
  import { UserConfirmationType } from "../../core/signingEngine/stepUpConfirmation/userConfirmationType.js";
72
72
  import { exportKeypairWithUI, resolveExactKeyExportLane } from "../../core/signingEngine/flows/recovery/public.js";
73
73
  import { activateAuthenticatedWalletState, finalizeWalletEcdsaRegistration, finalizeWalletEd25519SignerRegistration, getAllUsers, getAuthenticationCredentialsSerialized, getLastUser, getUserBySignerSlot, getWalletNearProvisioningState, hasPasskeyCredential, nearAuthenticatorsByAccount, requestRegistrationCredentialConfirmation, rollbackUserRegistration, rollbackWalletEd25519SignerRegistration, setLastUser, setWalletNearProvisioningState, storeAuthenticator, storeUserData, storeWalletEcdsaRecoverySignerRecords, storeWalletEcdsaSignerRecords, storeWalletEd25519RecoveryRegistrationData, storeWalletEd25519RegistrationData, storeWalletEmailOtpEcdsaRegistrationData, storeWalletEmailOtpEcdsaSignerRecords, storeWalletEmailOtpEd25519RegistrationData, storeWalletEmailOtpMixedRegistrationData, storeWalletMixedRegistrationData } from "../../core/signingEngine/flows/registration/public.js";
74
- import { exactWalletSessionWithOperationCredentialOrThrow, readExactOwnerLaneWalletSession } from "../../core/signingEngine/session/identity/exactWalletSessionReader.js";
74
+ import { exactWalletSessionWithOperationCredentialOrThrow } from "../../core/signingEngine/session/identity/exactWalletSessionReader.js";
75
75
  import { enrollEmailOtpInternal, loginWithEmailOtpEcdsaCapabilityInternal, prepareEmailOtpRegistrationEnrollmentMaterialInternal, refreshEmailOtpSigningSession, requestEmailOtpSigningSessionChallenge } from "../../core/signingEngine/flows/signEvmFamily/emailOtpPublic.js";
76
76
  import { __isWalletIframeHostMode } from "../../core/browser/walletIframe/host-mode.js";
77
77
  import { destroyUnlockedWalletEd25519ExportRootCapabilitiesV1, establishUnlockedWalletEd25519ExportRootCapabilityV1, setUnlockedCustodyEnvelopeUpgradeSinkV1 } from "../../core/signingEngine/walletCustody/unlockedEd25519ExportRootCapability.js";
@@ -1141,7 +1141,7 @@ var BrowserSigningSurface = class {
1141
1141
  emailOtpSessions: this.emailOtpSessions,
1142
1142
  sealedSigningSessionStore: deps.sealedSigningSessionStore
1143
1143
  }, input),
1144
- resolveOwnerLaneScope: (walletId) => this.resolveActiveOwnerLaneScope(walletId)
1144
+ resolveOwnerLaneScope: (walletId) => this.resolveSelectedOwnerLaneScope(walletId)
1145
1145
  });
1146
1146
  this.enginePorts = createBrowserSigningSurfaceEnginePorts({
1147
1147
  runtimePorts: this.runtimePorts,
@@ -1167,7 +1167,7 @@ var BrowserSigningSurface = class {
1167
1167
  workerWarmupPolicy: deps.workerWarmupPolicy,
1168
1168
  getTheme: () => this.appearance.theme.mode,
1169
1169
  ensureSealedRefreshStartupParity: () => this.ensureSealedRefreshStartupParity(),
1170
- resolveOwnerLaneScope: (walletId) => this.resolveActiveOwnerLaneScope(walletId),
1170
+ resolveOwnerLaneScope: (walletId) => this.resolveSelectedOwnerLaneScope(walletId),
1171
1171
  getEnginePorts: () => this.enginePorts,
1172
1172
  getRegistrationPublicDeps: () => this.registrationPublicDeps,
1173
1173
  prepareNearEd25519YaoMaterialBoundary: this.prepareExactNearEd25519YaoMaterialBoundary.bind(this)
@@ -1488,11 +1488,11 @@ var BrowserSigningSurface = class {
1488
1488
  return await readOwnerScopedSigningLanes(this.sessionPublicDeps, args);
1489
1489
  }
1490
1490
  /**
1491
- * R103C derivation chain for post-login operations: the unique active Wallet
1492
- * Session authority resolves through the active wallet auth method to one
1493
- * exact owner scope. Callers never supply credential or slot hints.
1491
+ * Resolves the selected active Wallet Authority and auth method to one exact
1492
+ * owner scope. Session availability is resolved by the lane inventory so an
1493
+ * expired session can enter operation step-up.
1494
1494
  */
1495
- async resolveActiveOwnerLaneScope(walletId) {
1495
+ async resolveSelectedOwnerLaneScope(walletId) {
1496
1496
  const parsedWalletId = parseWalletId(walletId);
1497
1497
  if (!parsedWalletId.ok) throw new Error(parsedWalletId.error.message);
1498
1498
  const stores = {
@@ -1506,13 +1506,6 @@ var BrowserSigningSurface = class {
1506
1506
  const { selection, authMethod, authority } = selected;
1507
1507
  if (selection.walletId !== parsedWalletId.value || selection.walletAuthMethodId !== authMethod.walletAuthMethodId || authMethod.walletId !== parsedWalletId.value || authMethod.walletAuthorityId !== authority.authorityId || authority.walletId !== parsedWalletId.value) throw new Error("[SigningEngine] selected Wallet Authority identity mismatch");
1508
1508
  if (selection.lockState !== "unlocked" || authMethod.status !== "active" || authority.state !== "active") throw new Error("[SigningEngine] selected Wallet Authority is inactive or locked");
1509
- await readExactOwnerLaneWalletSession({
1510
- walletId: parsedWalletId.value,
1511
- authorityId: authority.authorityId,
1512
- authMethodId: authMethod.walletAuthMethodId,
1513
- authorityDigestB64u: authority.authorityDigestB64u,
1514
- authorityRevocationEpoch: authority.revocationEpoch
1515
- });
1516
1509
  if (authority.provenance.kind === "device_link" && authMethod.kind === "passkey" && authority.signerActivations.ed25519) return buildExactPasskeyOwnerLaneScope({
1517
1510
  authMethod,
1518
1511
  signerSlot: await resolveLinkedPasskeyOwnerSignerSlot({
@@ -132,6 +132,7 @@ async function signEvmFamilyWithUiConfirm(args) {
132
132
  const thresholdEcdsaStepUp = input.thresholdEcdsaStepUp;
133
133
  const thresholdEcdsaStepUpRuntime = thresholdEcdsaStepUp.kind === "not_required" ? void 0 : thresholdEcdsaStepUp.runtime;
134
134
  const signingAuthPlan = signingAuthPlanFromThresholdEcdsaStepUp(thresholdEcdsaStepUp);
135
+ const requiresThresholdEcdsaOperationStepUp = input.authorization.kind === "owner" && thresholdEcdsaStepUp.kind === "required" && (thresholdEcdsaStepUp.runtime.reusableAuthorization.kind === "absent" || !isWarmSessionSigningAuthPlan(thresholdEcdsaStepUp.authPlan.signingAuthPlan));
135
136
  if (hasThresholdEcdsaRequest && !signingAuthPlan) switch (input.authorization.kind) {
136
137
  case "owner": throw new Error("[chains] threshold ECDSA transaction signing requires an explicit auth plan");
137
138
  case "active_wallet_authority": break;
@@ -239,7 +240,7 @@ async function signEvmFamilyWithUiConfirm(args) {
239
240
  subtitle: config.body
240
241
  });
241
242
  let challengeB64u = base64UrlEncode(firstDigest);
242
- if (firstSignRequest.algorithm === "secp256k1" && thresholdEcdsaStepUpRuntime && activeThresholdEcdsaOperation && input.resolveEcdsaSigningMaterialPlan) {
243
+ if (requiresThresholdEcdsaOperationStepUp && firstSignRequest.algorithm === "secp256k1" && thresholdEcdsaStepUpRuntime && activeThresholdEcdsaOperation && input.resolveEcdsaSigningMaterialPlan) {
243
244
  const operationDigests = await buildEvmFamilyOperationDigests({
244
245
  operationFingerprint: input.signingOperation?.operationFingerprint,
245
246
  signingDigest32: inferDigest32FromSignRequest(firstSignRequest),
@@ -276,19 +276,16 @@ function buildNearPasskeyEd25519OperationStepUp(args) {
276
276
  if (args.auth.kind !== "passkey") return void 0;
277
277
  const auth = args.auth;
278
278
  return { prepare: async () => {
279
- const materialFacts = await resolveNearPasskeyStepUpMaterialFacts({
280
- preparation: args.preparation,
281
- executor: args.materialExecutor
282
- });
283
279
  const signer = args.signer;
280
+ const authority = await exactPasskeyStepUpAuthority({
281
+ authorityRef: nearPasskeyPreparationAuthority(args.preparation),
282
+ walletId: signer.account.wallet.walletId,
283
+ rpId: auth.rpId,
284
+ credentialIdB64u: auth.credentialIdB64u
285
+ });
284
286
  return {
285
- thresholdSessionId: materialFacts.thresholdSessionId,
286
- authority: await exactPasskeyStepUpAuthority({
287
- authorityRef: nearPasskeyPreparationAuthority(args.preparation),
288
- walletId: signer.account.wallet.walletId,
289
- rpId: auth.rpId,
290
- credentialIdB64u: auth.credentialIdB64u
291
- })
287
+ thresholdSessionId: args.thresholdSessionId,
288
+ authority
292
289
  };
293
290
  } };
294
291
  }
@@ -321,17 +318,6 @@ async function exactPasskeyStepUpAuthority(args) {
321
318
  if (resolvedRef.walletId !== args.authorityRef.walletId || resolvedRef.walletAuthMethodId !== args.authorityRef.walletAuthMethodId || resolvedRef.authorityDigest !== args.authorityRef.authorityDigest) throw new Error("[SigningEngine][near] exact Passkey step-up authority changed");
322
319
  return authority;
323
320
  }
324
- async function resolveNearPasskeyStepUpMaterialFacts(args) {
325
- switch (args.preparation.hydration.kind) {
326
- case "use_live_runtime": return (await args.executor.resolve(args.preparation)).facts;
327
- case "rehydrate_material_activation": return (await args.executor.preparePasskeyOperationStepUp(args.preparation)).facts;
328
- case "reauthorize_public_anchor": throw new Error("[SigningEngine][near] retired material cannot prepare Passkey step-up");
329
- case "blocked": throw new Error(`[SigningEngine][near] Passkey step-up material is blocked: ${args.preparation.hydration.reason}`);
330
- default:
331
- args.preparation.hydration;
332
- throw new Error("[SigningEngine][near] unsupported Passkey step-up material source");
333
- }
334
- }
335
321
  function buildNearEmailOtpEd25519StepUp(args) {
336
322
  if (args.auth.kind !== SIGNER_AUTH_METHODS.emailOtp || typeof args.deps.requestEmailOtpEd25519SigningChallenge !== "function") return;
337
323
  if (!args.preparation.hydration.materialActivation) return;
@@ -402,8 +388,8 @@ async function prepareNearAdHocSigningSession(args) {
402
388
  passkeyEd25519OperationStepUp: buildNearPasskeyEd25519OperationStepUp({
403
389
  auth: candidate.auth,
404
390
  signer,
405
- preparation: materialBoundary.preparation,
406
- materialExecutor: materialBoundary.executor
391
+ thresholdSessionId: materialIdentity.thresholdSessionId,
392
+ preparation: materialBoundary.preparation
407
393
  }) || null,
408
394
  emailOtpEd25519StepUp: buildNearEmailOtpEd25519StepUp({
409
395
  deps: args.deps,
@@ -430,8 +416,8 @@ async function prepareNearAdHocSigningSession(args) {
430
416
  passkeyEd25519OperationStepUp: buildNearPasskeyEd25519OperationStepUp({
431
417
  auth: selectedLane.auth,
432
418
  signer: selectedLane.identity.signer,
433
- preparation: materialBoundary.preparation,
434
- materialExecutor: materialBoundary.executor
419
+ thresholdSessionId: selectedLane.identity.thresholdSessionId,
420
+ preparation: materialBoundary.preparation
435
421
  }) || null,
436
422
  emailOtpEd25519StepUp: buildNearEmailOtpEd25519StepUp({
437
423
  deps: args.deps,
@@ -494,8 +480,8 @@ async function prepareNearAuthorizationRequiredTransaction(args) {
494
480
  passkeyEd25519OperationStepUp: buildNearPasskeyEd25519OperationStepUp({
495
481
  auth: candidate.auth,
496
482
  signer,
497
- preparation: materialBoundary.preparation,
498
- materialExecutor: materialBoundary.executor
483
+ thresholdSessionId: materialIdentity.thresholdSessionId,
484
+ preparation: materialBoundary.preparation
499
485
  }) || null,
500
486
  emailOtpEd25519StepUp: buildNearEmailOtpEd25519StepUp({
501
487
  deps: args.deps,
@@ -849,8 +835,8 @@ async function signTransactionWithActions(deps, args, attempt = {}) {
849
835
  const passkeyEd25519OperationStepUp = buildNearPasskeyEd25519OperationStepUp({
850
836
  auth: transactionLane.auth,
851
837
  signer: transactionLane.identity.signer,
852
- preparation: materialBoundary.preparation,
853
- materialExecutor: materialBoundary.executor
838
+ thresholdSessionId,
839
+ preparation: materialBoundary.preparation
854
840
  });
855
841
  const emailOtpEd25519StepUp = buildNearEmailOtpEd25519StepUp({
856
842
  deps,
@@ -112,6 +112,51 @@ function createNearTransactionSigningOperationId() {
112
112
  const randomId = secureRandomBase64Url(32, "NEAR transaction signing operation IDs");
113
113
  return SigningSessionIds.signingOperation(`near-transaction-sign:${randomId}`);
114
114
  }
115
+ async function prepareNearTransactionConfirmationReadiness(args) {
116
+ const material = await prepareNearOperationStepUpMaterial({
117
+ method: args.method,
118
+ preparation: args.preparation,
119
+ executor: args.executor
120
+ });
121
+ const materialFacts = nearOperationStepUpMaterialFacts(material);
122
+ if (String(materialFacts.thresholdSessionId) !== args.expectedThresholdSessionId) throw new Error("[SigningEngine][near] prepared operation material changed threshold session");
123
+ registerNearOperationStepUpBuilder({
124
+ requestId: args.requestId,
125
+ build: async (preparation) => {
126
+ if (preparation.kind !== "near_transaction") throw new Error("[SigningEngine][near] transaction step-up preparation kind changed");
127
+ if (preparation.operationId !== String(args.operation.operationId)) throw new Error("[SigningEngine][near] operation step-up operation identity changed");
128
+ return await prepareRouterAbEd25519NearTransactionOperationStepUp({
129
+ ...args.operation,
130
+ thresholdSessionId: materialFacts.thresholdSessionId,
131
+ materialFacts,
132
+ materialActivation: material.materialActivation,
133
+ transactionContext: preparation.transactionContext,
134
+ displayDigest: preparation.displayDigest
135
+ });
136
+ }
137
+ });
138
+ registerNearImplicitAccountFunder({
139
+ requestId: args.requestId,
140
+ fund: async (request) => await fundNearImplicitAccountForOperationStepUp({
141
+ ...args.funding,
142
+ request,
143
+ fundingSession: await args.executor.resolveFundingSession(),
144
+ method: args.method
145
+ })
146
+ });
147
+ return material;
148
+ }
149
+ function clearNearTransactionConfirmationResources(requestId) {
150
+ clearNearOperationStepUpBuilder(requestId);
151
+ clearNearImplicitAccountFunder(requestId);
152
+ }
153
+ function clearNearTransactionConfirmationReadinessWhenSettled(args) {
154
+ if (!args.readiness) {
155
+ clearNearTransactionConfirmationResources(args.requestId);
156
+ return;
157
+ }
158
+ args.readiness.then(clearNearTransactionConfirmationResources.bind(void 0, args.requestId), clearNearTransactionConfirmationResources.bind(void 0, args.requestId));
159
+ }
115
160
  /**
116
161
  * Sign one NEAR transaction. A transaction may contain multiple actions.
117
162
  */
@@ -201,44 +246,28 @@ async function runNearAuthorizationRequiredTransactionSigning(payload) {
201
246
  ...emailOtpEd25519StepUp ? { emailOtpEd25519StepUp } : {}
202
247
  });
203
248
  if (preparedStepUp.kind === "warm_session") throw new Error("[SigningEngine][near] deferred Ed25519 transaction cannot use warm session");
204
- const operationStepUpMaterial = await prepareNearOperationStepUpMaterial({
205
- method: preparedStepUp.kind,
206
- preparation: yaoSigningPreparation,
207
- executor: yaoMaterialExecutor
208
- });
209
- const materialFacts = nearOperationStepUpMaterialFacts(operationStepUpMaterial);
210
249
  const signingOperationUses = requiredNearTransactionSignatureUses(transaction);
211
- registerNearOperationStepUpBuilder({
212
- requestId: String(operationId),
213
- build: async (preparation) => {
214
- if (preparation.kind !== "near_transaction") throw new Error("[SigningEngine][near] transaction step-up preparation kind changed");
215
- return await prepareRouterAbEd25519NearTransactionOperationStepUp({
216
- ctx,
217
- thresholdSessionId: materialFacts.thresholdSessionId,
218
- materialFacts,
219
- thresholdKeyMaterial: signingContext.threshold.thresholdKeyMaterial,
220
- walletId: commandSubject.walletSession.walletId,
221
- nearAccountId,
222
- materialActivation: operationStepUpMaterial.materialActivation,
223
- operationId,
224
- operationFingerprint,
225
- txSigningRequest,
226
- transactionContext: preparation.transactionContext,
227
- displayDigest: preparation.displayDigest
228
- });
229
- }
230
- });
231
- registerNearImplicitAccountFunder({
250
+ const operationStepUpReadiness = prepareNearTransactionConfirmationReadiness({
232
251
  requestId: String(operationId),
233
- fund: async (fundingRequest) => await fundNearImplicitAccountForOperationStepUp({
234
- request: fundingRequest,
252
+ expectedThresholdSessionId: String(deferredIdentity.thresholdSessionId),
253
+ method: preparedStepUp.kind,
254
+ preparation: yaoSigningPreparation,
255
+ executor: yaoMaterialExecutor,
256
+ operation: {
257
+ ctx,
258
+ thresholdKeyMaterial: signingContext.threshold.thresholdKeyMaterial,
259
+ walletId: commandSubject.walletSession.walletId,
260
+ nearAccountId,
261
+ operationId,
262
+ operationFingerprint,
263
+ txSigningRequest
264
+ },
265
+ funding: {
235
266
  ctx,
236
267
  nearPublicKeyStr: signingContext.signingNearPublicKeyStr,
237
- fundingSession: await yaoMaterialExecutor.resolveFundingSession(),
238
- method: preparedStepUp.kind,
239
268
  signingOperation,
240
269
  signatureUses: signingOperationUses
241
- })
270
+ }
242
271
  });
243
272
  let confirmation;
244
273
  try {
@@ -274,6 +303,10 @@ async function runNearAuthorizationRequiredTransactionSigning(payload) {
274
303
  }),
275
304
  title,
276
305
  body,
306
+ confirmationReadiness: {
307
+ promise: operationStepUpReadiness,
308
+ body: "Preparing secure signing session…"
309
+ },
277
310
  onProgress: emitNearSigningConfirmationProgress.bind(void 0, {
278
311
  onEvent,
279
312
  nearAccountId,
@@ -282,9 +315,13 @@ async function runNearAuthorizationRequiredTransactionSigning(payload) {
282
315
  }
283
316
  });
284
317
  } finally {
285
- clearNearOperationStepUpBuilder(String(operationId));
286
- clearNearImplicitAccountFunder(String(operationId));
318
+ clearNearTransactionConfirmationReadinessWhenSettled({
319
+ requestId: String(operationId),
320
+ readiness: operationStepUpReadiness
321
+ });
287
322
  }
323
+ const operationStepUpMaterial = await operationStepUpReadiness;
324
+ const materialFacts = nearOperationStepUpMaterialFacts(operationStepUpMaterial);
288
325
  const stepUpAuthorization = buildNearEd25519StepUpAuthorization({
289
326
  prepared: preparedStepUp,
290
327
  confirmation
@@ -493,50 +530,28 @@ async function runAuthorizedNearTransactionWithActionsSigning({ ctx, commandSubj
493
530
  overlay: "show"
494
531
  }
495
532
  });
496
- let operationStepUpMaterial = null;
497
- if (preparedStepUp.kind !== "warm_session") {
498
- operationStepUpMaterial = await prepareNearOperationStepUpMaterial({
499
- method: preparedStepUp.kind,
500
- preparation: yaoSigningPreparation,
501
- executor: yaoMaterialExecutor
502
- });
503
- const material = operationStepUpMaterial;
504
- const materialFacts = nearOperationStepUpMaterialFacts(material);
505
- registerNearOperationStepUpBuilder({
506
- requestId: thresholdSessionId,
507
- build: async (preparation) => {
508
- if (preparation.kind !== "near_transaction") throw new Error("[SigningEngine][near] transaction step-up preparation kind changed");
509
- if (preparation.operationId !== String(signingOperation.operationId)) throw new Error("[SigningEngine][near] operation step-up operation identity changed");
510
- return await prepareRouterAbEd25519NearTransactionOperationStepUp({
511
- ctx,
512
- thresholdSessionId: materialFacts.thresholdSessionId,
513
- materialFacts,
514
- thresholdKeyMaterial: signingContext.threshold.thresholdKeyMaterial,
515
- walletId: commandSubject.walletSession.walletId,
516
- nearAccountId,
517
- materialActivation: material.materialActivation,
518
- operationId: signingOperation.operationId,
519
- operationFingerprint,
520
- txSigningRequest,
521
- transactionContext: preparation.transactionContext,
522
- displayDigest: preparation.displayDigest
523
- });
524
- }
525
- });
526
- const stepUpFundingMethod = preparedStepUp.kind;
527
- registerNearImplicitAccountFunder({
528
- requestId: thresholdSessionId,
529
- fund: async (fundingRequest) => await fundNearImplicitAccountForOperationStepUp({
530
- request: fundingRequest,
531
- ctx,
532
- nearPublicKeyStr: signingContext.signingNearPublicKeyStr,
533
- fundingSession: await yaoMaterialExecutor.resolveFundingSession(),
534
- method: stepUpFundingMethod,
535
- signingOperation,
536
- signatureUses: requiredSignatureUses
537
- })
538
- });
539
- }
533
+ const operationStepUpReadiness = preparedStepUp.kind === "warm_session" ? null : prepareNearTransactionConfirmationReadiness({
534
+ requestId: thresholdSessionId,
535
+ expectedThresholdSessionId: thresholdSessionId,
536
+ method: preparedStepUp.kind,
537
+ preparation: yaoSigningPreparation,
538
+ executor: yaoMaterialExecutor,
539
+ operation: {
540
+ ctx,
541
+ thresholdKeyMaterial: signingContext.threshold.thresholdKeyMaterial,
542
+ walletId: commandSubject.walletSession.walletId,
543
+ nearAccountId,
544
+ operationId: signingOperation.operationId,
545
+ operationFingerprint,
546
+ txSigningRequest
547
+ },
548
+ funding: {
549
+ ctx,
550
+ nearPublicKeyStr: signingContext.signingNearPublicKeyStr,
551
+ signingOperation,
552
+ signatureUses: requiredSignatureUses
553
+ }
554
+ });
540
555
  let confirmation;
541
556
  try {
542
557
  confirmation = await runSigningConfirmationCommand({
@@ -571,13 +586,20 @@ async function runAuthorizedNearTransactionWithActionsSigning({ ctx, commandSubj
571
586
  }),
572
587
  title,
573
588
  body,
589
+ ...operationStepUpReadiness ? { confirmationReadiness: {
590
+ promise: operationStepUpReadiness,
591
+ body: "Preparing secure signing session…"
592
+ } } : {},
574
593
  onProgress: emitUiConfirmProgress
575
594
  }
576
595
  });
577
596
  } finally {
578
- clearNearOperationStepUpBuilder(thresholdSessionId);
579
- clearNearImplicitAccountFunder(thresholdSessionId);
597
+ clearNearTransactionConfirmationReadinessWhenSettled({
598
+ requestId: thresholdSessionId,
599
+ readiness: operationStepUpReadiness
600
+ });
580
601
  }
602
+ const operationStepUpMaterial = operationStepUpReadiness ? await operationStepUpReadiness : null;
581
603
  emitNearSigningEvent(onEvent, nearAccountId, {
582
604
  phase: SigningEventPhase.STEP_05_CONFIRMATION_APPROVED,
583
605
  status: "succeeded",
@@ -1,4 +1,4 @@
1
- import { WalletSessionAuthorizationUpgradeRequiredError, walletSessionAuthorizations } from "../../../indexedDB/seamsWalletDB/walletSessionAuthorizationStore.js";
1
+ import { WalletSessionAuthorizationUpgradeRequiredError } from "../../../indexedDB/seamsWalletDB/walletSessionAuthorizationStore.js";
2
2
  //#region src/core/signingEngine/session/identity/exactWalletSessionReader.ts
3
3
  function exactWalletSessionMatchesAuthorityScope(args) {
4
4
  const { record, operationCredential, scope } = args;
@@ -48,32 +48,7 @@ function exactWalletSessionWithOperationCredentialOrThrow(result, message) {
48
48
  case "upgrade_required": throw new WalletSessionAuthorizationUpgradeRequiredError(message);
49
49
  }
50
50
  }
51
- async function readExactOwnerLaneWalletSession(args) {
52
- const read = await walletSessionAuthorizations.readExactActiveForWallet({
53
- walletId: args.walletId,
54
- authorityId: args.authorityId,
55
- authMethodId: args.authMethodId
56
- });
57
- switch (read.kind) {
58
- case "found":
59
- if (!exactWalletSessionMatchesAuthorityScope({
60
- record: read.record,
61
- operationCredential: read.operationCredential,
62
- scope: args
63
- })) throw new Error("[SigningEngine] selected Wallet Authority session identity mismatch");
64
- if (read.record.expiresAtMs <= Date.now()) throw new Error("[SigningEngine] selected Wallet Authority session is unavailable: expired");
65
- return;
66
- case "missing": throw new Error("[SigningEngine] selected Wallet Authority session is unavailable: missing");
67
- case "upgrade_required": throw new WalletSessionAuthorizationUpgradeRequiredError("[SigningEngine] selected Wallet Authority Wallet Session requires a newer client");
68
- case "corrupt": throw new Error("[SigningEngine] selected Wallet Authority session is unavailable: corrupt");
69
- case "persistence_unavailable": throw new Error("[SigningEngine] selected Wallet Authority session is unavailable: persistence_unavailable");
70
- default: return assertNeverWalletSessionAuthorizationRead(read);
71
- }
72
- }
73
- function assertNeverWalletSessionAuthorizationRead(value) {
74
- throw new Error(`Unknown exact Wallet Session authorization read: ${String(value)}`);
75
- }
76
51
  //#endregion
77
- export { exactWalletSessionWithOperationCredentialOrThrow, readExactOwnerLaneWalletSession, readExactWalletSessionAuthentication };
52
+ export { exactWalletSessionWithOperationCredentialOrThrow, readExactWalletSessionAuthentication };
78
53
 
79
54
  //# sourceMappingURL=exactWalletSessionReader.js.map
@@ -496,7 +496,7 @@ async function handleIntentDigestSigningFlow(ctx, request, worker, opts) {
496
496
  };
497
497
  const promptDecisionPromise = session.promptUser({
498
498
  securityContext,
499
- loading: !!intentPreparation,
499
+ loading: !!intentPreparation && signingAuthMode !== "warmSession",
500
500
  onMounted: () => {
501
501
  markPromptReady();
502
502
  }
@@ -71,7 +71,7 @@ import { reconcileTempoNonceLane, reportTempoBroadcastAccepted, reportTempoBroad
71
71
  import { UserConfirmationType } from "../../core/signingEngine/stepUpConfirmation/userConfirmationType.js";
72
72
  import { exportKeypairWithUI, resolveExactKeyExportLane } from "../../core/signingEngine/flows/recovery/public.js";
73
73
  import { activateAuthenticatedWalletState, finalizeWalletEcdsaRegistration, finalizeWalletEd25519SignerRegistration, getAllUsers, getAuthenticationCredentialsSerialized, getLastUser, getUserBySignerSlot, getWalletNearProvisioningState, hasPasskeyCredential, nearAuthenticatorsByAccount, requestRegistrationCredentialConfirmation, rollbackUserRegistration, rollbackWalletEd25519SignerRegistration, setLastUser, setWalletNearProvisioningState, storeAuthenticator, storeUserData, storeWalletEcdsaRecoverySignerRecords, storeWalletEcdsaSignerRecords, storeWalletEd25519RecoveryRegistrationData, storeWalletEd25519RegistrationData, storeWalletEmailOtpEcdsaRegistrationData, storeWalletEmailOtpEcdsaSignerRecords, storeWalletEmailOtpEd25519RegistrationData, storeWalletEmailOtpMixedRegistrationData, storeWalletMixedRegistrationData } from "../../core/signingEngine/flows/registration/public.js";
74
- import { exactWalletSessionWithOperationCredentialOrThrow, readExactOwnerLaneWalletSession } from "../../core/signingEngine/session/identity/exactWalletSessionReader.js";
74
+ import { exactWalletSessionWithOperationCredentialOrThrow } from "../../core/signingEngine/session/identity/exactWalletSessionReader.js";
75
75
  import { enrollEmailOtpInternal, loginWithEmailOtpEcdsaCapabilityInternal, prepareEmailOtpRegistrationEnrollmentMaterialInternal, refreshEmailOtpSigningSession, requestEmailOtpSigningSessionChallenge } from "../../core/signingEngine/flows/signEvmFamily/emailOtpPublic.js";
76
76
  import { __isWalletIframeHostMode } from "../../core/browser/walletIframe/host-mode.js";
77
77
  import { destroyUnlockedWalletEd25519ExportRootCapabilitiesV1, establishUnlockedWalletEd25519ExportRootCapabilityV1, setUnlockedCustodyEnvelopeUpgradeSinkV1 } from "../../core/signingEngine/walletCustody/unlockedEd25519ExportRootCapability.js";
@@ -1141,7 +1141,7 @@ var BrowserSigningSurface = class {
1141
1141
  emailOtpSessions: this.emailOtpSessions,
1142
1142
  sealedSigningSessionStore: deps.sealedSigningSessionStore
1143
1143
  }, input),
1144
- resolveOwnerLaneScope: (walletId) => this.resolveActiveOwnerLaneScope(walletId)
1144
+ resolveOwnerLaneScope: (walletId) => this.resolveSelectedOwnerLaneScope(walletId)
1145
1145
  });
1146
1146
  this.enginePorts = createBrowserSigningSurfaceEnginePorts({
1147
1147
  runtimePorts: this.runtimePorts,
@@ -1167,7 +1167,7 @@ var BrowserSigningSurface = class {
1167
1167
  workerWarmupPolicy: deps.workerWarmupPolicy,
1168
1168
  getTheme: () => this.appearance.theme.mode,
1169
1169
  ensureSealedRefreshStartupParity: () => this.ensureSealedRefreshStartupParity(),
1170
- resolveOwnerLaneScope: (walletId) => this.resolveActiveOwnerLaneScope(walletId),
1170
+ resolveOwnerLaneScope: (walletId) => this.resolveSelectedOwnerLaneScope(walletId),
1171
1171
  getEnginePorts: () => this.enginePorts,
1172
1172
  getRegistrationPublicDeps: () => this.registrationPublicDeps,
1173
1173
  prepareNearEd25519YaoMaterialBoundary: this.prepareExactNearEd25519YaoMaterialBoundary.bind(this)
@@ -1488,11 +1488,11 @@ var BrowserSigningSurface = class {
1488
1488
  return await readOwnerScopedSigningLanes(this.sessionPublicDeps, args);
1489
1489
  }
1490
1490
  /**
1491
- * R103C derivation chain for post-login operations: the unique active Wallet
1492
- * Session authority resolves through the active wallet auth method to one
1493
- * exact owner scope. Callers never supply credential or slot hints.
1491
+ * Resolves the selected active Wallet Authority and auth method to one exact
1492
+ * owner scope. Session availability is resolved by the lane inventory so an
1493
+ * expired session can enter operation step-up.
1494
1494
  */
1495
- async resolveActiveOwnerLaneScope(walletId) {
1495
+ async resolveSelectedOwnerLaneScope(walletId) {
1496
1496
  const parsedWalletId = parseWalletId(walletId);
1497
1497
  if (!parsedWalletId.ok) throw new Error(parsedWalletId.error.message);
1498
1498
  const stores = {
@@ -1506,13 +1506,6 @@ var BrowserSigningSurface = class {
1506
1506
  const { selection, authMethod, authority } = selected;
1507
1507
  if (selection.walletId !== parsedWalletId.value || selection.walletAuthMethodId !== authMethod.walletAuthMethodId || authMethod.walletId !== parsedWalletId.value || authMethod.walletAuthorityId !== authority.authorityId || authority.walletId !== parsedWalletId.value) throw new Error("[SigningEngine] selected Wallet Authority identity mismatch");
1508
1508
  if (selection.lockState !== "unlocked" || authMethod.status !== "active" || authority.state !== "active") throw new Error("[SigningEngine] selected Wallet Authority is inactive or locked");
1509
- await readExactOwnerLaneWalletSession({
1510
- walletId: parsedWalletId.value,
1511
- authorityId: authority.authorityId,
1512
- authMethodId: authMethod.walletAuthMethodId,
1513
- authorityDigestB64u: authority.authorityDigestB64u,
1514
- authorityRevocationEpoch: authority.revocationEpoch
1515
- });
1516
1509
  if (authority.provenance.kind === "device_link" && authMethod.kind === "passkey" && authority.signerActivations.ed25519) return buildExactPasskeyOwnerLaneScope({
1517
1510
  authMethod,
1518
1511
  signerSlot: await resolveLinkedPasskeyOwnerSignerSlot({
@@ -132,6 +132,7 @@ async function signEvmFamilyWithUiConfirm(args) {
132
132
  const thresholdEcdsaStepUp = input.thresholdEcdsaStepUp;
133
133
  const thresholdEcdsaStepUpRuntime = thresholdEcdsaStepUp.kind === "not_required" ? void 0 : thresholdEcdsaStepUp.runtime;
134
134
  const signingAuthPlan = signingAuthPlanFromThresholdEcdsaStepUp(thresholdEcdsaStepUp);
135
+ const requiresThresholdEcdsaOperationStepUp = input.authorization.kind === "owner" && thresholdEcdsaStepUp.kind === "required" && (thresholdEcdsaStepUp.runtime.reusableAuthorization.kind === "absent" || !isWarmSessionSigningAuthPlan(thresholdEcdsaStepUp.authPlan.signingAuthPlan));
135
136
  if (hasThresholdEcdsaRequest && !signingAuthPlan) switch (input.authorization.kind) {
136
137
  case "owner": throw new Error("[chains] threshold ECDSA transaction signing requires an explicit auth plan");
137
138
  case "active_wallet_authority": break;
@@ -239,7 +240,7 @@ async function signEvmFamilyWithUiConfirm(args) {
239
240
  subtitle: config.body
240
241
  });
241
242
  let challengeB64u = base64UrlEncode(firstDigest);
242
- if (firstSignRequest.algorithm === "secp256k1" && thresholdEcdsaStepUpRuntime && activeThresholdEcdsaOperation && input.resolveEcdsaSigningMaterialPlan) {
243
+ if (requiresThresholdEcdsaOperationStepUp && firstSignRequest.algorithm === "secp256k1" && thresholdEcdsaStepUpRuntime && activeThresholdEcdsaOperation && input.resolveEcdsaSigningMaterialPlan) {
243
244
  const operationDigests = await buildEvmFamilyOperationDigests({
244
245
  operationFingerprint: input.signingOperation?.operationFingerprint,
245
246
  signingDigest32: inferDigest32FromSignRequest(firstSignRequest),
@@ -276,19 +276,16 @@ function buildNearPasskeyEd25519OperationStepUp(args) {
276
276
  if (args.auth.kind !== "passkey") return void 0;
277
277
  const auth = args.auth;
278
278
  return { prepare: async () => {
279
- const materialFacts = await resolveNearPasskeyStepUpMaterialFacts({
280
- preparation: args.preparation,
281
- executor: args.materialExecutor
282
- });
283
279
  const signer = args.signer;
280
+ const authority = await exactPasskeyStepUpAuthority({
281
+ authorityRef: nearPasskeyPreparationAuthority(args.preparation),
282
+ walletId: signer.account.wallet.walletId,
283
+ rpId: auth.rpId,
284
+ credentialIdB64u: auth.credentialIdB64u
285
+ });
284
286
  return {
285
- thresholdSessionId: materialFacts.thresholdSessionId,
286
- authority: await exactPasskeyStepUpAuthority({
287
- authorityRef: nearPasskeyPreparationAuthority(args.preparation),
288
- walletId: signer.account.wallet.walletId,
289
- rpId: auth.rpId,
290
- credentialIdB64u: auth.credentialIdB64u
291
- })
287
+ thresholdSessionId: args.thresholdSessionId,
288
+ authority
292
289
  };
293
290
  } };
294
291
  }
@@ -321,17 +318,6 @@ async function exactPasskeyStepUpAuthority(args) {
321
318
  if (resolvedRef.walletId !== args.authorityRef.walletId || resolvedRef.walletAuthMethodId !== args.authorityRef.walletAuthMethodId || resolvedRef.authorityDigest !== args.authorityRef.authorityDigest) throw new Error("[SigningEngine][near] exact Passkey step-up authority changed");
322
319
  return authority;
323
320
  }
324
- async function resolveNearPasskeyStepUpMaterialFacts(args) {
325
- switch (args.preparation.hydration.kind) {
326
- case "use_live_runtime": return (await args.executor.resolve(args.preparation)).facts;
327
- case "rehydrate_material_activation": return (await args.executor.preparePasskeyOperationStepUp(args.preparation)).facts;
328
- case "reauthorize_public_anchor": throw new Error("[SigningEngine][near] retired material cannot prepare Passkey step-up");
329
- case "blocked": throw new Error(`[SigningEngine][near] Passkey step-up material is blocked: ${args.preparation.hydration.reason}`);
330
- default:
331
- args.preparation.hydration;
332
- throw new Error("[SigningEngine][near] unsupported Passkey step-up material source");
333
- }
334
- }
335
321
  function buildNearEmailOtpEd25519StepUp(args) {
336
322
  if (args.auth.kind !== SIGNER_AUTH_METHODS.emailOtp || typeof args.deps.requestEmailOtpEd25519SigningChallenge !== "function") return;
337
323
  if (!args.preparation.hydration.materialActivation) return;
@@ -402,8 +388,8 @@ async function prepareNearAdHocSigningSession(args) {
402
388
  passkeyEd25519OperationStepUp: buildNearPasskeyEd25519OperationStepUp({
403
389
  auth: candidate.auth,
404
390
  signer,
405
- preparation: materialBoundary.preparation,
406
- materialExecutor: materialBoundary.executor
391
+ thresholdSessionId: materialIdentity.thresholdSessionId,
392
+ preparation: materialBoundary.preparation
407
393
  }) || null,
408
394
  emailOtpEd25519StepUp: buildNearEmailOtpEd25519StepUp({
409
395
  deps: args.deps,
@@ -430,8 +416,8 @@ async function prepareNearAdHocSigningSession(args) {
430
416
  passkeyEd25519OperationStepUp: buildNearPasskeyEd25519OperationStepUp({
431
417
  auth: selectedLane.auth,
432
418
  signer: selectedLane.identity.signer,
433
- preparation: materialBoundary.preparation,
434
- materialExecutor: materialBoundary.executor
419
+ thresholdSessionId: selectedLane.identity.thresholdSessionId,
420
+ preparation: materialBoundary.preparation
435
421
  }) || null,
436
422
  emailOtpEd25519StepUp: buildNearEmailOtpEd25519StepUp({
437
423
  deps: args.deps,
@@ -494,8 +480,8 @@ async function prepareNearAuthorizationRequiredTransaction(args) {
494
480
  passkeyEd25519OperationStepUp: buildNearPasskeyEd25519OperationStepUp({
495
481
  auth: candidate.auth,
496
482
  signer,
497
- preparation: materialBoundary.preparation,
498
- materialExecutor: materialBoundary.executor
483
+ thresholdSessionId: materialIdentity.thresholdSessionId,
484
+ preparation: materialBoundary.preparation
499
485
  }) || null,
500
486
  emailOtpEd25519StepUp: buildNearEmailOtpEd25519StepUp({
501
487
  deps: args.deps,
@@ -849,8 +835,8 @@ async function signTransactionWithActions(deps, args, attempt = {}) {
849
835
  const passkeyEd25519OperationStepUp = buildNearPasskeyEd25519OperationStepUp({
850
836
  auth: transactionLane.auth,
851
837
  signer: transactionLane.identity.signer,
852
- preparation: materialBoundary.preparation,
853
- materialExecutor: materialBoundary.executor
838
+ thresholdSessionId,
839
+ preparation: materialBoundary.preparation
854
840
  });
855
841
  const emailOtpEd25519StepUp = buildNearEmailOtpEd25519StepUp({
856
842
  deps,