@seams/wallet 0.5.0 → 0.5.2
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/LICENSE.md +201 -0
- package/THIRD_PARTY_NOTICES.md +15095 -0
- package/dist/.build-inputs.sha256 +1 -1
- package/dist/esm/SeamsWeb/signingSurface/BrowserSigningSurface.js +7 -14
- package/dist/esm/core/signingEngine/session/identity/exactWalletSessionReader.js +2 -27
- package/dist/esm/react/SeamsWeb/signingSurface/BrowserSigningSurface.js +7 -14
- package/dist/esm/react/core/signingEngine/session/identity/exactWalletSessionReader.js +2 -27
- package/dist/esm/sdk/export-private-key-viewer.js +1420 -1425
- package/dist/esm/sdk/halo-border.js +1424 -1429
- package/dist/esm/sdk/{host-BqwEYhX0.js → host-DNmO0eve.js} +2 -2
- package/dist/esm/sdk/passkey-halo-loading.js +1426 -1431
- package/dist/{public/sdk/registrationPreparationPreload-u3ruCmpF.js → esm/sdk/registrationPreparationPreload-CwUkRwVz.js} +1 -1
- package/dist/esm/sdk/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/{public/sdk/runtime-auth-Da9yQyaD.js → esm/sdk/runtime-auth-dpoaCtkK.js} +2 -2
- package/dist/esm/sdk/{runtime-device-link-DNlzlwrr.js → runtime-device-link-C75epnbj.js} +1 -1
- package/dist/{public/sdk/runtime-ecdsa-tempo-B7dBVcCI.js → esm/sdk/runtime-ecdsa-tempo-CV-E-iZG.js} +1 -1
- package/dist/{public/sdk/runtime-email-otp-CckVQZJC.js → esm/sdk/runtime-email-otp-V0mdMD_t.js} +1 -1
- package/dist/{public/sdk/runtime-export-WAiBwZL_.js → esm/sdk/runtime-export-C4HO5ysH.js} +1 -1
- package/dist/esm/sdk/{runtime-near-DBJ4KfFv.js → runtime-near-DlviFQWy.js} +1 -1
- package/dist/{public/sdk/runtime-preferences-DmH7eMHH.js → esm/sdk/runtime-preferences-DyJidFuf.js} +1 -1
- package/dist/esm/sdk/{runtime-recovery-kPgl9nTT.js → runtime-recovery-CHDE5gl0.js} +1 -1
- package/dist/esm/sdk/{runtimeContext-BorCgXo5.js → runtimeContext-D_TkUM6Z.js} +6 -38
- package/dist/esm/sdk/{runtimeLoader-BKQjNgXO.js → runtimeLoader-DxiLgXPm.js} +9 -9
- package/dist/esm/sdk/tx-confirm-ui.js +1400 -1407
- package/dist/esm/sdk/w3a-tx-confirmer.js +1442 -1447
- 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/esm/wasm/near_signer/pkg/wasm_signer_worker.js +4 -4
- package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
- package/dist/esm/wasm/router_ab_ecdsa_client/pkg/router_ab_ecdsa_client_bg.wasm +0 -0
- package/dist/esm/wasm/router_ab_ed25519_yao_client/pkg/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/public/headers.manifest.json +1 -1
- package/dist/public/sdk/export-private-key-viewer.js +1420 -1425
- package/dist/public/sdk/halo-border.js +1424 -1429
- package/dist/public/sdk/{host-BqwEYhX0.js → host-DNmO0eve.js} +2 -2
- package/dist/public/sdk/passkey-halo-loading.js +1426 -1431
- package/dist/{esm/sdk/registrationPreparationPreload-u3ruCmpF.js → public/sdk/registrationPreparationPreload-CwUkRwVz.js} +1 -1
- package/dist/public/sdk/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/{esm/sdk/runtime-auth-Da9yQyaD.js → public/sdk/runtime-auth-dpoaCtkK.js} +2 -2
- package/dist/public/sdk/{runtime-device-link-DNlzlwrr.js → runtime-device-link-C75epnbj.js} +1 -1
- package/dist/{esm/sdk/runtime-ecdsa-tempo-B7dBVcCI.js → public/sdk/runtime-ecdsa-tempo-CV-E-iZG.js} +1 -1
- package/dist/{esm/sdk/runtime-email-otp-CckVQZJC.js → public/sdk/runtime-email-otp-V0mdMD_t.js} +1 -1
- package/dist/{esm/sdk/runtime-export-WAiBwZL_.js → public/sdk/runtime-export-C4HO5ysH.js} +1 -1
- package/dist/public/sdk/{runtime-near-DBJ4KfFv.js → runtime-near-DlviFQWy.js} +1 -1
- package/dist/{esm/sdk/runtime-preferences-DmH7eMHH.js → public/sdk/runtime-preferences-DyJidFuf.js} +1 -1
- package/dist/public/sdk/{runtime-recovery-kPgl9nTT.js → runtime-recovery-CHDE5gl0.js} +1 -1
- package/dist/public/sdk/{runtimeContext-BorCgXo5.js → runtimeContext-D_TkUM6Z.js} +6 -38
- package/dist/public/sdk/{runtimeLoader-BKQjNgXO.js → runtimeLoader-DxiLgXPm.js} +9 -9
- package/dist/public/sdk/tx-confirm-ui.js +1400 -1407
- package/dist/public/sdk/w3a-tx-confirmer.js +1442 -1447
- 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/sdk/workers/device-linking-key.worker.js +133 -140
- package/dist/public/sdk/workers/ecdsa-derivation-client.worker.js +94 -188
- package/dist/public/sdk/workers/ecdsa-online-client.worker.js +6 -7
- package/dist/public/sdk/workers/ecdsa-presign-client.worker.js +6 -7
- package/dist/public/sdk/workers/email-otp.worker.js +39 -52
- package/dist/public/sdk/workers/email_otp_runtime_bg.wasm +0 -0
- package/dist/public/sdk/workers/evm-crypto.worker.js +3 -3
- package/dist/public/sdk/workers/evm_crypto.wasm +0 -0
- package/dist/public/sdk/workers/evm_crypto_bg.wasm +0 -0
- package/dist/public/sdk/workers/near-signer.worker.js +9 -9
- package/dist/public/sdk/workers/near_signer.wasm +0 -0
- package/dist/public/sdk/workers/passkey-confirm.worker.js +4 -4
- package/dist/public/sdk/workers/passkey-mpc-export.worker.js +9 -19
- package/dist/public/sdk/workers/router_ab_ecdsa_client_bg.wasm +0 -0
- package/dist/public/sdk/workers/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/public/sdk/workers/shamir3pass.worker.js +3 -3
- package/dist/public/sdk/workers/shamir3pass_runtime_bg.wasm +0 -0
- package/dist/public/sdk/workers/tempo-signer.worker.js +3 -3
- package/dist/public/sdk/workers/tempo_signer.wasm +0 -0
- package/dist/public/sdk/workers/tempo_signer_bg.wasm +0 -0
- package/dist/public/sdk/workers/wallet-custody-ceremony.worker.js +55 -1244
- package/dist/public/sdk/workers/wallet_custody_ceremony_bg.wasm +0 -0
- package/dist/public/sdk/workers/wasm_signer_worker_bg.wasm +0 -0
- package/dist/public/wallet-assets.manifest.json +32 -32
- package/dist/types/wallet/src/SeamsWeb/signingSurface/BrowserSigningSurface.d.ts +4 -4
- package/dist/types/wallet/src/core/signingEngine/session/identity/exactWalletSessionReader.d.ts +1 -9
- package/dist/workers/device-linking-key.worker.js +133 -140
- package/dist/workers/ecdsa-derivation-client.worker.js +94 -188
- package/dist/workers/ecdsa-online-client.worker.js +6 -7
- package/dist/workers/ecdsa-presign-client.worker.js +6 -7
- package/dist/workers/email-otp.worker.js +39 -52
- package/dist/workers/email_otp_runtime_bg.wasm +0 -0
- package/dist/workers/evm-crypto.worker.js +3 -3
- package/dist/workers/evm_crypto.wasm +0 -0
- package/dist/workers/evm_crypto_bg.wasm +0 -0
- package/dist/workers/near-signer.worker.js +9 -9
- package/dist/workers/near_signer.wasm +0 -0
- package/dist/workers/passkey-confirm.worker.js +4 -4
- package/dist/workers/passkey-mpc-export.worker.js +9 -19
- package/dist/workers/router_ab_ecdsa_client_bg.wasm +0 -0
- package/dist/workers/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/workers/shamir3pass.worker.js +3 -3
- package/dist/workers/shamir3pass_runtime_bg.wasm +0 -0
- package/dist/workers/tempo-signer.worker.js +3 -3
- package/dist/workers/tempo_signer.wasm +0 -0
- package/dist/workers/tempo_signer_bg.wasm +0 -0
- package/dist/workers/wallet-custody-ceremony.worker.js +55 -1244
- package/dist/workers/wallet_custody_ceremony_bg.wasm +0 -0
- package/dist/workers/wasm_signer_worker_bg.wasm +0 -0
- package/package.json +6 -3
- package/LICENSE +0 -21
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
// ../shared-ts/src/utils/domainIds.ts
|
|
2
|
-
class MpcMaterialActivationReference {
|
|
3
|
-
retainProof() {
|
|
4
|
-
return true;
|
|
5
|
-
}
|
|
6
|
-
kind;
|
|
7
|
-
activationId;
|
|
8
|
-
capability;
|
|
9
|
-
materialOwner;
|
|
10
|
-
keyBinding;
|
|
11
|
-
lifecycleBinding;
|
|
12
|
-
signingWorker;
|
|
13
|
-
constructor(fields) {
|
|
14
|
-
this.retainProof();
|
|
15
|
-
this.kind = "mpc_material_activation_ref";
|
|
16
|
-
this.activationId = fields.activationId;
|
|
17
|
-
this.capability = fields.capability;
|
|
18
|
-
this.materialOwner = fields.materialOwner;
|
|
19
|
-
this.keyBinding = fields.keyBinding;
|
|
20
|
-
this.lifecycleBinding = fields.lifecycleBinding;
|
|
21
|
-
this.signingWorker = fields.signingWorker;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
2
|
function parseDomainId(raw, fieldName) {
|
|
25
3
|
if (raw == null) {
|
|
26
4
|
return {
|
|
@@ -106,121 +84,9 @@ function parsePasskeyEnvelopeId(raw) {
|
|
|
106
84
|
function parseWalletAuthMethodId(raw) {
|
|
107
85
|
return parseDomainId(raw, "walletAuthMethodId");
|
|
108
86
|
}
|
|
109
|
-
function parseCapabilityInstanceRef(raw) {
|
|
110
|
-
return parseDomainId(raw, "capabilityInstanceRef");
|
|
111
|
-
}
|
|
112
|
-
function parseMpcMaterialOwnerRef(raw) {
|
|
113
|
-
return parseDomainId(raw, "mpcMaterialOwnerRef");
|
|
114
|
-
}
|
|
115
|
-
function parseMpcMaterialActivationId(raw) {
|
|
116
|
-
return parseDomainId(raw, "mpcMaterialActivationId");
|
|
117
|
-
}
|
|
118
87
|
function parseMpcSigningWorkerRef(raw) {
|
|
119
88
|
return parseDomainId(raw, "mpcSigningWorkerRef");
|
|
120
89
|
}
|
|
121
|
-
function parseMpcKeyBindingRef(raw) {
|
|
122
|
-
return parseDomainId(raw, "mpcKeyBindingRef");
|
|
123
|
-
}
|
|
124
|
-
function parseMpcLifecycleBindingRef(raw) {
|
|
125
|
-
return parseDomainId(raw, "mpcLifecycleBindingRef");
|
|
126
|
-
}
|
|
127
|
-
function buildMpcMaterialActivationRef(fields) {
|
|
128
|
-
return new MpcMaterialActivationReference(fields);
|
|
129
|
-
}
|
|
130
|
-
function isMpcMaterialActivationRefField(field) {
|
|
131
|
-
switch (field) {
|
|
132
|
-
case "kind":
|
|
133
|
-
case "activationId":
|
|
134
|
-
case "capability":
|
|
135
|
-
case "materialOwner":
|
|
136
|
-
case "keyBinding":
|
|
137
|
-
case "lifecycleBinding":
|
|
138
|
-
case "signingWorker":
|
|
139
|
-
return true;
|
|
140
|
-
default:
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function parseMpcMaterialActivationRef(raw) {
|
|
145
|
-
if (raw == null) {
|
|
146
|
-
return {
|
|
147
|
-
ok: false,
|
|
148
|
-
error: {
|
|
149
|
-
code: "missing",
|
|
150
|
-
message: "mpcMaterialActivationRef is required"
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
if (typeof raw !== "object" || Array.isArray(raw)) {
|
|
155
|
-
return {
|
|
156
|
-
ok: false,
|
|
157
|
-
error: {
|
|
158
|
-
code: "invalid",
|
|
159
|
-
message: "mpcMaterialActivationRef must be an object"
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
const record = raw;
|
|
164
|
-
const fields = Object.keys(record);
|
|
165
|
-
if (fields.length !== 7) {
|
|
166
|
-
return {
|
|
167
|
-
ok: false,
|
|
168
|
-
error: {
|
|
169
|
-
code: "invalid",
|
|
170
|
-
message: "mpcMaterialActivationRef has invalid fields"
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
for (const field of fields) {
|
|
175
|
-
if (!isMpcMaterialActivationRefField(field)) {
|
|
176
|
-
return {
|
|
177
|
-
ok: false,
|
|
178
|
-
error: {
|
|
179
|
-
code: "invalid",
|
|
180
|
-
message: "mpcMaterialActivationRef has invalid fields"
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (record.kind !== "mpc_material_activation_ref") {
|
|
186
|
-
return {
|
|
187
|
-
ok: false,
|
|
188
|
-
error: {
|
|
189
|
-
code: "invalid",
|
|
190
|
-
message: "mpcMaterialActivationRef.kind is invalid"
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
const activationId = parseMpcMaterialActivationId(record.activationId);
|
|
195
|
-
if (!activationId.ok)
|
|
196
|
-
return activationId;
|
|
197
|
-
const capability = parseCapabilityInstanceRef(record.capability);
|
|
198
|
-
if (!capability.ok)
|
|
199
|
-
return capability;
|
|
200
|
-
const materialOwner = parseMpcMaterialOwnerRef(record.materialOwner);
|
|
201
|
-
if (!materialOwner.ok)
|
|
202
|
-
return materialOwner;
|
|
203
|
-
const keyBinding = parseMpcKeyBindingRef(record.keyBinding);
|
|
204
|
-
if (!keyBinding.ok)
|
|
205
|
-
return keyBinding;
|
|
206
|
-
const lifecycleBinding = parseMpcLifecycleBindingRef(record.lifecycleBinding);
|
|
207
|
-
if (!lifecycleBinding.ok)
|
|
208
|
-
return lifecycleBinding;
|
|
209
|
-
const signingWorker = parseMpcSigningWorkerRef(record.signingWorker);
|
|
210
|
-
if (!signingWorker.ok)
|
|
211
|
-
return signingWorker;
|
|
212
|
-
return {
|
|
213
|
-
ok: true,
|
|
214
|
-
value: buildMpcMaterialActivationRef({
|
|
215
|
-
activationId: activationId.value,
|
|
216
|
-
capability: capability.value,
|
|
217
|
-
materialOwner: materialOwner.value,
|
|
218
|
-
keyBinding: keyBinding.value,
|
|
219
|
-
lifecycleBinding: lifecycleBinding.value,
|
|
220
|
-
signingWorker: signingWorker.value
|
|
221
|
-
})
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
90
|
function parseThresholdEcdsaSessionId(raw) {
|
|
225
91
|
return parseDomainId(raw, "thresholdEcdsaSessionId");
|
|
226
92
|
}
|
|
@@ -236,24 +102,9 @@ function parseLaneShareEpoch(raw) {
|
|
|
236
102
|
function parseLinkedDeviceId(raw) {
|
|
237
103
|
return parseDomainId(raw, "linkedDeviceId");
|
|
238
104
|
}
|
|
239
|
-
function parseLaneOperationId(raw) {
|
|
240
|
-
return parseDomainId(raw, "laneOperationId");
|
|
241
|
-
}
|
|
242
|
-
function parseLaneEnrollmentId(raw) {
|
|
243
|
-
return parseDomainId(raw, "laneEnrollmentId");
|
|
244
|
-
}
|
|
245
|
-
function parseLaneOperationIdempotencyKey(raw) {
|
|
246
|
-
return parseDomainId(raw, "laneOperationIdempotencyKey");
|
|
247
|
-
}
|
|
248
105
|
function parseLinkedDeviceEnrollmentId(raw) {
|
|
249
106
|
return parseDomainId(raw, "linkedDeviceEnrollmentId");
|
|
250
107
|
}
|
|
251
|
-
function parseEd25519YaoSuiteId(raw) {
|
|
252
|
-
return parseDomainId(raw, "ed25519YaoSuiteId");
|
|
253
|
-
}
|
|
254
|
-
function parseEcdsaRelayerKeyId(raw) {
|
|
255
|
-
return parseDomainId(raw, "ecdsaRelayerKeyId");
|
|
256
|
-
}
|
|
257
108
|
function parseLinkDeviceSessionId(raw) {
|
|
258
109
|
return parseDomainId(raw, "linkDeviceSessionId");
|
|
259
110
|
}
|
|
@@ -284,10 +135,10 @@ var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function
|
|
|
284
135
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
285
136
|
if (realloc === undefined) {
|
|
286
137
|
const buf = cachedTextEncoder.encode(arg);
|
|
287
|
-
const
|
|
288
|
-
getUint8ArrayMemory0().subarray(
|
|
138
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
139
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
289
140
|
WASM_VECTOR_LEN = buf.length;
|
|
290
|
-
return
|
|
141
|
+
return ptr;
|
|
291
142
|
}
|
|
292
143
|
let len = arg.length;
|
|
293
144
|
let ptr = malloc(len, 1) >>> 0;
|
|
@@ -934,10 +785,10 @@ var encodeString2 = typeof cachedTextEncoder2.encodeInto === "function" ? functi
|
|
|
934
785
|
function passStringToWasm02(arg, malloc, realloc) {
|
|
935
786
|
if (realloc === undefined) {
|
|
936
787
|
const buf = cachedTextEncoder2.encode(arg);
|
|
937
|
-
const
|
|
938
|
-
getUint8ArrayMemory02().subarray(
|
|
788
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
789
|
+
getUint8ArrayMemory02().subarray(ptr, ptr + buf.length).set(buf);
|
|
939
790
|
WASM_VECTOR_LEN2 = buf.length;
|
|
940
|
-
return
|
|
791
|
+
return ptr;
|
|
941
792
|
}
|
|
942
793
|
let len = arg.length;
|
|
943
794
|
let ptr = malloc(len, 1) >>> 0;
|
|
@@ -1176,10 +1027,10 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
1176
1027
|
return getUint8ArrayMemory02().subarray(ptr / 1, ptr / 1 + len);
|
|
1177
1028
|
}
|
|
1178
1029
|
function __wbg_adapter_52(arg0, arg1, arg2) {
|
|
1179
|
-
wasm2.
|
|
1030
|
+
wasm2.closure67_externref_shim(arg0, arg1, arg2);
|
|
1180
1031
|
}
|
|
1181
1032
|
function __wbg_adapter_387(arg0, arg1, arg2, arg3) {
|
|
1182
|
-
wasm2.
|
|
1033
|
+
wasm2.closure60_externref_shim(arg0, arg1, arg2, arg3);
|
|
1183
1034
|
}
|
|
1184
1035
|
var ConfirmationBehavior = Object.freeze({
|
|
1185
1036
|
RequireClick: 0,
|
|
@@ -1785,11 +1636,11 @@ function __wbg_get_imports2() {
|
|
|
1785
1636
|
imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
1786
1637
|
try {
|
|
1787
1638
|
var state0 = { a: arg0, b: arg1 };
|
|
1788
|
-
var cb0 = (
|
|
1639
|
+
var cb0 = (arg0, arg1) => {
|
|
1789
1640
|
const a = state0.a;
|
|
1790
1641
|
state0.a = 0;
|
|
1791
1642
|
try {
|
|
1792
|
-
return __wbg_adapter_387(a, state0.b,
|
|
1643
|
+
return __wbg_adapter_387(a, state0.b, arg0, arg1);
|
|
1793
1644
|
} finally {
|
|
1794
1645
|
state0.a = a;
|
|
1795
1646
|
}
|
|
@@ -1990,8 +1841,8 @@ function __wbg_get_imports2() {
|
|
|
1990
1841
|
const ret = false;
|
|
1991
1842
|
return ret;
|
|
1992
1843
|
};
|
|
1993
|
-
imports.wbg.
|
|
1994
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1844
|
+
imports.wbg.__wbindgen_closure_wrapper2623 = function(arg0, arg1, arg2) {
|
|
1845
|
+
const ret = makeMutClosure(arg0, arg1, 68, __wbg_adapter_52);
|
|
1995
1846
|
return ret;
|
|
1996
1847
|
};
|
|
1997
1848
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
@@ -3404,10 +3255,10 @@ function passArray8ToWasm03(arg, malloc) {
|
|
|
3404
3255
|
function passStringToWasm03(arg, malloc, realloc) {
|
|
3405
3256
|
if (realloc === undefined) {
|
|
3406
3257
|
const buf = cachedTextEncoder3.encode(arg);
|
|
3407
|
-
const
|
|
3408
|
-
getUint8ArrayMemory03().subarray(
|
|
3258
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
3259
|
+
getUint8ArrayMemory03().subarray(ptr, ptr + buf.length).set(buf);
|
|
3409
3260
|
WASM_VECTOR_LEN3 = buf.length;
|
|
3410
|
-
return
|
|
3261
|
+
return ptr;
|
|
3411
3262
|
}
|
|
3412
3263
|
let len = arg.length;
|
|
3413
3264
|
let ptr = malloc(len, 1) >>> 0;
|
|
@@ -3918,12 +3769,6 @@ function parseSecp256k1CompressedPublicKeyB64u(value, label = "publicKey33B64u")
|
|
|
3918
3769
|
}
|
|
3919
3770
|
return value;
|
|
3920
3771
|
}
|
|
3921
|
-
function parseKeyCreationSignerSlot(value, label = "keyCreationSignerSlot") {
|
|
3922
|
-
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0 || value > 4294967295) {
|
|
3923
|
-
throw new Error(`${label} must be a positive u32`);
|
|
3924
|
-
}
|
|
3925
|
-
return value;
|
|
3926
|
-
}
|
|
3927
3772
|
function parseEnvelopeRevision(value, label = "envelopeRevision") {
|
|
3928
3773
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) {
|
|
3929
3774
|
throw new Error(`${label} must be a positive integer revision`);
|
|
@@ -4793,150 +4638,6 @@ var VAULT_OPERATION_KIND_VALUES = Object.values(VAULT_OPERATION_KINDS);
|
|
|
4793
4638
|
var NEAR_ED25519_MPC_OPERATION_KIND_VALUES = Object.values(NEAR_ED25519_MPC_OPERATION_KINDS);
|
|
4794
4639
|
var EVM_ECDSA_MPC_OPERATION_KIND_VALUES = Object.values(EVM_ECDSA_MPC_OPERATION_KINDS);
|
|
4795
4640
|
var AUTHORIZATION_EVIDENCE_KIND_VALUES = Object.values(AUTHORIZATION_EVIDENCE_KINDS);
|
|
4796
|
-
function parseAuthorizedOperationId(value) {
|
|
4797
|
-
return parseAuthorizationId(value, "authorizedOperationId");
|
|
4798
|
-
}
|
|
4799
|
-
function parseAuthorizationId(value, fieldName) {
|
|
4800
|
-
if (typeof value !== "string") {
|
|
4801
|
-
return {
|
|
4802
|
-
ok: false,
|
|
4803
|
-
error: {
|
|
4804
|
-
code: value == null ? "missing" : "invalid",
|
|
4805
|
-
message: `${fieldName} must be a nonempty string`
|
|
4806
|
-
}
|
|
4807
|
-
};
|
|
4808
|
-
}
|
|
4809
|
-
const normalized = value.trim();
|
|
4810
|
-
if (!normalized) {
|
|
4811
|
-
return {
|
|
4812
|
-
ok: false,
|
|
4813
|
-
error: {
|
|
4814
|
-
code: "missing",
|
|
4815
|
-
message: `${fieldName} is required`
|
|
4816
|
-
}
|
|
4817
|
-
};
|
|
4818
|
-
}
|
|
4819
|
-
if (normalized.length > 512 || hasWhitespaceOrControlCharacters(normalized)) {
|
|
4820
|
-
return {
|
|
4821
|
-
ok: false,
|
|
4822
|
-
error: {
|
|
4823
|
-
code: "invalid",
|
|
4824
|
-
message: `${fieldName} must be a compact opaque identifier`
|
|
4825
|
-
}
|
|
4826
|
-
};
|
|
4827
|
-
}
|
|
4828
|
-
return { ok: true, value: normalized };
|
|
4829
|
-
}
|
|
4830
|
-
|
|
4831
|
-
// ../shared-ts/src/utils/ecdsaCapabilityActivation.ts
|
|
4832
|
-
function parseNonEmptyString(value, label) {
|
|
4833
|
-
if (typeof value !== "string" || value.trim() !== value || value.length === 0) {
|
|
4834
|
-
throw new Error(`${label} must be a non-empty canonical string`);
|
|
4835
|
-
}
|
|
4836
|
-
return value;
|
|
4837
|
-
}
|
|
4838
|
-
function parseEcdsaServerGeneration(value) {
|
|
4839
|
-
return parseNonEmptyString(value, "ECDSA server generation");
|
|
4840
|
-
}
|
|
4841
|
-
function parseEcdsaCapabilityManifestId(value) {
|
|
4842
|
-
return parseNonEmptyString(value, "ECDSA manifest id");
|
|
4843
|
-
}
|
|
4844
|
-
function parseEcdsaCapabilityManifestRevision(value) {
|
|
4845
|
-
if (!Number.isSafeInteger(value) || Number(value) < 1) {
|
|
4846
|
-
throw new Error("ECDSA manifest revision must be a positive safe integer");
|
|
4847
|
-
}
|
|
4848
|
-
return value;
|
|
4849
|
-
}
|
|
4850
|
-
|
|
4851
|
-
// ../shared-ts/src/threshold/ecdsaDerivationRoleLocalBootstrap.ts
|
|
4852
|
-
function requireSdkBindingFactString(value, field) {
|
|
4853
|
-
const normalized = String(value ?? "").trim();
|
|
4854
|
-
if (!normalized)
|
|
4855
|
-
throw new Error(`${field} is required`);
|
|
4856
|
-
return normalized;
|
|
4857
|
-
}
|
|
4858
|
-
function parseSdkEcdsaDerivationThresholdKeyId(value) {
|
|
4859
|
-
return requireSdkBindingFactString(value, "ecdsaThresholdKeyId");
|
|
4860
|
-
}
|
|
4861
|
-
|
|
4862
|
-
// ../shared-ts/src/signing-lanes/participants.ts
|
|
4863
|
-
function missing(field) {
|
|
4864
|
-
return { code: "missing", message: `${field} is required` };
|
|
4865
|
-
}
|
|
4866
|
-
function invalid(field, reason) {
|
|
4867
|
-
return { code: "invalid", message: `${field} ${reason}` };
|
|
4868
|
-
}
|
|
4869
|
-
function parseIdentityId(raw, field) {
|
|
4870
|
-
if (raw === undefined || raw === null)
|
|
4871
|
-
return { ok: false, error: missing(field) };
|
|
4872
|
-
if (typeof raw !== "string")
|
|
4873
|
-
return { ok: false, error: invalid(field, "must be a string") };
|
|
4874
|
-
const value = raw.trim();
|
|
4875
|
-
if (!value)
|
|
4876
|
-
return { ok: false, error: missing(field) };
|
|
4877
|
-
if (hasWhitespaceOrControlCharacters(value)) {
|
|
4878
|
-
return { ok: false, error: invalid(field, "must not contain whitespace or control characters") };
|
|
4879
|
-
}
|
|
4880
|
-
return { ok: true, value };
|
|
4881
|
-
}
|
|
4882
|
-
function parseHpkePublicKey(raw, field) {
|
|
4883
|
-
if (raw === undefined || raw === null)
|
|
4884
|
-
return { ok: false, error: missing(field) };
|
|
4885
|
-
if (typeof raw !== "string" || raw.length === 0) {
|
|
4886
|
-
return { ok: false, error: invalid(field, "must be non-empty base64url") };
|
|
4887
|
-
}
|
|
4888
|
-
try {
|
|
4889
|
-
const bytes = base64UrlDecode(raw);
|
|
4890
|
-
if (bytes.length === 0 || base64UrlEncode(bytes) !== raw) {
|
|
4891
|
-
return { ok: false, error: invalid(field, "must be canonical unpadded base64url") };
|
|
4892
|
-
}
|
|
4893
|
-
} catch {
|
|
4894
|
-
return { ok: false, error: invalid(field, "must be canonical unpadded base64url") };
|
|
4895
|
-
}
|
|
4896
|
-
return { ok: true, value: raw };
|
|
4897
|
-
}
|
|
4898
|
-
function parseDigest(raw, field, brand) {
|
|
4899
|
-
if (raw === undefined || raw === null)
|
|
4900
|
-
return { ok: false, error: missing(field) };
|
|
4901
|
-
try {
|
|
4902
|
-
return { ok: true, value: brand(parseDigestB64u(raw)) };
|
|
4903
|
-
} catch {
|
|
4904
|
-
return { ok: false, error: invalid(field, "must be canonical base64url for 32 bytes") };
|
|
4905
|
-
}
|
|
4906
|
-
}
|
|
4907
|
-
function brandLaneCustodyDigest(value) {
|
|
4908
|
-
return value;
|
|
4909
|
-
}
|
|
4910
|
-
function brandRecipientDigest(value) {
|
|
4911
|
-
return value;
|
|
4912
|
-
}
|
|
4913
|
-
function brandParticipantDigest(value) {
|
|
4914
|
-
return value;
|
|
4915
|
-
}
|
|
4916
|
-
function parseLaneHolderParticipantId(raw) {
|
|
4917
|
-
return parseIdentityId(raw, "laneHolderParticipantId");
|
|
4918
|
-
}
|
|
4919
|
-
function parseSigningWorkerParticipantId(raw) {
|
|
4920
|
-
return parseIdentityId(raw, "signingWorkerParticipantId");
|
|
4921
|
-
}
|
|
4922
|
-
function parseSigningWorkerRecipientKeyId(raw) {
|
|
4923
|
-
return parseIdentityId(raw, "signingWorkerRecipientKeyId");
|
|
4924
|
-
}
|
|
4925
|
-
function parseLaneHolderCustodyBindingId(raw) {
|
|
4926
|
-
return parseIdentityId(raw, "laneHolderCustodyBindingId");
|
|
4927
|
-
}
|
|
4928
|
-
function parseHpkePublicKeyB64u(raw) {
|
|
4929
|
-
return parseHpkePublicKey(raw, "hpkePublicKeyB64u");
|
|
4930
|
-
}
|
|
4931
|
-
function parseLaneParticipantBindingDigestB64u(raw) {
|
|
4932
|
-
return parseDigest(raw, "participantBindingDigestB64u", brandParticipantDigest);
|
|
4933
|
-
}
|
|
4934
|
-
function parseLaneCustodyBindingDigestB64u(raw) {
|
|
4935
|
-
return parseDigest(raw, "custodyBindingDigestB64u", brandLaneCustodyDigest);
|
|
4936
|
-
}
|
|
4937
|
-
function parseSigningWorkerRecipientKeyDigestB64u(raw) {
|
|
4938
|
-
return parseDigest(raw, "hpkePublicKeyDigestB64u", brandRecipientDigest);
|
|
4939
|
-
}
|
|
4940
4641
|
|
|
4941
4642
|
// ../shared-ts/src/signing-lanes/participantDigest.ts
|
|
4942
4643
|
function concat(parts) {
|
|
@@ -5072,739 +4773,6 @@ function ownerLaneParticipantContinuityCanonicalBytesV1(input) {
|
|
|
5072
4773
|
]);
|
|
5073
4774
|
}
|
|
5074
4775
|
|
|
5075
|
-
// ../shared-ts/src/signing-lanes/rotationParsers.ts
|
|
5076
|
-
function opaqueJson(raw, label) {
|
|
5077
|
-
if (typeof raw !== "string" || raw.length === 0) {
|
|
5078
|
-
throw new Error(`${label} must be a non-empty JSON string`);
|
|
5079
|
-
}
|
|
5080
|
-
try {
|
|
5081
|
-
const parsed = JSON.parse(raw);
|
|
5082
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
5083
|
-
throw new Error("top-level value must be an object");
|
|
5084
|
-
}
|
|
5085
|
-
} catch (error) {
|
|
5086
|
-
throw new Error(`${label} must contain valid object JSON: ${error instanceof Error ? error.message : "invalid JSON"}`);
|
|
5087
|
-
}
|
|
5088
|
-
return raw;
|
|
5089
|
-
}
|
|
5090
|
-
var NON_EMPTY_FIELDS = {
|
|
5091
|
-
authorization: [
|
|
5092
|
-
"kind",
|
|
5093
|
-
"authorizedOperationId",
|
|
5094
|
-
"linkedDeviceEnrollmentId",
|
|
5095
|
-
"linkedDevicePermissionDigestB64u"
|
|
5096
|
-
],
|
|
5097
|
-
refreshAuthorization: ["kind", "authorizedOperationId", "ownerLaneRefreshDigestB64u"],
|
|
5098
|
-
ownerSource: [
|
|
5099
|
-
"laneId",
|
|
5100
|
-
"laneKind",
|
|
5101
|
-
"sourceKind",
|
|
5102
|
-
"laneShareEpoch",
|
|
5103
|
-
"revocationEpoch",
|
|
5104
|
-
"ownerParticipantContinuity",
|
|
5105
|
-
"participantBindingDigestB64u",
|
|
5106
|
-
"materialActivation"
|
|
5107
|
-
],
|
|
5108
|
-
provisionedSource: [
|
|
5109
|
-
"laneId",
|
|
5110
|
-
"laneKind",
|
|
5111
|
-
"sourceKind",
|
|
5112
|
-
"laneShareEpoch",
|
|
5113
|
-
"revocationEpoch",
|
|
5114
|
-
"holderParticipantId",
|
|
5115
|
-
"signingWorkerParticipantId",
|
|
5116
|
-
"signingWorkerRecipientKeyId",
|
|
5117
|
-
"participantBindingDigestB64u",
|
|
5118
|
-
"materialActivation"
|
|
5119
|
-
],
|
|
5120
|
-
holder: [
|
|
5121
|
-
"participantId",
|
|
5122
|
-
"participantBindingDigestB64u",
|
|
5123
|
-
"custodyBindingId",
|
|
5124
|
-
"custodyBindingDigestB64u",
|
|
5125
|
-
"hpkePublicKeyB64u",
|
|
5126
|
-
"hpkePublicKeyDigestB64u"
|
|
5127
|
-
],
|
|
5128
|
-
worker: [
|
|
5129
|
-
"participantId",
|
|
5130
|
-
"participantBindingDigestB64u",
|
|
5131
|
-
"recipientKeyId",
|
|
5132
|
-
"hpkePublicKeyB64u",
|
|
5133
|
-
"hpkePublicKeyDigestB64u"
|
|
5134
|
-
]
|
|
5135
|
-
};
|
|
5136
|
-
function requiredField(record, field, label) {
|
|
5137
|
-
if (!Object.prototype.hasOwnProperty.call(record, field) || record[field] === undefined) {
|
|
5138
|
-
throw new Error(`${label}.${field} is required`);
|
|
5139
|
-
}
|
|
5140
|
-
return record[field];
|
|
5141
|
-
}
|
|
5142
|
-
function exactRecord(raw, fields, label) {
|
|
5143
|
-
const record = requireRecord(raw, label);
|
|
5144
|
-
rejectUnknownFields(record, fields, label);
|
|
5145
|
-
for (const field of fields)
|
|
5146
|
-
requiredField(record, field, label);
|
|
5147
|
-
return record;
|
|
5148
|
-
}
|
|
5149
|
-
function requiredString(raw, label) {
|
|
5150
|
-
if (typeof raw !== "string")
|
|
5151
|
-
throw new Error(`${label} must be a string`);
|
|
5152
|
-
const value = raw.trim();
|
|
5153
|
-
if (!value)
|
|
5154
|
-
throw new Error(`${label} is required`);
|
|
5155
|
-
if (hasWhitespaceOrControlCharacters(value)) {
|
|
5156
|
-
throw new Error(`${label} must not contain whitespace or control characters`);
|
|
5157
|
-
}
|
|
5158
|
-
return value;
|
|
5159
|
-
}
|
|
5160
|
-
function requiredInteger(raw, label, allowZero = true) {
|
|
5161
|
-
if (!Number.isSafeInteger(raw) || Number(raw) < (allowZero ? 0 : 1)) {
|
|
5162
|
-
throw new Error(`${label} must be a ${allowZero ? "non-negative" : "positive"} safe integer`);
|
|
5163
|
-
}
|
|
5164
|
-
return Number(raw);
|
|
5165
|
-
}
|
|
5166
|
-
function resultValue(result, label) {
|
|
5167
|
-
if (result.ok)
|
|
5168
|
-
return result.value;
|
|
5169
|
-
throw new Error(`${label} ${result.error.message}`);
|
|
5170
|
-
}
|
|
5171
|
-
function digest(raw, label) {
|
|
5172
|
-
try {
|
|
5173
|
-
return parseDigestB64u(raw);
|
|
5174
|
-
} catch (error) {
|
|
5175
|
-
throw new Error(`${label} ${error instanceof Error ? error.message : "is invalid"}`);
|
|
5176
|
-
}
|
|
5177
|
-
}
|
|
5178
|
-
function parseMpcActivation(raw, label) {
|
|
5179
|
-
return resultValue(parseMpcMaterialActivationRef(raw), label);
|
|
5180
|
-
}
|
|
5181
|
-
function nonEmptyTuple(values, label) {
|
|
5182
|
-
if (values.length === 0)
|
|
5183
|
-
throw new Error(`${label} must be non-empty`);
|
|
5184
|
-
const [first, ...rest] = values;
|
|
5185
|
-
return [first, ...rest];
|
|
5186
|
-
}
|
|
5187
|
-
function parseLaneOperationId2(raw, label) {
|
|
5188
|
-
return resultValue(parseLaneOperationId(raw), label);
|
|
5189
|
-
}
|
|
5190
|
-
function parseEnrollmentId(raw, label) {
|
|
5191
|
-
return resultValue(parseLaneEnrollmentId(raw), label);
|
|
5192
|
-
}
|
|
5193
|
-
function parseOperationIdempotencyKey(raw, label) {
|
|
5194
|
-
return resultValue(parseLaneOperationIdempotencyKey(raw), label);
|
|
5195
|
-
}
|
|
5196
|
-
function parseLinkedDeviceEnrollmentIdValue(raw, label) {
|
|
5197
|
-
return resultValue(parseLinkedDeviceEnrollmentId(raw), label);
|
|
5198
|
-
}
|
|
5199
|
-
function parseLaneId(raw, label) {
|
|
5200
|
-
return resultValue(parseSigningLaneId(raw), label);
|
|
5201
|
-
}
|
|
5202
|
-
function parseShareEpoch(raw, label) {
|
|
5203
|
-
return resultValue(parseLaneShareEpoch(raw), label);
|
|
5204
|
-
}
|
|
5205
|
-
function parseKeyId(raw, label) {
|
|
5206
|
-
return resultValue(parseWalletKeyId(raw), label);
|
|
5207
|
-
}
|
|
5208
|
-
function parseLaneKind(raw, label) {
|
|
5209
|
-
switch (raw) {
|
|
5210
|
-
case "owner_passkey":
|
|
5211
|
-
case "owner_email_otp":
|
|
5212
|
-
case "linked_device":
|
|
5213
|
-
case "delegated_execution":
|
|
5214
|
-
case "recovery":
|
|
5215
|
-
case "break_glass":
|
|
5216
|
-
return raw;
|
|
5217
|
-
default:
|
|
5218
|
-
throw new Error(`${label} must be a known signing lane kind`);
|
|
5219
|
-
}
|
|
5220
|
-
}
|
|
5221
|
-
function parseKeyFamily(raw, label) {
|
|
5222
|
-
if (raw === "ed25519" || raw === "ecdsa_secp256k1")
|
|
5223
|
-
return raw;
|
|
5224
|
-
throw new Error(`${label} must be ed25519 or ecdsa_secp256k1`);
|
|
5225
|
-
}
|
|
5226
|
-
function parseAuthorization(raw, label = "authorization") {
|
|
5227
|
-
const record = requireRecord(raw, label);
|
|
5228
|
-
switch (record.kind) {
|
|
5229
|
-
case "linked_device_enrollment": {
|
|
5230
|
-
const value = exactRecord(record, NON_EMPTY_FIELDS.authorization, label);
|
|
5231
|
-
return {
|
|
5232
|
-
kind: "linked_device_enrollment",
|
|
5233
|
-
authorizedOperationId: resultValue(parseAuthorizedOperationId(value.authorizedOperationId), `${label}.authorizedOperationId`),
|
|
5234
|
-
linkedDeviceEnrollmentId: parseLinkedDeviceEnrollmentIdValue(value.linkedDeviceEnrollmentId, `${label}.linkedDeviceEnrollmentId`),
|
|
5235
|
-
linkedDevicePermissionDigestB64u: digest(value.linkedDevicePermissionDigestB64u, `${label}.linkedDevicePermissionDigestB64u`)
|
|
5236
|
-
};
|
|
5237
|
-
}
|
|
5238
|
-
case "owner_lane_refresh": {
|
|
5239
|
-
const value = exactRecord(record, NON_EMPTY_FIELDS.refreshAuthorization, label);
|
|
5240
|
-
return {
|
|
5241
|
-
kind: "owner_lane_refresh",
|
|
5242
|
-
authorizedOperationId: resultValue(parseAuthorizedOperationId(value.authorizedOperationId), `${label}.authorizedOperationId`),
|
|
5243
|
-
ownerLaneRefreshDigestB64u: digest(value.ownerLaneRefreshDigestB64u, `${label}.ownerLaneRefreshDigestB64u`)
|
|
5244
|
-
};
|
|
5245
|
-
}
|
|
5246
|
-
default:
|
|
5247
|
-
throw new Error(`${label}.kind is invalid`);
|
|
5248
|
-
}
|
|
5249
|
-
}
|
|
5250
|
-
function parseSource(raw, label = "source") {
|
|
5251
|
-
const baseRecord = requireRecord(raw, label);
|
|
5252
|
-
const laneKind = parseLaneKind(baseRecord.laneKind, `${label}.laneKind`);
|
|
5253
|
-
if (laneKind === "owner_passkey" || laneKind === "owner_email_otp") {
|
|
5254
|
-
const record2 = exactRecord(baseRecord, NON_EMPTY_FIELDS.ownerSource, label);
|
|
5255
|
-
if (record2.sourceKind !== "owner_registration") {
|
|
5256
|
-
throw new Error(`${label}.sourceKind must be owner_registration`);
|
|
5257
|
-
}
|
|
5258
|
-
return {
|
|
5259
|
-
sourceKind: "owner_registration",
|
|
5260
|
-
laneId: parseLaneId(record2.laneId, `${label}.laneId`),
|
|
5261
|
-
laneKind,
|
|
5262
|
-
laneShareEpoch: parseShareEpoch(record2.laneShareEpoch, `${label}.laneShareEpoch`),
|
|
5263
|
-
revocationEpoch: requiredInteger(record2.revocationEpoch, `${label}.revocationEpoch`),
|
|
5264
|
-
ownerParticipantContinuity: parseOwnerLaneParticipantContinuityV1(record2.ownerParticipantContinuity, `${label}.ownerParticipantContinuity`),
|
|
5265
|
-
participantBindingDigestB64u: resultValue(parseLaneParticipantBindingDigestB64u(record2.participantBindingDigestB64u), `${label}.participantBindingDigestB64u`),
|
|
5266
|
-
materialActivation: parseMpcActivation(record2.materialActivation, `${label}.materialActivation`)
|
|
5267
|
-
};
|
|
5268
|
-
}
|
|
5269
|
-
const record = exactRecord(baseRecord, NON_EMPTY_FIELDS.provisionedSource, label);
|
|
5270
|
-
if (record.sourceKind !== "provisioned_lane") {
|
|
5271
|
-
throw new Error(`${label}.sourceKind must be provisioned_lane`);
|
|
5272
|
-
}
|
|
5273
|
-
return {
|
|
5274
|
-
sourceKind: "provisioned_lane",
|
|
5275
|
-
laneId: parseLaneId(record.laneId, `${label}.laneId`),
|
|
5276
|
-
laneKind,
|
|
5277
|
-
laneShareEpoch: parseShareEpoch(record.laneShareEpoch, `${label}.laneShareEpoch`),
|
|
5278
|
-
revocationEpoch: requiredInteger(record.revocationEpoch, `${label}.revocationEpoch`),
|
|
5279
|
-
holderParticipantId: resultValue(parseLaneHolderParticipantId(record.holderParticipantId), `${label}.holderParticipantId`),
|
|
5280
|
-
signingWorkerParticipantId: resultValue(parseSigningWorkerParticipantId(record.signingWorkerParticipantId), `${label}.signingWorkerParticipantId`),
|
|
5281
|
-
signingWorkerRecipientKeyId: resultValue(parseSigningWorkerRecipientKeyId(record.signingWorkerRecipientKeyId), `${label}.signingWorkerRecipientKeyId`),
|
|
5282
|
-
participantBindingDigestB64u: resultValue(parseLaneParticipantBindingDigestB64u(record.participantBindingDigestB64u), `${label}.participantBindingDigestB64u`),
|
|
5283
|
-
materialActivation: parseMpcActivation(record.materialActivation, `${label}.materialActivation`)
|
|
5284
|
-
};
|
|
5285
|
-
}
|
|
5286
|
-
function parseTargetHolder(raw, label = "targetHolder") {
|
|
5287
|
-
const record = exactRecord(raw, NON_EMPTY_FIELDS.holder, label);
|
|
5288
|
-
return {
|
|
5289
|
-
participantId: resultValue(parseLaneHolderParticipantId(record.participantId), `${label}.participantId`),
|
|
5290
|
-
participantBindingDigestB64u: resultValue(parseLaneParticipantBindingDigestB64u(record.participantBindingDigestB64u), `${label}.participantBindingDigestB64u`),
|
|
5291
|
-
custodyBindingId: resultValue(parseLaneHolderCustodyBindingId(record.custodyBindingId), `${label}.custodyBindingId`),
|
|
5292
|
-
custodyBindingDigestB64u: resultValue(parseLaneCustodyBindingDigestB64u(record.custodyBindingDigestB64u), `${label}.custodyBindingDigestB64u`),
|
|
5293
|
-
hpkePublicKeyB64u: resultValue(parseHpkePublicKeyB64u(record.hpkePublicKeyB64u), `${label}.hpkePublicKeyB64u`),
|
|
5294
|
-
hpkePublicKeyDigestB64u: resultValue(parseSigningWorkerRecipientKeyDigestB64u(record.hpkePublicKeyDigestB64u), `${label}.hpkePublicKeyDigestB64u`)
|
|
5295
|
-
};
|
|
5296
|
-
}
|
|
5297
|
-
function parseTargetSigningWorker(raw, label = "targetSigningWorker") {
|
|
5298
|
-
const record = exactRecord(raw, NON_EMPTY_FIELDS.worker, label);
|
|
5299
|
-
return {
|
|
5300
|
-
participantId: resultValue(parseSigningWorkerParticipantId(record.participantId), `${label}.participantId`),
|
|
5301
|
-
participantBindingDigestB64u: resultValue(parseLaneParticipantBindingDigestB64u(record.participantBindingDigestB64u), `${label}.participantBindingDigestB64u`),
|
|
5302
|
-
recipientKeyId: resultValue(parseSigningWorkerRecipientKeyId(record.recipientKeyId), `${label}.recipientKeyId`),
|
|
5303
|
-
hpkePublicKeyB64u: resultValue(parseHpkePublicKeyB64u(record.hpkePublicKeyB64u), `${label}.hpkePublicKeyB64u`),
|
|
5304
|
-
hpkePublicKeyDigestB64u: resultValue(parseSigningWorkerRecipientKeyDigestB64u(record.hpkePublicKeyDigestB64u), `${label}.hpkePublicKeyDigestB64u`)
|
|
5305
|
-
};
|
|
5306
|
-
}
|
|
5307
|
-
function buildLaneCreationTargetV1(args) {
|
|
5308
|
-
return {
|
|
5309
|
-
operation: "create_lane",
|
|
5310
|
-
laneId: args.laneId,
|
|
5311
|
-
laneKind: "linked_device",
|
|
5312
|
-
laneShareEpoch: args.laneShareEpoch,
|
|
5313
|
-
expectedTargetState: "absent"
|
|
5314
|
-
};
|
|
5315
|
-
}
|
|
5316
|
-
function buildLaneRefreshTargetV1(args) {
|
|
5317
|
-
return {
|
|
5318
|
-
operation: "refresh_lane",
|
|
5319
|
-
laneId: args.laneId,
|
|
5320
|
-
laneKind: args.laneKind,
|
|
5321
|
-
laneShareEpoch: args.laneShareEpoch,
|
|
5322
|
-
expectedTargetState: "active_previous_epoch",
|
|
5323
|
-
priorMaterialActivation: args.priorMaterialActivation
|
|
5324
|
-
};
|
|
5325
|
-
}
|
|
5326
|
-
function parseTarget(raw, source, label = "target") {
|
|
5327
|
-
const record = requireRecord(raw, label);
|
|
5328
|
-
if (record.operation === "create_lane") {
|
|
5329
|
-
const value = exactRecord(record, ["operation", "laneId", "laneKind", "laneShareEpoch", "expectedTargetState"], label);
|
|
5330
|
-
if (value.laneKind !== "linked_device" || value.expectedTargetState !== "absent") {
|
|
5331
|
-
throw new Error(`${label} create branch has invalid target state`);
|
|
5332
|
-
}
|
|
5333
|
-
const target = buildLaneCreationTargetV1({
|
|
5334
|
-
laneId: parseLaneId(value.laneId, `${label}.laneId`),
|
|
5335
|
-
laneShareEpoch: parseShareEpoch(value.laneShareEpoch, `${label}.laneShareEpoch`)
|
|
5336
|
-
});
|
|
5337
|
-
if (source.laneKind === "linked_device" || source.laneKind === "delegated_execution") {
|
|
5338
|
-
throw new Error(`${label} creation requires an owner-controlled source lane`);
|
|
5339
|
-
}
|
|
5340
|
-
if (String(target.laneId) === String(source.laneId)) {
|
|
5341
|
-
throw new Error(`${label}.laneId must differ from source.laneId for creation`);
|
|
5342
|
-
}
|
|
5343
|
-
return target;
|
|
5344
|
-
}
|
|
5345
|
-
if (record.operation === "refresh_lane") {
|
|
5346
|
-
const value = exactRecord(record, [
|
|
5347
|
-
"operation",
|
|
5348
|
-
"laneId",
|
|
5349
|
-
"laneKind",
|
|
5350
|
-
"laneShareEpoch",
|
|
5351
|
-
"expectedTargetState",
|
|
5352
|
-
"priorMaterialActivation"
|
|
5353
|
-
], label);
|
|
5354
|
-
if (value.expectedTargetState !== "active_previous_epoch") {
|
|
5355
|
-
throw new Error(`${label} refresh branch has invalid target state`);
|
|
5356
|
-
}
|
|
5357
|
-
const laneId = parseLaneId(value.laneId, `${label}.laneId`);
|
|
5358
|
-
if (String(laneId) !== String(source.laneId)) {
|
|
5359
|
-
throw new Error(`${label}.laneId must match source.laneId for refresh`);
|
|
5360
|
-
}
|
|
5361
|
-
const laneShareEpoch = parseShareEpoch(value.laneShareEpoch, `${label}.laneShareEpoch`);
|
|
5362
|
-
if (String(laneShareEpoch) === String(source.laneShareEpoch)) {
|
|
5363
|
-
throw new Error(`${label}.laneShareEpoch must advance source.laneShareEpoch`);
|
|
5364
|
-
}
|
|
5365
|
-
const laneKind = parseLaneKind(value.laneKind, `${label}.laneKind`);
|
|
5366
|
-
if (laneKind !== source.laneKind) {
|
|
5367
|
-
throw new Error(`${label}.laneKind must match source.laneKind for refresh`);
|
|
5368
|
-
}
|
|
5369
|
-
if (laneKind !== "delegated_execution") {
|
|
5370
|
-
return buildLaneRefreshTargetV1({
|
|
5371
|
-
laneId,
|
|
5372
|
-
laneKind,
|
|
5373
|
-
laneShareEpoch,
|
|
5374
|
-
priorMaterialActivation: parseMpcActivation(value.priorMaterialActivation, `${label}.priorMaterialActivation`)
|
|
5375
|
-
});
|
|
5376
|
-
}
|
|
5377
|
-
}
|
|
5378
|
-
throw new Error(`${label}.operation is invalid`);
|
|
5379
|
-
}
|
|
5380
|
-
function parseOperation(raw, source, label = "operation") {
|
|
5381
|
-
const record = exactRecord(raw, ["target", "authorization"], label);
|
|
5382
|
-
const target = parseTarget(record.target, source, `${label}.target`);
|
|
5383
|
-
const authorization = parseAuthorization(record.authorization, `${label}.authorization`);
|
|
5384
|
-
if (target.operation === "create_lane") {
|
|
5385
|
-
if (authorization.kind !== "linked_device_enrollment") {
|
|
5386
|
-
throw new Error(`${label}.authorization must be linked-device enrollment for creation`);
|
|
5387
|
-
}
|
|
5388
|
-
return { target, authorization };
|
|
5389
|
-
}
|
|
5390
|
-
if (authorization.kind !== "owner_lane_refresh") {
|
|
5391
|
-
throw new Error(`${label}.authorization must be owner refresh for refresh`);
|
|
5392
|
-
}
|
|
5393
|
-
return { target, authorization };
|
|
5394
|
-
}
|
|
5395
|
-
function isParsedCreationOperation(value) {
|
|
5396
|
-
return value.target.operation === "create_lane";
|
|
5397
|
-
}
|
|
5398
|
-
function parseCommonJob(record, label) {
|
|
5399
|
-
const value = exactRecord({
|
|
5400
|
-
operationId: record.operationId,
|
|
5401
|
-
enrollmentId: record.enrollmentId,
|
|
5402
|
-
idempotencyKey: record.idempotencyKey,
|
|
5403
|
-
walletId: record.walletId,
|
|
5404
|
-
walletKeyId: record.walletKeyId,
|
|
5405
|
-
source: record.source,
|
|
5406
|
-
targetHolder: record.targetHolder,
|
|
5407
|
-
targetSigningWorker: record.targetSigningWorker,
|
|
5408
|
-
targetMaterialActivationId: record.targetMaterialActivationId,
|
|
5409
|
-
protocolVersion: record.protocolVersion,
|
|
5410
|
-
expiresAtMs: record.expiresAtMs
|
|
5411
|
-
}, [
|
|
5412
|
-
"operationId",
|
|
5413
|
-
"enrollmentId",
|
|
5414
|
-
"idempotencyKey",
|
|
5415
|
-
"walletId",
|
|
5416
|
-
"walletKeyId",
|
|
5417
|
-
"source",
|
|
5418
|
-
"targetHolder",
|
|
5419
|
-
"targetSigningWorker",
|
|
5420
|
-
"targetMaterialActivationId",
|
|
5421
|
-
"protocolVersion",
|
|
5422
|
-
"expiresAtMs"
|
|
5423
|
-
], label);
|
|
5424
|
-
const source = parseSource(value.source, `${label}.source`);
|
|
5425
|
-
const targetHolder = parseTargetHolder(value.targetHolder, `${label}.targetHolder`);
|
|
5426
|
-
const targetSigningWorker = parseTargetSigningWorker(value.targetSigningWorker, `${label}.targetSigningWorker`);
|
|
5427
|
-
const targetMaterialActivationId = resultValue(parseMpcMaterialActivationId(value.targetMaterialActivationId), `${label}.targetMaterialActivationId`);
|
|
5428
|
-
if (String(targetMaterialActivationId) === String(source.materialActivation.activationId)) {
|
|
5429
|
-
throw new Error(`${label}.targetMaterialActivationId must be fresh`);
|
|
5430
|
-
}
|
|
5431
|
-
if (value.protocolVersion !== "rotatable_signing_lane_protocol_v1") {
|
|
5432
|
-
throw new Error(`${label}.protocolVersion is invalid`);
|
|
5433
|
-
}
|
|
5434
|
-
return {
|
|
5435
|
-
operationId: parseLaneOperationId2(value.operationId, `${label}.operationId`),
|
|
5436
|
-
enrollmentId: parseEnrollmentId(value.enrollmentId, `${label}.enrollmentId`),
|
|
5437
|
-
idempotencyKey: parseOperationIdempotencyKey(value.idempotencyKey, `${label}.idempotencyKey`),
|
|
5438
|
-
walletId: resultValue(parseWalletId(value.walletId), `${label}.walletId`),
|
|
5439
|
-
walletKeyId: parseKeyId(value.walletKeyId, `${label}.walletKeyId`),
|
|
5440
|
-
source,
|
|
5441
|
-
targetHolder,
|
|
5442
|
-
targetSigningWorker,
|
|
5443
|
-
targetMaterialActivationId,
|
|
5444
|
-
protocolVersion: "rotatable_signing_lane_protocol_v1",
|
|
5445
|
-
expiresAtMs: requiredInteger(value.expiresAtMs, `${label}.expiresAtMs`)
|
|
5446
|
-
};
|
|
5447
|
-
}
|
|
5448
|
-
function parseEcdsaSourceCapability(raw, label) {
|
|
5449
|
-
const record = exactRecord(raw, ["manifestId", "manifestRevision", "serverGeneration", "ecdsaThresholdKeyId", "relayerKeyId"], label);
|
|
5450
|
-
return {
|
|
5451
|
-
manifestId: parseEcdsaCapabilityManifestId(record.manifestId),
|
|
5452
|
-
manifestRevision: parseEcdsaCapabilityManifestRevision(record.manifestRevision),
|
|
5453
|
-
serverGeneration: parseEcdsaServerGeneration(record.serverGeneration),
|
|
5454
|
-
ecdsaThresholdKeyId: parseSdkEcdsaDerivationThresholdKeyId(record.ecdsaThresholdKeyId),
|
|
5455
|
-
relayerKeyId: resultValue(parseEcdsaRelayerKeyId(record.relayerKeyId), `${label}.relayerKeyId`)
|
|
5456
|
-
};
|
|
5457
|
-
}
|
|
5458
|
-
function parseChainTarget(raw, label) {
|
|
5459
|
-
const record = requireRecord(raw, label);
|
|
5460
|
-
if (record.kind === "evm") {
|
|
5461
|
-
const value = exactRecord(record, ["kind", "namespace", "chainId", "networkSlug"], label);
|
|
5462
|
-
if (value.namespace !== "eip155")
|
|
5463
|
-
throw new Error(`${label}.namespace is invalid`);
|
|
5464
|
-
return {
|
|
5465
|
-
kind: "evm",
|
|
5466
|
-
namespace: "eip155",
|
|
5467
|
-
chainId: requiredInteger(value.chainId, `${label}.chainId`),
|
|
5468
|
-
networkSlug: requiredString(value.networkSlug, `${label}.networkSlug`)
|
|
5469
|
-
};
|
|
5470
|
-
}
|
|
5471
|
-
if (record.kind === "tempo") {
|
|
5472
|
-
const value = exactRecord(record, ["kind", "chainId", "networkSlug"], label);
|
|
5473
|
-
return {
|
|
5474
|
-
kind: "tempo",
|
|
5475
|
-
chainId: requiredInteger(value.chainId, `${label}.chainId`),
|
|
5476
|
-
networkSlug: requiredString(value.networkSlug, `${label}.networkSlug`)
|
|
5477
|
-
};
|
|
5478
|
-
}
|
|
5479
|
-
throw new Error(`${label}.kind is invalid`);
|
|
5480
|
-
}
|
|
5481
|
-
function parseEcdsaTargetCapabilityBindingV1(raw, label) {
|
|
5482
|
-
const record = exactRecord(raw, ["manifestId", "manifestRevision", "ecdsaThresholdKeyId", "orderedThresholdSessions"], label);
|
|
5483
|
-
const sessionsRaw = requiredArray(record.orderedThresholdSessions, `${label}.orderedThresholdSessions`);
|
|
5484
|
-
if (sessionsRaw.length === 0)
|
|
5485
|
-
throw new Error(`${label}.orderedThresholdSessions must be non-empty`);
|
|
5486
|
-
const orderedThresholdSessions = sessionsRaw.map((item, index) => {
|
|
5487
|
-
const session = exactRecord(item, ["chainTarget", "thresholdSessionId", "participantBindingDigestB64u"], `${label}.orderedThresholdSessions[${index}]`);
|
|
5488
|
-
return {
|
|
5489
|
-
chainTarget: parseChainTarget(session.chainTarget, `${label}.orderedThresholdSessions[${index}].chainTarget`),
|
|
5490
|
-
thresholdSessionId: resultValue(parseThresholdEcdsaSessionId(session.thresholdSessionId), `${label}.orderedThresholdSessions[${index}].thresholdSessionId`),
|
|
5491
|
-
participantBindingDigestB64u: digest(session.participantBindingDigestB64u, `${label}.orderedThresholdSessions[${index}].participantBindingDigestB64u`)
|
|
5492
|
-
};
|
|
5493
|
-
});
|
|
5494
|
-
return {
|
|
5495
|
-
manifestId: parseEcdsaCapabilityManifestId(record.manifestId),
|
|
5496
|
-
manifestRevision: parseEcdsaCapabilityManifestRevision(record.manifestRevision),
|
|
5497
|
-
ecdsaThresholdKeyId: parseSdkEcdsaDerivationThresholdKeyId(record.ecdsaThresholdKeyId),
|
|
5498
|
-
orderedThresholdSessions: nonEmptyTuple(orderedThresholdSessions, `${label}.orderedThresholdSessions`)
|
|
5499
|
-
};
|
|
5500
|
-
}
|
|
5501
|
-
function buildEdCreationJob(common, operation, curve) {
|
|
5502
|
-
return {
|
|
5503
|
-
operationId: common.operationId,
|
|
5504
|
-
enrollmentId: common.enrollmentId,
|
|
5505
|
-
idempotencyKey: common.idempotencyKey,
|
|
5506
|
-
walletId: common.walletId,
|
|
5507
|
-
walletKeyId: common.walletKeyId,
|
|
5508
|
-
source: common.source,
|
|
5509
|
-
targetHolder: common.targetHolder,
|
|
5510
|
-
targetSigningWorker: common.targetSigningWorker,
|
|
5511
|
-
targetMaterialActivationId: common.targetMaterialActivationId,
|
|
5512
|
-
protocolVersion: common.protocolVersion,
|
|
5513
|
-
expiresAtMs: common.expiresAtMs,
|
|
5514
|
-
target: operation.target,
|
|
5515
|
-
authorization: operation.authorization,
|
|
5516
|
-
yaoRequestKind: "lane_provisioning",
|
|
5517
|
-
kind: curve.kind,
|
|
5518
|
-
keyFamily: curve.keyFamily,
|
|
5519
|
-
registeredPublicKeyB64u: curve.registeredPublicKeyB64u,
|
|
5520
|
-
nearEd25519SigningKeyId: curve.nearEd25519SigningKeyId,
|
|
5521
|
-
keyCreationSignerSlot: curve.keyCreationSignerSlot,
|
|
5522
|
-
stableContextBindingB64u: curve.stableContextBindingB64u,
|
|
5523
|
-
yaoSuiteId: curve.yaoSuiteId,
|
|
5524
|
-
circuitDigestB64u: curve.circuitDigestB64u
|
|
5525
|
-
};
|
|
5526
|
-
}
|
|
5527
|
-
function buildEdRefreshJob(common, operation, curve) {
|
|
5528
|
-
return {
|
|
5529
|
-
operationId: common.operationId,
|
|
5530
|
-
enrollmentId: common.enrollmentId,
|
|
5531
|
-
idempotencyKey: common.idempotencyKey,
|
|
5532
|
-
walletId: common.walletId,
|
|
5533
|
-
walletKeyId: common.walletKeyId,
|
|
5534
|
-
source: common.source,
|
|
5535
|
-
targetHolder: common.targetHolder,
|
|
5536
|
-
targetSigningWorker: common.targetSigningWorker,
|
|
5537
|
-
targetMaterialActivationId: common.targetMaterialActivationId,
|
|
5538
|
-
protocolVersion: common.protocolVersion,
|
|
5539
|
-
expiresAtMs: common.expiresAtMs,
|
|
5540
|
-
target: operation.target,
|
|
5541
|
-
authorization: operation.authorization,
|
|
5542
|
-
yaoRequestKind: "lane_refresh",
|
|
5543
|
-
kind: curve.kind,
|
|
5544
|
-
keyFamily: curve.keyFamily,
|
|
5545
|
-
registeredPublicKeyB64u: curve.registeredPublicKeyB64u,
|
|
5546
|
-
nearEd25519SigningKeyId: curve.nearEd25519SigningKeyId,
|
|
5547
|
-
keyCreationSignerSlot: curve.keyCreationSignerSlot,
|
|
5548
|
-
stableContextBindingB64u: curve.stableContextBindingB64u,
|
|
5549
|
-
yaoSuiteId: curve.yaoSuiteId,
|
|
5550
|
-
circuitDigestB64u: curve.circuitDigestB64u
|
|
5551
|
-
};
|
|
5552
|
-
}
|
|
5553
|
-
function buildEcdsaCreationJob(common, operation, curve) {
|
|
5554
|
-
return {
|
|
5555
|
-
operationId: common.operationId,
|
|
5556
|
-
enrollmentId: common.enrollmentId,
|
|
5557
|
-
idempotencyKey: common.idempotencyKey,
|
|
5558
|
-
walletId: common.walletId,
|
|
5559
|
-
walletKeyId: common.walletKeyId,
|
|
5560
|
-
source: common.source,
|
|
5561
|
-
targetHolder: common.targetHolder,
|
|
5562
|
-
targetSigningWorker: common.targetSigningWorker,
|
|
5563
|
-
targetMaterialActivationId: common.targetMaterialActivationId,
|
|
5564
|
-
protocolVersion: common.protocolVersion,
|
|
5565
|
-
expiresAtMs: common.expiresAtMs,
|
|
5566
|
-
target: operation.target,
|
|
5567
|
-
authorization: operation.authorization,
|
|
5568
|
-
kind: curve.kind,
|
|
5569
|
-
keyFamily: curve.keyFamily,
|
|
5570
|
-
evmFamilySigningKeySlotId: curve.evmFamilySigningKeySlotId,
|
|
5571
|
-
thresholdPublicKey33B64u: curve.thresholdPublicKey33B64u,
|
|
5572
|
-
evmAddress: curve.evmAddress,
|
|
5573
|
-
sourceCapability: curve.sourceCapability,
|
|
5574
|
-
targetCapability: curve.targetCapability,
|
|
5575
|
-
sourceHolderVerifyingShare33B64u: curve.sourceHolderVerifyingShare33B64u,
|
|
5576
|
-
sourceServerVerifyingShare33B64u: curve.sourceServerVerifyingShare33B64u,
|
|
5577
|
-
reshareChannelBindingDigestB64u: curve.reshareChannelBindingDigestB64u,
|
|
5578
|
-
transcriptEncoding: curve.transcriptEncoding
|
|
5579
|
-
};
|
|
5580
|
-
}
|
|
5581
|
-
function buildEcdsaRefreshJob(common, operation, curve) {
|
|
5582
|
-
return {
|
|
5583
|
-
operationId: common.operationId,
|
|
5584
|
-
enrollmentId: common.enrollmentId,
|
|
5585
|
-
idempotencyKey: common.idempotencyKey,
|
|
5586
|
-
walletId: common.walletId,
|
|
5587
|
-
walletKeyId: common.walletKeyId,
|
|
5588
|
-
source: common.source,
|
|
5589
|
-
targetHolder: common.targetHolder,
|
|
5590
|
-
targetSigningWorker: common.targetSigningWorker,
|
|
5591
|
-
targetMaterialActivationId: common.targetMaterialActivationId,
|
|
5592
|
-
protocolVersion: common.protocolVersion,
|
|
5593
|
-
expiresAtMs: common.expiresAtMs,
|
|
5594
|
-
target: operation.target,
|
|
5595
|
-
authorization: operation.authorization,
|
|
5596
|
-
kind: curve.kind,
|
|
5597
|
-
keyFamily: curve.keyFamily,
|
|
5598
|
-
evmFamilySigningKeySlotId: curve.evmFamilySigningKeySlotId,
|
|
5599
|
-
thresholdPublicKey33B64u: curve.thresholdPublicKey33B64u,
|
|
5600
|
-
evmAddress: curve.evmAddress,
|
|
5601
|
-
sourceCapability: curve.sourceCapability,
|
|
5602
|
-
targetCapability: curve.targetCapability,
|
|
5603
|
-
sourceHolderVerifyingShare33B64u: curve.sourceHolderVerifyingShare33B64u,
|
|
5604
|
-
sourceServerVerifyingShare33B64u: curve.sourceServerVerifyingShare33B64u,
|
|
5605
|
-
reshareChannelBindingDigestB64u: curve.reshareChannelBindingDigestB64u,
|
|
5606
|
-
transcriptEncoding: curve.transcriptEncoding
|
|
5607
|
-
};
|
|
5608
|
-
}
|
|
5609
|
-
function parseEcdsaJob(record, label) {
|
|
5610
|
-
const value = exactRecord(record, [
|
|
5611
|
-
"kind",
|
|
5612
|
-
"keyFamily",
|
|
5613
|
-
"operationId",
|
|
5614
|
-
"enrollmentId",
|
|
5615
|
-
"idempotencyKey",
|
|
5616
|
-
"walletId",
|
|
5617
|
-
"walletKeyId",
|
|
5618
|
-
"source",
|
|
5619
|
-
"targetHolder",
|
|
5620
|
-
"targetSigningWorker",
|
|
5621
|
-
"targetMaterialActivationId",
|
|
5622
|
-
"protocolVersion",
|
|
5623
|
-
"expiresAtMs",
|
|
5624
|
-
"target",
|
|
5625
|
-
"authorization",
|
|
5626
|
-
"evmFamilySigningKeySlotId",
|
|
5627
|
-
"thresholdPublicKey33B64u",
|
|
5628
|
-
"evmAddress",
|
|
5629
|
-
"sourceCapability",
|
|
5630
|
-
"targetCapability",
|
|
5631
|
-
"sourceHolderVerifyingShare33B64u",
|
|
5632
|
-
"sourceServerVerifyingShare33B64u",
|
|
5633
|
-
"reshareChannelBindingDigestB64u",
|
|
5634
|
-
"transcriptEncoding"
|
|
5635
|
-
], label);
|
|
5636
|
-
if (value.kind !== "ecdsa_additive_lane_job_v1" || value.keyFamily !== "ecdsa_secp256k1") {
|
|
5637
|
-
throw new Error(`${label} kind/keyFamily is invalid`);
|
|
5638
|
-
}
|
|
5639
|
-
if (value.transcriptEncoding !== "ecdsa_additive_lane_transcript_v1") {
|
|
5640
|
-
throw new Error(`${label}.transcriptEncoding is invalid`);
|
|
5641
|
-
}
|
|
5642
|
-
const common = parseCommonJob(value, label);
|
|
5643
|
-
const operationFromValue = parseOperation({ target: value.target, authorization: value.authorization }, common.source, `${label}.operation`);
|
|
5644
|
-
const curve = {
|
|
5645
|
-
kind: "ecdsa_additive_lane_job_v1",
|
|
5646
|
-
keyFamily: "ecdsa_secp256k1",
|
|
5647
|
-
evmFamilySigningKeySlotId: (() => {
|
|
5648
|
-
const parsed = parseEvmFamilySigningKeySlotId(value.evmFamilySigningKeySlotId);
|
|
5649
|
-
if (parsed.ok)
|
|
5650
|
-
return parsed.value;
|
|
5651
|
-
throw new Error(`${label}.evmFamilySigningKeySlotId is invalid`);
|
|
5652
|
-
})(),
|
|
5653
|
-
thresholdPublicKey33B64u: parseSecp256k1CompressedPublicKeyB64u(value.thresholdPublicKey33B64u),
|
|
5654
|
-
evmAddress: requiredString(value.evmAddress, `${label}.evmAddress`),
|
|
5655
|
-
sourceCapability: parseEcdsaSourceCapability(value.sourceCapability, `${label}.sourceCapability`),
|
|
5656
|
-
targetCapability: parseEcdsaTargetCapabilityBindingV1(value.targetCapability, `${label}.targetCapability`),
|
|
5657
|
-
sourceHolderVerifyingShare33B64u: parseSecp256k1CompressedPublicKeyB64u(value.sourceHolderVerifyingShare33B64u, `${label}.sourceHolderVerifyingShare33B64u`),
|
|
5658
|
-
sourceServerVerifyingShare33B64u: parseSecp256k1CompressedPublicKeyB64u(value.sourceServerVerifyingShare33B64u, `${label}.sourceServerVerifyingShare33B64u`),
|
|
5659
|
-
reshareChannelBindingDigestB64u: digest(value.reshareChannelBindingDigestB64u, `${label}.reshareChannelBindingDigestB64u`),
|
|
5660
|
-
transcriptEncoding: "ecdsa_additive_lane_transcript_v1"
|
|
5661
|
-
};
|
|
5662
|
-
if (isParsedCreationOperation(operationFromValue)) {
|
|
5663
|
-
return buildEcdsaCreationJob(common, operationFromValue, curve);
|
|
5664
|
-
}
|
|
5665
|
-
return buildEcdsaRefreshJob(common, operationFromValue, curve);
|
|
5666
|
-
}
|
|
5667
|
-
function parseEdJob(record, label) {
|
|
5668
|
-
const value = exactRecord(record, [
|
|
5669
|
-
"kind",
|
|
5670
|
-
"keyFamily",
|
|
5671
|
-
"operationId",
|
|
5672
|
-
"enrollmentId",
|
|
5673
|
-
"idempotencyKey",
|
|
5674
|
-
"walletId",
|
|
5675
|
-
"walletKeyId",
|
|
5676
|
-
"source",
|
|
5677
|
-
"targetHolder",
|
|
5678
|
-
"targetSigningWorker",
|
|
5679
|
-
"targetMaterialActivationId",
|
|
5680
|
-
"protocolVersion",
|
|
5681
|
-
"expiresAtMs",
|
|
5682
|
-
"target",
|
|
5683
|
-
"authorization",
|
|
5684
|
-
"yaoRequestKind",
|
|
5685
|
-
"registeredPublicKeyB64u",
|
|
5686
|
-
"nearEd25519SigningKeyId",
|
|
5687
|
-
"keyCreationSignerSlot",
|
|
5688
|
-
"stableContextBindingB64u",
|
|
5689
|
-
"yaoSuiteId",
|
|
5690
|
-
"circuitDigestB64u"
|
|
5691
|
-
], label);
|
|
5692
|
-
if (value.kind !== "ed25519_yao_lane_job_v1" || value.keyFamily !== "ed25519") {
|
|
5693
|
-
throw new Error(`${label} kind/keyFamily is invalid`);
|
|
5694
|
-
}
|
|
5695
|
-
const common = parseCommonJob(value, label);
|
|
5696
|
-
const operation = parseOperation({ target: value.target, authorization: value.authorization }, common.source, `${label}.operation`);
|
|
5697
|
-
const yaoRequestKind = requiredString(value.yaoRequestKind, `${label}.yaoRequestKind`);
|
|
5698
|
-
const curve = {
|
|
5699
|
-
kind: "ed25519_yao_lane_job_v1",
|
|
5700
|
-
keyFamily: "ed25519",
|
|
5701
|
-
registeredPublicKeyB64u: parseEd25519PublicKeyB64u(value.registeredPublicKeyB64u),
|
|
5702
|
-
nearEd25519SigningKeyId: parseNearEd25519SigningKeyId(value.nearEd25519SigningKeyId),
|
|
5703
|
-
keyCreationSignerSlot: parseKeyCreationSignerSlot(value.keyCreationSignerSlot),
|
|
5704
|
-
stableContextBindingB64u: digest(value.stableContextBindingB64u, `${label}.stableContextBindingB64u`),
|
|
5705
|
-
yaoSuiteId: resultValue(parseEd25519YaoSuiteId(value.yaoSuiteId), `${label}.yaoSuiteId`),
|
|
5706
|
-
circuitDigestB64u: digest(value.circuitDigestB64u, `${label}.circuitDigestB64u`)
|
|
5707
|
-
};
|
|
5708
|
-
if (isParsedCreationOperation(operation)) {
|
|
5709
|
-
if (yaoRequestKind !== "lane_provisioning")
|
|
5710
|
-
throw new Error(`${label}.yaoRequestKind must be lane_provisioning for creation`);
|
|
5711
|
-
return buildEdCreationJob(common, operation, curve);
|
|
5712
|
-
}
|
|
5713
|
-
if (yaoRequestKind !== "lane_refresh")
|
|
5714
|
-
throw new Error(`${label}.yaoRequestKind must be lane_refresh for refresh`);
|
|
5715
|
-
return buildEdRefreshJob(common, operation, curve);
|
|
5716
|
-
}
|
|
5717
|
-
function parseRotatableSigningLaneJobV1(raw, label = "laneProtocolJob") {
|
|
5718
|
-
const record = requireRecord(raw, label);
|
|
5719
|
-
if (record.kind === "ed25519_yao_lane_job_v1")
|
|
5720
|
-
return parseEdJob(record, label);
|
|
5721
|
-
if (record.kind === "ecdsa_additive_lane_job_v1")
|
|
5722
|
-
return parseEcdsaJob(record, label);
|
|
5723
|
-
throw new Error(`${label}.kind is invalid`);
|
|
5724
|
-
}
|
|
5725
|
-
function parseLaneHolderPackageWireV1(raw, label = "laneHolderPackage") {
|
|
5726
|
-
const record = requireRecord(raw, label);
|
|
5727
|
-
switch (record.kind) {
|
|
5728
|
-
case "ed25519_yao_lane_holder_package_set_v1": {
|
|
5729
|
-
const value = exactRecord(record, ["kind", "deriverAEncryptedPackageJson", "deriverBEncryptedPackageJson"], label);
|
|
5730
|
-
return {
|
|
5731
|
-
kind: "ed25519_yao_lane_holder_package_set_v1",
|
|
5732
|
-
deriverAEncryptedPackageJson: opaqueJson(value.deriverAEncryptedPackageJson, `${label}.deriverAEncryptedPackageJson`),
|
|
5733
|
-
deriverBEncryptedPackageJson: opaqueJson(value.deriverBEncryptedPackageJson, `${label}.deriverBEncryptedPackageJson`)
|
|
5734
|
-
};
|
|
5735
|
-
}
|
|
5736
|
-
case "ecdsa_additive_lane_holder_package_v1": {
|
|
5737
|
-
const value = exactRecord(record, ["kind", "ecdsaEncryptedMaterialEnvelopeJson"], label);
|
|
5738
|
-
return {
|
|
5739
|
-
kind: "ecdsa_additive_lane_holder_package_v1",
|
|
5740
|
-
ecdsaEncryptedMaterialEnvelopeJson: opaqueJson(value.ecdsaEncryptedMaterialEnvelopeJson, `${label}.ecdsaEncryptedMaterialEnvelopeJson`)
|
|
5741
|
-
};
|
|
5742
|
-
}
|
|
5743
|
-
default:
|
|
5744
|
-
throw new Error(`${label}.kind is invalid`);
|
|
5745
|
-
}
|
|
5746
|
-
}
|
|
5747
|
-
function parseReceiptCommon(raw, fields, label) {
|
|
5748
|
-
return exactRecord(raw, fields, label);
|
|
5749
|
-
}
|
|
5750
|
-
function parseLaneProtocolCommitReceiptV1(raw, label = "protocolCommitReceipt") {
|
|
5751
|
-
const record = parseReceiptCommon(raw, [
|
|
5752
|
-
"kind",
|
|
5753
|
-
"operationId",
|
|
5754
|
-
"enrollmentId",
|
|
5755
|
-
"walletId",
|
|
5756
|
-
"walletKeyId",
|
|
5757
|
-
"sourceLaneId",
|
|
5758
|
-
"sourceLaneShareEpoch",
|
|
5759
|
-
"sourceRevocationEpoch",
|
|
5760
|
-
"sourceMaterialActivation",
|
|
5761
|
-
"targetLaneId",
|
|
5762
|
-
"targetLaneShareEpoch",
|
|
5763
|
-
"targetMaterialActivationId",
|
|
5764
|
-
"keyFamily",
|
|
5765
|
-
"publicIdentityDigestB64u",
|
|
5766
|
-
"targetHolderPublicCommitmentB64u",
|
|
5767
|
-
"targetServerPublicCommitmentB64u",
|
|
5768
|
-
"targetHolderCiphertextDigestSetB64u",
|
|
5769
|
-
"targetServerCiphertextDigestSetB64u",
|
|
5770
|
-
"holderRecipientKeyDigestB64u",
|
|
5771
|
-
"serverRecipientKeyDigestB64u",
|
|
5772
|
-
"transcriptHashB64u",
|
|
5773
|
-
"committedAtMs"
|
|
5774
|
-
], label);
|
|
5775
|
-
if (record.kind !== "lane_protocol_commit_receipt_v1")
|
|
5776
|
-
throw new Error(`${label}.kind is invalid`);
|
|
5777
|
-
return {
|
|
5778
|
-
kind: "lane_protocol_commit_receipt_v1",
|
|
5779
|
-
operationId: parseLaneOperationId2(record.operationId, `${label}.operationId`),
|
|
5780
|
-
enrollmentId: parseEnrollmentId(record.enrollmentId, `${label}.enrollmentId`),
|
|
5781
|
-
walletId: resultValue(parseWalletId(record.walletId), `${label}.walletId`),
|
|
5782
|
-
walletKeyId: parseKeyId(record.walletKeyId, `${label}.walletKeyId`),
|
|
5783
|
-
sourceLaneId: parseLaneId(record.sourceLaneId, `${label}.sourceLaneId`),
|
|
5784
|
-
sourceLaneShareEpoch: parseShareEpoch(record.sourceLaneShareEpoch, `${label}.sourceLaneShareEpoch`),
|
|
5785
|
-
sourceRevocationEpoch: requiredInteger(record.sourceRevocationEpoch, `${label}.sourceRevocationEpoch`),
|
|
5786
|
-
sourceMaterialActivation: parseMpcActivation(record.sourceMaterialActivation, `${label}.sourceMaterialActivation`),
|
|
5787
|
-
targetLaneId: parseLaneId(record.targetLaneId, `${label}.targetLaneId`),
|
|
5788
|
-
targetLaneShareEpoch: parseShareEpoch(record.targetLaneShareEpoch, `${label}.targetLaneShareEpoch`),
|
|
5789
|
-
targetMaterialActivationId: resultValue(parseMpcMaterialActivationId(record.targetMaterialActivationId), `${label}.targetMaterialActivationId`),
|
|
5790
|
-
keyFamily: parseKeyFamily(record.keyFamily, `${label}.keyFamily`),
|
|
5791
|
-
publicIdentityDigestB64u: digest(record.publicIdentityDigestB64u, `${label}.publicIdentityDigestB64u`),
|
|
5792
|
-
targetHolderPublicCommitmentB64u: requiredString(record.targetHolderPublicCommitmentB64u, `${label}.targetHolderPublicCommitmentB64u`),
|
|
5793
|
-
targetServerPublicCommitmentB64u: requiredString(record.targetServerPublicCommitmentB64u, `${label}.targetServerPublicCommitmentB64u`),
|
|
5794
|
-
targetHolderCiphertextDigestSetB64u: digest(record.targetHolderCiphertextDigestSetB64u, `${label}.targetHolderCiphertextDigestSetB64u`),
|
|
5795
|
-
targetServerCiphertextDigestSetB64u: digest(record.targetServerCiphertextDigestSetB64u, `${label}.targetServerCiphertextDigestSetB64u`),
|
|
5796
|
-
holderRecipientKeyDigestB64u: digest(record.holderRecipientKeyDigestB64u, `${label}.holderRecipientKeyDigestB64u`),
|
|
5797
|
-
serverRecipientKeyDigestB64u: digest(record.serverRecipientKeyDigestB64u, `${label}.serverRecipientKeyDigestB64u`),
|
|
5798
|
-
transcriptHashB64u: digest(record.transcriptHashB64u, `${label}.transcriptHashB64u`),
|
|
5799
|
-
committedAtMs: requiredInteger(record.committedAtMs, `${label}.committedAtMs`)
|
|
5800
|
-
};
|
|
5801
|
-
}
|
|
5802
|
-
function requiredArray(raw, label) {
|
|
5803
|
-
if (!Array.isArray(raw))
|
|
5804
|
-
throw new Error(`${label} must be an array`);
|
|
5805
|
-
return raw;
|
|
5806
|
-
}
|
|
5807
|
-
|
|
5808
4776
|
// ../shared-ts/src/signing-lanes/rotation.ts
|
|
5809
4777
|
function isProvisionedLaneProtocolSourceV1(source) {
|
|
5810
4778
|
return source.sourceKind === "provisioned_lane";
|
|
@@ -5855,7 +4823,7 @@ function text(value, label) {
|
|
|
5855
4823
|
throw new Error(`${label} must be a string`);
|
|
5856
4824
|
return lp32(TEXT_ENCODER.encode(value), label);
|
|
5857
4825
|
}
|
|
5858
|
-
function
|
|
4826
|
+
function digest(value, label) {
|
|
5859
4827
|
try {
|
|
5860
4828
|
return lp32(base64UrlDecode(parseDigestB64u(value)), label);
|
|
5861
4829
|
} catch (error) {
|
|
@@ -5891,7 +4859,7 @@ function encodeSource(value) {
|
|
|
5891
4859
|
return concat3([
|
|
5892
4860
|
...common,
|
|
5893
4861
|
ownerLaneParticipantContinuityCanonicalBytesV1(value.ownerParticipantContinuity),
|
|
5894
|
-
|
|
4862
|
+
digest(value.participantBindingDigestB64u, "source.participantBindingDigestB64u"),
|
|
5895
4863
|
activationField(value.materialActivation, "source.materialActivation")
|
|
5896
4864
|
]);
|
|
5897
4865
|
}
|
|
@@ -5903,7 +4871,7 @@ function encodeSource(value) {
|
|
|
5903
4871
|
text(value.holderParticipantId, "source.holderParticipantId"),
|
|
5904
4872
|
text(value.signingWorkerParticipantId, "source.signingWorkerParticipantId"),
|
|
5905
4873
|
text(value.signingWorkerRecipientKeyId, "source.signingWorkerRecipientKeyId"),
|
|
5906
|
-
|
|
4874
|
+
digest(value.participantBindingDigestB64u, "source.participantBindingDigestB64u"),
|
|
5907
4875
|
activationField(value.materialActivation, "source.materialActivation")
|
|
5908
4876
|
]);
|
|
5909
4877
|
}
|
|
@@ -5964,9 +4932,6 @@ function encodeEd25519YaoLaneJobTranscriptV1(value) {
|
|
|
5964
4932
|
u64(value.expiresAtMs, "expiresAtMs")
|
|
5965
4933
|
]);
|
|
5966
4934
|
}
|
|
5967
|
-
async function computeEd25519YaoLaneJobTranscriptDigestV1(value) {
|
|
5968
|
-
return base64UrlEncode(await sha256Bytes(encodeEd25519YaoLaneJobTranscriptV1(value)));
|
|
5969
|
-
}
|
|
5970
4935
|
async function computeEd25519YaoLaneSessionDigestV1(value) {
|
|
5971
4936
|
const jobDigest = await sha256Bytes(encodeEd25519YaoLaneJobTranscriptV1(value));
|
|
5972
4937
|
return base64UrlEncode(await sha256Bytes(concat3([TEXT_ENCODER.encode(ED25519_SESSION_DOMAIN), jobDigest])));
|
|
@@ -5996,8 +4961,8 @@ function requireAsciiString(value, label) {
|
|
|
5996
4961
|
return value;
|
|
5997
4962
|
}
|
|
5998
4963
|
function parseRouterAbMpcMaterialActivationRef(value) {
|
|
5999
|
-
const
|
|
6000
|
-
requireExactFields(
|
|
4964
|
+
const activation = requireRecord2(value, "material_activation");
|
|
4965
|
+
requireExactFields(activation, [
|
|
6001
4966
|
"kind",
|
|
6002
4967
|
"activation_id",
|
|
6003
4968
|
"capability",
|
|
@@ -6006,17 +4971,17 @@ function parseRouterAbMpcMaterialActivationRef(value) {
|
|
|
6006
4971
|
"lifecycle_binding",
|
|
6007
4972
|
"signing_worker"
|
|
6008
4973
|
], "material_activation");
|
|
6009
|
-
if (
|
|
4974
|
+
if (activation.kind !== "mpc_material_activation_ref") {
|
|
6010
4975
|
throw new Error("material_activation.kind is not supported");
|
|
6011
4976
|
}
|
|
6012
4977
|
return {
|
|
6013
4978
|
kind: "mpc_material_activation_ref",
|
|
6014
|
-
activation_id: requireAsciiString(
|
|
6015
|
-
capability: requireAsciiString(
|
|
6016
|
-
material_owner: requireAsciiString(
|
|
6017
|
-
key_binding: requireAsciiString(
|
|
6018
|
-
lifecycle_binding: requireAsciiString(
|
|
6019
|
-
signing_worker: requireAsciiString(
|
|
4979
|
+
activation_id: requireAsciiString(activation.activation_id, "material_activation.activation_id"),
|
|
4980
|
+
capability: requireAsciiString(activation.capability, "material_activation.capability"),
|
|
4981
|
+
material_owner: requireAsciiString(activation.material_owner, "material_activation.material_owner"),
|
|
4982
|
+
key_binding: requireAsciiString(activation.key_binding, "material_activation.key_binding"),
|
|
4983
|
+
lifecycle_binding: requireAsciiString(activation.lifecycle_binding, "material_activation.lifecycle_binding"),
|
|
4984
|
+
signing_worker: requireAsciiString(activation.signing_worker, "material_activation.signing_worker")
|
|
6020
4985
|
};
|
|
6021
4986
|
}
|
|
6022
4987
|
function routerAbMpcMaterialActivationRefToWire(input) {
|
|
@@ -6041,14 +5006,14 @@ var STABLE_KEY_CONTEXT_DOMAIN = "seams/router-ab/ed25519-yao/stable-key-context/
|
|
|
6041
5006
|
var STABLE_KEY_CONTEXT_BINDING_DOMAIN = "seams/router-ab/ed25519-yao/stable-key-context-binding/v1";
|
|
6042
5007
|
var UTF8 = new TextEncoder;
|
|
6043
5008
|
function u32BigEndian(value) {
|
|
6044
|
-
const
|
|
6045
|
-
new DataView(
|
|
6046
|
-
return
|
|
5009
|
+
const bytes = new Uint8Array(4);
|
|
5010
|
+
new DataView(bytes.buffer).setUint32(0, value, false);
|
|
5011
|
+
return bytes;
|
|
6047
5012
|
}
|
|
6048
5013
|
function u16BigEndian(value) {
|
|
6049
|
-
const
|
|
6050
|
-
new DataView(
|
|
6051
|
-
return
|
|
5014
|
+
const bytes = new Uint8Array(2);
|
|
5015
|
+
new DataView(bytes.buffer).setUint16(0, value, false);
|
|
5016
|
+
return bytes;
|
|
6052
5017
|
}
|
|
6053
5018
|
function concatenateBytes(chunks) {
|
|
6054
5019
|
let length = 0;
|
|
@@ -6069,8 +5034,8 @@ function labeledField(label, value) {
|
|
|
6069
5034
|
return concatenateBytes([lengthDelimited(UTF8.encode(label)), lengthDelimited(value)]);
|
|
6070
5035
|
}
|
|
6071
5036
|
async function sha256(value) {
|
|
6072
|
-
const
|
|
6073
|
-
return new Uint8Array(
|
|
5037
|
+
const digest = await globalThis.crypto.subtle.digest("SHA-256", value);
|
|
5038
|
+
return new Uint8Array(digest);
|
|
6074
5039
|
}
|
|
6075
5040
|
async function deriveRouterAbEd25519YaoApplicationBindingDigestV1(facts) {
|
|
6076
5041
|
const encoded = concatenateBytes([
|
|
@@ -6093,25 +5058,7 @@ async function deriveRouterAbEd25519YaoStableContextBindingV1(applicationBinding
|
|
|
6093
5058
|
return Array.from(await sha256(concatenateBytes([UTF8.encode(STABLE_KEY_CONTEXT_BINDING_DOMAIN), context])));
|
|
6094
5059
|
}
|
|
6095
5060
|
|
|
6096
|
-
// src/core/signingEngine/workerManager/executeWorkerOperation.ts
|
|
6097
|
-
async function executeWorkerOperation(args) {
|
|
6098
|
-
if (!args.ctx) {
|
|
6099
|
-
throw new Error(`[executeWorkerOperation] ctx is required for ${args.kind} operations`);
|
|
6100
|
-
}
|
|
6101
|
-
return args.ctx.requestWorkerOperation({
|
|
6102
|
-
kind: args.kind,
|
|
6103
|
-
request: args.request
|
|
6104
|
-
});
|
|
6105
|
-
}
|
|
6106
|
-
|
|
6107
5061
|
// src/core/signingEngine/threshold/crypto/ed25519YaoLaneWasm.ts
|
|
6108
|
-
function parseEdJob2(value) {
|
|
6109
|
-
const parsed = parseRotatableSigningLaneJobV1(value);
|
|
6110
|
-
if (parsed.keyFamily !== "ed25519") {
|
|
6111
|
-
throw new Error("Ed25519 Yao lane WASM requires an Ed25519 lane job");
|
|
6112
|
-
}
|
|
6113
|
-
return parsed;
|
|
6114
|
-
}
|
|
6115
5062
|
async function assertEd25519YaoLaneCeremonyBindingParityV1(input) {
|
|
6116
5063
|
const expectedApplicationDigestB64u = base64UrlEncode(Uint8Array.from(await deriveRouterAbEd25519YaoApplicationBindingDigestV1(input.applicationBinding)));
|
|
6117
5064
|
if (input.applicationBindingDigestB64u !== undefined && input.applicationBindingDigestB64u !== expectedApplicationDigestB64u) {
|
|
@@ -6150,142 +5097,6 @@ function assertCanonicalRecipientKeyV1(value, label) {
|
|
|
6150
5097
|
throw new Error(`Ed25519 Yao lane ${label} must be a canonical 32-byte value`);
|
|
6151
5098
|
}
|
|
6152
5099
|
}
|
|
6153
|
-
function requestJson(value) {
|
|
6154
|
-
if (typeof value !== "string" || !value.trim()) {
|
|
6155
|
-
throw new Error("Yao lane request JSON is required");
|
|
6156
|
-
}
|
|
6157
|
-
return value;
|
|
6158
|
-
}
|
|
6159
|
-
function responseJson(value) {
|
|
6160
|
-
if (typeof value !== "string" || !value.trim()) {
|
|
6161
|
-
throw new Error("Yao lane response JSON is required");
|
|
6162
|
-
}
|
|
6163
|
-
return value;
|
|
6164
|
-
}
|
|
6165
|
-
function parseCommitReceipt(value) {
|
|
6166
|
-
const receipt = parseLaneProtocolCommitReceiptV1(value);
|
|
6167
|
-
if (receipt.keyFamily !== "ed25519") {
|
|
6168
|
-
throw new Error("Yao lane protocol receipt has the wrong key family");
|
|
6169
|
-
}
|
|
6170
|
-
return receipt;
|
|
6171
|
-
}
|
|
6172
|
-
function parseEd25519YaoLaneCompletionV1(job, completion) {
|
|
6173
|
-
const receipt = parseCommitReceipt(completion.protocolCommitReceipt);
|
|
6174
|
-
const holderPackage = parseLaneHolderPackageWireV1(completion.holderPackage);
|
|
6175
|
-
if (holderPackage.kind !== "ed25519_yao_lane_holder_package_set_v1") {
|
|
6176
|
-
throw new Error("Yao lane completion returned the wrong holder package family");
|
|
6177
|
-
}
|
|
6178
|
-
assertReceiptJobIdentity(receipt, job);
|
|
6179
|
-
return { protocolCommitReceipt: receipt, holderPackage };
|
|
6180
|
-
}
|
|
6181
|
-
function assertReceiptJobIdentity(receipt, job) {
|
|
6182
|
-
if (String(receipt.operationId) !== String(job.operationId) || String(receipt.enrollmentId) !== String(job.enrollmentId) || String(receipt.walletId) !== String(job.walletId) || String(receipt.walletKeyId) !== String(job.walletKeyId) || String(receipt.sourceLaneId) !== String(job.source.laneId) || String(receipt.targetLaneId) !== String(job.target.laneId) || String(receipt.targetLaneShareEpoch) !== String(job.target.laneShareEpoch) || String(receipt.targetMaterialActivationId) !== String(job.targetMaterialActivationId)) {
|
|
6183
|
-
throw new Error("Yao lane protocol receipt does not match its job");
|
|
6184
|
-
}
|
|
6185
|
-
}
|
|
6186
|
-
class Ed25519YaoLaneWorkerSource {
|
|
6187
|
-
workerCtx;
|
|
6188
|
-
sourceHandle;
|
|
6189
|
-
#discarded = false;
|
|
6190
|
-
constructor(workerCtx, sourceHandle) {
|
|
6191
|
-
this.workerCtx = workerCtx;
|
|
6192
|
-
this.sourceHandle = sourceHandle;
|
|
6193
|
-
}
|
|
6194
|
-
async discard() {
|
|
6195
|
-
if (this.#discarded)
|
|
6196
|
-
return;
|
|
6197
|
-
this.#discarded = true;
|
|
6198
|
-
await executeWorkerOperation({
|
|
6199
|
-
ctx: this.workerCtx,
|
|
6200
|
-
kind: "walletCustodyCeremony",
|
|
6201
|
-
request: {
|
|
6202
|
-
type: "discardEd25519YaoLaneSource",
|
|
6203
|
-
payload: { sourceHandle: this.sourceHandle }
|
|
6204
|
-
}
|
|
6205
|
-
});
|
|
6206
|
-
}
|
|
6207
|
-
async prepareSourcePreservingRegistration(input) {
|
|
6208
|
-
if (this.#discarded) {
|
|
6209
|
-
throw new Error("Ed25519 Yao lane source is already consumed");
|
|
6210
|
-
}
|
|
6211
|
-
this.#discarded = true;
|
|
6212
|
-
const result = await executeWorkerOperation({
|
|
6213
|
-
ctx: this.workerCtx,
|
|
6214
|
-
kind: "walletCustodyCeremony",
|
|
6215
|
-
request: {
|
|
6216
|
-
type: "prepareEd25519YaoSourcePreservingRegistration",
|
|
6217
|
-
payload: {
|
|
6218
|
-
sourceHandle: this.sourceHandle,
|
|
6219
|
-
targetAdmission: input.targetAdmission,
|
|
6220
|
-
applicationBinding: input.applicationBinding,
|
|
6221
|
-
participantIds: input.participantIds,
|
|
6222
|
-
expectedRegisteredPublicKeyB64u: input.expectedRegisteredPublicKeyB64u,
|
|
6223
|
-
targetClientRecipientPublicKeyB64u: input.targetClientRecipientPublicKeyB64u
|
|
6224
|
-
}
|
|
6225
|
-
}
|
|
6226
|
-
});
|
|
6227
|
-
return { requestJson: requestJson(result.requestJson) };
|
|
6228
|
-
}
|
|
6229
|
-
}
|
|
6230
|
-
|
|
6231
|
-
class Ed25519YaoLaneDerivationWorkerWasmV1 {
|
|
6232
|
-
config;
|
|
6233
|
-
#state = { state: "empty" };
|
|
6234
|
-
constructor(config) {
|
|
6235
|
-
this.config = config;
|
|
6236
|
-
}
|
|
6237
|
-
async prepare(input) {
|
|
6238
|
-
if (this.#state.state !== "empty") {
|
|
6239
|
-
throw new Error("Ed25519 Yao lane worker client is already prepared");
|
|
6240
|
-
}
|
|
6241
|
-
const job = parseEdJob2(input);
|
|
6242
|
-
const prepared = await executeWorkerOperation({
|
|
6243
|
-
ctx: this.config.workerCtx,
|
|
6244
|
-
kind: "walletCustodyCeremony",
|
|
6245
|
-
request: {
|
|
6246
|
-
type: "prepareEd25519YaoLane",
|
|
6247
|
-
payload: {
|
|
6248
|
-
sourceHandle: this.config.source.sourceHandle,
|
|
6249
|
-
job,
|
|
6250
|
-
ceremonyBinding: this.config.ceremonyBinding,
|
|
6251
|
-
applicationBinding: this.config.applicationBinding,
|
|
6252
|
-
participantIds: this.config.participantIds,
|
|
6253
|
-
deriverAInputPublicKeyB64u: this.config.deriverAInputPublicKeyB64u,
|
|
6254
|
-
deriverBInputPublicKeyB64u: this.config.deriverBInputPublicKeyB64u
|
|
6255
|
-
}
|
|
6256
|
-
}
|
|
6257
|
-
});
|
|
6258
|
-
this.#state = { state: "prepared", job, sessionHandle: prepared.sessionHandle };
|
|
6259
|
-
return { requestJson: requestJson(prepared.requestJson) };
|
|
6260
|
-
}
|
|
6261
|
-
async complete(input) {
|
|
6262
|
-
if (this.#state.state !== "prepared") {
|
|
6263
|
-
throw new Error("Ed25519 Yao lane worker client is not prepared");
|
|
6264
|
-
}
|
|
6265
|
-
const prepared = this.#state;
|
|
6266
|
-
this.#state = { state: "consumed" };
|
|
6267
|
-
const job = parseEdJob2(input.job);
|
|
6268
|
-
const [jobDigest, preparedJobDigest] = await Promise.all([
|
|
6269
|
-
computeEd25519YaoLaneJobTranscriptDigestV1(job),
|
|
6270
|
-
computeEd25519YaoLaneJobTranscriptDigestV1(prepared.job)
|
|
6271
|
-
]);
|
|
6272
|
-
if (jobDigest !== preparedJobDigest) {
|
|
6273
|
-
throw new Error("Ed25519 Yao lane completion changed the prepared job");
|
|
6274
|
-
}
|
|
6275
|
-
const completion = await executeWorkerOperation({
|
|
6276
|
-
ctx: this.config.workerCtx,
|
|
6277
|
-
kind: "walletCustodyCeremony",
|
|
6278
|
-
request: {
|
|
6279
|
-
type: "completeEd25519YaoLane",
|
|
6280
|
-
payload: {
|
|
6281
|
-
sessionHandle: prepared.sessionHandle,
|
|
6282
|
-
responseJson: responseJson(input.responseJson)
|
|
6283
|
-
}
|
|
6284
|
-
}
|
|
6285
|
-
});
|
|
6286
|
-
return parseEd25519YaoLaneCompletionV1(prepared.job, completion);
|
|
6287
|
-
}
|
|
6288
|
-
}
|
|
6289
5100
|
|
|
6290
5101
|
// src/core/signingEngine/workerManager/workers/wallet-custody-ceremony.worker.ts
|
|
6291
5102
|
var wasmUrl = resolveWasmUrl("wallet_custody_ceremony_bg.wasm", "Wallet Custody Ceremony");
|
|
@@ -6474,12 +5285,12 @@ async function prepareEd25519YaoLane(request) {
|
|
|
6474
5285
|
participantIds: request.payload.participantIds
|
|
6475
5286
|
});
|
|
6476
5287
|
const prepared = client.prepare(JSON.stringify(request.payload.job), JSON.stringify(request.payload.ceremonyBinding), JSON.stringify(request.payload.applicationBinding), request.payload.participantIds[0], request.payload.participantIds[1], source, base64UrlDecode(request.payload.deriverAInputPublicKeyB64u), base64UrlDecode(request.payload.deriverBInputPublicKeyB64u), deriverASealSeed, deriverBSealSeed);
|
|
6477
|
-
const
|
|
6478
|
-
if (!
|
|
5288
|
+
const requestJson = String(prepared.requestJson || "").trim();
|
|
5289
|
+
if (!requestJson)
|
|
6479
5290
|
throw new Error("Ed25519 Yao lane preparation returned no request JSON");
|
|
6480
5291
|
const sessionHandle = secureOpaqueHandle("ed25519-yao-lane-session-v1");
|
|
6481
5292
|
ed25519YaoLaneSessions.set(sessionHandle, { sourceHandle, client });
|
|
6482
|
-
return { sessionHandle, requestJson
|
|
5293
|
+
return { sessionHandle, requestJson };
|
|
6483
5294
|
} catch (error) {
|
|
6484
5295
|
client.free();
|
|
6485
5296
|
throw error;
|
|
@@ -6588,12 +5399,12 @@ function beginKeySetRun(request) {
|
|
|
6588
5399
|
throw new Error("Too many wallet custody ceremonies are in flight");
|
|
6589
5400
|
}
|
|
6590
5401
|
if (request.payload.keySet === "near_ed25519_v1") {
|
|
6591
|
-
const
|
|
6592
|
-
const
|
|
6593
|
-
const yaoExecuteRequestJson =
|
|
5402
|
+
const seedHeld = takeSeed(request.payload.custody);
|
|
5403
|
+
const prepared = seedHeld.prepare_near_ed25519(request.payload.protocolInputsJson);
|
|
5404
|
+
const yaoExecuteRequestJson = prepared.yao_execute_request_json();
|
|
6594
5405
|
if (!yaoExecuteRequestJson)
|
|
6595
5406
|
throw new Error("NEAR custody preparation returned no request");
|
|
6596
|
-
ceremonies.set(ceremonyId, { step: "near_prepared", handle:
|
|
5407
|
+
ceremonies.set(ceremonyId, { step: "near_prepared", handle: prepared });
|
|
6597
5408
|
return { ceremonyId, keySet: "near_ed25519_v1", yaoExecuteRequestJson };
|
|
6598
5409
|
}
|
|
6599
5410
|
const custody = request.payload.custody;
|
|
@@ -6636,18 +5447,18 @@ function beginKeySetRun(request) {
|
|
|
6636
5447
|
};
|
|
6637
5448
|
}
|
|
6638
5449
|
function requireRecordedManifestDigest(value) {
|
|
6639
|
-
const
|
|
6640
|
-
if (!
|
|
5450
|
+
const digest = String(value || "").trim();
|
|
5451
|
+
if (!digest)
|
|
6641
5452
|
throw new Error("recovery requires a recorded key manifest digest");
|
|
6642
|
-
return
|
|
5453
|
+
return digest;
|
|
6643
5454
|
}
|
|
6644
5455
|
function completeKeySetRun(request) {
|
|
6645
5456
|
const ceremonyId = requireCeremonyId(request.payload.ceremonyId);
|
|
6646
5457
|
if (request.payload.keySet === "evm_family_ecdsa_v1") {
|
|
6647
|
-
const { handle
|
|
6648
|
-
const generatedCompletion =
|
|
6649
|
-
const
|
|
6650
|
-
return { ceremonyId, keySet: "evm_family_ecdsa_v1", activation
|
|
5458
|
+
const { handle } = takeCeremony(ceremonyId, "evm_activation_pending");
|
|
5459
|
+
const generatedCompletion = handle.complete(request.payload.protocolResultJson);
|
|
5460
|
+
const activation = parseWalletCustodyEvmFamilyActivationCompletion(generatedCompletion);
|
|
5461
|
+
return { ceremonyId, keySet: "evm_family_ecdsa_v1", activation };
|
|
6651
5462
|
}
|
|
6652
5463
|
const { handle } = takeCeremony(ceremonyId, "near_prepared");
|
|
6653
5464
|
const completed = handle.complete_near_ed25519(request.payload.protocolResultJson);
|
|
@@ -6875,9 +5686,9 @@ function requireCapabilityFact(value, label) {
|
|
|
6875
5686
|
return value;
|
|
6876
5687
|
}
|
|
6877
5688
|
function createUnlockedExportRootCapabilityHandleId() {
|
|
6878
|
-
const
|
|
6879
|
-
globalThis.crypto.getRandomValues(
|
|
6880
|
-
return `unlocked-ed25519-export-root-${base64UrlEncode(
|
|
5689
|
+
const bytes = new Uint8Array(16);
|
|
5690
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
5691
|
+
return `unlocked-ed25519-export-root-${base64UrlEncode(bytes)}`;
|
|
6881
5692
|
}
|
|
6882
5693
|
async function acceptLinkedDeviceEd25519ExportRoot(request) {
|
|
6883
5694
|
await initializeNearSignerWasm();
|
|
@@ -6914,9 +5725,9 @@ function discardLinkedDeviceEd25519ExportRootRecipient(request) {
|
|
|
6914
5725
|
};
|
|
6915
5726
|
}
|
|
6916
5727
|
function createExportRootRecipientHandleId() {
|
|
6917
|
-
const
|
|
6918
|
-
globalThis.crypto.getRandomValues(
|
|
6919
|
-
return `linked-device-ed25519-export-root-${base64UrlEncode(
|
|
5728
|
+
const bytes = new Uint8Array(16);
|
|
5729
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
5730
|
+
return `linked-device-ed25519-export-root-${base64UrlEncode(bytes)}`;
|
|
6920
5731
|
}
|
|
6921
5732
|
async function rotateWalletRecoverySet(request) {
|
|
6922
5733
|
const factorSecret = toBytes(request.payload.factorSecret);
|