@seams/wallet 0.5.2 → 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.
- package/dist/.build-inputs.sha256 +1 -1
- package/dist/esm/core/signingEngine/flows/signEvmFamily/signingFlow.js +2 -1
- package/dist/esm/core/signingEngine/flows/signNear/signNear.js +16 -30
- package/dist/esm/core/signingEngine/flows/signNear/signTransactions.js +102 -80
- package/dist/esm/core/signingEngine/uiConfirm/handlers/flows/signing.js +1 -1
- package/dist/esm/react/core/signingEngine/flows/signEvmFamily/signingFlow.js +2 -1
- package/dist/esm/react/core/signingEngine/flows/signNear/signNear.js +16 -30
- package/dist/esm/react/core/signingEngine/flows/signNear/signTransactions.js +102 -80
- package/dist/esm/react/core/signingEngine/uiConfirm/handlers/flows/signing.js +1 -1
- package/dist/esm/sdk/{display-rIXVrumh.js → display-CV_FRBAv.js} +1 -1
- package/dist/{public/sdk/host-DNmO0eve.js → esm/sdk/host-saeh9CWY.js} +2 -2
- package/dist/esm/sdk/{registrationPreparationPreload-CwUkRwVz.js → registrationPreparationPreload-9iIiVEzP.js} +2 -2
- package/dist/{public/sdk/runtime-auth-dpoaCtkK.js → esm/sdk/runtime-auth-CqJzUZit.js} +3 -3
- package/dist/esm/sdk/{runtime-device-link-C75epnbj.js → runtime-device-link-BDex3l39.js} +2 -2
- package/dist/{public/sdk/runtime-ecdsa-tempo-CV-E-iZG.js → esm/sdk/runtime-ecdsa-tempo-CV2jjenL.js} +2 -2
- package/dist/{public/sdk/runtime-email-otp-V0mdMD_t.js → esm/sdk/runtime-email-otp-CRXxFJfB.js} +2 -2
- package/dist/{public/sdk/runtime-export-C4HO5ysH.js → esm/sdk/runtime-export-DDRRvQHJ.js} +2 -2
- package/dist/esm/sdk/{runtime-near-DlviFQWy.js → runtime-near-DOmJffsR.js} +2 -2
- package/dist/{public/sdk/runtime-preferences-DyJidFuf.js → esm/sdk/runtime-preferences-CPxDZqxr.js} +2 -2
- package/dist/esm/sdk/{runtime-recovery-CHDE5gl0.js → runtime-recovery-wZqjlB5u.js} +2 -2
- package/dist/esm/sdk/{runtimeContext-D_TkUM6Z.js → runtimeContext-D73F6HOf.js} +12 -12
- package/dist/{public/sdk/runtimeLoader-DxiLgXPm.js → esm/sdk/runtimeLoader-DzuoDxql.js} +9 -9
- package/dist/esm/sdk/{signEvmFamily-CwJEkCP7.js → signEvmFamily-CIlzzMEd.js} +3 -3
- package/dist/esm/sdk/{signEvmFamilyWithUiConfirmForTempo-DtF2dEhK.js → signEvmFamilyWithUiConfirmForTempo-LNMzIdPa.js} +2 -2
- package/dist/{public/sdk/signEvmWithUiConfirm-CeDL-vEX.js → esm/sdk/signEvmWithUiConfirm-C4vBAKpE.js} +1 -1
- package/dist/esm/sdk/{signNear-B04A4qzs.js → signNear-d9Xz3SDg.js} +118 -110
- package/dist/esm/sdk/{signatureUses-BsYpH81W.js → signatureUses-Dg0S52Mp.js} +2 -1
- package/dist/{public/sdk/signerLoader-BhF6IFbD.js → esm/sdk/signerLoader-DVlqSMOs.js} +2 -2
- package/dist/esm/sdk/wallet-iframe-host-ecdsa.js +1 -1
- package/dist/esm/sdk/wallet-iframe-host-full.js +1 -1
- package/dist/esm/sdk/wallet-iframe-host-near.js +1 -1
- package/dist/esm/sdk/wallet-iframe-host-runtime.js +1 -1
- package/dist/public/headers.manifest.json +1 -1
- package/dist/public/sdk/{display-rIXVrumh.js → display-CV_FRBAv.js} +1 -1
- package/dist/{esm/sdk/host-DNmO0eve.js → public/sdk/host-saeh9CWY.js} +2 -2
- package/dist/public/sdk/{registrationPreparationPreload-CwUkRwVz.js → registrationPreparationPreload-9iIiVEzP.js} +2 -2
- package/dist/{esm/sdk/runtime-auth-dpoaCtkK.js → public/sdk/runtime-auth-CqJzUZit.js} +3 -3
- package/dist/public/sdk/{runtime-device-link-C75epnbj.js → runtime-device-link-BDex3l39.js} +2 -2
- package/dist/{esm/sdk/runtime-ecdsa-tempo-CV-E-iZG.js → public/sdk/runtime-ecdsa-tempo-CV2jjenL.js} +2 -2
- package/dist/{esm/sdk/runtime-email-otp-V0mdMD_t.js → public/sdk/runtime-email-otp-CRXxFJfB.js} +2 -2
- package/dist/{esm/sdk/runtime-export-C4HO5ysH.js → public/sdk/runtime-export-DDRRvQHJ.js} +2 -2
- package/dist/public/sdk/{runtime-near-DlviFQWy.js → runtime-near-DOmJffsR.js} +2 -2
- package/dist/{esm/sdk/runtime-preferences-DyJidFuf.js → public/sdk/runtime-preferences-CPxDZqxr.js} +2 -2
- package/dist/public/sdk/{runtime-recovery-CHDE5gl0.js → runtime-recovery-wZqjlB5u.js} +2 -2
- package/dist/public/sdk/{runtimeContext-D_TkUM6Z.js → runtimeContext-D73F6HOf.js} +12 -12
- package/dist/{esm/sdk/runtimeLoader-DxiLgXPm.js → public/sdk/runtimeLoader-DzuoDxql.js} +9 -9
- package/dist/public/sdk/{signEvmFamily-CwJEkCP7.js → signEvmFamily-CIlzzMEd.js} +3 -3
- package/dist/public/sdk/{signEvmFamilyWithUiConfirmForTempo-DtF2dEhK.js → signEvmFamilyWithUiConfirmForTempo-LNMzIdPa.js} +2 -2
- package/dist/{esm/sdk/signEvmWithUiConfirm-CeDL-vEX.js → public/sdk/signEvmWithUiConfirm-C4vBAKpE.js} +1 -1
- package/dist/public/sdk/{signNear-B04A4qzs.js → signNear-d9Xz3SDg.js} +118 -110
- package/dist/public/sdk/{signatureUses-BsYpH81W.js → signatureUses-Dg0S52Mp.js} +2 -1
- package/dist/{esm/sdk/signerLoader-BhF6IFbD.js → public/sdk/signerLoader-DVlqSMOs.js} +2 -2
- package/dist/public/sdk/wallet-iframe-host-ecdsa.js +1 -1
- package/dist/public/sdk/wallet-iframe-host-full.js +1 -1
- package/dist/public/sdk/wallet-iframe-host-near.js +1 -1
- package/dist/public/sdk/wallet-iframe-host-runtime.js +1 -1
- package/dist/public/wallet-assets.manifest.json +42 -42
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b5b2bc0f0d923ec728dc7382b6332ea8ed424a567a5c77e1979ed72c282ee2b0
|
|
@@ -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:
|
|
286
|
-
authority
|
|
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
|
-
|
|
406
|
-
|
|
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
|
-
|
|
434
|
-
|
|
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
|
-
|
|
498
|
-
|
|
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
|
-
|
|
853
|
-
|
|
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
|
-
|
|
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
|
-
|
|
234
|
-
|
|
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
|
-
|
|
286
|
-
|
|
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
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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
|
-
|
|
579
|
-
|
|
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",
|
|
@@ -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
|
}
|
|
@@ -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:
|
|
286
|
-
authority
|
|
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
|
-
|
|
406
|
-
|
|
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
|
-
|
|
434
|
-
|
|
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
|
-
|
|
498
|
-
|
|
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
|
-
|
|
853
|
-
|
|
838
|
+
thresholdSessionId,
|
|
839
|
+
preparation: materialBoundary.preparation
|
|
854
840
|
});
|
|
855
841
|
const emailOtpEd25519StepUp = buildNearEmailOtpEd25519StepUp({
|
|
856
842
|
deps,
|