hd-wallet-ui 2.0.28 → 2.0.29
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/README.md +2 -2
- package/dist/wallet-origin/index.js +1149 -1128
- package/dist/wallet-origin-host/assets/{wallet-origin.71d202b108d16ad07d05c5a345a76f97fbdc182870626f8263793f7cd6d72bb7.wasm → wallet-origin.70d4ed537fa935f3066c524133ab99e44190c3d26c7b9143b23b42ce337af863.wasm} +0 -0
- package/dist/wallet-origin-host/assets/{wallet-origin.aee6e1a4897def2269b92bb475b236c5ee2e067177ee592399adfddc158a6d8a.css → wallet-origin.75df63c4c7a374517c0fb1f72aa7033d11cf430b98a649a14e513ac31e90d086.css} +1 -1
- package/dist/wallet-origin-host/assets/{wallet-origin.647699ee7ce50961bd226011dd06fe309ec0d372c1e7c43acc3e6650b504acff.js → wallet-origin.a1c4a1ebca4eb16cfdcc1c5f36bcc11f528a52d89d4e344b8ba53e02452334ff.js} +2848 -2827
- package/dist/wallet-origin-host/index.html +2 -2
- package/dist/wallet-origin-host/integrity.json +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getWalletOriginCapabilities as
|
|
1
|
+
import { getWalletOriginCapabilities as Bn } from "hd-wallet-wasm";
|
|
2
2
|
const Ni = Object.freeze({
|
|
3
3
|
cm: 0.01,
|
|
4
4
|
km: 1e3,
|
|
@@ -11,7 +11,7 @@ const Ni = Object.freeze({
|
|
|
11
11
|
scaleComponentInclusiveMax: 1e6,
|
|
12
12
|
translationComponentAbsMax: 1e6,
|
|
13
13
|
upAxes: Object.freeze(["X_UP", "Y_UP", "Z_UP"])
|
|
14
|
-
}), Ci = Object.freeze({ reviewedTransform: Ti, schemaVersion: 1 }),
|
|
14
|
+
}), Ci = Object.freeze({ reviewedTransform: Ti, schemaVersion: 1 }), Se = new TextEncoder(), Vn = Object.getPrototypeOf(Uint8Array.prototype), _i = Object.getOwnPropertyDescriptor(Vn, "buffer").get, xi = Object.getOwnPropertyDescriptor(Vn, "length").get, Di = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, hn = typeof SharedArrayBuffer > "u" ? null : Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get, Ee = "sdn-bip32-slip10-purpose-v1", mt = "password-scrypt-v2", Pe = "ed25519-over-sha256-jcs-v1", yn = "ed25519-raw-32-v1", Mn = "https://review.spacedatanetwork.org", $n = "sdn-asset-review-v1", Pi = "asset-review:assets.ipfs.01", ki = "asset-review-authority:assets.ipfs.01", Vt = "sdn-login:sdn.spaceaware.io", Ui = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, le = /^[0-9a-f]{64}$/u, Fn = /^[0-9a-f]{128}$/u, We = /^sha256:[0-9a-f]{64}$/u, ji = /^[1-9A-HJ-NP-Za-km-z]+$/u, Bi = /^b[a-z2-7]{58}$/u, Mt = "abcdefghijklmnopqrstuvwxyz234567", Wn = 131072, Vi = [
|
|
15
15
|
"accountFingerprint",
|
|
16
16
|
"accountIndex",
|
|
17
17
|
"accountLabel",
|
|
@@ -56,7 +56,7 @@ const Ni = Object.freeze({
|
|
|
56
56
|
"signatureHex",
|
|
57
57
|
"signatureProfile",
|
|
58
58
|
"signedDigestSha256"
|
|
59
|
-
],
|
|
59
|
+
], gt = [
|
|
60
60
|
"audience",
|
|
61
61
|
"clientId",
|
|
62
62
|
"expiresAt",
|
|
@@ -70,7 +70,7 @@ const Ni = Object.freeze({
|
|
|
70
70
|
"requestOrigin",
|
|
71
71
|
"serviceInstance",
|
|
72
72
|
"signatureProfile"
|
|
73
|
-
],
|
|
73
|
+
], $t = [
|
|
74
74
|
"audience",
|
|
75
75
|
"candidateKey",
|
|
76
76
|
"challengeId",
|
|
@@ -97,12 +97,12 @@ const Ni = Object.freeze({
|
|
|
97
97
|
function y(e) {
|
|
98
98
|
throw new TypeError(e);
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function Ot(e) {
|
|
101
101
|
if (e === null || typeof e != "object" || Array.isArray(e)) return !1;
|
|
102
102
|
const t = Object.getPrototypeOf(e);
|
|
103
103
|
return t === Object.prototype || t === null;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function ue(e, t) {
|
|
106
106
|
typeof e != "string" && y(`${t} must be a string`);
|
|
107
107
|
for (let n = 0; n < e.length; n += 1) {
|
|
108
108
|
const i = e.charCodeAt(n);
|
|
@@ -115,8 +115,8 @@ function oe(e, t) {
|
|
|
115
115
|
}
|
|
116
116
|
return e;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
typeof e != "string" && y("wire JSON must be a string"),
|
|
118
|
+
function zn(e) {
|
|
119
|
+
typeof e != "string" && y("wire JSON must be a string"), Se.encode(e).byteLength > Wn && y("wire JSON is too large"), e.charCodeAt(0) === 65279 && y("wire JSON must not contain a BOM");
|
|
120
120
|
let t = 0, n = 0;
|
|
121
121
|
const i = () => {
|
|
122
122
|
for (; t < e.length && /[\u0009\u000a\u000d\u0020]/u.test(e[t]); ) t += 1;
|
|
@@ -133,7 +133,7 @@ function Fn(e) {
|
|
|
133
133
|
} catch {
|
|
134
134
|
y("invalid JSON string");
|
|
135
135
|
}
|
|
136
|
-
return
|
|
136
|
+
return ue(l, "JSON string");
|
|
137
137
|
}
|
|
138
138
|
c < 32 && y("invalid JSON control character"), c === 92 && (t += 1, t >= e.length && y("unterminated JSON escape")), t += 1;
|
|
139
139
|
}
|
|
@@ -180,8 +180,8 @@ function Fn(e) {
|
|
|
180
180
|
const a = s();
|
|
181
181
|
return i(), t !== e.length && y("wire JSON contains trailing bytes"), a;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
return typeof e == "string" ?
|
|
183
|
+
function qn(e) {
|
|
184
|
+
return typeof e == "string" ? zn(e) : e;
|
|
185
185
|
}
|
|
186
186
|
function qi(e, t) {
|
|
187
187
|
if (e.byteLength !== t.byteLength) return !1;
|
|
@@ -189,10 +189,10 @@ function qi(e, t) {
|
|
|
189
189
|
for (let i = 0; i < e.byteLength; i += 1) n |= e[i] ^ t[i];
|
|
190
190
|
return n === 0;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
const i =
|
|
194
|
-
|
|
195
|
-
const r = Object.getOwnPropertyNames(i).sort(), s = [...t].sort(), a =
|
|
192
|
+
function ee(e, t, n) {
|
|
193
|
+
const i = qn(e);
|
|
194
|
+
Ot(i) || y(`${n} must be a JSON object`), Object.getOwnPropertySymbols(i).length !== 0 && y(`${n} has an unknown symbol field`);
|
|
195
|
+
const r = Object.getOwnPropertyNames(i).sort(), s = [...t].sort(), a = Se.encode(r.join("\0")), o = Se.encode(s.join("\0"));
|
|
196
196
|
qi(a, o) || y(`${n} has missing or unknown fields`);
|
|
197
197
|
for (const c of r) {
|
|
198
198
|
const l = Object.getOwnPropertyDescriptor(i, c);
|
|
@@ -200,15 +200,15 @@ function Z(e, t, n) {
|
|
|
200
200
|
}
|
|
201
201
|
return i;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function ot(e) {
|
|
204
204
|
if (!e || typeof e != "object" || Object.isFrozen(e)) return e;
|
|
205
|
-
for (const t of Object.values(e))
|
|
205
|
+
for (const t of Object.values(e)) ot(t);
|
|
206
206
|
return Object.freeze(e);
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
return
|
|
208
|
+
function de(e) {
|
|
209
|
+
return ot(Object.fromEntries([...e].sort(([t], [n]) => t < n ? -1 : t > n ? 1 : 0)));
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function Jt(e, t, n) {
|
|
212
212
|
(!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length !== t) && y(`${n} must be a plain array with exactly ${t} values`);
|
|
213
213
|
const i = [...Array.from({ length: t }, (s, a) => String(a)), "length"], r = Reflect.ownKeys(e);
|
|
214
214
|
(r.length !== i.length || r.some((s, a) => s !== i[a])) && y(`${n} must be a dense plain array`);
|
|
@@ -218,20 +218,20 @@ function Ht(e, t, n) {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
function Hi(e) {
|
|
221
|
-
const t =
|
|
221
|
+
const t = ee(
|
|
222
222
|
e,
|
|
223
223
|
["reviewedTransform", "schemaVersion"],
|
|
224
224
|
"asset review protocol policy"
|
|
225
225
|
);
|
|
226
|
-
|
|
227
|
-
const n =
|
|
226
|
+
v(t.schemaVersion, 1, "asset review protocol schemaVersion");
|
|
227
|
+
const n = ee(t.reviewedTransform, [
|
|
228
228
|
"metersPerSourceUnit",
|
|
229
229
|
"quaternionNormTolerance",
|
|
230
230
|
"scaleComponentExclusiveMin",
|
|
231
231
|
"scaleComponentInclusiveMax",
|
|
232
232
|
"translationComponentAbsMax",
|
|
233
233
|
"upAxes"
|
|
234
|
-
], "asset review transform policy"), i =
|
|
234
|
+
], "asset review transform policy"), i = ee(
|
|
235
235
|
n.metersPerSourceUnit,
|
|
236
236
|
["cm", "km", "m", "mm"],
|
|
237
237
|
"asset review unit policy"
|
|
@@ -245,8 +245,8 @@ function Hi(e) {
|
|
|
245
245
|
["translationComponentAbsMax", n.translationComponentAbsMax]
|
|
246
246
|
])
|
|
247
247
|
(typeof s != "number" || !Number.isFinite(s)) && y(`asset review transform policy ${r} must be finite`);
|
|
248
|
-
return (n.quaternionNormTolerance <= 0 || n.scaleComponentInclusiveMax <= n.scaleComponentExclusiveMin || n.translationComponentAbsMax <= 0) && y("asset review transform policy bounds are inconsistent"),
|
|
249
|
-
["metersPerSourceUnit",
|
|
248
|
+
return (n.quaternionNormTolerance <= 0 || n.scaleComponentInclusiveMax <= n.scaleComponentExclusiveMin || n.translationComponentAbsMax <= 0) && y("asset review transform policy bounds are inconsistent"), Jt(n.upAxes, 3, "asset review up-axis policy"), n.upAxes.join("\0") !== "X_UP\0Y_UP\0Z_UP" && y("asset review up-axis policy is invalid"), de([
|
|
249
|
+
["metersPerSourceUnit", de(Object.entries(i))],
|
|
250
250
|
["quaternionNormTolerance", n.quaternionNormTolerance],
|
|
251
251
|
["scaleComponentExclusiveMin", n.scaleComponentExclusiveMin],
|
|
252
252
|
["scaleComponentInclusiveMax", n.scaleComponentInclusiveMax],
|
|
@@ -254,20 +254,20 @@ function Hi(e) {
|
|
|
254
254
|
["upAxes", Object.freeze(Array.from({ length: 3 }, (r, s) => n.upAxes[s]))]
|
|
255
255
|
]);
|
|
256
256
|
}
|
|
257
|
-
const
|
|
258
|
-
function
|
|
257
|
+
const xe = Hi(Ci);
|
|
258
|
+
function v(e, t, n) {
|
|
259
259
|
return e !== t && y(`${n} must equal ${JSON.stringify(t)}`), e;
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function Qt(e, t, n) {
|
|
262
262
|
return t.includes(e) || y(`${n} is not an allowed value`), e;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
return
|
|
264
|
+
function q(e, t, n) {
|
|
265
|
+
return ue(e, n), t.test(e) || y(`${n} has an invalid encoding`), e;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
return
|
|
267
|
+
function we(e, t) {
|
|
268
|
+
return ue(e, t), (!Ui.test(e) || new Date(e).toISOString() !== e) && y(`${t} must be exact RFC3339 milliseconds UTC`), e;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function Nt(e, t) {
|
|
271
271
|
const n = Date.parse(e), i = Date.parse(t);
|
|
272
272
|
i > n && i - n <= 3e5 || y("request lifetime must be in (0, 300] seconds");
|
|
273
273
|
}
|
|
@@ -277,9 +277,9 @@ function Gi(e, t) {
|
|
|
277
277
|
(r.length !== i.length || r.some((d, u) => d !== i[u])) && y(`${t} Uint8Array must contain only 32 indexed bytes`);
|
|
278
278
|
const s = _i.call(e);
|
|
279
279
|
let a = !1;
|
|
280
|
-
if (
|
|
280
|
+
if (hn)
|
|
281
281
|
try {
|
|
282
|
-
|
|
282
|
+
hn.call(s), a = !0;
|
|
283
283
|
} catch {
|
|
284
284
|
a = !1;
|
|
285
285
|
}
|
|
@@ -299,8 +299,8 @@ function Gi(e, t) {
|
|
|
299
299
|
const l = globalThis.btoa(c).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/gu, "");
|
|
300
300
|
return l.length !== 43 && y(`${t} did not encode to 43 base64url characters`), l;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
|
|
302
|
+
function Hn(e, t) {
|
|
303
|
+
ue(e, t), /^[A-Za-z0-9_-]{43}$/u.test(e) || y(`${t} must be canonical unpadded base64url`);
|
|
304
304
|
let n;
|
|
305
305
|
try {
|
|
306
306
|
n = globalThis.atob(`${e.replace(/-/gu, "+").replace(/_/gu, "/")}=`);
|
|
@@ -314,15 +314,15 @@ function Ki(e) {
|
|
|
314
314
|
let t = 0, n = 0, i = "";
|
|
315
315
|
for (const r of e)
|
|
316
316
|
for (t = t << 8 | r, n += 8; n >= 5; )
|
|
317
|
-
n -= 5, i +=
|
|
318
|
-
return n !== 0 && (i +=
|
|
317
|
+
n -= 5, i += Mt[t >>> n & 31], t &= (1 << n) - 1;
|
|
318
|
+
return n !== 0 && (i += Mt[t << 5 - n & 31]), i;
|
|
319
319
|
}
|
|
320
320
|
function Ji(e, t) {
|
|
321
|
-
|
|
321
|
+
ue(e, "modelCid"), Bi.test(e) || y("modelCid must be canonical CIDv1 raw sha2-256 base32");
|
|
322
322
|
let n = 0, i = 0;
|
|
323
323
|
const r = [];
|
|
324
324
|
for (const o of e.slice(1)) {
|
|
325
|
-
const c =
|
|
325
|
+
const c = Mt.indexOf(o);
|
|
326
326
|
c < 0 && y("modelCid contains invalid base32"), n = n << 5 | c, i += 5, i >= 8 && (i -= 8, r.push(n >>> i & 255), n &= (1 << i) - 1);
|
|
327
327
|
}
|
|
328
328
|
(i !== 0 && n !== 0 || r.length !== 36) && y("modelCid has noncanonical base32 tail bits or length");
|
|
@@ -335,15 +335,15 @@ function Ji(e, t) {
|
|
|
335
335
|
}
|
|
336
336
|
return a !== 0 && y("modelCid digest does not match modelSha256"), e;
|
|
337
337
|
}
|
|
338
|
-
function
|
|
339
|
-
return e === null || typeof e == "boolean" ? JSON.stringify(e) : typeof e == "string" ? (
|
|
338
|
+
function Ft(e) {
|
|
339
|
+
return e === null || typeof e == "boolean" ? JSON.stringify(e) : typeof e == "string" ? (ue(e, "canonical JSON string"), JSON.stringify(e)) : typeof e == "number" ? (Number.isFinite(e) || y("canonical JSON numbers must be finite"), JSON.stringify(e)) : Array.isArray(e) ? `[${e.map(Ft).join(",")}]` : (Ot(e) || y("canonical JSON contains an unsupported value"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${Ft(e[t])}`).join(",")}}`);
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function Yt(e, t) {
|
|
342
342
|
for (const n of ["identityScheme", "keyId", "signatureProfile"])
|
|
343
343
|
e[n] !== t[n] && y(`canonicalEnvelope ${n} must match the signature result`);
|
|
344
344
|
}
|
|
345
345
|
function Qi(e, t) {
|
|
346
|
-
const i =
|
|
346
|
+
const i = ee(e, [
|
|
347
347
|
"audience",
|
|
348
348
|
"challengeSha256",
|
|
349
349
|
"clientId",
|
|
@@ -357,18 +357,18 @@ function Qi(e, t) {
|
|
|
357
357
|
"requestOrigin",
|
|
358
358
|
"signatureProfile"
|
|
359
359
|
], "SDN login canonicalEnvelope");
|
|
360
|
-
|
|
360
|
+
Yt(i, t), v(i.audience, Vt, "SDN login envelope audience"), q(i.challengeSha256, le, "SDN login envelope challengeSha256"), v(i.clientId, "sdn-node-console-v1", "SDN login envelope clientId"), we(i.issuedAt, "SDN login envelope issuedAt"), we(i.expiresAt, "SDN login envelope expiresAt"), Nt(i.issuedAt, i.expiresAt), v(i.identityScheme, Ee, "SDN login envelope identityScheme"), q(i.keyId, We, "SDN login envelope keyId"), v(i.kind, "sdn-login", "SDN login envelope kind"), q(i.nonce, le, "SDN login envelope nonce"), v(i.protocolVersion, 2, "SDN login envelope protocolVersion"), v(i.requestOrigin, "https://sdn.spaceaware.io", "SDN login envelope requestOrigin"), v(i.signatureProfile, Pe, "SDN login envelope signatureProfile");
|
|
361
361
|
}
|
|
362
362
|
function Yi(e, t) {
|
|
363
|
-
const n =
|
|
363
|
+
const n = ee(
|
|
364
364
|
e,
|
|
365
|
-
[...
|
|
365
|
+
[...gt, "kind"],
|
|
366
366
|
"authority activation canonicalEnvelope"
|
|
367
367
|
);
|
|
368
|
-
|
|
368
|
+
Yt(n, t), v(n.kind, "asset-review-authority-activation", "activation envelope kind"), Kn(Object.fromEntries(gt.map((i) => [i, n[i]])));
|
|
369
369
|
}
|
|
370
370
|
function Xi(e, t) {
|
|
371
|
-
const n = e?.decision === "approve" ? ["note", "reviewedTransform"] : e?.decision === "disapprove" ? ["reason"] : [], i = [
|
|
371
|
+
const n = e?.decision === "approve" ? ["note", "reviewedTransform"] : e?.decision === "disapprove" ? ["reason"] : [], i = [...$t, ...n], r = ee(e, [
|
|
372
372
|
...i,
|
|
373
373
|
"identityScheme",
|
|
374
374
|
"keyId",
|
|
@@ -376,37 +376,37 @@ function Xi(e, t) {
|
|
|
376
376
|
"purpose",
|
|
377
377
|
"signatureProfile"
|
|
378
378
|
], "asset review decision canonicalEnvelope");
|
|
379
|
-
|
|
379
|
+
Yt(r, t), v(r.identityScheme, Ee, "decision envelope identityScheme"), q(r.keyId, We, "decision envelope keyId"), v(r.kind, "asset-review-attestation", "decision envelope kind"), v(r.purpose, "asset-review-approval", "decision envelope purpose"), v(r.signatureProfile, Pe, "decision envelope signatureProfile"), Jn(Object.fromEntries(i.map((s) => [s, r[s]])));
|
|
380
380
|
}
|
|
381
381
|
function Zi(e, t, n) {
|
|
382
|
-
|
|
383
|
-
const i =
|
|
384
|
-
return (!
|
|
382
|
+
ue(e, "canonicalEnvelope"), Se.encode(e).byteLength > Wn && y("canonicalEnvelope is too large");
|
|
383
|
+
const i = zn(e);
|
|
384
|
+
return (!Ot(i) || i.kind !== t) && y("canonicalEnvelope kind does not match the operation"), Ft(i) !== e && y("canonicalEnvelope must be exact JCS"), t === "sdn-login" ? Qi(i, n) : t === "asset-review-authority-activation" ? Yi(i, n) : t === "asset-review-attestation" ? Xi(i, n) : y("canonicalEnvelope operation is not registered"), e;
|
|
385
385
|
}
|
|
386
386
|
function er(e, t) {
|
|
387
|
-
const n =
|
|
388
|
-
return
|
|
387
|
+
const n = ee(e, Mi, `identity key ${t.purpose}`);
|
|
388
|
+
return v(n.purpose, t.purpose, "key purpose"), v(n.identityScheme, Ee, "key identityScheme"), v(n.seedProfile, mt, "key seedProfile"), v(n.signatureProfile, t.signatureProfile, "key signatureProfile"), v(n.curve, t.curve, "key curve"), v(n.derivation, "slip10", "key derivation"), v(n.path, t.path, "key path"), v(n.encoding, "raw", "key encoding"), q(n.publicKeyHex, le, "key publicKeyHex"), v(n.bip32Fingerprint, null, "key bip32Fingerprint"), q(n.keyId, We, "key keyId"), de([
|
|
389
389
|
["bip32Fingerprint", null],
|
|
390
390
|
["curve", n.curve],
|
|
391
391
|
["derivation", "slip10"],
|
|
392
392
|
["encoding", "raw"],
|
|
393
|
-
["identityScheme",
|
|
393
|
+
["identityScheme", Ee],
|
|
394
394
|
["keyId", n.keyId],
|
|
395
395
|
["path", n.path],
|
|
396
396
|
["publicKeyHex", n.publicKeyHex],
|
|
397
397
|
["purpose", n.purpose],
|
|
398
|
-
["seedProfile",
|
|
398
|
+
["seedProfile", mt],
|
|
399
399
|
["signatureProfile", n.signatureProfile]
|
|
400
400
|
]);
|
|
401
401
|
}
|
|
402
402
|
function tr(e) {
|
|
403
|
-
const t =
|
|
404
|
-
|
|
403
|
+
const t = ee(e, Vi, "WalletPublicIdentity");
|
|
404
|
+
v(t.schemaVersion, 1, "identity schemaVersion"), v(t.identityScheme, Ee, "identity identityScheme"), v(t.seedProfile, mt, "identity seedProfile"), t.accountIndex !== 0 && y("public wallet identity must use account 0"), v(t.accountLabel, null, "identity accountLabel"), ue(t.accountXpub, "identity accountXpub"), /^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(t.accountXpub) || y("identity accountXpub is invalid"), ue(t.accountPeerId, "identity accountPeerId"), (!t.accountPeerId.startsWith("16Uiu2H") || t.accountPeerId.length < 40 || t.accountPeerId.length > 64 || !ji.test(t.accountPeerId)) && y("identity accountPeerId is invalid"), q(t.accountFingerprint, /^[0-9a-f]{8}$/u, "identity accountFingerprint"), Jt(t.keys, 3, "public identity keys array");
|
|
405
405
|
const n = [
|
|
406
406
|
{
|
|
407
407
|
purpose: "asset-review-approval",
|
|
408
408
|
curve: "ed25519",
|
|
409
|
-
signatureProfile:
|
|
409
|
+
signatureProfile: Pe,
|
|
410
410
|
path: "m/44'/0'/0'/2'/0'"
|
|
411
411
|
},
|
|
412
412
|
{
|
|
@@ -418,30 +418,30 @@ function tr(e) {
|
|
|
418
418
|
{
|
|
419
419
|
purpose: "sdn-authentication",
|
|
420
420
|
curve: "ed25519",
|
|
421
|
-
signatureProfile:
|
|
421
|
+
signatureProfile: Pe,
|
|
422
422
|
path: "m/44'/0'/0'/0'/0'"
|
|
423
423
|
}
|
|
424
424
|
], i = Array.from(
|
|
425
425
|
{ length: 3 },
|
|
426
426
|
(r, s) => er(t.keys[s], n[s])
|
|
427
427
|
);
|
|
428
|
-
return
|
|
428
|
+
return de([
|
|
429
429
|
["accountFingerprint", t.accountFingerprint],
|
|
430
430
|
["accountIndex", 0],
|
|
431
431
|
["accountLabel", null],
|
|
432
432
|
["accountPeerId", t.accountPeerId],
|
|
433
433
|
["accountXpub", t.accountXpub],
|
|
434
|
-
["identityScheme",
|
|
435
|
-
["keys",
|
|
434
|
+
["identityScheme", Ee],
|
|
435
|
+
["keys", ot(i)],
|
|
436
436
|
["schemaVersion", 1],
|
|
437
|
-
["seedProfile",
|
|
437
|
+
["seedProfile", mt]
|
|
438
438
|
]);
|
|
439
439
|
}
|
|
440
|
-
function
|
|
441
|
-
const n =
|
|
442
|
-
|
|
440
|
+
function Gn(e, t) {
|
|
441
|
+
const n = ee(e, $i, `${t} result`);
|
|
442
|
+
v(n.schemaVersion, 1, "connection result schemaVersion"), Qt(n.event, ["connected", "disconnected"], "connection event"), t === "connect" && n.event !== "connected" && y("connect result must be connected");
|
|
443
443
|
let i = null, r = null;
|
|
444
|
-
return n.event === "connected" ? (i = tr(n.identity), r =
|
|
444
|
+
return n.event === "connected" ? (i = tr(n.identity), r = we(n.connectionExpiresAt, "connectionExpiresAt")) : (n.identity !== null || n.connectionExpiresAt !== null) && y("disconnected result must clear identity and expiry"), de([
|
|
445
445
|
["connectionExpiresAt", r],
|
|
446
446
|
["event", n.event],
|
|
447
447
|
["identity", i],
|
|
@@ -449,43 +449,43 @@ function qn(e, t) {
|
|
|
449
449
|
]);
|
|
450
450
|
}
|
|
451
451
|
function nr(e) {
|
|
452
|
-
const t =
|
|
453
|
-
return
|
|
452
|
+
const t = ee(e, Fi, "raw signature");
|
|
453
|
+
return v(t.schemaVersion, 1, "signature schemaVersion"), q(t.keyId, We, "signature keyId"), Qt(t.identityScheme, [
|
|
454
454
|
"sdn-fast-password-auth-v1-legacy",
|
|
455
455
|
"sdn-bip39-auth-v1-legacy"
|
|
456
|
-
], "raw signature identityScheme"),
|
|
456
|
+
], "raw signature identityScheme"), v(t.algorithm, "ed25519", "signature algorithm"), v(t.encoding, "raw", "signature encoding"), v(t.signatureProfile, yn, "signature profile"), q(t.signatureHex, Fn, "signatureHex"), de([
|
|
457
457
|
["algorithm", "ed25519"],
|
|
458
458
|
["encoding", "raw"],
|
|
459
459
|
["identityScheme", t.identityScheme],
|
|
460
460
|
["keyId", t.keyId],
|
|
461
461
|
["schemaVersion", 1],
|
|
462
462
|
["signatureHex", t.signatureHex],
|
|
463
|
-
["signatureProfile",
|
|
463
|
+
["signatureProfile", yn]
|
|
464
464
|
]);
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
const n =
|
|
468
|
-
return
|
|
466
|
+
function Xt(e, t) {
|
|
467
|
+
const n = ee(e, Wi, "canonical signature");
|
|
468
|
+
return v(n.schemaVersion, 1, "signature schemaVersion"), q(n.keyId, We, "signature keyId"), v(n.identityScheme, Ee, "signature identityScheme"), v(n.algorithm, "ed25519", "signature algorithm"), v(n.encoding, "raw", "signature encoding"), v(n.signatureProfile, Pe, "signature profile"), Zi(n.canonicalEnvelope, t, n), q(n.signedDigestSha256, le, "signedDigestSha256"), q(n.signatureHex, Fn, "signatureHex"), de([
|
|
469
469
|
["algorithm", "ed25519"],
|
|
470
470
|
["canonicalEnvelope", n.canonicalEnvelope],
|
|
471
471
|
["encoding", "raw"],
|
|
472
|
-
["identityScheme",
|
|
472
|
+
["identityScheme", Ee],
|
|
473
473
|
["keyId", n.keyId],
|
|
474
474
|
["schemaVersion", 1],
|
|
475
475
|
["signatureHex", n.signatureHex],
|
|
476
|
-
["signatureProfile",
|
|
476
|
+
["signatureProfile", Pe],
|
|
477
477
|
["signedDigestSha256", n.signedDigestSha256]
|
|
478
478
|
]);
|
|
479
479
|
}
|
|
480
480
|
function ir(e) {
|
|
481
|
-
const t =
|
|
482
|
-
return
|
|
481
|
+
const t = ee(e, ["challengeBase64url", "protocolVersion"], "SDN login v1 request");
|
|
482
|
+
return v(t.protocolVersion, 1, "SDN login v1 protocolVersion"), Hn(t.challengeBase64url, "challengeBase64url"), de([
|
|
483
483
|
["challengeBase64url", t.challengeBase64url],
|
|
484
484
|
["protocolVersion", 1]
|
|
485
485
|
]);
|
|
486
486
|
}
|
|
487
487
|
function rr(e) {
|
|
488
|
-
const t =
|
|
488
|
+
const t = ee(e, [
|
|
489
489
|
"audience",
|
|
490
490
|
"challengeBase64url",
|
|
491
491
|
"expiresAt",
|
|
@@ -493,8 +493,8 @@ function rr(e) {
|
|
|
493
493
|
"nonce",
|
|
494
494
|
"protocolVersion"
|
|
495
495
|
], "SDN login v2 request");
|
|
496
|
-
return
|
|
497
|
-
["audience",
|
|
496
|
+
return v(t.protocolVersion, 2, "SDN login v2 protocolVersion"), v(t.audience, Vt, "SDN login v2 audience"), Hn(t.challengeBase64url, "challengeBase64url"), q(t.nonce, le, "SDN login nonce"), we(t.issuedAt, "SDN login issuedAt"), we(t.expiresAt, "SDN login expiresAt"), Nt(t.issuedAt, t.expiresAt), de([
|
|
497
|
+
["audience", Vt],
|
|
498
498
|
["challengeBase64url", t.challengeBase64url],
|
|
499
499
|
["expiresAt", t.expiresAt],
|
|
500
500
|
["issuedAt", t.issuedAt],
|
|
@@ -502,23 +502,23 @@ function rr(e) {
|
|
|
502
502
|
["protocolVersion", 2]
|
|
503
503
|
]);
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
const t =
|
|
507
|
-
return
|
|
505
|
+
function Kn(e) {
|
|
506
|
+
const t = ee(e, gt, "authority activation request");
|
|
507
|
+
return v(t.protocolVersion, 1, "activation protocolVersion"), v(t.audience, ki, "activation audience"), v(t.requestOrigin, Mn, "activation requestOrigin"), v(t.clientId, $n, "activation clientId"), v(t.serviceInstance, "assets.ipfs.01/asset-review-attestation", "activation serviceInstance"), v(t.purpose, "asset-review-authority-activation", "activation purpose"), q(t.nonce, le, "activation nonce"), we(t.issuedAt, "activation issuedAt"), we(t.expiresAt, "activation expiresAt"), Nt(t.issuedAt, t.expiresAt), q(t.publicKeyHex, le, "activation publicKeyHex"), q(t.keyId, We, "activation keyId"), v(t.identityScheme, Ee, "activation identityScheme"), v(t.signatureProfile, Pe, "activation signatureProfile"), de(gt.map((n) => [n, t[n]]));
|
|
508
508
|
}
|
|
509
|
-
function
|
|
510
|
-
|
|
509
|
+
function Dt(e, t, n) {
|
|
510
|
+
Jt(e, t, `${n} array`);
|
|
511
511
|
const i = Array.from({ length: t }, (r, s) => {
|
|
512
512
|
const a = e[s];
|
|
513
513
|
return (typeof a != "number" || !Number.isFinite(a)) && y(`${n} values must be finite numbers`), a;
|
|
514
514
|
});
|
|
515
|
-
return
|
|
515
|
+
return ot(i);
|
|
516
516
|
}
|
|
517
517
|
function sr(e) {
|
|
518
|
-
const t =
|
|
519
|
-
n.some((a) => Math.abs(a) >
|
|
518
|
+
const t = ee(e, zi, "reviewedTransform"), n = Dt(t.translation, 3, "translation"), i = Dt(t.rotation, 4, "rotation"), r = Dt(t.scale, 3, "scale");
|
|
519
|
+
n.some((a) => Math.abs(a) > xe.translationComponentAbsMax) && y("translation values exceed the reviewed transform policy"), r.some((a) => a <= xe.scaleComponentExclusiveMin || a > xe.scaleComponentInclusiveMax) && y("scale values exceed the reviewed transform policy");
|
|
520
520
|
const s = Math.hypot(...i);
|
|
521
|
-
return Math.abs(s - 1) >
|
|
521
|
+
return Math.abs(s - 1) > xe.quaternionNormTolerance && y("rotation must be a unit quaternion within the reviewed tolerance"), Qt(t.upAxis, xe.upAxes, "upAxis"), ue(t.sourceUnits, "sourceUnits"), Object.hasOwn(xe.metersPerSourceUnit, t.sourceUnits) || y("sourceUnits is not allowed by the reviewed transform policy"), (typeof t.metersPerSourceUnit != "number" || !Number.isFinite(t.metersPerSourceUnit) || t.metersPerSourceUnit !== xe.metersPerSourceUnit[t.sourceUnits]) && y("metersPerSourceUnit must exactly match sourceUnits"), de([
|
|
522
522
|
["metersPerSourceUnit", t.metersPerSourceUnit],
|
|
523
523
|
["rotation", i],
|
|
524
524
|
["scale", r],
|
|
@@ -527,43 +527,43 @@ function sr(e) {
|
|
|
527
527
|
["upAxis", t.upAxis]
|
|
528
528
|
]);
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function mn(e) {
|
|
531
531
|
return e >= 9 && e <= 13 || e === 32 || e === 160 || e === 5760 || e >= 8192 && e <= 8202 || e === 8232 || e === 8233 || e === 8239 || e === 8287 || e === 12288 || e === 65279;
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function gn(e, t, n) {
|
|
534
534
|
if (n && e === null) return null;
|
|
535
|
-
|
|
535
|
+
ue(e, t), (e.length === 0 || Se.encode(e).byteLength > 2e3) && y(`${t} has an invalid length`);
|
|
536
536
|
const i = Array.from(e, (r) => r.codePointAt(0));
|
|
537
|
-
return (
|
|
537
|
+
return (mn(i[0]) || mn(i[i.length - 1])) && y(`${t} must already be trimmed`), e;
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
const t =
|
|
541
|
-
|
|
539
|
+
function Jn(e) {
|
|
540
|
+
const t = qn(e);
|
|
541
|
+
Ot(t) || y("asset review decision request must be a JSON object");
|
|
542
542
|
const n = Object.getOwnPropertyDescriptor(t, "decision");
|
|
543
543
|
(!n || !n.enumerable || !("value" in n) || n.value === void 0) && y("asset review decision request has an invalid decision field");
|
|
544
|
-
const i = n.value, r = i === "approve" ? ["note", "reviewedTransform"] : i === "disapprove" ? ["reason"] : [], s =
|
|
545
|
-
|
|
544
|
+
const i = n.value, r = i === "approve" ? ["note", "reviewedTransform"] : i === "disapprove" ? ["reason"] : [], s = ee(t, [...$t, ...r], "asset review decision request");
|
|
545
|
+
v(s.protocolVersion, 1, "decision protocolVersion"), v(s.audience, Pi, "decision audience"), v(s.requestOrigin, Mn, "decision requestOrigin"), v(s.clientId, $n, "decision clientId"), q(s.challengeId, le, "challengeId"), q(s.nonce, le, "decision nonce"), we(s.issuedAt, "decision issuedAt"), we(s.expiresAt, "decision expiresAt"), Nt(s.issuedAt, s.expiresAt), q(s.modelSha256, le, "modelSha256"), q(s.metadataSha256, le, "metadataSha256"), s.previousDecisionHead !== null && q(s.previousDecisionHead, le, "previousDecisionHead"), Ji(s.modelCid, s.modelSha256), (!Number.isSafeInteger(s.modelBytes) || s.modelBytes <= 0) && y("modelBytes must be a positive safe integer"), ue(s.candidateKey, "candidateKey");
|
|
546
546
|
const a = "asset-review:", o = `:${s.modelSha256}`;
|
|
547
|
-
(!s.candidateKey.startsWith(a) || !s.candidateKey.endsWith(o) ||
|
|
547
|
+
(!s.candidateKey.startsWith(a) || !s.candidateKey.endsWith(o) || Se.encode(s.candidateKey).byteLength > 206) && y("candidateKey does not bind the model digest");
|
|
548
548
|
const c = s.candidateKey.slice(a.length, -o.length);
|
|
549
|
-
(!/^[a-z0-9-]+\/[a-z0-9][a-z0-9-]*$/u.test(c) ||
|
|
550
|
-
const l =
|
|
551
|
-
return i === "approve" ? (l.push(["note",
|
|
549
|
+
(!/^[a-z0-9-]+\/[a-z0-9][a-z0-9-]*$/u.test(c) || Se.encode(c).byteLength > 128) && y("candidateKey entityId is invalid");
|
|
550
|
+
const l = $t.map((u) => [u, s[u]]);
|
|
551
|
+
return i === "approve" ? (l.push(["note", gn(s.note, "note", !0)]), l.push(["reviewedTransform", sr(s.reviewedTransform)])) : l.push(["reason", gn(s.reason, "reason", !1)]), Object.values(s).filter((u) => typeof u == "string").reduce((u, f) => u + Se.encode(f).byteLength, 0) > 16384 && y("decision request strings exceed 16 KiB"), de(l);
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
return
|
|
553
|
+
function Qn(e, t) {
|
|
554
|
+
return ee(e, [], t), ot({});
|
|
555
555
|
}
|
|
556
556
|
function or(e) {
|
|
557
|
-
return
|
|
557
|
+
return Qn(e, "wallet connect request");
|
|
558
558
|
}
|
|
559
559
|
function ar(e) {
|
|
560
|
-
return
|
|
560
|
+
return Gn(e, "connect");
|
|
561
561
|
}
|
|
562
562
|
function cr(e) {
|
|
563
|
-
return
|
|
563
|
+
return Qn(e, "wallet account request");
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
return
|
|
565
|
+
function Yn(e) {
|
|
566
|
+
return Gn(e, "account");
|
|
567
567
|
}
|
|
568
568
|
function lr(e) {
|
|
569
569
|
return ir(e);
|
|
@@ -575,19 +575,19 @@ function dr(e) {
|
|
|
575
575
|
return rr(e);
|
|
576
576
|
}
|
|
577
577
|
function fr(e) {
|
|
578
|
-
return
|
|
578
|
+
return Xt(e, "sdn-login");
|
|
579
579
|
}
|
|
580
580
|
function pr(e) {
|
|
581
|
-
return
|
|
581
|
+
return Kn(e);
|
|
582
582
|
}
|
|
583
583
|
function hr(e) {
|
|
584
|
-
return
|
|
584
|
+
return Xt(e, "asset-review-authority-activation");
|
|
585
585
|
}
|
|
586
586
|
function yr(e) {
|
|
587
|
-
return
|
|
587
|
+
return Jn(e);
|
|
588
588
|
}
|
|
589
589
|
function mr(e) {
|
|
590
|
-
return
|
|
590
|
+
return Xt(e, "asset-review-attestation");
|
|
591
591
|
}
|
|
592
592
|
const gr = Object.freeze([
|
|
593
593
|
"callbackUri",
|
|
@@ -603,7 +603,7 @@ const gr = Object.freeze([
|
|
|
603
603
|
"schemaVersion",
|
|
604
604
|
"state",
|
|
605
605
|
"transactionId"
|
|
606
|
-
]),
|
|
606
|
+
]), Pt = /^[0-9a-f]{64}$/u, Xn = /^[A-Za-z0-9_-]{43}$/u, Ar = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, Er = new TextEncoder(), Zn = Object.freeze({
|
|
607
607
|
"sdn.auth.jcs-envelope.v2": Object.freeze({
|
|
608
608
|
parseRequest: dr,
|
|
609
609
|
buildResult: fr,
|
|
@@ -634,7 +634,7 @@ const gr = Object.freeze([
|
|
|
634
634
|
}),
|
|
635
635
|
"sdn.wallet.account.v1": Object.freeze({
|
|
636
636
|
parseRequest: cr,
|
|
637
|
-
buildResult:
|
|
637
|
+
buildResult: Yn,
|
|
638
638
|
connect: !0
|
|
639
639
|
}),
|
|
640
640
|
"sdn.wallet.connect.v1": Object.freeze({
|
|
@@ -643,21 +643,21 @@ const gr = Object.freeze([
|
|
|
643
643
|
connect: !0
|
|
644
644
|
})
|
|
645
645
|
});
|
|
646
|
-
class
|
|
646
|
+
class Le extends Error {
|
|
647
647
|
constructor(t) {
|
|
648
648
|
super(t), this.name = "WalletOperationError", this.code = t;
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
function $(e) {
|
|
652
|
-
throw new
|
|
652
|
+
throw new Le(e);
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function Zt(e) {
|
|
655
655
|
if (e === null || typeof e != "object" || Array.isArray(e)) return !1;
|
|
656
656
|
const t = Object.getPrototypeOf(e);
|
|
657
657
|
return t === Object.prototype || t === null;
|
|
658
658
|
}
|
|
659
659
|
function wr(e, t, n = "INVALID_TRANSACTION") {
|
|
660
|
-
|
|
660
|
+
Zt(e) || $(n);
|
|
661
661
|
let i;
|
|
662
662
|
try {
|
|
663
663
|
i = Reflect.ownKeys(e);
|
|
@@ -684,21 +684,21 @@ function br(e, t = "INVALID_TRANSACTION") {
|
|
|
684
684
|
const n = Date.parse(e);
|
|
685
685
|
return (!Number.isFinite(n) || new Date(n).toISOString() !== e) && $(t), n;
|
|
686
686
|
}
|
|
687
|
-
function
|
|
688
|
-
if (Array.isArray(e)) return Object.freeze(e.map(
|
|
689
|
-
if (!
|
|
687
|
+
function tt(e) {
|
|
688
|
+
if (Array.isArray(e)) return Object.freeze(e.map(tt));
|
|
689
|
+
if (!Zt(e)) return e;
|
|
690
690
|
const t = {};
|
|
691
|
-
for (const n of Object.keys(e).sort()) t[n] =
|
|
691
|
+
for (const n of Object.keys(e).sort()) t[n] = tt(e[n]);
|
|
692
692
|
return Object.freeze(t);
|
|
693
693
|
}
|
|
694
|
-
function
|
|
695
|
-
return e === null || typeof e == "boolean" || typeof e == "string" ? JSON.stringify(e) : typeof e == "number" ? (Number.isFinite(e) || $("INVALID_TRANSACTION"), JSON.stringify(e)) : Array.isArray(e) ? `[${e.map(
|
|
694
|
+
function At(e) {
|
|
695
|
+
return e === null || typeof e == "boolean" || typeof e == "string" ? JSON.stringify(e) : typeof e == "number" ? (Number.isFinite(e) || $("INVALID_TRANSACTION"), JSON.stringify(e)) : Array.isArray(e) ? `[${e.map(At).join(",")}]` : (Zt(e) || $("INVALID_TRANSACTION"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${At(e[t])}`).join(",")}}`);
|
|
696
696
|
}
|
|
697
697
|
async function Ir(e, t) {
|
|
698
698
|
typeof t != "function" && $("CRYPTO_UNAVAILABLE");
|
|
699
699
|
let n;
|
|
700
700
|
try {
|
|
701
|
-
n = await t(Er.encode(
|
|
701
|
+
n = await t(Er.encode(At(e)));
|
|
702
702
|
} catch {
|
|
703
703
|
$("CRYPTO_UNAVAILABLE");
|
|
704
704
|
}
|
|
@@ -719,12 +719,12 @@ function Sr(e, t) {
|
|
|
719
719
|
if (typeof e?.resolve == "function") return e.resolve(t);
|
|
720
720
|
if (typeof e == "function") return e(t);
|
|
721
721
|
} catch (n) {
|
|
722
|
-
if (n instanceof
|
|
722
|
+
if (n instanceof Le) throw n;
|
|
723
723
|
$("UNREGISTERED_TRANSACTION");
|
|
724
724
|
}
|
|
725
725
|
$("UNREGISTERED_TRANSACTION");
|
|
726
726
|
}
|
|
727
|
-
function
|
|
727
|
+
function oe({ document: e, window: t }) {
|
|
728
728
|
let n = !1;
|
|
729
729
|
try {
|
|
730
730
|
n = t?.top === t;
|
|
@@ -733,7 +733,7 @@ function ne({ document: e, window: t }) {
|
|
|
733
733
|
}
|
|
734
734
|
(!n || e?.visibilityState !== "visible" || typeof e?.hasFocus != "function" || e.hasFocus() !== !0) && $("WALLET_CONTEXT_UNTRUSTED");
|
|
735
735
|
}
|
|
736
|
-
async function
|
|
736
|
+
async function kt(e, {
|
|
737
737
|
registry: t,
|
|
738
738
|
relay: n,
|
|
739
739
|
sha256: i,
|
|
@@ -742,8 +742,8 @@ async function xt(e, {
|
|
|
742
742
|
expectedTransactionId: a = null
|
|
743
743
|
}) {
|
|
744
744
|
const o = wr(e, gr);
|
|
745
|
-
(o.schemaVersion !== 1 || typeof o.clientDisplayName != "string" || o.clientDisplayName.length < 1 || o.clientDisplayName.length > 80 || !
|
|
746
|
-
const c =
|
|
745
|
+
(o.schemaVersion !== 1 || typeof o.clientDisplayName != "string" || o.clientDisplayName.length < 1 || o.clientDisplayName.length > 80 || !Pt.test(o.transactionId) || !Pt.test(o.state) || !Pt.test(o.requestSha256) || !Xn.test(o.resultToken)) && $("INVALID_TRANSACTION"), a !== null && o.transactionId !== a && $("INVALID_TRANSACTION");
|
|
746
|
+
const c = Zn[o.operation];
|
|
747
747
|
c || $("UNREGISTERED_TRANSACTION");
|
|
748
748
|
const l = Sr(t, {
|
|
749
749
|
clientId: o.clientId,
|
|
@@ -762,21 +762,21 @@ async function xt(e, {
|
|
|
762
762
|
let p;
|
|
763
763
|
try {
|
|
764
764
|
p = await Ir(f, i);
|
|
765
|
-
} catch (
|
|
766
|
-
if (
|
|
765
|
+
} catch (A) {
|
|
766
|
+
if (A instanceof Le) throw A;
|
|
767
767
|
$("CRYPTO_UNAVAILABLE");
|
|
768
768
|
}
|
|
769
769
|
vr(p, o.requestSha256) || $("REQUEST_HASH_MISMATCH");
|
|
770
770
|
const g = { ...o, request: f };
|
|
771
771
|
return Object.freeze({
|
|
772
|
-
binding:
|
|
772
|
+
binding: tt(l),
|
|
773
773
|
operation: c,
|
|
774
|
-
request:
|
|
775
|
-
transaction:
|
|
774
|
+
request: tt(f),
|
|
775
|
+
transaction: tt(g)
|
|
776
776
|
});
|
|
777
777
|
}
|
|
778
778
|
function Rr(e) {
|
|
779
|
-
|
|
779
|
+
Xn.test(e) || $("INVALID_TRANSACTION");
|
|
780
780
|
let t;
|
|
781
781
|
try {
|
|
782
782
|
t = globalThis.atob(`${e.replace(/-/gu, "+").replace(/_/gu, "/")}=`);
|
|
@@ -786,13 +786,13 @@ function Rr(e) {
|
|
|
786
786
|
const n = Uint8Array.from(t, (i) => i.charCodeAt(0));
|
|
787
787
|
return n.byteLength !== 32 && $("INVALID_TRANSACTION"), n;
|
|
788
788
|
}
|
|
789
|
-
function
|
|
789
|
+
function pe(e, t, n, i) {
|
|
790
790
|
const r = e.createElement("div");
|
|
791
791
|
r.className = "wallet-confirmation-row";
|
|
792
792
|
const s = e.createElement("strong");
|
|
793
793
|
s.textContent = `${n}: `;
|
|
794
794
|
const a = e.createElement("span");
|
|
795
|
-
a.textContent = i === null ? "null" : typeof i == "string" ? i :
|
|
795
|
+
a.textContent = i === null ? "null" : typeof i == "string" ? i : At(i), r.append(s, a), t.append(r);
|
|
796
796
|
}
|
|
797
797
|
function Lr(e, {
|
|
798
798
|
binding: t,
|
|
@@ -803,10 +803,10 @@ function Lr(e, {
|
|
|
803
803
|
}) {
|
|
804
804
|
e.replaceChildren();
|
|
805
805
|
const a = n.createElement("h1");
|
|
806
|
-
a.id = "wallet-confirmation-heading", a.textContent = "Confirm wallet action", e.append(a),
|
|
806
|
+
a.id = "wallet-confirmation-heading", a.textContent = "Confirm wallet action", e.append(a), pe(n, e, "Client", t.clientDisplayName), pe(n, e, "Requesting origin", t.requestOrigin), pe(n, e, "Operation", t.operation), t.audience !== void 0 && pe(n, e, "Audience", t.audience), t.callbackUri !== void 0 && pe(n, e, "Callback URI", t.callbackUri), s && (pe(n, e, "Transaction ID", s.transactionId), pe(n, e, "Request hash", s.requestSha256), pe(n, e, "Registry release", s.registryVersion), pe(n, e, "Transaction expiry", s.expiresAt));
|
|
807
807
|
const o = t.operation.startsWith("sdn.asset-review.") ? "asset-review-approval" : t.operation.startsWith("sdn.auth.") ? "sdn-authentication" : null, c = o && Array.isArray(i?.keys) ? i.keys.find((l) => l?.purpose === o) : null;
|
|
808
|
-
c?.keyId &&
|
|
809
|
-
for (const l of Object.keys(r).sort())
|
|
808
|
+
c?.keyId && pe(n, e, "Signing key ID", c.keyId);
|
|
809
|
+
for (const l of Object.keys(r).sort()) pe(n, e, l, r[l]);
|
|
810
810
|
return e;
|
|
811
811
|
}
|
|
812
812
|
function Or({ binding: e, document: t, identity: n = null, request: i, transaction: r = null }) {
|
|
@@ -819,41 +819,41 @@ function Or({ binding: e, document: t, identity: n = null, request: i, transacti
|
|
|
819
819
|
const l = t.createElement("button");
|
|
820
820
|
l.type = "button", l.dataset.walletAction = "cancel", l.textContent = "Cancel", o.append(c, l), a.append(o), t.body.append(a);
|
|
821
821
|
let d = !1, u, f;
|
|
822
|
-
const p = new Promise((
|
|
823
|
-
u =
|
|
824
|
-
}), g = (
|
|
825
|
-
d ||
|
|
826
|
-
},
|
|
827
|
-
if (
|
|
828
|
-
if (
|
|
829
|
-
|
|
822
|
+
const p = new Promise((O, I) => {
|
|
823
|
+
u = O, f = I;
|
|
824
|
+
}), g = (O, I) => {
|
|
825
|
+
d || I?.isTrusted !== !0 || (d = !0, c.disabled = !0, l.disabled = !0, O ? u() : f(new Le("USER_CANCELLED")));
|
|
826
|
+
}, A = (O) => g(!0, O), h = (O) => g(!1, O), E = (O) => {
|
|
827
|
+
if (O?.isTrusted !== !0) return;
|
|
828
|
+
if (O.key === "Escape") {
|
|
829
|
+
O.preventDefault?.(), g(!1, O);
|
|
830
830
|
return;
|
|
831
831
|
}
|
|
832
|
-
if (
|
|
833
|
-
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
}, m = (
|
|
837
|
-
let
|
|
832
|
+
if (O.key !== "Tab") return;
|
|
833
|
+
O.preventDefault?.();
|
|
834
|
+
const I = t.activeElement;
|
|
835
|
+
O.shiftKey === !0 ? (I === c ? l : c).focus?.() : (I === l ? c : l).focus?.();
|
|
836
|
+
}, m = (O) => {
|
|
837
|
+
let I = !1;
|
|
838
838
|
try {
|
|
839
|
-
|
|
839
|
+
I = a.contains?.(O?.target) === !0;
|
|
840
840
|
} catch {
|
|
841
|
-
|
|
841
|
+
I = !1;
|
|
842
842
|
}
|
|
843
|
-
|
|
843
|
+
I || c.focus?.();
|
|
844
844
|
};
|
|
845
|
-
c.addEventListener("click",
|
|
845
|
+
c.addEventListener("click", A), l.addEventListener("click", h), a.addEventListener("keydown", E), t.addEventListener?.("focusin", m);
|
|
846
846
|
try {
|
|
847
847
|
c.focus?.();
|
|
848
848
|
} catch {
|
|
849
849
|
}
|
|
850
850
|
return Object.freeze({
|
|
851
851
|
promise: p,
|
|
852
|
-
cancel(
|
|
853
|
-
d || (d = !0, f(new
|
|
852
|
+
cancel(O = "STALE_CONTROLLER") {
|
|
853
|
+
d || (d = !0, f(new Le(O)));
|
|
854
854
|
},
|
|
855
855
|
destroy() {
|
|
856
|
-
c.removeEventListener?.("click",
|
|
856
|
+
c.removeEventListener?.("click", A), l.removeEventListener?.("click", h), a.removeEventListener?.("keydown", E), t.removeEventListener?.("focusin", m), a.remove();
|
|
857
857
|
try {
|
|
858
858
|
s?.focus?.();
|
|
859
859
|
} catch {
|
|
@@ -870,7 +870,7 @@ async function Nr({
|
|
|
870
870
|
transaction: r,
|
|
871
871
|
wasm: s
|
|
872
872
|
}) {
|
|
873
|
-
const a = s?.sdn ?? s, o =
|
|
873
|
+
const a = s?.sdn ?? s, o = Zn[r.operation];
|
|
874
874
|
if ((!o || !a) && $("OPERATION_NOT_ALLOWED"), o.connect)
|
|
875
875
|
return o.buildResult({
|
|
876
876
|
connectionExpiresAt: r.expiresAt,
|
|
@@ -892,14 +892,14 @@ async function Nr({
|
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
function Tr() {
|
|
895
|
-
return
|
|
895
|
+
return Yn({
|
|
896
896
|
connectionExpiresAt: null,
|
|
897
897
|
event: "disconnected",
|
|
898
898
|
identity: null,
|
|
899
899
|
schemaVersion: 1
|
|
900
900
|
});
|
|
901
901
|
}
|
|
902
|
-
const
|
|
902
|
+
const An = "webauthn-prf-hkdf-sha256-aes256gcm-v2", Cr = "sdn-bip32-slip10-purpose-v1", _r = "password-scrypt-v2", xr = Object.freeze([
|
|
903
903
|
"aad",
|
|
904
904
|
"canonicalUsername",
|
|
905
905
|
"ciphertextBase64url",
|
|
@@ -917,55 +917,55 @@ const gn = "webauthn-prf-hkdf-sha256-aes256gcm-v2", Cr = "sdn-bip32-slip10-purpo
|
|
|
917
917
|
"seedProfile",
|
|
918
918
|
"storageProfile",
|
|
919
919
|
"usernameSha256"
|
|
920
|
-
]),
|
|
920
|
+
]), Pr = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, kr = /^[0-9a-f]{64}$/u, Ur = /^[A-Za-z0-9_-]+$/u, jr = new TextEncoder(), ae = "sdn.wallet.remembered.v2", Re = `${ae}.pending`, pt = 16 * 1024, ei = Object.freeze([
|
|
921
921
|
"wallet_storage_metadata",
|
|
922
922
|
"wallet_storage_encrypted",
|
|
923
923
|
"wallet_storage_passkey_credential",
|
|
924
924
|
"encrypted_wallet",
|
|
925
925
|
"passkey_credential",
|
|
926
926
|
"passkey_wallet"
|
|
927
|
-
]),
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
...
|
|
931
|
-
]),
|
|
932
|
-
class
|
|
927
|
+
]), ti = /* @__PURE__ */ new Set([
|
|
928
|
+
ae,
|
|
929
|
+
Re,
|
|
930
|
+
...ei
|
|
931
|
+
]), Wt = /* @__PURE__ */ new WeakSet();
|
|
932
|
+
class at extends Error {
|
|
933
933
|
constructor(t) {
|
|
934
934
|
super(t), this.name = "WalletStorageError", this.code = t;
|
|
935
935
|
}
|
|
936
936
|
}
|
|
937
|
-
function
|
|
938
|
-
throw new
|
|
937
|
+
function C(e) {
|
|
938
|
+
throw new at(e);
|
|
939
939
|
}
|
|
940
|
-
function
|
|
940
|
+
function ni(e) {
|
|
941
941
|
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
942
942
|
const t = Object.getPrototypeOf(e);
|
|
943
943
|
return t === Object.prototype || t === null;
|
|
944
944
|
}
|
|
945
|
-
function
|
|
946
|
-
|
|
945
|
+
function En(e, t) {
|
|
946
|
+
ni(e) || C("INVALID_REMEMBERED_WALLET");
|
|
947
947
|
let n;
|
|
948
948
|
try {
|
|
949
949
|
n = Reflect.ownKeys(e);
|
|
950
950
|
} catch {
|
|
951
|
-
|
|
951
|
+
C("INVALID_REMEMBERED_WALLET");
|
|
952
952
|
}
|
|
953
|
-
n.some((a) => typeof a != "string") &&
|
|
953
|
+
n.some((a) => typeof a != "string") && C("INVALID_REMEMBERED_WALLET");
|
|
954
954
|
const i = [...t].sort(), r = [...n].sort();
|
|
955
|
-
(r.length !== i.length || r.some((a, o) => a !== i[o])) &&
|
|
955
|
+
(r.length !== i.length || r.some((a, o) => a !== i[o])) && C("INVALID_REMEMBERED_WALLET");
|
|
956
956
|
const s = {};
|
|
957
957
|
for (const a of i) {
|
|
958
958
|
let o;
|
|
959
959
|
try {
|
|
960
960
|
o = Object.getOwnPropertyDescriptor(e, a);
|
|
961
961
|
} catch {
|
|
962
|
-
|
|
962
|
+
C("INVALID_REMEMBERED_WALLET");
|
|
963
963
|
}
|
|
964
|
-
(!o?.enumerable || !("value" in o) || o.value === void 0) &&
|
|
964
|
+
(!o?.enumerable || !("value" in o) || o.value === void 0) && C("INVALID_REMEMBERED_WALLET"), s[a] = o.value;
|
|
965
965
|
}
|
|
966
966
|
return s;
|
|
967
967
|
}
|
|
968
|
-
function
|
|
968
|
+
function wn(e) {
|
|
969
969
|
if (typeof e != "string") return !1;
|
|
970
970
|
for (let t = 0; t < e.length; t += 1) {
|
|
971
971
|
const n = e.charCodeAt(t);
|
|
@@ -983,23 +983,23 @@ function Br(e) {
|
|
|
983
983
|
t += String.fromCharCode(...e.subarray(n, n + 32768));
|
|
984
984
|
return btoa(t).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
|
|
985
985
|
}
|
|
986
|
-
function
|
|
987
|
-
(typeof e != "string" || e.length === 0 || !Ur.test(e)) &&
|
|
986
|
+
function Ae(e, { minimum: t = 0, maximum: n = 65536, exact: i = null } = {}) {
|
|
987
|
+
(typeof e != "string" || e.length === 0 || !Ur.test(e)) && C("INVALID_REMEMBERED_WALLET");
|
|
988
988
|
const r = e.length % 4;
|
|
989
|
-
r === 1 &&
|
|
989
|
+
r === 1 && C("INVALID_REMEMBERED_WALLET");
|
|
990
990
|
const s = e.replace(/-/gu, "+").replace(/_/gu, "/") + "=".repeat((4 - r) % 4);
|
|
991
991
|
let a;
|
|
992
992
|
try {
|
|
993
993
|
a = atob(s);
|
|
994
994
|
} catch {
|
|
995
|
-
|
|
995
|
+
C("INVALID_REMEMBERED_WALLET");
|
|
996
996
|
}
|
|
997
997
|
const o = new Uint8Array(a.length);
|
|
998
998
|
for (let c = 0; c < a.length; c += 1) o[c] = a.charCodeAt(c);
|
|
999
|
-
return (Br(o) !== e || o.length < t || o.length > n || i !== null && o.length !== i) &&
|
|
999
|
+
return (Br(o) !== e || o.length < t || o.length > n || i !== null && o.length !== i) && C("INVALID_REMEMBERED_WALLET"), o;
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1002
|
-
return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e) ? JSON.stringify(e) : (
|
|
1001
|
+
function en(e) {
|
|
1002
|
+
return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e) ? JSON.stringify(e) : (ni(e) || C("INVALID_REMEMBERED_WALLET"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${en(e[t])}`).join(",")}}`);
|
|
1003
1003
|
}
|
|
1004
1004
|
function Vr(e) {
|
|
1005
1005
|
return Object.freeze({
|
|
@@ -1015,35 +1015,35 @@ function Vr(e) {
|
|
|
1015
1015
|
storageProfile: e.storageProfile
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1019
|
-
const t =
|
|
1020
|
-
return (t.schemaVersion !== 2 || t.storageProfile !==
|
|
1018
|
+
function ii(e) {
|
|
1019
|
+
const t = En(e, xr), n = En(t.aad, Dr), i = wn(t.canonicalUsername) ? jr.encode(t.canonicalUsername) : null;
|
|
1020
|
+
return (t.schemaVersion !== 2 || t.storageProfile !== An || n.schemaVersion !== 2 || n.storageProfile !== An || n.identityScheme !== Cr || n.seedProfile !== _r || !i || i.length < 3 || i.length > 64 || !/^[a-z0-9][a-z0-9._-]*$/u.test(t.canonicalUsername) || !kr.test(n.usernameSha256) || t.credentialIdBase64url !== n.credentialIdBase64url || !wn(t.createdAt) || !Pr.test(t.createdAt) || new Date(t.createdAt).toISOString() !== t.createdAt) && C("INVALID_REMEMBERED_WALLET"), Ae(t.credentialIdBase64url, { minimum: 1, maximum: 1024 }), Ae(t.ciphertextBase64url, { minimum: 17, maximum: 1024 }), Ae(t.hkdfSaltBase64url, { exact: 32 }), Ae(t.nonceBase64url, { exact: 12 }), Ae(t.prfInputBase64url, { exact: 32 }), Vr({ ...t, aad: n });
|
|
1021
1021
|
}
|
|
1022
1022
|
function Mr(e) {
|
|
1023
|
-
return
|
|
1023
|
+
return en(ii(e));
|
|
1024
1024
|
}
|
|
1025
|
-
function
|
|
1026
|
-
(typeof e != "string" || e.length === 0 || e.length > 131072) &&
|
|
1025
|
+
function tn(e) {
|
|
1026
|
+
(typeof e != "string" || e.length === 0 || e.length > 131072) && C("INVALID_REMEMBERED_WALLET");
|
|
1027
1027
|
let t;
|
|
1028
1028
|
try {
|
|
1029
1029
|
t = JSON.parse(e);
|
|
1030
1030
|
} catch {
|
|
1031
|
-
|
|
1031
|
+
C("INVALID_REMEMBERED_WALLET");
|
|
1032
1032
|
}
|
|
1033
|
-
const n =
|
|
1034
|
-
return
|
|
1033
|
+
const n = ii(t);
|
|
1034
|
+
return en(n) !== e && C("INVALID_REMEMBERED_WALLET"), n;
|
|
1035
1035
|
}
|
|
1036
|
-
function
|
|
1037
|
-
(!e || typeof e.getItem != "function") &&
|
|
1036
|
+
function zt(e, t, { pending: n = !1 } = {}) {
|
|
1037
|
+
(!e || typeof e.getItem != "function") && C("STORAGE_UNAVAILABLE");
|
|
1038
1038
|
let i;
|
|
1039
1039
|
try {
|
|
1040
1040
|
i = e.getItem(t);
|
|
1041
1041
|
} catch {
|
|
1042
|
-
|
|
1042
|
+
C("STORAGE_UNAVAILABLE");
|
|
1043
1043
|
}
|
|
1044
1044
|
if (i === null) return Object.freeze({ raw: null, record: null, status: "empty" });
|
|
1045
|
-
typeof i != "string" &&
|
|
1046
|
-
const r = i.length >
|
|
1045
|
+
typeof i != "string" && C("STORAGE_UNAVAILABLE");
|
|
1046
|
+
const r = i.length > pt;
|
|
1047
1047
|
if (n || r)
|
|
1048
1048
|
return Object.freeze({
|
|
1049
1049
|
exportable: !r,
|
|
@@ -1054,7 +1054,7 @@ function $t(e, t, { pending: n = !1 } = {}) {
|
|
|
1054
1054
|
status: "quarantined"
|
|
1055
1055
|
});
|
|
1056
1056
|
try {
|
|
1057
|
-
const s =
|
|
1057
|
+
const s = tn(i);
|
|
1058
1058
|
return Object.freeze({
|
|
1059
1059
|
raw: i,
|
|
1060
1060
|
record: s,
|
|
@@ -1071,8 +1071,8 @@ function $t(e, t, { pending: n = !1 } = {}) {
|
|
|
1071
1071
|
});
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const t =
|
|
1074
|
+
function ri(e) {
|
|
1075
|
+
const t = zt(e, Re, { pending: !0 }), n = zt(e, ae), i = t.status === "empty", r = n.status === "empty" || n.status === "valid";
|
|
1076
1076
|
return Object.freeze({
|
|
1077
1077
|
active: n,
|
|
1078
1078
|
canRestore: i && n.status === "valid",
|
|
@@ -1081,57 +1081,57 @@ function ni(e) {
|
|
|
1081
1081
|
});
|
|
1082
1082
|
}
|
|
1083
1083
|
function $r(e, t) {
|
|
1084
|
-
const n =
|
|
1085
|
-
n.canSetup ||
|
|
1084
|
+
const n = ri(e);
|
|
1085
|
+
n.canSetup || C("STORAGE_QUARANTINED");
|
|
1086
1086
|
const i = Mr(t);
|
|
1087
1087
|
try {
|
|
1088
|
-
e.setItem(
|
|
1088
|
+
e.setItem(Re, i);
|
|
1089
1089
|
} catch (a) {
|
|
1090
1090
|
throw a;
|
|
1091
1091
|
}
|
|
1092
1092
|
let r;
|
|
1093
1093
|
try {
|
|
1094
|
-
r = e.getItem(
|
|
1094
|
+
r = e.getItem(Re);
|
|
1095
1095
|
} catch {
|
|
1096
|
-
|
|
1096
|
+
C("STORAGE_UNAVAILABLE");
|
|
1097
1097
|
}
|
|
1098
|
-
r !== i &&
|
|
1098
|
+
r !== i && C("STORAGE_WRITE_FAILED"), tn(r);
|
|
1099
1099
|
const s = Object.freeze({
|
|
1100
1100
|
previousActiveRaw: n.active.raw,
|
|
1101
1101
|
serialized: i,
|
|
1102
1102
|
storage: e
|
|
1103
1103
|
});
|
|
1104
|
-
return
|
|
1104
|
+
return Wt.add(s), s;
|
|
1105
1105
|
}
|
|
1106
1106
|
function Fr(e, t) {
|
|
1107
|
-
(!
|
|
1107
|
+
(!Wt.has(t) || t.storage !== e) && C("INVALID_STORAGE_TRANSACTION"), Wt.delete(t);
|
|
1108
1108
|
let n, i;
|
|
1109
1109
|
try {
|
|
1110
|
-
n = e.getItem(
|
|
1110
|
+
n = e.getItem(Re), i = e.getItem(ae);
|
|
1111
1111
|
} catch {
|
|
1112
|
-
|
|
1112
|
+
C("STORAGE_UNAVAILABLE");
|
|
1113
1113
|
}
|
|
1114
|
-
(n !== t.serialized || i !== t.previousActiveRaw) &&
|
|
1114
|
+
(n !== t.serialized || i !== t.previousActiveRaw) && C("STORAGE_COLLISION"), e.removeItem(Re), e.getItem(Re) !== null && C("STORAGE_WRITE_FAILED"), e.setItem(ae, t.serialized);
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
|
|
1116
|
+
function nn(e, t) {
|
|
1117
|
+
ti.has(t) || C("INVALID_STORAGE_KEY"), (!e || typeof e.getItem != "function") && C("STORAGE_UNAVAILABLE");
|
|
1118
1118
|
let n;
|
|
1119
1119
|
try {
|
|
1120
1120
|
n = e.getItem(t);
|
|
1121
1121
|
} catch {
|
|
1122
|
-
|
|
1122
|
+
C("STORAGE_UNAVAILABLE");
|
|
1123
1123
|
}
|
|
1124
1124
|
if (n === null) return null;
|
|
1125
|
-
if (typeof n != "string" &&
|
|
1125
|
+
if (typeof n != "string" && C("STORAGE_UNAVAILABLE"), t === ae && n.length <= pt)
|
|
1126
1126
|
try {
|
|
1127
|
-
|
|
1127
|
+
tn(n), C("NOT_QUARANTINED");
|
|
1128
1128
|
} catch (i) {
|
|
1129
|
-
if (i instanceof
|
|
1129
|
+
if (i instanceof at && i.code === "NOT_QUARANTINED") throw i;
|
|
1130
1130
|
}
|
|
1131
1131
|
return Object.freeze({
|
|
1132
|
-
exportable: n.length <=
|
|
1132
|
+
exportable: n.length <= pt,
|
|
1133
1133
|
key: t,
|
|
1134
|
-
oversized: n.length >
|
|
1134
|
+
oversized: n.length > pt,
|
|
1135
1135
|
raw: n,
|
|
1136
1136
|
rawLength: n.length
|
|
1137
1137
|
});
|
|
@@ -1147,15 +1147,15 @@ function Wr(e) {
|
|
|
1147
1147
|
function zr(e) {
|
|
1148
1148
|
const t = [];
|
|
1149
1149
|
for (const n of [
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
...
|
|
1150
|
+
ae,
|
|
1151
|
+
Re,
|
|
1152
|
+
...ei
|
|
1153
1153
|
]) {
|
|
1154
1154
|
let i;
|
|
1155
1155
|
try {
|
|
1156
|
-
i =
|
|
1156
|
+
i = nn(e, n);
|
|
1157
1157
|
} catch (r) {
|
|
1158
|
-
if (r instanceof
|
|
1158
|
+
if (r instanceof at && r.code === "NOT_QUARANTINED") continue;
|
|
1159
1159
|
throw r;
|
|
1160
1160
|
}
|
|
1161
1161
|
i && t.push(Wr(i));
|
|
@@ -1163,33 +1163,33 @@ function zr(e) {
|
|
|
1163
1163
|
return Object.freeze(t);
|
|
1164
1164
|
}
|
|
1165
1165
|
function qr(e, t) {
|
|
1166
|
-
const n =
|
|
1167
|
-
return n ||
|
|
1166
|
+
const n = nn(e, t);
|
|
1167
|
+
return n || C("QUARANTINE_NOT_FOUND"), n.exportable || C("QUARANTINE_EXPORT_TOO_LARGE"), n.raw;
|
|
1168
1168
|
}
|
|
1169
1169
|
function Hr(e, t, n) {
|
|
1170
|
-
|
|
1170
|
+
ti.has(t) || C("INVALID_STORAGE_KEY"), n !== t && C("CONFIRMATION_REQUIRED"), nn(e, t) || C("QUARANTINE_NOT_FOUND");
|
|
1171
1171
|
try {
|
|
1172
|
-
e.removeItem(t), e.getItem(t) !== null &&
|
|
1172
|
+
e.removeItem(t), e.getItem(t) !== null && C("STORAGE_WRITE_FAILED");
|
|
1173
1173
|
} catch (r) {
|
|
1174
|
-
if (r instanceof
|
|
1175
|
-
|
|
1174
|
+
if (r instanceof at) throw r;
|
|
1175
|
+
C("STORAGE_UNAVAILABLE");
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
1178
|
function Gr(e, t) {
|
|
1179
|
-
t !==
|
|
1180
|
-
const n =
|
|
1181
|
-
n.status === "empty" &&
|
|
1179
|
+
t !== ae && C("CONFIRMATION_REQUIRED");
|
|
1180
|
+
const n = zt(e, ae);
|
|
1181
|
+
n.status === "empty" && C("REMEMBER_UNAVAILABLE"), n.status !== "valid" && C("STORAGE_QUARANTINED");
|
|
1182
1182
|
try {
|
|
1183
|
-
e.removeItem(
|
|
1183
|
+
e.removeItem(ae), e.getItem(ae) !== null && C("STORAGE_WRITE_FAILED");
|
|
1184
1184
|
} catch (i) {
|
|
1185
|
-
if (i instanceof
|
|
1186
|
-
|
|
1185
|
+
if (i instanceof at) throw i;
|
|
1186
|
+
C("STORAGE_UNAVAILABLE");
|
|
1187
1187
|
}
|
|
1188
1188
|
}
|
|
1189
|
-
const
|
|
1189
|
+
const Et = "sdn-bip32-slip10-purpose-v1", wt = "password-scrypt-v2", qt = "m/44'/0'/0'/2'/0'", rn = "Approval unavailable — migrate to the new wallet profile", bn = Object.freeze({
|
|
1190
1190
|
"bip39-mnemonic-v1-legacy": "sdn-bip39-auth-v1-legacy",
|
|
1191
1191
|
"password-fast-v1-legacy": "sdn-fast-password-auth-v1-legacy"
|
|
1192
|
-
}),
|
|
1192
|
+
}), In = new TextEncoder(), Kr = Uint8Array.prototype.fill, sn = Object.freeze([
|
|
1193
1193
|
"accountFingerprint",
|
|
1194
1194
|
"accountIndex",
|
|
1195
1195
|
"accountLabel",
|
|
@@ -1199,7 +1199,7 @@ const mt = "sdn-bip32-slip10-purpose-v1", gt = "password-scrypt-v2", Ft = "m/44'
|
|
|
1199
1199
|
"keys",
|
|
1200
1200
|
"schemaVersion",
|
|
1201
1201
|
"seedProfile"
|
|
1202
|
-
]),
|
|
1202
|
+
]), on = Object.freeze([
|
|
1203
1203
|
"bip32Fingerprint",
|
|
1204
1204
|
"curve",
|
|
1205
1205
|
"derivation",
|
|
@@ -1211,10 +1211,10 @@ const mt = "sdn-bip32-slip10-purpose-v1", gt = "password-scrypt-v2", Ft = "m/44'
|
|
|
1211
1211
|
"purpose",
|
|
1212
1212
|
"seedProfile",
|
|
1213
1213
|
"signatureProfile"
|
|
1214
|
-
]),
|
|
1214
|
+
]), bt = Object.freeze([
|
|
1215
1215
|
Object.freeze({
|
|
1216
1216
|
curve: "ed25519",
|
|
1217
|
-
path:
|
|
1217
|
+
path: qt,
|
|
1218
1218
|
purpose: "asset-review-approval",
|
|
1219
1219
|
signatureProfile: "ed25519-over-sha256-jcs-v1"
|
|
1220
1220
|
}),
|
|
@@ -1231,26 +1231,26 @@ const mt = "sdn-bip32-slip10-purpose-v1", gt = "password-scrypt-v2", Ft = "m/44'
|
|
|
1231
1231
|
signatureProfile: "ed25519-over-sha256-jcs-v1"
|
|
1232
1232
|
})
|
|
1233
1233
|
]);
|
|
1234
|
-
class
|
|
1234
|
+
class si extends Error {
|
|
1235
1235
|
constructor(t) {
|
|
1236
|
-
super(t === "APPROVAL_UNAVAILABLE" ?
|
|
1236
|
+
super(t === "APPROVAL_UNAVAILABLE" ? rn : t), this.name = "WalletAccountError", this.code = t;
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1240
|
-
throw new
|
|
1239
|
+
function M(e) {
|
|
1240
|
+
throw new si(e);
|
|
1241
1241
|
}
|
|
1242
|
-
function
|
|
1242
|
+
function vn(e) {
|
|
1243
1243
|
if (e instanceof Uint8Array)
|
|
1244
1244
|
try {
|
|
1245
1245
|
Kr.call(e, 0);
|
|
1246
1246
|
} catch {
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1250
|
-
if (Array.isArray(e)) return Object.freeze(e.map(
|
|
1249
|
+
function ke(e) {
|
|
1250
|
+
if (Array.isArray(e)) return Object.freeze(e.map(ke));
|
|
1251
1251
|
if (!e || typeof e != "object") return e;
|
|
1252
1252
|
const t = {};
|
|
1253
|
-
for (const n of Object.keys(e).sort()) t[n] =
|
|
1253
|
+
for (const n of Object.keys(e).sort()) t[n] = ke(e[n]);
|
|
1254
1254
|
return Object.freeze(t);
|
|
1255
1255
|
}
|
|
1256
1256
|
function Jr(e) {
|
|
@@ -1258,30 +1258,30 @@ function Jr(e) {
|
|
|
1258
1258
|
const t = Object.getPrototypeOf(e);
|
|
1259
1259
|
return t === Object.prototype || t === null;
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1262
|
-
Jr(e) ||
|
|
1261
|
+
function It(e, t) {
|
|
1262
|
+
Jr(e) || M("INVALID_PUBLIC_IDENTITY");
|
|
1263
1263
|
let n;
|
|
1264
1264
|
try {
|
|
1265
1265
|
n = Reflect.ownKeys(e);
|
|
1266
1266
|
} catch {
|
|
1267
|
-
|
|
1267
|
+
M("INVALID_PUBLIC_IDENTITY");
|
|
1268
1268
|
}
|
|
1269
|
-
n.some((a) => typeof a != "string") &&
|
|
1269
|
+
n.some((a) => typeof a != "string") && M("INVALID_PUBLIC_IDENTITY");
|
|
1270
1270
|
const i = [...n].sort(), r = [...t].sort();
|
|
1271
|
-
(i.length !== r.length || i.some((a, o) => a !== r[o])) &&
|
|
1271
|
+
(i.length !== r.length || i.some((a, o) => a !== r[o])) && M("INVALID_PUBLIC_IDENTITY");
|
|
1272
1272
|
const s = {};
|
|
1273
1273
|
for (const a of i) {
|
|
1274
1274
|
let o;
|
|
1275
1275
|
try {
|
|
1276
1276
|
o = Object.getOwnPropertyDescriptor(e, a);
|
|
1277
1277
|
} catch {
|
|
1278
|
-
|
|
1278
|
+
M("INVALID_PUBLIC_IDENTITY");
|
|
1279
1279
|
}
|
|
1280
|
-
(!o?.enumerable || !("value" in o) || o.value === void 0) &&
|
|
1280
|
+
(!o?.enumerable || !("value" in o) || o.value === void 0) && M("INVALID_PUBLIC_IDENTITY"), s[a] = o.value;
|
|
1281
1281
|
}
|
|
1282
1282
|
return s;
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1284
|
+
function Me(e) {
|
|
1285
1285
|
if (typeof e != "string") return !1;
|
|
1286
1286
|
for (let t = 0; t < e.length; t += 1) {
|
|
1287
1287
|
const n = e.charCodeAt(t);
|
|
@@ -1293,7 +1293,7 @@ function je(e) {
|
|
|
1293
1293
|
return !0;
|
|
1294
1294
|
}
|
|
1295
1295
|
function Qr(e) {
|
|
1296
|
-
if (!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length !==
|
|
1296
|
+
if (!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length !== bt.length) return !1;
|
|
1297
1297
|
let t;
|
|
1298
1298
|
try {
|
|
1299
1299
|
t = Reflect.ownKeys(e);
|
|
@@ -1302,7 +1302,7 @@ function Qr(e) {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
const n = ["0", "1", "2", "length"];
|
|
1304
1304
|
if (t.length !== n.length || t.some((i, r) => i !== n[r])) return !1;
|
|
1305
|
-
for (let i = 0; i <
|
|
1305
|
+
for (let i = 0; i < bt.length; i += 1) {
|
|
1306
1306
|
const r = Object.getOwnPropertyDescriptor(e, String(i));
|
|
1307
1307
|
if (!r?.enumerable || !("value" in r)) return !1;
|
|
1308
1308
|
}
|
|
@@ -1320,24 +1320,24 @@ function Yr(e) {
|
|
|
1320
1320
|
const n = Object.getOwnPropertyDescriptor(e, "0");
|
|
1321
1321
|
return n?.enumerable === !0 && "value" in n;
|
|
1322
1322
|
}
|
|
1323
|
-
function
|
|
1324
|
-
const t =
|
|
1325
|
-
(t.schemaVersion !== 1 || t.identityScheme !==
|
|
1326
|
-
const n =
|
|
1327
|
-
const s =
|
|
1328
|
-
return (s.bip32Fingerprint !== null || s.curve !== i.curve || s.derivation !== "slip10" || s.encoding !== "raw" || s.identityScheme !==
|
|
1323
|
+
function me(e) {
|
|
1324
|
+
const t = It(e, sn);
|
|
1325
|
+
(t.schemaVersion !== 1 || t.identityScheme !== Et || t.seedProfile !== wt || t.accountIndex !== 0 || t.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(t.accountFingerprint) || !Me(t.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(t.accountXpub) || !Me(t.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(t.accountPeerId) || !Qr(t.keys)) && M("INVALID_PUBLIC_IDENTITY");
|
|
1326
|
+
const n = bt.map((i, r) => {
|
|
1327
|
+
const s = It(t.keys[r], on);
|
|
1328
|
+
return (s.bip32Fingerprint !== null || s.curve !== i.curve || s.derivation !== "slip10" || s.encoding !== "raw" || s.identityScheme !== Et || s.path !== i.path || s.purpose !== i.purpose || s.seedProfile !== wt || s.signatureProfile !== i.signatureProfile || !/^[0-9a-f]{64}$/u.test(s.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(s.keyId)) && M("INVALID_PUBLIC_IDENTITY"), ke(s);
|
|
1329
1329
|
});
|
|
1330
|
-
return
|
|
1330
|
+
return ke({ ...t, keys: n });
|
|
1331
1331
|
}
|
|
1332
1332
|
function Xr(e, { accountIndex: t = 0, profile: n } = {}) {
|
|
1333
|
-
const i = Object.hasOwn(
|
|
1334
|
-
(!i || t !== 0) &&
|
|
1335
|
-
const r =
|
|
1336
|
-
(r.schemaVersion !== 1 || r.identityScheme !== i || r.seedProfile !== n || r.accountIndex !== t || r.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(r.accountFingerprint) || !
|
|
1337
|
-
const s =
|
|
1338
|
-
return (s.bip32Fingerprint !== null || s.curve !== "ed25519" || s.derivation !== "bip32-scalar-as-ed25519-seed" || s.encoding !== "raw" || s.identityScheme !== i || s.path !== `m/44'/0'/${t}'/0/0` || s.purpose !== "sdn-authentication" || s.seedProfile !== n || s.signatureProfile !== "ed25519-raw-32-v1" || !/^[0-9a-f]{64}$/u.test(s.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(s.keyId)) &&
|
|
1339
|
-
}
|
|
1340
|
-
function
|
|
1333
|
+
const i = Object.hasOwn(bn, n) ? bn[n] : null;
|
|
1334
|
+
(!i || t !== 0) && M("INVALID_LEGACY_PROFILE");
|
|
1335
|
+
const r = It(e, sn);
|
|
1336
|
+
(r.schemaVersion !== 1 || r.identityScheme !== i || r.seedProfile !== n || r.accountIndex !== t || r.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(r.accountFingerprint) || !Me(r.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(r.accountXpub) || !Me(r.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(r.accountPeerId) || !Yr(r.keys)) && M("INVALID_PUBLIC_IDENTITY");
|
|
1337
|
+
const s = It(r.keys[0], on);
|
|
1338
|
+
return (s.bip32Fingerprint !== null || s.curve !== "ed25519" || s.derivation !== "bip32-scalar-as-ed25519-seed" || s.encoding !== "raw" || s.identityScheme !== i || s.path !== `m/44'/0'/${t}'/0/0` || s.purpose !== "sdn-authentication" || s.seedProfile !== n || s.signatureProfile !== "ed25519-raw-32-v1" || !/^[0-9a-f]{64}$/u.test(s.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(s.keyId)) && M("INVALID_PUBLIC_IDENTITY"), ke({ ...r, keys: [s] });
|
|
1339
|
+
}
|
|
1340
|
+
function Sn(e) {
|
|
1341
1341
|
if (!(!e || typeof e != "object")) {
|
|
1342
1342
|
try {
|
|
1343
1343
|
e.value = "";
|
|
@@ -1373,7 +1373,7 @@ function vn(e) {
|
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
|
-
function
|
|
1376
|
+
function Rn(e, t) {
|
|
1377
1377
|
if (typeof e != "string" || typeof t != "string") return !1;
|
|
1378
1378
|
const n = Math.max(e.length, t.length);
|
|
1379
1379
|
let i = e.length ^ t.length;
|
|
@@ -1386,24 +1386,24 @@ function Sn(e, t) {
|
|
|
1386
1386
|
function Zr(e) {
|
|
1387
1387
|
return !e || typeof e != "object" || !Array.isArray(e.keys) ? null : e.keys.find((t) => t?.purpose === "asset-review-approval") ?? null;
|
|
1388
1388
|
}
|
|
1389
|
-
function
|
|
1389
|
+
function Ut(e, t) {
|
|
1390
1390
|
try {
|
|
1391
|
-
e =
|
|
1391
|
+
e = me(e), t = me(t);
|
|
1392
1392
|
} catch {
|
|
1393
1393
|
return !1;
|
|
1394
1394
|
}
|
|
1395
1395
|
let n = !0;
|
|
1396
|
-
for (const i of
|
|
1396
|
+
for (const i of sn.filter((r) => r !== "keys"))
|
|
1397
1397
|
n = e[i] === t[i] && n;
|
|
1398
|
-
for (let i = 0; i <
|
|
1398
|
+
for (let i = 0; i < bt.length; i += 1) {
|
|
1399
1399
|
const r = e.keys[i], s = t.keys[i];
|
|
1400
|
-
for (const a of
|
|
1400
|
+
for (const a of on.filter((o) => o !== "publicKeyHex" && o !== "keyId"))
|
|
1401
1401
|
n = r[a] === s[a] && n;
|
|
1402
|
-
n =
|
|
1402
|
+
n = Rn(r.publicKeyHex, s.publicKeyHex) && n, n = Rn(r.keyId.slice(7), s.keyId.slice(7)) && n;
|
|
1403
1403
|
}
|
|
1404
1404
|
return n;
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1406
|
+
function Be(e, t, n, i) {
|
|
1407
1407
|
const r = e.createElement("div");
|
|
1408
1408
|
r.className = "wallet-account-row";
|
|
1409
1409
|
const s = e.createElement("strong");
|
|
@@ -1411,12 +1411,12 @@ function Pe(e, t, n, i) {
|
|
|
1411
1411
|
const a = e.createElement("span");
|
|
1412
1412
|
a.textContent = i == null ? "" : String(i), r.append(s, a), t.append(r);
|
|
1413
1413
|
}
|
|
1414
|
-
function
|
|
1415
|
-
(e?.identityScheme !==
|
|
1414
|
+
function oi(e) {
|
|
1415
|
+
(e?.identityScheme !== Et || e?.seedProfile !== wt || e?.accountIndex !== 0) && M("APPROVAL_UNAVAILABLE");
|
|
1416
1416
|
const t = Zr(e);
|
|
1417
|
-
return (!t || t.identityScheme !== e.identityScheme || t.seedProfile !== e.seedProfile || t.signatureProfile !== "ed25519-over-sha256-jcs-v1" || t.curve !== "ed25519" || t.derivation !== "slip10" || t.path !==
|
|
1417
|
+
return (!t || t.identityScheme !== e.identityScheme || t.seedProfile !== e.seedProfile || t.signatureProfile !== "ed25519-over-sha256-jcs-v1" || t.curve !== "ed25519" || t.derivation !== "slip10" || t.path !== qt || t.encoding !== "raw" || !/^[0-9a-f]{64}$/u.test(t.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(t.keyId)) && M("APPROVAL_UNAVAILABLE"), ke({
|
|
1418
1418
|
algorithm: "Ed25519",
|
|
1419
|
-
derivationPath:
|
|
1419
|
+
derivationPath: qt,
|
|
1420
1420
|
encoding: "raw-32-byte",
|
|
1421
1421
|
identityScheme: e.identityScheme,
|
|
1422
1422
|
keyId: t.keyId,
|
|
@@ -1433,12 +1433,12 @@ function es(e) {
|
|
|
1433
1433
|
function ts(e, t, { document: n = e.ownerDocument } = {}) {
|
|
1434
1434
|
e.replaceChildren();
|
|
1435
1435
|
const i = n.createElement("h1");
|
|
1436
|
-
if (i.textContent = "Account", e.append(i),
|
|
1436
|
+
if (i.textContent = "Account", e.append(i), Be(n, e, "Username / account", t?.accountLabel ?? "account 0"), Be(n, e, "Account xpub", t?.accountXpub), Be(n, e, "Peer ID", t?.accountPeerId), Be(n, e, "Fingerprint", t?.accountFingerprint), t?.identityScheme !== Et || t?.seedProfile !== wt) {
|
|
1437
1437
|
const s = n.createElement("p");
|
|
1438
|
-
return s.textContent =
|
|
1438
|
+
return s.textContent = rn, e.append(s), Object.freeze({ approvalAvailable: !1 });
|
|
1439
1439
|
}
|
|
1440
|
-
const r =
|
|
1441
|
-
return
|
|
1440
|
+
const r = oi(t);
|
|
1441
|
+
return Be(n, e, "Asset approval public key", r.publicKeyHex), Be(n, e, "Asset approval key ID", r.keyId), Object.freeze({ approvalAvailable: !0, configuration: r });
|
|
1442
1442
|
}
|
|
1443
1443
|
function ns(e, { document: t = e.ownerDocument } = {}) {
|
|
1444
1444
|
e.replaceChildren();
|
|
@@ -1451,7 +1451,7 @@ function ns(e, { document: t = e.ownerDocument } = {}) {
|
|
|
1451
1451
|
const s = t.createElement("div");
|
|
1452
1452
|
s.hidden = !0;
|
|
1453
1453
|
const a = t.createElement("p");
|
|
1454
|
-
a.textContent = `Type ${
|
|
1454
|
+
a.textContent = `Type ${ae} to confirm.`;
|
|
1455
1455
|
const o = t.createElement("input");
|
|
1456
1456
|
o.type = "text", o.autocomplete = "off", o.spellcheck = !1, o.dataset.walletForgetConfirmation = "exact-storage-key";
|
|
1457
1457
|
const c = t.createElement("button");
|
|
@@ -1464,7 +1464,7 @@ function ns(e, { document: t = e.ownerDocument } = {}) {
|
|
|
1464
1464
|
confirm: c,
|
|
1465
1465
|
confirmation: o,
|
|
1466
1466
|
confirmationGroup: s,
|
|
1467
|
-
confirmationKey:
|
|
1467
|
+
confirmationKey: ae,
|
|
1468
1468
|
launch: r,
|
|
1469
1469
|
status: d
|
|
1470
1470
|
});
|
|
@@ -1491,16 +1491,16 @@ function is(e, t, { document: n = e.ownerDocument } = {}) {
|
|
|
1491
1491
|
p.type = "button", p.dataset.walletAction = "delete-quarantined-wallet", p.dataset.walletQuarantineKey = c.key, p.textContent = "Delete";
|
|
1492
1492
|
const g = n.createElement("div");
|
|
1493
1493
|
g.hidden = !0;
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1494
|
+
const A = n.createElement("p");
|
|
1495
|
+
A.textContent = `Type ${c.key} to confirm deletion.`;
|
|
1496
1496
|
const h = n.createElement("input");
|
|
1497
1497
|
h.type = "text", h.autocomplete = "off", h.spellcheck = !1, h.dataset.walletQuarantineConfirmation = c.key;
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1498
|
+
const E = n.createElement("button");
|
|
1499
|
+
E.type = "button", E.dataset.walletAction = "confirm-delete-quarantined-wallet", E.dataset.walletQuarantineKey = c.key, E.textContent = "Confirm delete";
|
|
1500
1500
|
const m = n.createElement("button");
|
|
1501
|
-
m.type = "button", m.dataset.walletAction = "cancel-delete-quarantined-wallet", m.dataset.walletQuarantineKey = c.key, m.textContent = "Cancel", g.append(
|
|
1501
|
+
m.type = "button", m.dataset.walletAction = "cancel-delete-quarantined-wallet", m.dataset.walletQuarantineKey = c.key, m.textContent = "Cancel", g.append(A, h, E, m), l.append(d, u, f, p, g), s.append(l), o.push(Object.freeze({
|
|
1502
1502
|
cancel: m,
|
|
1503
|
-
confirm:
|
|
1503
|
+
confirm: E,
|
|
1504
1504
|
confirmation: h,
|
|
1505
1505
|
confirmationGroup: g,
|
|
1506
1506
|
deleteButton: p,
|
|
@@ -1534,7 +1534,7 @@ async function rs(e, {
|
|
|
1534
1534
|
}
|
|
1535
1535
|
return a;
|
|
1536
1536
|
}
|
|
1537
|
-
async function
|
|
1537
|
+
async function Ln(e, t, n, {
|
|
1538
1538
|
assertCurrent: i,
|
|
1539
1539
|
ownBuffer: r,
|
|
1540
1540
|
ownHandle: s,
|
|
@@ -1545,9 +1545,9 @@ async function Rn(e, t, n, {
|
|
|
1545
1545
|
try {
|
|
1546
1546
|
i();
|
|
1547
1547
|
const p = c?.value, g = l?.value;
|
|
1548
|
-
(typeof p != "string" || typeof g != "string") &&
|
|
1548
|
+
(typeof p != "string" || typeof g != "string") && M("CREDENTIAL_CONFIRMATION_MISMATCH"), (!Me(p) || !Me(g)) && M("CREDENTIAL_CONFIRMATION_MISMATCH"), d = In.encode(p), r(d), u = In.encode(g), r(u);
|
|
1549
1549
|
} finally {
|
|
1550
|
-
|
|
1550
|
+
Sn(c), Sn(l);
|
|
1551
1551
|
const p = c?.form, g = l?.form;
|
|
1552
1552
|
try {
|
|
1553
1553
|
(p?.parentNode ?? p)?.remove?.();
|
|
@@ -1565,12 +1565,12 @@ async function Rn(e, t, n, {
|
|
|
1565
1565
|
accountIndex: 0,
|
|
1566
1566
|
passwordUtf8: u,
|
|
1567
1567
|
usernameUtf8: d
|
|
1568
|
-
}), f?.handle ||
|
|
1568
|
+
}), f?.handle || M("CREDENTIAL_CONFIRMATION_MISMATCH"), s(f.handle), i();
|
|
1569
1569
|
let p;
|
|
1570
1570
|
try {
|
|
1571
|
-
p =
|
|
1571
|
+
p = me(f.identity);
|
|
1572
1572
|
} catch {
|
|
1573
|
-
|
|
1573
|
+
M("CREDENTIAL_CONFIRMATION_MISMATCH");
|
|
1574
1574
|
}
|
|
1575
1575
|
return { handle: f.handle, identity: p };
|
|
1576
1576
|
} finally {
|
|
@@ -1591,11 +1591,11 @@ class ss {
|
|
|
1591
1591
|
constructor({ wasm: t, credentialRound: n, expectedIdentity: i = null }) {
|
|
1592
1592
|
this.#t = t?.sdn ?? t, this.#m = n;
|
|
1593
1593
|
try {
|
|
1594
|
-
this.#f = i === null ? null :
|
|
1594
|
+
this.#f = i === null ? null : me(i);
|
|
1595
1595
|
} catch {
|
|
1596
|
-
|
|
1596
|
+
M("CREDENTIAL_CONFIRMATION_MISMATCH");
|
|
1597
1597
|
}
|
|
1598
|
-
(typeof this.#t?.derivePasswordIdentity != "function" || typeof this.#t?.destroySdnIdentity != "function" || typeof n != "function") &&
|
|
1598
|
+
(typeof this.#t?.derivePasswordIdentity != "function" || typeof this.#t?.destroySdnIdentity != "function" || typeof n != "function") && M("CREDENTIAL_CONFIRMATION_MISMATCH");
|
|
1599
1599
|
}
|
|
1600
1600
|
get confirmed() {
|
|
1601
1601
|
return this.#d;
|
|
@@ -1607,30 +1607,30 @@ class ss {
|
|
|
1607
1607
|
return this.clear();
|
|
1608
1608
|
}
|
|
1609
1609
|
async confirm() {
|
|
1610
|
-
if (this.#h &&
|
|
1610
|
+
if (this.#h && M("CREDENTIAL_CONFIRMATION_MISMATCH"), this.#d) return this.#d;
|
|
1611
1611
|
this.#e += 1;
|
|
1612
1612
|
const t = this.#v;
|
|
1613
1613
|
let n, i;
|
|
1614
1614
|
try {
|
|
1615
|
-
this.#R(), this.#n.size !== 0 &&
|
|
1615
|
+
this.#R(), this.#n.size !== 0 && M("CREDENTIAL_CONFIRMATION_MISMATCH");
|
|
1616
1616
|
const s = {
|
|
1617
1617
|
assertCurrent: () => this.#p(t),
|
|
1618
1618
|
ownBuffer: (a) => this.#r.add(a),
|
|
1619
1619
|
ownHandle: (a) => this.#n.add(a),
|
|
1620
1620
|
releaseBuffer: (a) => {
|
|
1621
|
-
|
|
1621
|
+
vn(a), this.#r.delete(a);
|
|
1622
1622
|
}
|
|
1623
1623
|
};
|
|
1624
|
-
return n = await
|
|
1624
|
+
return n = await Ln(this.#t, this.#m, 1, s), this.#S(n.handle) || M("CREDENTIAL_CONFIRMATION_MISMATCH"), n.handle = null, this.#p(t), i = await Ln(this.#t, this.#m, 2, s), this.#S(i.handle) || M("CREDENTIAL_CONFIRMATION_MISMATCH"), i.handle = null, this.#p(t), (!Ut(n.identity, i.identity) || this.#f !== null && (!Ut(n.identity, this.#f) || !Ut(i.identity, this.#f))) && M("CREDENTIAL_CONFIRMATION_MISMATCH"), this.#n.size !== 0 && M("CREDENTIAL_CONFIRMATION_MISMATCH"), this.#d = oi(i.identity), this.#d;
|
|
1625
1625
|
} catch (r) {
|
|
1626
|
-
if (this.#d = null, r instanceof
|
|
1627
|
-
|
|
1626
|
+
if (this.#d = null, r instanceof si && r.code === "CREDENTIAL_CONFIRMATION_MISMATCH") throw r;
|
|
1627
|
+
M("CREDENTIAL_CONFIRMATION_MISMATCH");
|
|
1628
1628
|
} finally {
|
|
1629
1629
|
this.#o(), this.#R(), this.#e -= 1;
|
|
1630
1630
|
}
|
|
1631
1631
|
}
|
|
1632
1632
|
#p(t) {
|
|
1633
|
-
(this.#h || this.#v !== t) &&
|
|
1633
|
+
(this.#h || this.#v !== t) && M("CREDENTIAL_CONFIRMATION_MISMATCH");
|
|
1634
1634
|
}
|
|
1635
1635
|
#S(t) {
|
|
1636
1636
|
if (!this.#n.has(t)) return !0;
|
|
@@ -1650,7 +1650,7 @@ class ss {
|
|
|
1650
1650
|
#o() {
|
|
1651
1651
|
const t = [...this.#r];
|
|
1652
1652
|
this.#r.clear();
|
|
1653
|
-
for (const n of t)
|
|
1653
|
+
for (const n of t) vn(n);
|
|
1654
1654
|
}
|
|
1655
1655
|
}
|
|
1656
1656
|
async function os({
|
|
@@ -1666,10 +1666,10 @@ async function os({
|
|
|
1666
1666
|
}) {
|
|
1667
1667
|
const o = e?.sdn ?? e;
|
|
1668
1668
|
let c;
|
|
1669
|
-
return t === "password-fast-v1-legacy" ? (typeof o?.deriveLegacyPasswordIdentity != "function" &&
|
|
1669
|
+
return t === "password-fast-v1-legacy" ? (typeof o?.deriveLegacyPasswordIdentity != "function" && M("INVALID_LEGACY_PROFILE"), c = await o.deriveLegacyPasswordIdentity({ accountIndex: r, ...i })) : t === "bip39-mnemonic-v1-legacy" ? (typeof o?.importLegacyMnemonicIdentity != "function" && M("INVALID_LEGACY_PROFILE"), c = await o.importLegacyMnemonicIdentity({ accountIndex: r, ...i })) : M("INVALID_LEGACY_PROFILE"), c?.handle !== null && c?.handle !== void 0 && a(c.handle), s(), Object.freeze({
|
|
1670
1670
|
approval: null,
|
|
1671
1671
|
handle: c.handle,
|
|
1672
|
-
identity:
|
|
1672
|
+
identity: ke(c.identity),
|
|
1673
1673
|
legacy: !0
|
|
1674
1674
|
});
|
|
1675
1675
|
}
|
|
@@ -1693,17 +1693,17 @@ function as(e, { document: t = e.ownerDocument } = {}) {
|
|
|
1693
1693
|
const a = t.createElement("div");
|
|
1694
1694
|
return a.className = "wallet-legacy-comparison", e.append(n, i, r, s, a), Object.freeze({ launch: s, result: a, select: r });
|
|
1695
1695
|
}
|
|
1696
|
-
const
|
|
1696
|
+
const vt = Uint8Array, ai = ArrayBuffer, an = Object.getPrototypeOf(vt.prototype), cs = Object.getOwnPropertyDescriptor(an, "buffer").get, ls = Object.getOwnPropertyDescriptor(an, "byteLength").get, us = Object.getOwnPropertyDescriptor(an, "byteOffset").get, ds = Object.getOwnPropertyDescriptor(ai.prototype, "byteLength").get;
|
|
1697
1697
|
class fs extends Error {
|
|
1698
1698
|
constructor(t = "RNG_FAILURE") {
|
|
1699
1699
|
super(t), this.name = "WalletRandomError", this.code = t;
|
|
1700
1700
|
}
|
|
1701
1701
|
}
|
|
1702
|
-
function
|
|
1702
|
+
function ve() {
|
|
1703
1703
|
throw new fs();
|
|
1704
1704
|
}
|
|
1705
1705
|
function ps(e) {
|
|
1706
|
-
if (!(e instanceof
|
|
1706
|
+
if (!(e instanceof vt) || Object.getPrototypeOf(e) !== vt.prototype) return null;
|
|
1707
1707
|
let t, n, i;
|
|
1708
1708
|
try {
|
|
1709
1709
|
t = Reflect.apply(cs, e, []), n = Reflect.apply(ls, e, []), i = Reflect.apply(us, e, []);
|
|
@@ -1716,40 +1716,40 @@ function ps(e) {
|
|
|
1716
1716
|
} catch {
|
|
1717
1717
|
return null;
|
|
1718
1718
|
}
|
|
1719
|
-
return Object.getPrototypeOf(t) !==
|
|
1719
|
+
return Object.getPrototypeOf(t) !== ai.prototype || i !== 0 || n !== r || n !== 12 && n !== 32 ? null : t;
|
|
1720
1720
|
}
|
|
1721
1721
|
function hs({ getRandomValues: e, observedWrite: t } = {}) {
|
|
1722
1722
|
if (typeof e != "function")
|
|
1723
|
-
return () =>
|
|
1723
|
+
return () => ve();
|
|
1724
1724
|
const n = /* @__PURE__ */ new WeakSet(), i = /* @__PURE__ */ new WeakSet();
|
|
1725
1725
|
return function(s) {
|
|
1726
1726
|
const a = ps(s);
|
|
1727
|
-
(!a || n.has(s) || i.has(a)) &&
|
|
1727
|
+
(!a || n.has(s) || i.has(a)) && ve(), n.add(s), i.add(a);
|
|
1728
1728
|
let o;
|
|
1729
1729
|
try {
|
|
1730
1730
|
o = e(s);
|
|
1731
1731
|
} catch {
|
|
1732
|
-
|
|
1732
|
+
ve();
|
|
1733
1733
|
}
|
|
1734
|
-
if (o !== s &&
|
|
1735
|
-
typeof t != "function" &&
|
|
1734
|
+
if (o !== s && ve(), t !== void 0) {
|
|
1735
|
+
typeof t != "function" && ve();
|
|
1736
1736
|
let c = !1;
|
|
1737
1737
|
try {
|
|
1738
1738
|
c = t(s) === !0;
|
|
1739
1739
|
} catch {
|
|
1740
|
-
|
|
1740
|
+
ve();
|
|
1741
1741
|
}
|
|
1742
|
-
c ||
|
|
1742
|
+
c || ve();
|
|
1743
1743
|
}
|
|
1744
1744
|
return s;
|
|
1745
1745
|
};
|
|
1746
1746
|
}
|
|
1747
|
-
function
|
|
1748
|
-
(typeof e != "function" || t !== 12 && t !== 32) &&
|
|
1749
|
-
const n = new
|
|
1747
|
+
function Ve(e, t) {
|
|
1748
|
+
(typeof e != "function" || t !== 12 && t !== 32) && ve();
|
|
1749
|
+
const n = new vt(t);
|
|
1750
1750
|
return e(n);
|
|
1751
1751
|
}
|
|
1752
|
-
const
|
|
1752
|
+
const nt = new TextEncoder(), ys = new TextDecoder("utf-8", { fatal: !0 }), ms = Uint8Array.prototype.fill, gs = Uint8Array.prototype.slice, As = Uint8Array.prototype.subarray, cn = Object.getPrototypeOf(Uint8Array.prototype), Es = Object.getOwnPropertyDescriptor(cn, "buffer").get, ci = Object.getOwnPropertyDescriptor(cn, "byteLength").get, ws = Object.getOwnPropertyDescriptor(cn, "byteOffset").get, li = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, bs = ArrayBuffer.prototype.slice, On = "webauthn-prf-hkdf-sha256-aes256gcm-v2", Is = "sdn-bip32-slip10-purpose-v1", vs = "password-scrypt-v2", Ss = "Space Data Network Wallet", ui = 12e4;
|
|
1753
1753
|
class Rs extends Error {
|
|
1754
1754
|
constructor(t) {
|
|
1755
1755
|
super(t), this.name = "RememberedWalletError", this.code = t;
|
|
@@ -1758,20 +1758,33 @@ class Rs extends Error {
|
|
|
1758
1758
|
function _(e) {
|
|
1759
1759
|
throw new Rs(e);
|
|
1760
1760
|
}
|
|
1761
|
-
function
|
|
1761
|
+
function Nn(e) {
|
|
1762
|
+
if (typeof e != "string") return "";
|
|
1763
|
+
const t = e.trim().toLowerCase();
|
|
1764
|
+
return t.endsWith(".") ? t.slice(0, -1) : t;
|
|
1765
|
+
}
|
|
1766
|
+
function Ls(e, t) {
|
|
1767
|
+
if (e == null || e === "") return;
|
|
1768
|
+
const n = Nn(e);
|
|
1769
|
+
n === "" && _("INVALID_RP_ID");
|
|
1770
|
+
const i = Nn(t);
|
|
1771
|
+
if (i === "" || n === i || i.endsWith(`.${n}`)) return n;
|
|
1772
|
+
_("INVALID_RP_ID");
|
|
1773
|
+
}
|
|
1774
|
+
function D(e) {
|
|
1762
1775
|
if (e instanceof Uint8Array)
|
|
1763
1776
|
try {
|
|
1764
1777
|
ms.call(e, 0);
|
|
1765
1778
|
} catch {
|
|
1766
1779
|
}
|
|
1767
1780
|
}
|
|
1768
|
-
function
|
|
1781
|
+
function St(e) {
|
|
1769
1782
|
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
1770
1783
|
const t = Object.getPrototypeOf(e);
|
|
1771
1784
|
return t === Object.prototype || t === null;
|
|
1772
1785
|
}
|
|
1773
|
-
function
|
|
1774
|
-
if (!
|
|
1786
|
+
function di(e, t) {
|
|
1787
|
+
if (!St(e)) return !1;
|
|
1775
1788
|
let n;
|
|
1776
1789
|
try {
|
|
1777
1790
|
n = Reflect.ownKeys(e);
|
|
@@ -1782,8 +1795,8 @@ function ui(e, t) {
|
|
|
1782
1795
|
const i = [...n].sort(), r = [...t].sort();
|
|
1783
1796
|
return i.length === r.length && i.every((s, a) => s === r[a]);
|
|
1784
1797
|
}
|
|
1785
|
-
function
|
|
1786
|
-
if (!
|
|
1798
|
+
function it(e, t) {
|
|
1799
|
+
if (!di(e, t)) return null;
|
|
1787
1800
|
const n = {};
|
|
1788
1801
|
for (const i of t) {
|
|
1789
1802
|
let r;
|
|
@@ -1798,38 +1811,38 @@ function et(e, t) {
|
|
|
1798
1811
|
}
|
|
1799
1812
|
return n;
|
|
1800
1813
|
}
|
|
1801
|
-
function
|
|
1814
|
+
function ht(e, t = null) {
|
|
1802
1815
|
if (!(e instanceof Uint8Array) || Object.getPrototypeOf(e) !== Uint8Array.prototype)
|
|
1803
1816
|
return !1;
|
|
1804
1817
|
let n, i, r, s;
|
|
1805
1818
|
try {
|
|
1806
|
-
n = Reflect.apply(Es, e, []), i = Reflect.apply(
|
|
1819
|
+
n = Reflect.apply(Es, e, []), i = Reflect.apply(ci, e, []), r = Reflect.apply(ws, e, []), s = Reflect.apply(li, n, []);
|
|
1807
1820
|
} catch {
|
|
1808
1821
|
return !1;
|
|
1809
1822
|
}
|
|
1810
1823
|
return Object.getPrototypeOf(n) === ArrayBuffer.prototype && r === 0 && i === s && (t === null || i === t);
|
|
1811
1824
|
}
|
|
1812
|
-
function
|
|
1825
|
+
function fi(e, t, n) {
|
|
1813
1826
|
if (!(e instanceof ArrayBuffer) || Object.getPrototypeOf(e) !== ArrayBuffer.prototype)
|
|
1814
1827
|
return !1;
|
|
1815
1828
|
let i;
|
|
1816
1829
|
try {
|
|
1817
|
-
i = Reflect.apply(
|
|
1830
|
+
i = Reflect.apply(li, e, []);
|
|
1818
1831
|
} catch {
|
|
1819
1832
|
return !1;
|
|
1820
1833
|
}
|
|
1821
1834
|
return i >= t && i <= n;
|
|
1822
1835
|
}
|
|
1823
|
-
function
|
|
1836
|
+
function De(e) {
|
|
1824
1837
|
try {
|
|
1825
|
-
return Reflect.apply(
|
|
1838
|
+
return Reflect.apply(ci, e, []);
|
|
1826
1839
|
} catch {
|
|
1827
1840
|
return -1;
|
|
1828
1841
|
}
|
|
1829
1842
|
}
|
|
1830
|
-
function
|
|
1843
|
+
function Qe(e) {
|
|
1831
1844
|
let t = "";
|
|
1832
|
-
const n =
|
|
1845
|
+
const n = De(e);
|
|
1833
1846
|
n < 0 && _("INVALID_REMEMBERED_WALLET");
|
|
1834
1847
|
for (let i = 0; i < n; i += 32768)
|
|
1835
1848
|
t += String.fromCharCode(...Reflect.apply(
|
|
@@ -1839,17 +1852,17 @@ function Ge(e) {
|
|
|
1839
1852
|
));
|
|
1840
1853
|
return btoa(t).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
|
|
1841
1854
|
}
|
|
1842
|
-
function
|
|
1855
|
+
function Os(e) {
|
|
1843
1856
|
let t = "";
|
|
1844
1857
|
for (const n of e) t += n.toString(16).padStart(2, "0");
|
|
1845
1858
|
return t;
|
|
1846
1859
|
}
|
|
1847
|
-
function
|
|
1848
|
-
return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e) ? JSON.stringify(e) : Array.isArray(e) ? `[${e.map(
|
|
1860
|
+
function $e(e) {
|
|
1861
|
+
return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e) ? JSON.stringify(e) : Array.isArray(e) ? `[${e.map($e).join(",")}]` : (St(e) || _("INVALID_REMEMBERED_WALLET"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${$e(e[t])}`).join(",")}}`);
|
|
1849
1862
|
}
|
|
1850
|
-
function
|
|
1863
|
+
function Ns(e, t) {
|
|
1851
1864
|
if (!(e instanceof Uint8Array) || !(t instanceof Uint8Array)) return !1;
|
|
1852
|
-
const n =
|
|
1865
|
+
const n = De(e), i = De(t);
|
|
1853
1866
|
if (n < 0 || i < 0) return !1;
|
|
1854
1867
|
const r = Math.max(n, i);
|
|
1855
1868
|
let s = n ^ i;
|
|
@@ -1857,10 +1870,10 @@ function Os(e, t) {
|
|
|
1857
1870
|
s |= (e[a] ?? 0) ^ (t[a] ?? 0);
|
|
1858
1871
|
return s === 0;
|
|
1859
1872
|
}
|
|
1860
|
-
function
|
|
1861
|
-
return
|
|
1873
|
+
function Ts(e, t) {
|
|
1874
|
+
return $e(e) === $e(t);
|
|
1862
1875
|
}
|
|
1863
|
-
function
|
|
1876
|
+
function pi(e) {
|
|
1864
1877
|
(!e || typeof e != "object" && typeof e != "function") && _("WEBAUTHN_INVALID_RESPONSE");
|
|
1865
1878
|
let t, n, i;
|
|
1866
1879
|
try {
|
|
@@ -1868,7 +1881,7 @@ function fi(e) {
|
|
|
1868
1881
|
} catch {
|
|
1869
1882
|
_("WEBAUTHN_INVALID_RESPONSE");
|
|
1870
1883
|
}
|
|
1871
|
-
return (t !== "public-key" || !
|
|
1884
|
+
return (t !== "public-key" || !fi(n, 1, 1024) || typeof i != "function") && _("WEBAUTHN_INVALID_RESPONSE"), Object.freeze({
|
|
1872
1885
|
rawId: new Uint8Array(Reflect.apply(bs, n, [0])),
|
|
1873
1886
|
readExtensionResults() {
|
|
1874
1887
|
try {
|
|
@@ -1879,19 +1892,19 @@ function fi(e) {
|
|
|
1879
1892
|
}
|
|
1880
1893
|
});
|
|
1881
1894
|
}
|
|
1882
|
-
function
|
|
1883
|
-
const t =
|
|
1895
|
+
function Cs(e) {
|
|
1896
|
+
const t = it(e.readExtensionResults(), ["prf"]), n = t ? it(t.prf, ["enabled"]) : null;
|
|
1884
1897
|
(!n || n.enabled !== !0) && _("WEBAUTHN_PRF_REQUIRED");
|
|
1885
1898
|
}
|
|
1886
|
-
function
|
|
1887
|
-
const n =
|
|
1888
|
-
|
|
1889
|
-
const r =
|
|
1890
|
-
|
|
1899
|
+
function _s(e, t) {
|
|
1900
|
+
const n = pi(e), i = n.rawId;
|
|
1901
|
+
Ns(i, t) || (D(i), _("WEBAUTHN_CREDENTIAL_MISMATCH")), D(i);
|
|
1902
|
+
const r = it(n.readExtensionResults(), ["prf"]), s = r ? it(r.prf, ["results"]) : null, o = (s ? it(s.results, ["first"]) : null)?.first;
|
|
1903
|
+
fi(o, 32, 32) || _("WEBAUTHN_PRF_REQUIRED");
|
|
1891
1904
|
const c = new Uint8Array(o), l = Reflect.apply(gs, c, []);
|
|
1892
|
-
return
|
|
1905
|
+
return D(c), l;
|
|
1893
1906
|
}
|
|
1894
|
-
function
|
|
1907
|
+
function xs({ challenge: e, credentialId: t, prfInput: n, rpId: i, signal: r }) {
|
|
1895
1908
|
return {
|
|
1896
1909
|
publicKey: {
|
|
1897
1910
|
allowCredentials: [{
|
|
@@ -1900,31 +1913,32 @@ function _s({ challenge: e, credentialId: t, prfInput: n, signal: i }) {
|
|
|
1900
1913
|
}],
|
|
1901
1914
|
challenge: e,
|
|
1902
1915
|
extensions: { prf: { eval: { first: n } } },
|
|
1903
|
-
rpId:
|
|
1904
|
-
timeout:
|
|
1916
|
+
...i === void 0 ? {} : { rpId: i },
|
|
1917
|
+
timeout: ui,
|
|
1905
1918
|
userVerification: "required"
|
|
1906
1919
|
},
|
|
1907
|
-
signal:
|
|
1920
|
+
signal: r
|
|
1908
1921
|
};
|
|
1909
1922
|
}
|
|
1910
|
-
async function
|
|
1911
|
-
const
|
|
1912
|
-
let
|
|
1923
|
+
async function Tn({ assertCurrent: e, credentials: t, credentialId: n, fillRandom: i, prfInput: r, rpId: s, signal: a }) {
|
|
1924
|
+
const o = Ve(i, 32);
|
|
1925
|
+
let c;
|
|
1913
1926
|
try {
|
|
1914
|
-
|
|
1915
|
-
challenge:
|
|
1927
|
+
c = await t.get(xs({
|
|
1928
|
+
challenge: o,
|
|
1916
1929
|
credentialId: n,
|
|
1917
1930
|
prfInput: r,
|
|
1918
|
-
|
|
1931
|
+
rpId: s,
|
|
1932
|
+
signal: a
|
|
1919
1933
|
}));
|
|
1920
|
-
} catch (
|
|
1921
|
-
throw e(),
|
|
1934
|
+
} catch (l) {
|
|
1935
|
+
throw e(), l;
|
|
1922
1936
|
} finally {
|
|
1923
|
-
|
|
1937
|
+
D(o);
|
|
1924
1938
|
}
|
|
1925
|
-
return e(),
|
|
1939
|
+
return e(), _s(c, n);
|
|
1926
1940
|
}
|
|
1927
|
-
function
|
|
1941
|
+
function Ds(e) {
|
|
1928
1942
|
if (typeof e != "string") return !1;
|
|
1929
1943
|
for (let t = 0; t < e.length; t += 1) {
|
|
1930
1944
|
const n = e.charCodeAt(t);
|
|
@@ -1936,212 +1950,214 @@ function xs(e) {
|
|
|
1936
1950
|
}
|
|
1937
1951
|
return !0;
|
|
1938
1952
|
}
|
|
1939
|
-
function
|
|
1953
|
+
function Ps(e) {
|
|
1940
1954
|
if (typeof e == "string")
|
|
1941
|
-
return
|
|
1942
|
-
(!
|
|
1955
|
+
return Ds(e) || _("INVALID_USERNAME"), nt.encode(e).length > 256 && _("INVALID_USERNAME"), e;
|
|
1956
|
+
(!ht(e) || De(e) > 256) && _("INVALID_USERNAME");
|
|
1943
1957
|
try {
|
|
1944
1958
|
return ys.decode(e);
|
|
1945
1959
|
} catch {
|
|
1946
1960
|
_("INVALID_USERNAME");
|
|
1947
1961
|
}
|
|
1948
1962
|
}
|
|
1949
|
-
function
|
|
1950
|
-
const n =
|
|
1963
|
+
function Ht(e) {
|
|
1964
|
+
const n = Ps(e).replace(/^ +/u, "").replace(/ +$/u, "").replace(/[A-Z]/gu, (r) => r.toLowerCase()), i = nt.encode(n);
|
|
1951
1965
|
return (i.length < 3 || i.length > 64 || !/^[a-z0-9][a-z0-9._-]*$/u.test(n)) && _("INVALID_USERNAME"), n;
|
|
1952
1966
|
}
|
|
1953
1967
|
function ks(e) {
|
|
1954
1968
|
let t;
|
|
1955
1969
|
try {
|
|
1956
|
-
t =
|
|
1970
|
+
t = Bn(e?.module);
|
|
1957
1971
|
} catch {
|
|
1958
1972
|
_("WASM_UNAVAILABLE");
|
|
1959
1973
|
}
|
|
1960
|
-
return (!
|
|
1974
|
+
return (!di(t, ["sdn", "sha256"]) || typeof t.sha256 != "function" || !t.sdn || typeof t.sdn != "object") && _("WASM_UNAVAILABLE"), t;
|
|
1961
1975
|
}
|
|
1962
|
-
function
|
|
1963
|
-
const t = ks(e), n = t.sdn, i = e?.storage, r = e?.credentials, s = hs(e?.rng), a = e?.createRequestController, o = e?.releaseRequestController, c = e?.ownHandle, l = e?.destroyHandle, d = e?.ownedHandlesClean, u = e?.now ?? (() => /* @__PURE__ */ new Date()), f = () => typeof r?.create == "function" && typeof r?.get == "function",
|
|
1964
|
-
let
|
|
1976
|
+
function Us(e) {
|
|
1977
|
+
const t = ks(e), n = t.sdn, i = e?.storage, r = e?.credentials, s = hs(e?.rng), a = e?.createRequestController, o = e?.releaseRequestController, c = e?.ownHandle, l = e?.destroyHandle, d = e?.ownedHandlesClean, u = e?.now ?? (() => /* @__PURE__ */ new Date()), f = e?.rpHostname ?? e?.window?.location?.hostname ?? globalThis?.location?.hostname, p = Ls(e?.rpId, f), g = typeof e?.rpName == "string" && e.rpName !== "" ? e.rpName : Ss, A = () => typeof r?.create == "function" && typeof r?.get == "function", h = () => ri(i), E = () => zr(i), m = (N) => qr(i, N), O = (N, F) => (Hr(i, N, F), E().some((b) => b.key === N) && _("STORAGE_WRITE_FAILED"), !0), I = () => h().active.status === "valid", B = ({ confirmation: N } = {}) => (I() || _("REMEMBER_UNAVAILABLE"), Gr(i, N), h().active.status !== "empty" && _("STORAGE_WRITE_FAILED"), !0), P = async (N) => {
|
|
1978
|
+
let F;
|
|
1965
1979
|
try {
|
|
1966
|
-
|
|
1980
|
+
F = await t.sha256(nt.encode(N));
|
|
1967
1981
|
} catch {
|
|
1968
1982
|
_("WASM_FAILURE");
|
|
1969
1983
|
}
|
|
1970
|
-
return
|
|
1984
|
+
return ht(F, 32) || _("WASM_FAILURE"), Os(F);
|
|
1971
1985
|
};
|
|
1972
1986
|
return Object.freeze({
|
|
1973
|
-
canForget:
|
|
1974
|
-
deleteQuarantine:
|
|
1975
|
-
exportQuarantine:
|
|
1976
|
-
forget:
|
|
1977
|
-
inspect:
|
|
1978
|
-
listQuarantine:
|
|
1979
|
-
restore: async ({ assertCurrent:
|
|
1980
|
-
(typeof
|
|
1981
|
-
const
|
|
1982
|
-
(!
|
|
1983
|
-
const
|
|
1984
|
-
|
|
1985
|
-
const
|
|
1987
|
+
canForget: I,
|
|
1988
|
+
deleteQuarantine: O,
|
|
1989
|
+
exportQuarantine: m,
|
|
1990
|
+
forget: B,
|
|
1991
|
+
inspect: h,
|
|
1992
|
+
listQuarantine: E,
|
|
1993
|
+
restore: async ({ assertCurrent: N } = {}) => {
|
|
1994
|
+
(typeof N != "function" || !A() || typeof n.importRememberedIdentity != "function" || typeof c != "function" || typeof l != "function" || typeof a != "function" || typeof o != "function") && _("REMEMBER_UNAVAILABLE");
|
|
1995
|
+
const F = h();
|
|
1996
|
+
(!F.canRestore || !F.active.record) && _("STORAGE_QUARANTINED");
|
|
1997
|
+
const b = F.active.record;
|
|
1998
|
+
Ht(b.canonicalUsername) !== b.canonicalUsername && _("INVALID_REMEMBERED_WALLET"), await P(b.canonicalUsername) !== b.aad.usernameSha256 && _("INVALID_REMEMBERED_WALLET"), N();
|
|
1999
|
+
const T = Ae(b.credentialIdBase64url, {
|
|
1986
2000
|
minimum: 1,
|
|
1987
2001
|
maximum: 1024
|
|
1988
|
-
}),
|
|
2002
|
+
}), ie = Ae(b.prfInputBase64url, { exact: 32 }), Q = Ae(b.ciphertextBase64url, {
|
|
1989
2003
|
minimum: 17,
|
|
1990
2004
|
maximum: 1024
|
|
1991
|
-
}),
|
|
1992
|
-
(!
|
|
1993
|
-
let
|
|
2005
|
+
}), k = Ae(b.hkdfSaltBase64url, { exact: 32 }), R = Ae(b.nonceBase64url, { exact: 12 }), z = nt.encode(b.canonicalUsername), Y = $e(b.aad), G = typeof a == "function" ? a() : null;
|
|
2006
|
+
(!G?.signal || typeof G.abort != "function") && (D(T), D(ie), D(Q), D(k), D(R), D(z), _("WEBAUTHN_UNAVAILABLE"));
|
|
2007
|
+
let K, te = null, re = !1;
|
|
1994
2008
|
try {
|
|
1995
|
-
|
|
1996
|
-
assertCurrent:
|
|
1997
|
-
credentialId:
|
|
2009
|
+
K = await Tn({
|
|
2010
|
+
assertCurrent: N,
|
|
2011
|
+
credentialId: T,
|
|
1998
2012
|
credentials: r,
|
|
1999
2013
|
fillRandom: s,
|
|
2000
|
-
prfInput:
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2014
|
+
prfInput: ie,
|
|
2015
|
+
rpId: p,
|
|
2016
|
+
signal: G.signal
|
|
2017
|
+
}), N();
|
|
2018
|
+
let ne;
|
|
2019
|
+
const se = K;
|
|
2005
2020
|
try {
|
|
2006
|
-
|
|
2007
|
-
canonicalAad:
|
|
2008
|
-
canonicalUsernameUtf8:
|
|
2009
|
-
ciphertextAndTag:
|
|
2010
|
-
hkdfSalt:
|
|
2011
|
-
nonce:
|
|
2012
|
-
prfOutput:
|
|
2021
|
+
ne = n.importRememberedIdentity({
|
|
2022
|
+
canonicalAad: Y,
|
|
2023
|
+
canonicalUsernameUtf8: z,
|
|
2024
|
+
ciphertextAndTag: Q,
|
|
2025
|
+
hkdfSalt: k,
|
|
2026
|
+
nonce: R,
|
|
2027
|
+
prfOutput: se
|
|
2013
2028
|
});
|
|
2014
2029
|
} finally {
|
|
2015
|
-
|
|
2030
|
+
D(se), K = null;
|
|
2016
2031
|
}
|
|
2017
|
-
|
|
2018
|
-
const
|
|
2019
|
-
return
|
|
2032
|
+
St(ne) || _("WASM_FAILURE"), te = ne.handle, (te == null || typeof c != "function") && _("WASM_FAILURE"), c(te);
|
|
2033
|
+
const J = me(ne.identity);
|
|
2034
|
+
return N(), re = !0, Object.freeze({ handle: te, identity: J });
|
|
2020
2035
|
} finally {
|
|
2021
|
-
!
|
|
2036
|
+
!re && te !== null && typeof l == "function" && (l(te) || _("DESTRUCTION_FAILED")), D(K), D(T), D(ie), D(Q), D(k), D(R), D(z), typeof o == "function" && o(G);
|
|
2022
2037
|
}
|
|
2023
2038
|
},
|
|
2024
|
-
setup: async ({ assertCurrent:
|
|
2039
|
+
setup: async ({ assertCurrent: N, canonicalUsername: F, handle: b, identity: W, passwordUtf8: T }) => {
|
|
2025
2040
|
try {
|
|
2026
|
-
(typeof
|
|
2027
|
-
const
|
|
2028
|
-
|
|
2029
|
-
const
|
|
2030
|
-
(!
|
|
2031
|
-
let
|
|
2041
|
+
(typeof N != "function" || b === null || b === void 0 || !ht(T) || De(T) === 0 || De(T) > 256 || Ht(F) !== F || !A() || typeof n.sealRememberedIdentity != "function" || typeof n.importRememberedIdentity != "function" || typeof c != "function" || typeof l != "function" || typeof d != "function" || typeof a != "function" || typeof o != "function") && (D(T), _("REMEMBER_UNAVAILABLE"));
|
|
2042
|
+
const ie = me(W);
|
|
2043
|
+
h().canSetup || (D(T), _("STORAGE_QUARANTINED"));
|
|
2044
|
+
const k = typeof a == "function" ? a() : null;
|
|
2045
|
+
(!k?.signal || typeof k.abort != "function") && (D(T), _("WEBAUTHN_UNAVAILABLE"));
|
|
2046
|
+
let R, z, Y, G, K, te, re, ne, se, J = null, Oe = null;
|
|
2032
2047
|
try {
|
|
2033
|
-
|
|
2034
|
-
let
|
|
2048
|
+
R = Ve(s, 32), z = Ve(s, 32), Y = Ve(s, 32), G = Ve(s, 32), K = Ve(s, 12), N();
|
|
2049
|
+
let Ue;
|
|
2035
2050
|
try {
|
|
2036
|
-
|
|
2051
|
+
Ue = await r.create({
|
|
2037
2052
|
publicKey: {
|
|
2038
2053
|
attestation: "none",
|
|
2039
2054
|
authenticatorSelection: {
|
|
2040
2055
|
residentKey: "preferred",
|
|
2041
2056
|
userVerification: "required"
|
|
2042
2057
|
},
|
|
2043
|
-
challenge:
|
|
2058
|
+
challenge: R,
|
|
2044
2059
|
extensions: { prf: {} },
|
|
2045
2060
|
pubKeyCredParams: [
|
|
2046
2061
|
{ alg: -7, type: "public-key" },
|
|
2047
2062
|
{ alg: -257, type: "public-key" }
|
|
2048
2063
|
],
|
|
2049
|
-
rp: { id:
|
|
2050
|
-
timeout:
|
|
2064
|
+
rp: p === void 0 ? { name: g } : { id: p, name: g },
|
|
2065
|
+
timeout: ui,
|
|
2051
2066
|
user: {
|
|
2052
|
-
displayName:
|
|
2053
|
-
id:
|
|
2054
|
-
name:
|
|
2067
|
+
displayName: F,
|
|
2068
|
+
id: z,
|
|
2069
|
+
name: F
|
|
2055
2070
|
}
|
|
2056
2071
|
},
|
|
2057
|
-
signal:
|
|
2072
|
+
signal: k.signal
|
|
2058
2073
|
});
|
|
2059
|
-
} catch (
|
|
2060
|
-
throw
|
|
2074
|
+
} catch (Ce) {
|
|
2075
|
+
throw N(), Ce;
|
|
2061
2076
|
}
|
|
2062
|
-
|
|
2063
|
-
const
|
|
2064
|
-
|
|
2065
|
-
assertCurrent:
|
|
2066
|
-
credentialId:
|
|
2077
|
+
N();
|
|
2078
|
+
const ze = pi(Ue);
|
|
2079
|
+
te = ze.rawId, Cs(ze), re = await Tn({
|
|
2080
|
+
assertCurrent: N,
|
|
2081
|
+
credentialId: te,
|
|
2067
2082
|
credentials: r,
|
|
2068
2083
|
fillRandom: s,
|
|
2069
|
-
prfInput:
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2084
|
+
prfInput: Y,
|
|
2085
|
+
rpId: p,
|
|
2086
|
+
signal: k.signal
|
|
2087
|
+
}), ne = re.slice(), se = re.slice(), D(re), re = null;
|
|
2088
|
+
const be = await P(F);
|
|
2089
|
+
N();
|
|
2090
|
+
const je = Qe(te), qe = Object.freeze({
|
|
2091
|
+
credentialIdBase64url: je,
|
|
2076
2092
|
identityScheme: Is,
|
|
2077
2093
|
schemaVersion: 2,
|
|
2078
2094
|
seedProfile: vs,
|
|
2079
|
-
storageProfile:
|
|
2080
|
-
usernameSha256:
|
|
2081
|
-
}),
|
|
2082
|
-
let
|
|
2095
|
+
storageProfile: On,
|
|
2096
|
+
usernameSha256: be
|
|
2097
|
+
}), He = $e(qe);
|
|
2098
|
+
let Ie;
|
|
2083
2099
|
try {
|
|
2084
|
-
|
|
2085
|
-
canonicalAad:
|
|
2086
|
-
hkdfSalt:
|
|
2087
|
-
nonce:
|
|
2088
|
-
passwordUtf8:
|
|
2089
|
-
prfOutput:
|
|
2100
|
+
Ie = n.sealRememberedIdentity(b, {
|
|
2101
|
+
canonicalAad: He,
|
|
2102
|
+
hkdfSalt: G,
|
|
2103
|
+
nonce: K,
|
|
2104
|
+
passwordUtf8: T,
|
|
2105
|
+
prfOutput: ne
|
|
2090
2106
|
});
|
|
2091
2107
|
} finally {
|
|
2092
|
-
|
|
2108
|
+
D(T), D(ne);
|
|
2093
2109
|
}
|
|
2094
|
-
|
|
2095
|
-
const
|
|
2096
|
-
(!
|
|
2097
|
-
let
|
|
2110
|
+
T = null, ne = null;
|
|
2111
|
+
const Ne = De(Ie);
|
|
2112
|
+
(!ht(Ie) || Ne < 17 || Ne > 1024) && _("WASM_FAILURE");
|
|
2113
|
+
let Ge;
|
|
2098
2114
|
try {
|
|
2099
|
-
const
|
|
2100
|
-
|
|
2115
|
+
const Ce = u();
|
|
2116
|
+
Ge = Ce instanceof Date ? Ce.toISOString() : new Date(Ce).toISOString();
|
|
2101
2117
|
} catch {
|
|
2102
2118
|
_("CLOCK_FAILURE");
|
|
2103
2119
|
}
|
|
2104
|
-
const
|
|
2105
|
-
aad:
|
|
2106
|
-
canonicalUsername:
|
|
2107
|
-
ciphertextBase64url:
|
|
2108
|
-
createdAt:
|
|
2109
|
-
credentialIdBase64url:
|
|
2110
|
-
hkdfSaltBase64url:
|
|
2111
|
-
nonceBase64url:
|
|
2112
|
-
prfInputBase64url:
|
|
2120
|
+
const ct = Object.freeze({
|
|
2121
|
+
aad: qe,
|
|
2122
|
+
canonicalUsername: F,
|
|
2123
|
+
ciphertextBase64url: Qe(Ie),
|
|
2124
|
+
createdAt: Ge,
|
|
2125
|
+
credentialIdBase64url: je,
|
|
2126
|
+
hkdfSaltBase64url: Qe(G),
|
|
2127
|
+
nonceBase64url: Qe(K),
|
|
2128
|
+
prfInputBase64url: Qe(Y),
|
|
2113
2129
|
schemaVersion: 2,
|
|
2114
|
-
storageProfile:
|
|
2130
|
+
storageProfile: On
|
|
2115
2131
|
});
|
|
2116
|
-
|
|
2117
|
-
let
|
|
2118
|
-
const
|
|
2132
|
+
N(), Oe = $r(i, ct);
|
|
2133
|
+
let Te;
|
|
2134
|
+
const Ke = se;
|
|
2119
2135
|
try {
|
|
2120
|
-
|
|
2121
|
-
canonicalAad:
|
|
2122
|
-
canonicalUsernameUtf8:
|
|
2123
|
-
ciphertextAndTag:
|
|
2124
|
-
hkdfSalt:
|
|
2125
|
-
nonce:
|
|
2126
|
-
prfOutput:
|
|
2136
|
+
Te = n.importRememberedIdentity({
|
|
2137
|
+
canonicalAad: He,
|
|
2138
|
+
canonicalUsernameUtf8: nt.encode(F),
|
|
2139
|
+
ciphertextAndTag: Ie.slice(),
|
|
2140
|
+
hkdfSalt: G.slice(),
|
|
2141
|
+
nonce: K.slice(),
|
|
2142
|
+
prfOutput: Ke
|
|
2127
2143
|
});
|
|
2128
2144
|
} finally {
|
|
2129
|
-
|
|
2145
|
+
D(Ke), se = null;
|
|
2130
2146
|
}
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2133
|
-
return
|
|
2147
|
+
St(Te) || _("WASM_FAILURE"), J = Te.handle, (J == null || typeof c != "function") && _("WASM_FAILURE"), c(J);
|
|
2148
|
+
const lt = me(Te.identity);
|
|
2149
|
+
return Ts(ie, lt) || _("IDENTITY_MISMATCH"), N(), (typeof l != "function" || !l(J)) && _("DESTRUCTION_FAILED"), J = null, (typeof d != "function" || !d(b)) && _("DESTRUCTION_FAILED"), N(), Fr(i, Oe), Oe = null, Object.freeze({ remembered: !0 });
|
|
2134
2150
|
} finally {
|
|
2135
|
-
|
|
2151
|
+
J !== null && typeof l == "function" && l(J), D(T), D(R), D(z), D(re), D(ne), D(se), D(G), D(K), D(te), typeof o == "function" && o(k);
|
|
2136
2152
|
}
|
|
2137
2153
|
} finally {
|
|
2138
|
-
|
|
2154
|
+
D(T);
|
|
2139
2155
|
}
|
|
2140
2156
|
},
|
|
2141
|
-
supported:
|
|
2157
|
+
supported: A
|
|
2142
2158
|
});
|
|
2143
2159
|
}
|
|
2144
|
-
const
|
|
2160
|
+
const rt = /^[0-9a-f]{64}$/u, js = /^[A-Za-z0-9_-]{43}$/u, Bs = Object.freeze([
|
|
2145
2161
|
"callbackUri",
|
|
2146
2162
|
"clientDisplayName",
|
|
2147
2163
|
"clientId",
|
|
@@ -2155,56 +2171,56 @@ const tt = /^[0-9a-f]{64}$/u, Us = /^[A-Za-z0-9_-]{43}$/u, js = Object.freeze([
|
|
|
2155
2171
|
"schemaVersion",
|
|
2156
2172
|
"state",
|
|
2157
2173
|
"transactionId"
|
|
2158
|
-
]),
|
|
2159
|
-
class
|
|
2174
|
+
]), Vs = Object.freeze(["redirectUri", "schemaVersion", "transactionId"]), Ms = 64 * 1024, $s = 4 * 1024, Fs = new TextEncoder(), Ws = new TextDecoder("utf-8", { fatal: !0 });
|
|
2175
|
+
class Rt extends Error {
|
|
2160
2176
|
constructor() {
|
|
2161
2177
|
super("RELAY_FAILURE"), this.name = "WalletRelayError", this.code = "RELAY_FAILURE";
|
|
2162
2178
|
}
|
|
2163
2179
|
}
|
|
2164
|
-
function
|
|
2165
|
-
throw new
|
|
2180
|
+
function x() {
|
|
2181
|
+
throw new Rt();
|
|
2166
2182
|
}
|
|
2167
|
-
function
|
|
2183
|
+
function hi(e) {
|
|
2168
2184
|
if (e === null || typeof e != "object" || Array.isArray(e)) return !1;
|
|
2169
2185
|
const t = Object.getPrototypeOf(e);
|
|
2170
2186
|
return t === Object.prototype || t === null;
|
|
2171
2187
|
}
|
|
2172
|
-
function
|
|
2173
|
-
|
|
2188
|
+
function yi(e, t) {
|
|
2189
|
+
hi(e) || x();
|
|
2174
2190
|
let n;
|
|
2175
2191
|
try {
|
|
2176
2192
|
n = Reflect.ownKeys(e);
|
|
2177
2193
|
} catch {
|
|
2178
|
-
|
|
2194
|
+
x();
|
|
2179
2195
|
}
|
|
2180
|
-
n.some((s) => typeof s != "string") &&
|
|
2196
|
+
n.some((s) => typeof s != "string") && x();
|
|
2181
2197
|
const i = [...n].sort(), r = [...t].sort();
|
|
2182
|
-
(i.length !== r.length || i.some((s, a) => s !== r[a])) &&
|
|
2198
|
+
(i.length !== r.length || i.some((s, a) => s !== r[a])) && x();
|
|
2183
2199
|
for (const s of i) {
|
|
2184
2200
|
let a;
|
|
2185
2201
|
try {
|
|
2186
2202
|
a = Object.getOwnPropertyDescriptor(e, s);
|
|
2187
2203
|
} catch {
|
|
2188
|
-
|
|
2204
|
+
x();
|
|
2189
2205
|
}
|
|
2190
|
-
(!a?.enumerable || !("value" in a) || a.value === void 0) &&
|
|
2206
|
+
(!a?.enumerable || !("value" in a) || a.value === void 0) && x();
|
|
2191
2207
|
}
|
|
2192
2208
|
return e;
|
|
2193
2209
|
}
|
|
2194
|
-
function
|
|
2195
|
-
if (Array.isArray(e)) return Object.freeze(e.map(
|
|
2196
|
-
if (!
|
|
2210
|
+
function Gt(e) {
|
|
2211
|
+
if (Array.isArray(e)) return Object.freeze(e.map(Gt));
|
|
2212
|
+
if (!hi(e)) return e;
|
|
2197
2213
|
const t = {};
|
|
2198
|
-
for (const n of Object.keys(e).sort()) t[n] =
|
|
2214
|
+
for (const n of Object.keys(e).sort()) t[n] = Gt(e[n]);
|
|
2199
2215
|
return Object.freeze(t);
|
|
2200
2216
|
}
|
|
2201
|
-
function
|
|
2202
|
-
(typeof e != "string" ||
|
|
2217
|
+
function zs(e, t) {
|
|
2218
|
+
(typeof e != "string" || Fs.encode(e).byteLength > t || e.charCodeAt(0) === 65279) && x();
|
|
2203
2219
|
let n = 0, i = 0;
|
|
2204
2220
|
const r = () => {
|
|
2205
2221
|
for (; n < e.length && /[\u0009\u000a\u000d\u0020]/u.test(e[n]); ) n += 1;
|
|
2206
2222
|
}, s = () => {
|
|
2207
|
-
e[n] !== '"' &&
|
|
2223
|
+
e[n] !== '"' && x();
|
|
2208
2224
|
const c = n;
|
|
2209
2225
|
for (n += 1; n < e.length; ) {
|
|
2210
2226
|
const l = e.charCodeAt(n);
|
|
@@ -2214,22 +2230,22 @@ function Ws(e, t) {
|
|
|
2214
2230
|
try {
|
|
2215
2231
|
d = JSON.parse(e.slice(c, n));
|
|
2216
2232
|
} catch {
|
|
2217
|
-
|
|
2233
|
+
x();
|
|
2218
2234
|
}
|
|
2219
2235
|
for (let u = 0; u < d.length; u += 1) {
|
|
2220
2236
|
const f = d.charCodeAt(u);
|
|
2221
2237
|
if (f >= 55296 && f <= 56319) {
|
|
2222
2238
|
const p = d.charCodeAt(u + 1);
|
|
2223
|
-
p >= 56320 && p <= 57343 ||
|
|
2224
|
-
} else f >= 56320 && f <= 57343 &&
|
|
2239
|
+
p >= 56320 && p <= 57343 || x(), u += 1;
|
|
2240
|
+
} else f >= 56320 && f <= 57343 && x();
|
|
2225
2241
|
}
|
|
2226
2242
|
return d;
|
|
2227
2243
|
}
|
|
2228
|
-
l < 32 &&
|
|
2244
|
+
l < 32 && x(), l === 92 && (n += 1, n >= e.length && x()), n += 1;
|
|
2229
2245
|
}
|
|
2230
|
-
|
|
2246
|
+
x();
|
|
2231
2247
|
}, a = (c = 0) => {
|
|
2232
|
-
(c > 32 || ++i > 4096) &&
|
|
2248
|
+
(c > 32 || ++i > 4096) && x(), r();
|
|
2233
2249
|
const l = e[n];
|
|
2234
2250
|
if (l === '"') return s();
|
|
2235
2251
|
if (l === "{") {
|
|
@@ -2240,11 +2256,11 @@ function Ws(e, t) {
|
|
|
2240
2256
|
for (; n < e.length; ) {
|
|
2241
2257
|
r();
|
|
2242
2258
|
const g = s();
|
|
2243
|
-
if (p.has(g) &&
|
|
2259
|
+
if (p.has(g) && x(), p.add(g), r(), e[n] !== ":" && x(), n += 1, f[g] = a(c + 1), r(), e[n] === "}")
|
|
2244
2260
|
return n += 1, f;
|
|
2245
|
-
e[n] !== "," &&
|
|
2261
|
+
e[n] !== "," && x(), n += 1;
|
|
2246
2262
|
}
|
|
2247
|
-
|
|
2263
|
+
x();
|
|
2248
2264
|
}
|
|
2249
2265
|
if (l === "[") {
|
|
2250
2266
|
n += 1;
|
|
@@ -2254,48 +2270,48 @@ function Ws(e, t) {
|
|
|
2254
2270
|
for (; n < e.length; ) {
|
|
2255
2271
|
if (f.push(a(c + 1)), r(), e[n] === "]")
|
|
2256
2272
|
return n += 1, f;
|
|
2257
|
-
e[n] !== "," &&
|
|
2273
|
+
e[n] !== "," && x(), n += 1;
|
|
2258
2274
|
}
|
|
2259
|
-
|
|
2275
|
+
x();
|
|
2260
2276
|
}
|
|
2261
2277
|
for (const [f, p] of [["true", !0], ["false", !1], ["null", null]])
|
|
2262
2278
|
if (e.startsWith(f, n))
|
|
2263
2279
|
return n += f.length, p;
|
|
2264
2280
|
const d = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/u.exec(e.slice(n));
|
|
2265
|
-
d ||
|
|
2281
|
+
d || x(), n += d[0].length;
|
|
2266
2282
|
const u = Number(d[0]);
|
|
2267
|
-
return Number.isFinite(u) ||
|
|
2283
|
+
return Number.isFinite(u) || x(), u;
|
|
2268
2284
|
};
|
|
2269
2285
|
r();
|
|
2270
2286
|
const o = a();
|
|
2271
|
-
return r(), n !== e.length &&
|
|
2287
|
+
return r(), n !== e.length && x(), o;
|
|
2272
2288
|
}
|
|
2273
|
-
function
|
|
2289
|
+
function Cn(e) {
|
|
2274
2290
|
try {
|
|
2275
2291
|
Promise.resolve(e).catch(() => {
|
|
2276
2292
|
});
|
|
2277
2293
|
} catch {
|
|
2278
2294
|
}
|
|
2279
2295
|
}
|
|
2280
|
-
function
|
|
2296
|
+
function mi(e, t = null) {
|
|
2281
2297
|
try {
|
|
2282
2298
|
const n = t?.cancel;
|
|
2283
|
-
typeof n == "function" &&
|
|
2299
|
+
typeof n == "function" && Cn(Reflect.apply(n, t, []));
|
|
2284
2300
|
} catch {
|
|
2285
2301
|
}
|
|
2286
2302
|
if (!t)
|
|
2287
2303
|
try {
|
|
2288
2304
|
const n = e?.body, i = n?.cancel;
|
|
2289
|
-
typeof i == "function" &&
|
|
2305
|
+
typeof i == "function" && Cn(Reflect.apply(i, n, []));
|
|
2290
2306
|
} catch {
|
|
2291
2307
|
}
|
|
2292
2308
|
}
|
|
2293
|
-
function
|
|
2309
|
+
function gi(e, t, n = null) {
|
|
2294
2310
|
let i;
|
|
2295
2311
|
try {
|
|
2296
2312
|
i = Promise.resolve(e);
|
|
2297
2313
|
} catch {
|
|
2298
|
-
return Promise.reject(new
|
|
2314
|
+
return Promise.reject(new Rt());
|
|
2299
2315
|
}
|
|
2300
2316
|
return t ? new Promise((r, s) => {
|
|
2301
2317
|
let a = !1;
|
|
@@ -2304,7 +2320,7 @@ function mi(e, t, n = null) {
|
|
|
2304
2320
|
t.removeEventListener?.("abort", l);
|
|
2305
2321
|
} catch {
|
|
2306
2322
|
}
|
|
2307
|
-
}, c = (d, u) => a ? !1 : (a = !0, o(), d(u), !0), l = () => c(s, new
|
|
2323
|
+
}, c = (d, u) => a ? !1 : (a = !0, o(), d(u), !0), l = () => c(s, new Rt());
|
|
2308
2324
|
try {
|
|
2309
2325
|
t.addEventListener?.("abort", l, { once: !0 }), t.aborted === !0 && l();
|
|
2310
2326
|
} catch {
|
|
@@ -2324,26 +2340,26 @@ function mi(e, t, n = null) {
|
|
|
2324
2340
|
);
|
|
2325
2341
|
}) : i;
|
|
2326
2342
|
}
|
|
2327
|
-
async function
|
|
2343
|
+
async function qs(e, t, n, i) {
|
|
2328
2344
|
let r = null;
|
|
2329
2345
|
try {
|
|
2330
|
-
(!e || e.status !== t || e.redirected === !0 || e.headers?.get?.("cache-control")?.trim().toLowerCase() !== "no-store" || e.headers?.get?.("content-type")?.trim().toLowerCase() !== "application/json; charset=utf-8" || typeof e.body?.getReader != "function") &&
|
|
2346
|
+
(!e || e.status !== t || e.redirected === !0 || e.headers?.get?.("cache-control")?.trim().toLowerCase() !== "no-store" || e.headers?.get?.("content-type")?.trim().toLowerCase() !== "application/json; charset=utf-8" || typeof e.body?.getReader != "function") && x(), r = e.body.getReader(), (!r || typeof r.read != "function" || i?.aborted === !0) && x();
|
|
2331
2347
|
const s = [];
|
|
2332
2348
|
let a = 0;
|
|
2333
2349
|
for (; ; ) {
|
|
2334
|
-
i?.aborted === !0 &&
|
|
2335
|
-
const { done: l, value: d } = await
|
|
2336
|
-
if (i?.aborted === !0 &&
|
|
2337
|
-
d instanceof Uint8Array ||
|
|
2350
|
+
i?.aborted === !0 && x();
|
|
2351
|
+
const { done: l, value: d } = await gi(r.read(), i);
|
|
2352
|
+
if (i?.aborted === !0 && x(), l) break;
|
|
2353
|
+
d instanceof Uint8Array || x(), a += d.byteLength, a > n && x(), s.push(d);
|
|
2338
2354
|
}
|
|
2339
2355
|
const o = new Uint8Array(a);
|
|
2340
2356
|
let c = 0;
|
|
2341
2357
|
for (const l of s)
|
|
2342
2358
|
o.set(l, c), c += l.byteLength;
|
|
2343
|
-
return Ws
|
|
2359
|
+
return zs(Ws.decode(o), n);
|
|
2344
2360
|
} catch (s) {
|
|
2345
|
-
if (
|
|
2346
|
-
|
|
2361
|
+
if (mi(e, r), s instanceof Rt) throw s;
|
|
2362
|
+
x();
|
|
2347
2363
|
} finally {
|
|
2348
2364
|
try {
|
|
2349
2365
|
r?.releaseLock?.();
|
|
@@ -2351,21 +2367,21 @@ async function zs(e, t, n, i) {
|
|
|
2351
2367
|
}
|
|
2352
2368
|
}
|
|
2353
2369
|
}
|
|
2354
|
-
function
|
|
2355
|
-
return
|
|
2370
|
+
function _n(e, t) {
|
|
2371
|
+
return yi(e, Bs), (e.schemaVersion !== 1 || e.transactionId !== t || !rt.test(e.transactionId) || !rt.test(e.state) || !rt.test(e.requestSha256) || !js.test(e.resultToken) || typeof e.callbackUri != "string" || typeof e.clientDisplayName != "string" || typeof e.clientId != "string" || typeof e.expiresAt != "string" || typeof e.operation != "string" || typeof e.registryVersion != "string" || typeof e.requestOrigin != "string") && x(), Gt(e);
|
|
2356
2372
|
}
|
|
2357
|
-
function
|
|
2358
|
-
|
|
2373
|
+
function Kt(e, t) {
|
|
2374
|
+
yi(t, Vs), (t.schemaVersion !== 1 || t.transactionId !== e.transactionId || typeof t.redirectUri != "string") && x();
|
|
2359
2375
|
const n = `${e.callbackUri}#code=`, i = `&state=${e.state}`;
|
|
2360
|
-
(!t.redirectUri.startsWith(n) || !t.redirectUri.endsWith(i)) &&
|
|
2376
|
+
(!t.redirectUri.startsWith(n) || !t.redirectUri.endsWith(i)) && x();
|
|
2361
2377
|
const r = t.redirectUri.slice(n.length, t.redirectUri.length - i.length);
|
|
2362
|
-
return (!
|
|
2378
|
+
return (!rt.test(r) || t.redirectUri !== `${n}${r}${i}`) && x(), Object.freeze({
|
|
2363
2379
|
redirectUri: t.redirectUri,
|
|
2364
2380
|
schemaVersion: 1,
|
|
2365
2381
|
transactionId: t.transactionId
|
|
2366
2382
|
});
|
|
2367
2383
|
}
|
|
2368
|
-
function
|
|
2384
|
+
function xn(e, t, n = void 0) {
|
|
2369
2385
|
const i = {
|
|
2370
2386
|
cache: "no-store",
|
|
2371
2387
|
credentials: "omit",
|
|
@@ -2378,48 +2394,48 @@ function Cn(e, t, n = void 0) {
|
|
|
2378
2394
|
};
|
|
2379
2395
|
return n !== void 0 && (i.body = JSON.stringify(n)), i;
|
|
2380
2396
|
}
|
|
2381
|
-
function
|
|
2382
|
-
(typeof e != "function" || typeof t?.replace != "function") &&
|
|
2397
|
+
function Hs({ fetch: e, location: t }) {
|
|
2398
|
+
(typeof e != "function" || typeof t?.replace != "function") && x();
|
|
2383
2399
|
const n = /* @__PURE__ */ new Set(), i = async (r, s, a, o) => {
|
|
2384
2400
|
let c;
|
|
2385
2401
|
try {
|
|
2386
|
-
c = await
|
|
2402
|
+
c = await gi(e(r, s), s.signal, (l) => mi(l));
|
|
2387
2403
|
} catch {
|
|
2388
|
-
|
|
2404
|
+
x();
|
|
2389
2405
|
}
|
|
2390
|
-
return
|
|
2406
|
+
return qs(c, a, o, s.signal);
|
|
2391
2407
|
};
|
|
2392
2408
|
return Object.freeze({
|
|
2393
2409
|
async fetchTransaction(r, { signal: s } = {}) {
|
|
2394
|
-
(typeof r != "string" || !
|
|
2410
|
+
(typeof r != "string" || !rt.test(r)) && x();
|
|
2395
2411
|
const a = await i(
|
|
2396
2412
|
`/relay/v1/transactions/${r}`,
|
|
2397
|
-
|
|
2413
|
+
xn("GET", s),
|
|
2398
2414
|
200,
|
|
2399
|
-
|
|
2415
|
+
Ms
|
|
2400
2416
|
);
|
|
2401
|
-
return
|
|
2417
|
+
return _n(a, r);
|
|
2402
2418
|
},
|
|
2403
2419
|
async publishResult(r, s, { signal: a } = {}) {
|
|
2404
|
-
const o =
|
|
2420
|
+
const o = _n(r, r?.transactionId), c = await i(
|
|
2405
2421
|
`/relay/v1/transactions/${o.transactionId}/result`,
|
|
2406
|
-
|
|
2422
|
+
xn("POST", a, {
|
|
2407
2423
|
result: s,
|
|
2408
2424
|
resultToken: o.resultToken,
|
|
2409
2425
|
schemaVersion: 1,
|
|
2410
2426
|
transactionId: o.transactionId
|
|
2411
2427
|
}),
|
|
2412
2428
|
201,
|
|
2413
|
-
|
|
2414
|
-
), l =
|
|
2429
|
+
$s
|
|
2430
|
+
), l = Kt(o, c);
|
|
2415
2431
|
return n.clear(), n.add(l.redirectUri), l;
|
|
2416
2432
|
},
|
|
2417
2433
|
navigate(r) {
|
|
2418
|
-
(typeof r != "string" || !n.delete(r)) &&
|
|
2434
|
+
(typeof r != "string" || !n.delete(r)) && x();
|
|
2419
2435
|
try {
|
|
2420
2436
|
Reflect.apply(t.replace, t, [r]);
|
|
2421
2437
|
} catch {
|
|
2422
|
-
|
|
2438
|
+
x();
|
|
2423
2439
|
}
|
|
2424
2440
|
},
|
|
2425
2441
|
revokeNow() {
|
|
@@ -2430,26 +2446,26 @@ function qs({ fetch: e, location: t }) {
|
|
|
2430
2446
|
}
|
|
2431
2447
|
});
|
|
2432
2448
|
}
|
|
2433
|
-
const
|
|
2434
|
-
class
|
|
2449
|
+
const Ai = Uint8Array, Gs = Ai.prototype.fill, Ye = new TextEncoder();
|
|
2450
|
+
class V extends Error {
|
|
2435
2451
|
constructor(t) {
|
|
2436
2452
|
super(t), this.name = "WalletOriginError", this.code = t;
|
|
2437
2453
|
}
|
|
2438
2454
|
}
|
|
2439
2455
|
function w(e) {
|
|
2440
|
-
throw new
|
|
2456
|
+
throw new V(e);
|
|
2441
2457
|
}
|
|
2442
|
-
function
|
|
2443
|
-
throw e instanceof
|
|
2458
|
+
function Xe(e) {
|
|
2459
|
+
throw e instanceof Le ? new V(e.code) : e;
|
|
2444
2460
|
}
|
|
2445
|
-
function
|
|
2446
|
-
if (e instanceof
|
|
2461
|
+
function he(e) {
|
|
2462
|
+
if (e instanceof Ai)
|
|
2447
2463
|
try {
|
|
2448
|
-
|
|
2464
|
+
Gs.call(e, 0);
|
|
2449
2465
|
} catch {
|
|
2450
2466
|
}
|
|
2451
2467
|
}
|
|
2452
|
-
function
|
|
2468
|
+
function Ze(e) {
|
|
2453
2469
|
if (typeof e != "string") return !1;
|
|
2454
2470
|
for (let t = 0; t < e.length; t += 1) {
|
|
2455
2471
|
const n = e.charCodeAt(t);
|
|
@@ -2460,7 +2476,7 @@ function Qe(e) {
|
|
|
2460
2476
|
}
|
|
2461
2477
|
return !0;
|
|
2462
2478
|
}
|
|
2463
|
-
function
|
|
2479
|
+
function Dn(e) {
|
|
2464
2480
|
if (!(!e || typeof e != "object")) {
|
|
2465
2481
|
try {
|
|
2466
2482
|
e.type === "checkbox" && (e.checked = !1);
|
|
@@ -2503,7 +2519,7 @@ function _n(e) {
|
|
|
2503
2519
|
}
|
|
2504
2520
|
}
|
|
2505
2521
|
}
|
|
2506
|
-
function
|
|
2522
|
+
function et(e, t) {
|
|
2507
2523
|
const n = /* @__PURE__ */ new Set();
|
|
2508
2524
|
for (const i of t) {
|
|
2509
2525
|
let r = null;
|
|
@@ -2512,7 +2528,7 @@ function Ye(e, t) {
|
|
|
2512
2528
|
} catch {
|
|
2513
2529
|
r = null;
|
|
2514
2530
|
}
|
|
2515
|
-
r && n.add(r),
|
|
2531
|
+
r && n.add(r), Dn(i);
|
|
2516
2532
|
}
|
|
2517
2533
|
for (const i of n) {
|
|
2518
2534
|
let r = [];
|
|
@@ -2521,7 +2537,7 @@ function Ye(e, t) {
|
|
|
2521
2537
|
} catch {
|
|
2522
2538
|
r = [];
|
|
2523
2539
|
}
|
|
2524
|
-
for (const s of r)
|
|
2540
|
+
for (const s of r) Dn(s);
|
|
2525
2541
|
try {
|
|
2526
2542
|
i.inert = !0, i.setAttribute?.("aria-hidden", "true");
|
|
2527
2543
|
const s = e.createElement("div");
|
|
@@ -2534,21 +2550,21 @@ function Ye(e, t) {
|
|
|
2534
2550
|
}
|
|
2535
2551
|
}
|
|
2536
2552
|
}
|
|
2537
|
-
function
|
|
2553
|
+
function Ks(e) {
|
|
2538
2554
|
let t;
|
|
2539
2555
|
try {
|
|
2540
|
-
t =
|
|
2556
|
+
t = Bn(e);
|
|
2541
2557
|
} catch {
|
|
2542
2558
|
w("WASM_UNAVAILABLE");
|
|
2543
2559
|
}
|
|
2544
2560
|
const n = t?.sdn, i = t?.sha256;
|
|
2545
2561
|
return (!n || typeof n.derivePasswordIdentity != "function" || typeof n.destroySdnIdentity != "function" || typeof i != "function") && w("WASM_UNAVAILABLE"), Object.freeze({ capabilities: n, sha256: i });
|
|
2546
2562
|
}
|
|
2547
|
-
function
|
|
2563
|
+
function dt(e) {
|
|
2548
2564
|
const t = e?.AbortController ?? globalThis.AbortController;
|
|
2549
2565
|
return typeof t == "function" ? new t() : null;
|
|
2550
2566
|
}
|
|
2551
|
-
class
|
|
2567
|
+
class Js {
|
|
2552
2568
|
#d = !1;
|
|
2553
2569
|
#m;
|
|
2554
2570
|
#h = null;
|
|
@@ -2566,7 +2582,7 @@ class Ks {
|
|
|
2566
2582
|
#g = null;
|
|
2567
2583
|
#C = null;
|
|
2568
2584
|
#D = /* @__PURE__ */ new WeakSet();
|
|
2569
|
-
#
|
|
2585
|
+
#P = /* @__PURE__ */ new WeakMap();
|
|
2570
2586
|
#u = null;
|
|
2571
2587
|
#_;
|
|
2572
2588
|
#y;
|
|
@@ -2586,35 +2602,40 @@ class Ks {
|
|
|
2586
2602
|
registry: r,
|
|
2587
2603
|
relay: s,
|
|
2588
2604
|
rng: a,
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2605
|
+
rpId: o,
|
|
2606
|
+
rpName: c,
|
|
2607
|
+
storage: l,
|
|
2608
|
+
wasm: d,
|
|
2609
|
+
window: u
|
|
2592
2610
|
}) {
|
|
2593
|
-
const
|
|
2594
|
-
this.#m =
|
|
2611
|
+
const f = Ks(d);
|
|
2612
|
+
this.#m = f.capabilities, this.#x = f.sha256, this.#_ = r, this.#c = s, this.#n = n, this.#s = u, this.#y = Us({
|
|
2595
2613
|
createRequestController: () => {
|
|
2596
|
-
const
|
|
2597
|
-
return
|
|
2614
|
+
const p = dt(this.#s);
|
|
2615
|
+
return p && (this.#a.add(p), this.#O.add(p)), p;
|
|
2598
2616
|
},
|
|
2599
|
-
credentials: t ??
|
|
2600
|
-
|
|
2601
|
-
|
|
2617
|
+
credentials: t ?? u?.navigator?.credentials ?? globalThis.navigator?.credentials,
|
|
2618
|
+
rpHostname: u?.location?.hostname ?? globalThis?.location?.hostname,
|
|
2619
|
+
rpId: o,
|
|
2620
|
+
rpName: c,
|
|
2621
|
+
destroyHandle: (p) => this.#E(p),
|
|
2622
|
+
module: d,
|
|
2602
2623
|
now: i,
|
|
2603
|
-
ownHandle: (
|
|
2604
|
-
ownedHandlesClean: (
|
|
2605
|
-
releaseRequestController: (
|
|
2606
|
-
this.#O.delete(
|
|
2624
|
+
ownHandle: (p) => this.#o.add(p),
|
|
2625
|
+
ownedHandlesClean: (p) => this.#o.size === 1 && this.#o.has(p) && this.#t === p,
|
|
2626
|
+
releaseRequestController: (p) => {
|
|
2627
|
+
this.#O.delete(p), this.#a.delete(p);
|
|
2607
2628
|
},
|
|
2608
2629
|
rng: a ?? {
|
|
2609
|
-
getRandomValues:
|
|
2630
|
+
getRandomValues: u?.crypto?.getRandomValues?.bind(u.crypto) ?? globalThis.crypto?.getRandomValues?.bind(globalThis.crypto)
|
|
2610
2631
|
},
|
|
2611
|
-
storage:
|
|
2632
|
+
storage: l ?? u?.localStorage ?? globalThis.localStorage
|
|
2612
2633
|
}), this.#F();
|
|
2613
2634
|
}
|
|
2614
2635
|
get generation() {
|
|
2615
2636
|
return this.#r;
|
|
2616
2637
|
}
|
|
2617
|
-
#
|
|
2638
|
+
#k() {
|
|
2618
2639
|
return this.#r = this.#r >= Number.MAX_SAFE_INTEGER ? 1 : this.#r + 1, this.#r;
|
|
2619
2640
|
}
|
|
2620
2641
|
#F() {
|
|
@@ -2682,7 +2703,7 @@ class Ks {
|
|
|
2682
2703
|
#U() {
|
|
2683
2704
|
const t = [...this.#l];
|
|
2684
2705
|
this.#l.clear();
|
|
2685
|
-
for (const n of t)
|
|
2706
|
+
for (const n of t) he(n);
|
|
2686
2707
|
}
|
|
2687
2708
|
#N(t = []) {
|
|
2688
2709
|
if (this.#f.size === 0) return;
|
|
@@ -2691,11 +2712,11 @@ class Ks {
|
|
|
2691
2712
|
n.has(r) || i.push(r);
|
|
2692
2713
|
this.#f = new Set(
|
|
2693
2714
|
[...this.#f].filter((r) => n.has(r))
|
|
2694
|
-
),
|
|
2715
|
+
), et(this.#n, i);
|
|
2695
2716
|
}
|
|
2696
2717
|
#j(t = []) {
|
|
2697
2718
|
(this.#e || this.#i) && w("STALE_CONTROLLER");
|
|
2698
|
-
const n = this.#
|
|
2719
|
+
const n = this.#k();
|
|
2699
2720
|
this.#N(t), this.#z(), this.#U();
|
|
2700
2721
|
let i = this.#E();
|
|
2701
2722
|
return i && (i = this.#w() && this.#o.size === 0), i || (this.revokeNow("native-destruction-failed"), this.#w(), w("DESTRUCTION_FAILED")), this.#A = null, n;
|
|
@@ -2710,7 +2731,7 @@ class Ks {
|
|
|
2710
2731
|
return f || (this.revokeNow("native-destruction-failed"), this.#w()), Object.freeze({ destroyed: f, permit: null });
|
|
2711
2732
|
}
|
|
2712
2733
|
const o = this.#L, c = i ? Object.freeze({}) : null;
|
|
2713
|
-
this.#
|
|
2734
|
+
this.#k(), this.#i = !0, this.#d = !1, this.#u = c, this.#o.add(t), this.#t = null, this.#p = null, r || (this.#A = null);
|
|
2714
2735
|
const l = this.#h;
|
|
2715
2736
|
this.#h = null;
|
|
2716
2737
|
let d = this.#E(t);
|
|
@@ -2740,17 +2761,17 @@ class Ks {
|
|
|
2740
2761
|
if (this.#C) return this.#C;
|
|
2741
2762
|
const n = this.#g;
|
|
2742
2763
|
if (!n || t !== "connected" && t !== "disconnected")
|
|
2743
|
-
return Promise.reject(new
|
|
2764
|
+
return Promise.reject(new V("STALE_CONTROLLER"));
|
|
2744
2765
|
this.#g = null, this.#A = null;
|
|
2745
2766
|
let i, r;
|
|
2746
2767
|
const s = new Promise((a, o) => {
|
|
2747
2768
|
i = a, r = o;
|
|
2748
2769
|
});
|
|
2749
2770
|
return this.#C = s, (async () => {
|
|
2750
|
-
const a =
|
|
2771
|
+
const a = dt(this.#s);
|
|
2751
2772
|
a && this.#a.add(a);
|
|
2752
2773
|
try {
|
|
2753
|
-
this.#I(n.epoch, n.permit),
|
|
2774
|
+
this.#I(n.epoch, n.permit), oe({ document: this.#n, window: this.#s }), typeof this.#c?.publishResult != "function" && w("RELAY_UNAVAILABLE");
|
|
2754
2775
|
const o = t === "connected" ? n.connectedResult : Tr();
|
|
2755
2776
|
let c;
|
|
2756
2777
|
try {
|
|
@@ -2760,8 +2781,8 @@ class Ks {
|
|
|
2760
2781
|
} catch (l) {
|
|
2761
2782
|
throw this.#I(n.epoch, n.permit), l;
|
|
2762
2783
|
}
|
|
2763
|
-
if (this.#I(n.epoch, n.permit),
|
|
2764
|
-
const l =
|
|
2784
|
+
if (this.#I(n.epoch, n.permit), oe({ document: this.#n, window: this.#s }), typeof this.#c?.navigate == "function") {
|
|
2785
|
+
const l = Kt(n.transaction, c);
|
|
2765
2786
|
this.#I(n.epoch, n.permit), this.#u = null, this.#c.navigate(l.redirectUri);
|
|
2766
2787
|
} else
|
|
2767
2788
|
this.#u = null;
|
|
@@ -2785,7 +2806,7 @@ class Ks {
|
|
|
2785
2806
|
const t = this.#p ?? this.#A;
|
|
2786
2807
|
t || w("STALE_CONTROLLER");
|
|
2787
2808
|
try {
|
|
2788
|
-
return
|
|
2809
|
+
return me(t);
|
|
2789
2810
|
} catch {
|
|
2790
2811
|
w("WASM_FAILURE");
|
|
2791
2812
|
}
|
|
@@ -2809,7 +2830,7 @@ class Ks {
|
|
|
2809
2830
|
try {
|
|
2810
2831
|
return this.#y.listQuarantine();
|
|
2811
2832
|
} catch (t) {
|
|
2812
|
-
throw typeof t?.code == "string" ? new
|
|
2833
|
+
throw typeof t?.code == "string" ? new V(t.code) : t;
|
|
2813
2834
|
}
|
|
2814
2835
|
}
|
|
2815
2836
|
exportQuarantinedWalletRecord(t) {
|
|
@@ -2817,7 +2838,7 @@ class Ks {
|
|
|
2817
2838
|
try {
|
|
2818
2839
|
return this.#y.exportQuarantine(t);
|
|
2819
2840
|
} catch (n) {
|
|
2820
|
-
throw typeof n?.code == "string" ? new
|
|
2841
|
+
throw typeof n?.code == "string" ? new V(n.code) : n;
|
|
2821
2842
|
}
|
|
2822
2843
|
}
|
|
2823
2844
|
deleteQuarantinedWalletRecord(t, n) {
|
|
@@ -2825,7 +2846,7 @@ class Ks {
|
|
|
2825
2846
|
try {
|
|
2826
2847
|
return this.#y.deleteQuarantine(t, n);
|
|
2827
2848
|
} catch (i) {
|
|
2828
|
-
throw typeof i?.code == "string" ? new
|
|
2849
|
+
throw typeof i?.code == "string" ? new V(i.code) : i;
|
|
2829
2850
|
}
|
|
2830
2851
|
}
|
|
2831
2852
|
canForgetRememberedWallet() {
|
|
@@ -2841,7 +2862,7 @@ class Ks {
|
|
|
2841
2862
|
try {
|
|
2842
2863
|
return this.#y.forget({ confirmation: t });
|
|
2843
2864
|
} catch (n) {
|
|
2844
|
-
throw typeof n?.code == "string" ? new
|
|
2865
|
+
throw typeof n?.code == "string" ? new V(n.code) : n;
|
|
2845
2866
|
}
|
|
2846
2867
|
}
|
|
2847
2868
|
async unlockPassword({
|
|
@@ -2853,18 +2874,18 @@ class Ks {
|
|
|
2853
2874
|
}) {
|
|
2854
2875
|
(this.#e || this.#i) && w("STALE_CONTROLLER"), t !== 0 && w("INVALID_ACCOUNT"), (!s || !n) && w("INVALID_CREDENTIAL_FORM");
|
|
2855
2876
|
try {
|
|
2856
|
-
|
|
2877
|
+
oe({ document: this.#n, window: this.#s });
|
|
2857
2878
|
} catch (h) {
|
|
2858
|
-
|
|
2879
|
+
et(
|
|
2859
2880
|
this.#n,
|
|
2860
2881
|
[s, n, i].filter(Boolean)
|
|
2861
|
-
),
|
|
2882
|
+
), Xe(h);
|
|
2862
2883
|
}
|
|
2863
2884
|
let a;
|
|
2864
2885
|
try {
|
|
2865
2886
|
a = this.#j([s, n]);
|
|
2866
2887
|
} catch (h) {
|
|
2867
|
-
throw
|
|
2888
|
+
throw et(
|
|
2868
2889
|
this.#n,
|
|
2869
2890
|
[s, n, i].filter(Boolean)
|
|
2870
2891
|
), h;
|
|
@@ -2873,19 +2894,19 @@ class Ks {
|
|
|
2873
2894
|
let o, c, l, d, u, f, p = null, g = !1;
|
|
2874
2895
|
try {
|
|
2875
2896
|
try {
|
|
2876
|
-
|
|
2877
|
-
} catch (
|
|
2878
|
-
|
|
2897
|
+
oe({ document: this.#n, window: this.#s });
|
|
2898
|
+
} catch (E) {
|
|
2899
|
+
Xe(E);
|
|
2879
2900
|
}
|
|
2880
2901
|
this.#T(a);
|
|
2881
2902
|
const h = s?.value;
|
|
2882
|
-
p = n?.value,
|
|
2903
|
+
p = n?.value, Ze(h) || w("INVALID_USERNAME"), Ze(p) || w("INVALID_PASSWORD");
|
|
2883
2904
|
try {
|
|
2884
|
-
o =
|
|
2905
|
+
o = Ht(h);
|
|
2885
2906
|
} catch {
|
|
2886
2907
|
w("INVALID_USERNAME");
|
|
2887
2908
|
}
|
|
2888
|
-
c =
|
|
2909
|
+
c = Ye.encode(h), f = Ye.encode(p), g = i?.checked === !0 && i?.disabled !== !0 && this.#y.supported(), g ? ((f.length === 0 || f.length > 256) && w("INVALID_PASSWORD"), l = f.slice(), d = f.slice(), u = d, he(f), f = null) : (l = f, f = null), this.#l.add(c), this.#l.add(l), d && this.#l.add(d);
|
|
2889
2910
|
} finally {
|
|
2890
2911
|
if (p = null, i && typeof i == "object") {
|
|
2891
2912
|
try {
|
|
@@ -2901,31 +2922,31 @@ class Ks {
|
|
|
2901
2922
|
} catch {
|
|
2902
2923
|
}
|
|
2903
2924
|
}
|
|
2904
|
-
|
|
2925
|
+
he(f), this.#N();
|
|
2905
2926
|
}
|
|
2906
|
-
let
|
|
2927
|
+
let A;
|
|
2907
2928
|
try {
|
|
2908
|
-
|
|
2929
|
+
A = await this.#m.derivePasswordIdentity({
|
|
2909
2930
|
accountIndex: t,
|
|
2910
2931
|
passwordUtf8: l,
|
|
2911
2932
|
usernameUtf8: c
|
|
2912
|
-
}), (!
|
|
2913
|
-
const h =
|
|
2933
|
+
}), (!A || typeof A != "object") && w("WASM_FAILURE");
|
|
2934
|
+
const h = A.handle;
|
|
2914
2935
|
h == null && w("WASM_FAILURE"), this.#o.add(h);
|
|
2915
|
-
let
|
|
2936
|
+
let E;
|
|
2916
2937
|
try {
|
|
2917
|
-
|
|
2938
|
+
E = me(A.identity);
|
|
2918
2939
|
} catch {
|
|
2919
2940
|
const m = this.#E(h);
|
|
2920
|
-
|
|
2941
|
+
A = null, m || (this.revokeNow("native-destruction-failed"), w("DESTRUCTION_FAILED")), w("WASM_FAILURE");
|
|
2921
2942
|
}
|
|
2922
|
-
if ((this.#e || this.#i || this.#r !== a) && (this.#E(h) || (this.revokeNow("native-destruction-failed"), w("DESTRUCTION_FAILED")), w("STALE_CONTROLLER")), this.#t = h, this.#p =
|
|
2943
|
+
if ((this.#e || this.#i || this.#r !== a) && (this.#E(h) || (this.revokeNow("native-destruction-failed"), w("DESTRUCTION_FAILED")), w("STALE_CONTROLLER")), this.#t = h, this.#p = E, g)
|
|
2923
2944
|
try {
|
|
2924
2945
|
await this.#y.setup({
|
|
2925
2946
|
assertCurrent: () => this.#b(h, a),
|
|
2926
2947
|
canonicalUsername: o,
|
|
2927
2948
|
handle: h,
|
|
2928
|
-
identity:
|
|
2949
|
+
identity: E,
|
|
2929
2950
|
passwordUtf8: d
|
|
2930
2951
|
}), this.#b(h, a), this.#l.delete(u), d = null;
|
|
2931
2952
|
try {
|
|
@@ -2933,25 +2954,25 @@ class Ks {
|
|
|
2933
2954
|
} catch {
|
|
2934
2955
|
}
|
|
2935
2956
|
} catch {
|
|
2936
|
-
|
|
2957
|
+
he(d), this.#l.delete(u), d = null, (this.#e || this.#i || this.#r !== a || this.#t !== h) && w("STALE_CONTROLLER"), this.#o.size === 1 && this.#o.has(h) && this.#t === h || (this.revokeNow("remembered-wallet-cleanup-failed"), w("DESTRUCTION_FAILED"));
|
|
2937
2958
|
try {
|
|
2938
2959
|
r && (r.textContent = "Wallet was not remembered.");
|
|
2939
2960
|
} catch {
|
|
2940
2961
|
}
|
|
2941
2962
|
}
|
|
2942
|
-
return this.#b(h, a),
|
|
2963
|
+
return this.#b(h, a), E;
|
|
2943
2964
|
} catch (h) {
|
|
2944
|
-
throw h instanceof
|
|
2965
|
+
throw h instanceof V && h.code === "DESTRUCTION_FAILED" || (this.#e || this.#i || this.#r !== a) && w("STALE_CONTROLLER"), h;
|
|
2945
2966
|
} finally {
|
|
2946
|
-
|
|
2967
|
+
he(c), he(l), he(d), he(u), this.#l.delete(c), this.#l.delete(l), this.#l.delete(u);
|
|
2947
2968
|
}
|
|
2948
2969
|
}
|
|
2949
2970
|
async unlockRemembered({ accountIndex: t = 0 } = {}) {
|
|
2950
2971
|
(this.#e || this.#i) && w("STALE_CONTROLLER"), t !== 0 && w("INVALID_ACCOUNT"), this.canRestoreRememberedWallet() || w("REMEMBER_UNAVAILABLE");
|
|
2951
2972
|
try {
|
|
2952
|
-
|
|
2973
|
+
oe({ document: this.#n, window: this.#s });
|
|
2953
2974
|
} catch (i) {
|
|
2954
|
-
|
|
2975
|
+
Xe(i);
|
|
2955
2976
|
}
|
|
2956
2977
|
const n = this.#j();
|
|
2957
2978
|
try {
|
|
@@ -2961,13 +2982,13 @@ class Ks {
|
|
|
2961
2982
|
(r == null || !this.#o.has(r)) && w("WASM_FAILURE");
|
|
2962
2983
|
let s;
|
|
2963
2984
|
try {
|
|
2964
|
-
s =
|
|
2985
|
+
s = me(i.identity);
|
|
2965
2986
|
} catch {
|
|
2966
2987
|
w("WASM_FAILURE");
|
|
2967
2988
|
}
|
|
2968
2989
|
return (this.#e || this.#i || this.#r !== n) && (this.#E(r) || (this.revokeNow("native-destruction-failed"), w("DESTRUCTION_FAILED")), w("STALE_CONTROLLER")), this.#t = r, this.#p = s, s;
|
|
2969
2990
|
} catch (i) {
|
|
2970
|
-
throw i instanceof
|
|
2991
|
+
throw i instanceof V && i.code === "DESTRUCTION_FAILED" || ((this.#e || this.#i || this.#r !== n) && w("STALE_CONTROLLER"), this.#o.size > 0 && (this.#w(), this.#o.size > 0 && (this.revokeNow("remembered-wallet-cleanup-failed"), w("DESTRUCTION_FAILED"))), i instanceof V) ? i : typeof i?.code == "string" ? new V(i.code) : i;
|
|
2971
2992
|
}
|
|
2972
2993
|
}
|
|
2973
2994
|
async unlockLegacy({
|
|
@@ -2983,30 +3004,30 @@ class Ks {
|
|
|
2983
3004
|
!o && !(s === "bip39-mnemonic-v1-legacy") && w("INVALID_LEGACY_PROFILE"), o ? (!a || !r) && w("INVALID_CREDENTIAL_FORM") : (!n || typeof n != "object") && w("INVALID_CREDENTIAL_FORM");
|
|
2984
3005
|
const l = o ? [a, r] : [n];
|
|
2985
3006
|
try {
|
|
2986
|
-
|
|
2987
|
-
} catch (
|
|
2988
|
-
|
|
3007
|
+
oe({ document: this.#n, window: this.#s });
|
|
3008
|
+
} catch (A) {
|
|
3009
|
+
et(this.#n, l), Xe(A);
|
|
2989
3010
|
}
|
|
2990
3011
|
let d;
|
|
2991
3012
|
try {
|
|
2992
3013
|
d = this.#j(l);
|
|
2993
|
-
} catch (
|
|
2994
|
-
throw
|
|
3014
|
+
} catch (A) {
|
|
3015
|
+
throw et(this.#n, l), A;
|
|
2995
3016
|
}
|
|
2996
3017
|
o ? this.registerCredentialControls({ passwordControl: r, usernameControl: a }) : this.#f.add(n);
|
|
2997
3018
|
let u, f, p;
|
|
2998
3019
|
try {
|
|
2999
3020
|
try {
|
|
3000
|
-
|
|
3001
|
-
} catch (
|
|
3002
|
-
|
|
3021
|
+
oe({ document: this.#n, window: this.#s });
|
|
3022
|
+
} catch (A) {
|
|
3023
|
+
Xe(A);
|
|
3003
3024
|
}
|
|
3004
3025
|
if (this.#T(d), o) {
|
|
3005
|
-
const
|
|
3006
|
-
|
|
3026
|
+
const A = a?.value, h = r?.value;
|
|
3027
|
+
Ze(A) || w("INVALID_USERNAME"), Ze(h) || w("INVALID_PASSWORD"), u = Ye.encode(A), f = Ye.encode(h), this.#l.add(u), this.#l.add(f);
|
|
3007
3028
|
} else {
|
|
3008
|
-
const
|
|
3009
|
-
|
|
3029
|
+
const A = n?.value;
|
|
3030
|
+
Ze(A) || w("INVALID_MNEMONIC"), p = Ye.encode(A), this.#l.add(p);
|
|
3010
3031
|
}
|
|
3011
3032
|
} finally {
|
|
3012
3033
|
this.#N();
|
|
@@ -3018,70 +3039,70 @@ class Ks {
|
|
|
3018
3039
|
passwordUtf8: f,
|
|
3019
3040
|
usernameUtf8: u
|
|
3020
3041
|
}) : await this.#m.importLegacyMnemonicIdentity({ accountIndex: t, mnemonicUtf8: p }), (!g || typeof g != "object") && w("WASM_FAILURE");
|
|
3021
|
-
const
|
|
3022
|
-
|
|
3042
|
+
const A = g.handle;
|
|
3043
|
+
A == null && w("WASM_FAILURE"), this.#o.add(A);
|
|
3023
3044
|
let h;
|
|
3024
3045
|
try {
|
|
3025
3046
|
h = Xr(g.identity, { accountIndex: t, profile: s });
|
|
3026
3047
|
} catch {
|
|
3027
|
-
const
|
|
3028
|
-
g = null,
|
|
3048
|
+
const E = this.#E(A);
|
|
3049
|
+
g = null, E || (this.revokeNow("native-destruction-failed"), w("DESTRUCTION_FAILED")), w("WASM_FAILURE");
|
|
3029
3050
|
}
|
|
3030
|
-
return (this.#e || this.#i || this.#r !== d) && (this.#E(
|
|
3031
|
-
} catch (
|
|
3032
|
-
throw
|
|
3051
|
+
return (this.#e || this.#i || this.#r !== d) && (this.#E(A) || (this.revokeNow("native-destruction-failed"), w("DESTRUCTION_FAILED")), w("STALE_CONTROLLER")), this.#t = A, this.#p = h, h;
|
|
3052
|
+
} catch (A) {
|
|
3053
|
+
throw A instanceof V && A.code === "DESTRUCTION_FAILED" || (this.#e || this.#i || this.#r !== d) && w("STALE_CONTROLLER"), A;
|
|
3033
3054
|
} finally {
|
|
3034
|
-
|
|
3055
|
+
he(u), he(f), he(p), this.#l.delete(u), this.#l.delete(f), this.#l.delete(p);
|
|
3035
3056
|
}
|
|
3036
3057
|
}
|
|
3037
3058
|
async prepare(t) {
|
|
3038
3059
|
(this.#e || this.#i) && w("STALE_CONTROLLER"), this.#d && w("TRANSACTION_IN_PROGRESS"), this.#d = !0;
|
|
3039
|
-
const n = this.#r, i = typeof t == "string" ? t : t?.transactionId ?? null, r =
|
|
3060
|
+
const n = this.#r, i = typeof t == "string" ? t : t?.transactionId ?? null, r = dt(this.#s);
|
|
3040
3061
|
r && this.#a.add(r);
|
|
3041
3062
|
try {
|
|
3042
3063
|
const s = typeof this.#c?.fetchTransaction == "function" ? await this.#c.fetchTransaction(t, { signal: r?.signal }) : t;
|
|
3043
3064
|
this.#T(n);
|
|
3044
|
-
const a = await
|
|
3065
|
+
const a = await kt(s, {
|
|
3045
3066
|
expectedTransactionId: i,
|
|
3046
3067
|
registry: this.#_,
|
|
3047
3068
|
relay: this.#c,
|
|
3048
3069
|
sha256: this.#x,
|
|
3049
3070
|
window: this.#s
|
|
3050
3071
|
});
|
|
3051
|
-
return this.#T(n),
|
|
3072
|
+
return this.#T(n), oe({ document: this.#n, window: this.#s }), this.#D.add(a), r && this.#P.set(a, r), a;
|
|
3052
3073
|
} catch (s) {
|
|
3053
3074
|
const a = this.#e || this.#i || this.#r !== n;
|
|
3054
|
-
throw this.#d = !1, r && this.#a.delete(r), a && w("STALE_CONTROLLER"), s instanceof
|
|
3075
|
+
throw this.#d = !1, r && this.#a.delete(r), a && w("STALE_CONTROLLER"), s instanceof V ? s : s instanceof Le ? new V(s.code) : s;
|
|
3055
3076
|
}
|
|
3056
3077
|
}
|
|
3057
3078
|
async executePrepared(t) {
|
|
3058
3079
|
(!t || typeof t != "object" || !this.#D.has(t)) && w("INVALID_TRANSACTION"), this.#D.delete(t);
|
|
3059
|
-
const n = this.#
|
|
3060
|
-
this.#
|
|
3080
|
+
const n = this.#P.get(t) ?? null;
|
|
3081
|
+
this.#P.delete(t), (this.#e || this.#i || this.#t === null) && (n && this.#a.delete(n), this.#d = !1, w("STALE_CONTROLLER"));
|
|
3061
3082
|
const i = this.#t, r = this.#p, s = this.#r;
|
|
3062
3083
|
let a = !1;
|
|
3063
3084
|
try {
|
|
3064
3085
|
this.#b(i, s);
|
|
3065
|
-
let o = await
|
|
3086
|
+
let o = await kt(t.transaction, {
|
|
3066
3087
|
expectedTransactionId: t.transaction.transactionId,
|
|
3067
3088
|
registry: this.#_,
|
|
3068
3089
|
relay: this.#c,
|
|
3069
3090
|
sha256: this.#x,
|
|
3070
3091
|
window: this.#s
|
|
3071
3092
|
});
|
|
3072
|
-
this.#b(i, s),
|
|
3093
|
+
this.#b(i, s), oe({ document: this.#n, window: this.#s }), this.#h = Or({
|
|
3073
3094
|
binding: o.binding,
|
|
3074
3095
|
document: this.#n,
|
|
3075
3096
|
identity: r,
|
|
3076
3097
|
request: o.request,
|
|
3077
3098
|
transaction: o.transaction
|
|
3078
|
-
}), await this.#h.promise, this.#b(i, s),
|
|
3099
|
+
}), await this.#h.promise, this.#b(i, s), oe({ document: this.#n, window: this.#s }), o = await kt(t.transaction, {
|
|
3079
3100
|
expectedTransactionId: t.transaction.transactionId,
|
|
3080
3101
|
registry: this.#_,
|
|
3081
3102
|
relay: this.#c,
|
|
3082
3103
|
sha256: this.#x,
|
|
3083
3104
|
window: this.#s
|
|
3084
|
-
}), this.#b(i, s),
|
|
3105
|
+
}), this.#b(i, s), oe({ document: this.#n, window: this.#s });
|
|
3085
3106
|
const c = await Nr({
|
|
3086
3107
|
assertCurrent: () => this.#b(i, s),
|
|
3087
3108
|
binding: o.binding,
|
|
@@ -3090,9 +3111,9 @@ class Ks {
|
|
|
3090
3111
|
transaction: o.transaction,
|
|
3091
3112
|
wasm: this.#m
|
|
3092
3113
|
});
|
|
3093
|
-
this.#b(i, s),
|
|
3114
|
+
this.#b(i, s), oe({ document: this.#n, window: this.#s });
|
|
3094
3115
|
const l = o.transaction.operation === "sdn.wallet.account.v1";
|
|
3095
|
-
l && (this.#A =
|
|
3116
|
+
l && (this.#A = me(r));
|
|
3096
3117
|
const d = this.#B(i, s, {
|
|
3097
3118
|
allowPublication: !0,
|
|
3098
3119
|
retainIdentity: l
|
|
@@ -3108,7 +3129,7 @@ class Ks {
|
|
|
3108
3129
|
}), Object.freeze({ accountReady: !0 });
|
|
3109
3130
|
try {
|
|
3110
3131
|
this.#I(u, f), typeof this.#c?.publishResult != "function" && w("RELAY_UNAVAILABLE");
|
|
3111
|
-
const p =
|
|
3132
|
+
const p = dt(this.#s);
|
|
3112
3133
|
p && this.#a.add(p);
|
|
3113
3134
|
let g;
|
|
3114
3135
|
try {
|
|
@@ -3116,15 +3137,15 @@ class Ks {
|
|
|
3116
3137
|
g = await this.#c.publishResult(o.transaction, c, {
|
|
3117
3138
|
signal: p?.signal
|
|
3118
3139
|
});
|
|
3119
|
-
} catch (
|
|
3120
|
-
throw this.#I(u, f),
|
|
3140
|
+
} catch (A) {
|
|
3141
|
+
throw this.#I(u, f), A;
|
|
3121
3142
|
}
|
|
3122
3143
|
} finally {
|
|
3123
3144
|
p && this.#a.delete(p);
|
|
3124
3145
|
}
|
|
3125
|
-
if (this.#I(u, f),
|
|
3126
|
-
const
|
|
3127
|
-
this.#I(u, f), this.#u = null, this.#c.navigate(
|
|
3146
|
+
if (this.#I(u, f), oe({ document: this.#n, window: this.#s }), typeof this.#c?.navigate == "function") {
|
|
3147
|
+
const A = Kt(o.transaction, g);
|
|
3148
|
+
this.#I(u, f), this.#u = null, this.#c.navigate(A.redirectUri);
|
|
3128
3149
|
} else
|
|
3129
3150
|
this.#u = null;
|
|
3130
3151
|
return g;
|
|
@@ -3132,7 +3153,7 @@ class Ks {
|
|
|
3132
3153
|
this.#u === f && (this.#u = null);
|
|
3133
3154
|
}
|
|
3134
3155
|
} catch (o) {
|
|
3135
|
-
throw !a && (this.#r !== s || this.#t !== i) && w("STALE_CONTROLLER"), o instanceof
|
|
3156
|
+
throw !a && (this.#r !== s || this.#t !== i) && w("STALE_CONTROLLER"), o instanceof V ? o : o instanceof Le ? new V(o.code) : o;
|
|
3136
3157
|
} finally {
|
|
3137
3158
|
n && this.#a.delete(n), a || this.#B(i, s);
|
|
3138
3159
|
}
|
|
@@ -3160,7 +3181,7 @@ class Ks {
|
|
|
3160
3181
|
this.#w();
|
|
3161
3182
|
return;
|
|
3162
3183
|
}
|
|
3163
|
-
!this.#i && (this.#i = !0, this.#
|
|
3184
|
+
!this.#i && (this.#i = !0, this.#k()), this.#d = !1, this.#A = null, this.#t !== null && this.#t !== void 0 && this.#o.add(this.#t), this.#t = null, this.#p = null;
|
|
3164
3185
|
const i = this.#h;
|
|
3165
3186
|
this.#h = null;
|
|
3166
3187
|
const r = !this.#V;
|
|
@@ -3199,7 +3220,7 @@ class Ks {
|
|
|
3199
3220
|
})(), i;
|
|
3200
3221
|
}
|
|
3201
3222
|
}
|
|
3202
|
-
const
|
|
3223
|
+
const Qs = [
|
|
3203
3224
|
{
|
|
3204
3225
|
allowedOperations: [
|
|
3205
3226
|
"sdn.wallet.account.v1",
|
|
@@ -3531,11 +3552,11 @@ const Js = [
|
|
|
3531
3552
|
],
|
|
3532
3553
|
requestOrigin: "https://review.spacedatanetwork.org"
|
|
3533
3554
|
}
|
|
3534
|
-
],
|
|
3535
|
-
clients:
|
|
3536
|
-
registryReleaseSha256:
|
|
3537
|
-
schemaVersion:
|
|
3538
|
-
},
|
|
3555
|
+
], Ys = "e1ce6fe903c9700484a8a87d96581c8cad97063dabf63030b4518a31a3bdaa93", Xs = 1, Ei = {
|
|
3556
|
+
clients: Qs,
|
|
3557
|
+
registryReleaseSha256: Ys,
|
|
3558
|
+
schemaVersion: Xs
|
|
3559
|
+
}, Zs = new TextEncoder(), eo = /^[0-9a-f]{64}$/u, to = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u, no = Object.freeze({
|
|
3539
3560
|
"sdn.wallet.account.v1": Object.freeze({
|
|
3540
3561
|
audience: null,
|
|
3541
3562
|
registryRow: null,
|
|
@@ -3572,29 +3593,29 @@ const Js = [
|
|
|
3572
3593
|
serviceActivationState: "activated",
|
|
3573
3594
|
serviceInstance: null
|
|
3574
3595
|
})
|
|
3575
|
-
}),
|
|
3596
|
+
}), ge = Object.freeze([
|
|
3576
3597
|
"sdn.wallet.account.v1",
|
|
3577
3598
|
"sdn.wallet.connect.v1"
|
|
3578
|
-
]),
|
|
3599
|
+
]), io = Object.freeze([
|
|
3579
3600
|
"sdn.auth.jcs-envelope.v2",
|
|
3580
3601
|
"sdn.auth.raw-challenge.v1",
|
|
3581
|
-
...
|
|
3582
|
-
]),
|
|
3602
|
+
...ge
|
|
3603
|
+
]), ro = Object.freeze([
|
|
3583
3604
|
"sdn.asset-review.authority-activation.v1",
|
|
3584
3605
|
"sdn.asset-review.decision.v1",
|
|
3585
|
-
...
|
|
3586
|
-
]),
|
|
3587
|
-
Object.freeze(["sdn-landing-web-v1", "Space Data Network", "https://spacedatanetwork.org", "https://spacedatanetwork.org/wallet-callback.html",
|
|
3588
|
-
Object.freeze(["sdn-standards-web-v1", "Space Data Standards", "https://spacedatastandards.org", "https://spacedatastandards.org/wallet-callback.html",
|
|
3589
|
-
Object.freeze(["sdn-flatbuffers-pages-v1", "FlatBuffers Documentation", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/flatbuffers/wallet-callback.html",
|
|
3590
|
-
Object.freeze(["sdn-flatsql-pages-v1", "FlatSQL Documentation", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/flatsql/wallet-callback.html",
|
|
3591
|
-
Object.freeze(["sdn-module-sdk-pages-v1", "Space Data Module SDK", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/space-data-module-sdk/wallet-callback.html",
|
|
3592
|
-
Object.freeze(["spaceaware-web-v1", "SpaceAware", "https://spaceaware.io", "https://spaceaware.io/wallet/callback",
|
|
3593
|
-
Object.freeze(["sdn-node-console-v1", "SDN Node Console", "https://sdn.spaceaware.io", "https://sdn.spaceaware.io/wallet/callback",
|
|
3594
|
-
Object.freeze(["orbpro-pages-v1", "OrbPro", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/OrbPro/wallet-callback.html",
|
|
3595
|
-
Object.freeze(["sdn-asset-models-pages-v1", "SDN Asset Models", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/asset-models/wallet-callback.html",
|
|
3596
|
-
Object.freeze(["sdn-asset-review-v1", "SDN Asset Review", "https://review.spacedatanetwork.org", "https://review.spacedatanetwork.org/wallet/callback",
|
|
3597
|
-
]),
|
|
3606
|
+
...ge
|
|
3607
|
+
]), Pn = Object.freeze([
|
|
3608
|
+
Object.freeze(["sdn-landing-web-v1", "Space Data Network", "https://spacedatanetwork.org", "https://spacedatanetwork.org/wallet-callback.html", ge]),
|
|
3609
|
+
Object.freeze(["sdn-standards-web-v1", "Space Data Standards", "https://spacedatastandards.org", "https://spacedatastandards.org/wallet-callback.html", ge]),
|
|
3610
|
+
Object.freeze(["sdn-flatbuffers-pages-v1", "FlatBuffers Documentation", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/flatbuffers/wallet-callback.html", ge]),
|
|
3611
|
+
Object.freeze(["sdn-flatsql-pages-v1", "FlatSQL Documentation", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/flatsql/wallet-callback.html", ge]),
|
|
3612
|
+
Object.freeze(["sdn-module-sdk-pages-v1", "Space Data Module SDK", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/space-data-module-sdk/wallet-callback.html", ge]),
|
|
3613
|
+
Object.freeze(["spaceaware-web-v1", "SpaceAware", "https://spaceaware.io", "https://spaceaware.io/wallet/callback", ge]),
|
|
3614
|
+
Object.freeze(["sdn-node-console-v1", "SDN Node Console", "https://sdn.spaceaware.io", "https://sdn.spaceaware.io/wallet/callback", io]),
|
|
3615
|
+
Object.freeze(["orbpro-pages-v1", "OrbPro", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/OrbPro/wallet-callback.html", ge]),
|
|
3616
|
+
Object.freeze(["sdn-asset-models-pages-v1", "SDN Asset Models", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/asset-models/wallet-callback.html", ge]),
|
|
3617
|
+
Object.freeze(["sdn-asset-review-v1", "SDN Asset Review", "https://review.spacedatanetwork.org", "https://review.spacedatanetwork.org/wallet/callback", ro])
|
|
3618
|
+
]), so = Object.freeze([
|
|
3598
3619
|
Object.freeze({
|
|
3599
3620
|
audience: "sdn-login:sdn.spaceaware.io",
|
|
3600
3621
|
clientId: "sdn-node-console-v1",
|
|
@@ -3626,67 +3647,67 @@ const Js = [
|
|
|
3626
3647
|
serviceInstance: null
|
|
3627
3648
|
})
|
|
3628
3649
|
]);
|
|
3629
|
-
function
|
|
3650
|
+
function j(e) {
|
|
3630
3651
|
throw new TypeError(e);
|
|
3631
3652
|
}
|
|
3632
|
-
function
|
|
3653
|
+
function ln(e) {
|
|
3633
3654
|
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
3634
3655
|
const t = Object.getPrototypeOf(e);
|
|
3635
3656
|
return t === Object.prototype || t === null;
|
|
3636
3657
|
}
|
|
3637
|
-
function
|
|
3638
|
-
|
|
3658
|
+
function yt(e, t, n) {
|
|
3659
|
+
ln(e) || j(`${n} must be an object`);
|
|
3639
3660
|
const i = Reflect.ownKeys(e);
|
|
3640
|
-
i.some((a) => typeof a != "string") &&
|
|
3661
|
+
i.some((a) => typeof a != "string") && j(`${n} has missing or unknown fields`);
|
|
3641
3662
|
const r = i.sort(), s = [...t].sort();
|
|
3642
|
-
(r.length !== s.length || r.some((a, o) => a !== s[o])) &&
|
|
3663
|
+
(r.length !== s.length || r.some((a, o) => a !== s[o])) && j(`${n} has missing or unknown fields`);
|
|
3643
3664
|
for (const a of r) {
|
|
3644
3665
|
const o = Object.getOwnPropertyDescriptor(e, a);
|
|
3645
|
-
(!o || !o.enumerable || !("value" in o) || o.value === void 0) &&
|
|
3666
|
+
(!o || !o.enumerable || !("value" in o) || o.value === void 0) && j(`${n} has an invalid field`);
|
|
3646
3667
|
}
|
|
3647
3668
|
return e;
|
|
3648
3669
|
}
|
|
3649
|
-
function
|
|
3650
|
-
return e === null || typeof e == "boolean" || typeof e == "string" ? JSON.stringify(e) : typeof e == "number" ? (Number.isFinite(e) ||
|
|
3670
|
+
function ye(e) {
|
|
3671
|
+
return e === null || typeof e == "boolean" || typeof e == "string" ? JSON.stringify(e) : typeof e == "number" ? (Number.isFinite(e) || j("registry contains a non-finite number"), JSON.stringify(e)) : Array.isArray(e) ? `[${e.map(ye).join(",")}]` : (ln(e) || j("registry contains an unsupported value"), `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${ye(e[t])}`).join(",")}}`);
|
|
3651
3672
|
}
|
|
3652
|
-
async function
|
|
3673
|
+
async function oo(e) {
|
|
3653
3674
|
const t = globalThis.crypto?.subtle;
|
|
3654
|
-
t ||
|
|
3655
|
-
const n = new Uint8Array(await t.digest("SHA-256",
|
|
3675
|
+
t || j("Web Crypto SHA-256 is unavailable");
|
|
3676
|
+
const n = new Uint8Array(await t.digest("SHA-256", Zs.encode(e)));
|
|
3656
3677
|
return Array.from(n, (i) => i.toString(16).padStart(2, "0")).join("");
|
|
3657
3678
|
}
|
|
3658
|
-
function
|
|
3659
|
-
if (Array.isArray(e)) return Object.freeze(e.map(
|
|
3660
|
-
if (!
|
|
3679
|
+
function Lt(e) {
|
|
3680
|
+
if (Array.isArray(e)) return Object.freeze(e.map(Lt));
|
|
3681
|
+
if (!ln(e)) return e;
|
|
3661
3682
|
const t = {};
|
|
3662
|
-
for (const n of Object.keys(e).sort()) t[n] =
|
|
3683
|
+
for (const n of Object.keys(e).sort()) t[n] = Lt(e[n]);
|
|
3663
3684
|
return Object.freeze(t);
|
|
3664
3685
|
}
|
|
3665
|
-
function
|
|
3666
|
-
(typeof e != "string" || !e.startsWith("https://") || e.includes("*")) &&
|
|
3686
|
+
function ao(e, t) {
|
|
3687
|
+
(typeof e != "string" || !e.startsWith("https://") || e.includes("*")) && j(`${t} must be exact HTTPS`);
|
|
3667
3688
|
let n;
|
|
3668
3689
|
try {
|
|
3669
3690
|
n = new URL(e);
|
|
3670
3691
|
} catch {
|
|
3671
|
-
|
|
3692
|
+
j(`${t} must be a valid URL`);
|
|
3672
3693
|
}
|
|
3673
|
-
(n.protocol !== "https:" || n.username || n.password || n.port || n.origin !== e || n.pathname !== "/" || n.search || n.hash) &&
|
|
3694
|
+
(n.protocol !== "https:" || n.username || n.password || n.port || n.origin !== e || n.pathname !== "/" || n.search || n.hash) && j(`${t} must be an exact HTTPS origin`);
|
|
3674
3695
|
}
|
|
3675
|
-
function
|
|
3676
|
-
(typeof e != "string" || !e.startsWith("https://") || e.includes("*")) &&
|
|
3696
|
+
function co(e, t) {
|
|
3697
|
+
(typeof e != "string" || !e.startsWith("https://") || e.includes("*")) && j("callbackUri must be exact HTTPS");
|
|
3677
3698
|
let n;
|
|
3678
3699
|
try {
|
|
3679
3700
|
n = new URL(e);
|
|
3680
3701
|
} catch {
|
|
3681
|
-
|
|
3702
|
+
j("callbackUri must be a valid URL");
|
|
3682
3703
|
}
|
|
3683
|
-
(n.protocol !== "https:" || n.username || n.password || n.port || n.origin !== t || n.search || n.hash || n.href !== e) &&
|
|
3704
|
+
(n.protocol !== "https:" || n.username || n.password || n.port || n.origin !== t || n.search || n.hash || n.href !== e) && j("callbackUri must be exact and same-origin");
|
|
3684
3705
|
}
|
|
3685
|
-
function
|
|
3686
|
-
|
|
3706
|
+
function lo(e) {
|
|
3707
|
+
yt(e, ["clients", "registryReleaseSha256", "schemaVersion"], "registry"), e.schemaVersion !== 1 && j("registry schemaVersion must be 1"), (typeof e.registryReleaseSha256 != "string" || !eo.test(e.registryReleaseSha256)) && j("registryReleaseSha256 must be lowercase SHA-256"), (!Array.isArray(e.clients) || e.clients.length !== Pn.length) && j("registry must contain exactly the reviewed clients");
|
|
3687
3708
|
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
3688
3709
|
e.clients.forEach((i, r) => {
|
|
3689
|
-
|
|
3710
|
+
yt(i, [
|
|
3690
3711
|
"allowedOperations",
|
|
3691
3712
|
"audiences",
|
|
3692
3713
|
"callbackUri",
|
|
@@ -3695,9 +3716,9 @@ function co(e) {
|
|
|
3695
3716
|
"operationBindings",
|
|
3696
3717
|
"requestOrigin"
|
|
3697
3718
|
], `client ${r}`);
|
|
3698
|
-
const [s, a, o, c, l] =
|
|
3699
|
-
(i.clientId !== s || i.clientDisplayName !== a || i.requestOrigin !== o || i.callbackUri !== c) &&
|
|
3700
|
-
|
|
3719
|
+
const [s, a, o, c, l] = Pn[r];
|
|
3720
|
+
(i.clientId !== s || i.clientDisplayName !== a || i.requestOrigin !== o || i.callbackUri !== c) && j(`client ${r} differs from the reviewed row`), (!to.test(i.clientId) || t.has(i.clientId)) && j("clientId must be unique and canonical"), t.add(i.clientId), (typeof i.clientDisplayName != "string" || i.clientDisplayName.length < 1 || i.clientDisplayName.length > 80) && j("clientDisplayName is invalid"), ao(i.requestOrigin, "requestOrigin"), co(i.callbackUri, i.requestOrigin), (!Array.isArray(i.allowedOperations) || ye(i.allowedOperations) !== ye(l)) && j(`${i.clientId} allowedOperations differ from the reviewed allowlist`), (!Array.isArray(i.operationBindings) || i.operationBindings.length !== l.length) && j(`${i.clientId} operationBindings differ from the reviewed allowlist`), i.operationBindings.forEach((u, f) => {
|
|
3721
|
+
yt(u, [
|
|
3701
3722
|
"audience",
|
|
3702
3723
|
"maxLifetimeSeconds",
|
|
3703
3724
|
"operation",
|
|
@@ -3706,16 +3727,16 @@ function co(e) {
|
|
|
3706
3727
|
"serviceInstance"
|
|
3707
3728
|
], `${i.clientId} operation ${f}`);
|
|
3708
3729
|
const p = l[f];
|
|
3709
|
-
u.operation !== p &&
|
|
3710
|
-
const g =
|
|
3711
|
-
g ||
|
|
3712
|
-
const
|
|
3713
|
-
n.has(
|
|
3730
|
+
u.operation !== p && j(`${i.clientId} operation allowlist order or value changed`);
|
|
3731
|
+
const g = no[u.operation];
|
|
3732
|
+
g || j("unknown registry operation"), (u.maxLifetimeSeconds !== 300 || u.audience !== g.audience || u.registryRow !== g.registryRow || u.serviceActivationState !== g.serviceActivationState || u.serviceInstance !== g.serviceInstance) && j(`${i.clientId} operation policy differs from the reviewed binding`);
|
|
3733
|
+
const A = `${i.clientId}\0${i.requestOrigin}\0${u.operation}`;
|
|
3734
|
+
n.has(A) && j("duplicate registry binding"), n.add(A);
|
|
3714
3735
|
});
|
|
3715
3736
|
const d = [...new Set(i.operationBindings.map(({ audience: u }) => u).filter((u) => u !== null))].sort();
|
|
3716
|
-
(!Array.isArray(i.audiences) ||
|
|
3737
|
+
(!Array.isArray(i.audiences) || ye(i.audiences) !== ye(d)) && j(`${i.clientId} audiences differ from operationBindings`), ye(i.allowedOperations) !== ye(i.operationBindings.map(({ operation: u }) => u)) && j(`${i.clientId} allowedOperations differ from operationBindings`);
|
|
3717
3738
|
});
|
|
3718
|
-
for (const i of
|
|
3739
|
+
for (const i of so) {
|
|
3719
3740
|
const r = e.clients.find((o) => o.clientId === i.clientId && o.requestOrigin === i.requestOrigin), s = r?.operationBindings.find((o) => o.operation === i.operation), a = s && {
|
|
3720
3741
|
audience: s.audience,
|
|
3721
3742
|
clientId: r.clientId,
|
|
@@ -3726,18 +3747,18 @@ function co(e) {
|
|
|
3726
3747
|
serviceActivationState: s.serviceActivationState,
|
|
3727
3748
|
serviceInstance: s.serviceInstance
|
|
3728
3749
|
};
|
|
3729
|
-
(!a ||
|
|
3730
|
-
}
|
|
3731
|
-
return
|
|
3732
|
-
}
|
|
3733
|
-
const { registryReleaseSha256:
|
|
3734
|
-
|
|
3735
|
-
const
|
|
3736
|
-
function
|
|
3737
|
-
const t =
|
|
3738
|
-
(typeof t.clientId != "string" || typeof t.requestOrigin != "string" || typeof t.operation != "string") &&
|
|
3739
|
-
const n =
|
|
3740
|
-
return (!n || !i) &&
|
|
3750
|
+
(!a || ye(a) !== ye(i)) && j(`registry projection drifted from compiled row ${i.registryRow}`);
|
|
3751
|
+
}
|
|
3752
|
+
return Lt(e);
|
|
3753
|
+
}
|
|
3754
|
+
const { registryReleaseSha256: uo, ...fo } = Ei, po = await oo(ye(fo));
|
|
3755
|
+
po !== uo && j("registry release SHA-256 mismatch");
|
|
3756
|
+
const kn = lo(Ei);
|
|
3757
|
+
function ho(e) {
|
|
3758
|
+
const t = yt(e, ["clientId", "operation", "requestOrigin"], "registry lookup");
|
|
3759
|
+
(typeof t.clientId != "string" || typeof t.requestOrigin != "string" || typeof t.operation != "string") && j("registry lookup fields must be strings");
|
|
3760
|
+
const n = kn.clients.find((r) => r.clientId === t.clientId && r.requestOrigin === t.requestOrigin), i = n?.operationBindings.find((r) => r.operation === t.operation);
|
|
3761
|
+
return (!n || !i) && j("no exact registry binding exists"), Lt({
|
|
3741
3762
|
audience: i.audience,
|
|
3742
3763
|
callbackUri: n.callbackUri,
|
|
3743
3764
|
clientDisplayName: n.clientDisplayName,
|
|
@@ -3745,21 +3766,21 @@ function po(e) {
|
|
|
3745
3766
|
maxLifetimeSeconds: i.maxLifetimeSeconds,
|
|
3746
3767
|
operation: i.operation,
|
|
3747
3768
|
requestOrigin: n.requestOrigin,
|
|
3748
|
-
registryReleaseSha256:
|
|
3769
|
+
registryReleaseSha256: kn.registryReleaseSha256,
|
|
3749
3770
|
registryRow: i.registryRow,
|
|
3750
3771
|
serviceActivationState: i.serviceActivationState,
|
|
3751
3772
|
serviceInstance: i.serviceInstance
|
|
3752
3773
|
});
|
|
3753
3774
|
}
|
|
3754
|
-
const
|
|
3755
|
-
function
|
|
3775
|
+
const yo = /^\/transaction\/([0-9a-f]{64})$/u, jt = new TextEncoder(), mo = Uint8Array.prototype.fill, go = Object.freeze({ resolveRegistryBinding: ho });
|
|
3776
|
+
function Un(e) {
|
|
3756
3777
|
if (e instanceof Uint8Array)
|
|
3757
3778
|
try {
|
|
3758
|
-
|
|
3779
|
+
mo.call(e, 0);
|
|
3759
3780
|
} catch {
|
|
3760
3781
|
}
|
|
3761
3782
|
}
|
|
3762
|
-
function
|
|
3783
|
+
function Bt(e) {
|
|
3763
3784
|
if (typeof e != "string") return !1;
|
|
3764
3785
|
for (let t = 0; t < e.length; t += 1) {
|
|
3765
3786
|
const n = e.charCodeAt(t);
|
|
@@ -3770,14 +3791,14 @@ function Pt(e) {
|
|
|
3770
3791
|
}
|
|
3771
3792
|
return !0;
|
|
3772
3793
|
}
|
|
3773
|
-
function
|
|
3774
|
-
return new
|
|
3794
|
+
function jn() {
|
|
3795
|
+
return new V("INVALID_TRANSACTION");
|
|
3775
3796
|
}
|
|
3776
|
-
function
|
|
3797
|
+
function st(e, t, n, i) {
|
|
3777
3798
|
const r = e.createElement("label"), s = e.createElement("span");
|
|
3778
3799
|
s.textContent = n, r.append(s, i), t.append(r);
|
|
3779
3800
|
}
|
|
3780
|
-
function
|
|
3801
|
+
function Fe(e, t) {
|
|
3781
3802
|
for (const n of t) {
|
|
3782
3803
|
try {
|
|
3783
3804
|
n.value = "";
|
|
@@ -3817,7 +3838,7 @@ function Ve(e, t) {
|
|
|
3817
3838
|
} catch {
|
|
3818
3839
|
}
|
|
3819
3840
|
}
|
|
3820
|
-
function
|
|
3841
|
+
function wi({
|
|
3821
3842
|
clipboard: e,
|
|
3822
3843
|
controller: t,
|
|
3823
3844
|
document: n,
|
|
@@ -3829,13 +3850,13 @@ function Ei({
|
|
|
3829
3850
|
r.className = "wallet-quarantine-manager";
|
|
3830
3851
|
const s = t.generation;
|
|
3831
3852
|
let a = !1, o = 0, c = [], l = null;
|
|
3832
|
-
const d = (h = o) => !a && h === o && t.isUiGenerationCurrent?.(s) === !0, u = (h,
|
|
3833
|
-
d(
|
|
3853
|
+
const d = (h = o) => !a && h === o && t.isUiGenerationCurrent?.(s) === !0, u = (h, E = o) => {
|
|
3854
|
+
d(E) && l?.status && (l.status.textContent = h);
|
|
3834
3855
|
}, f = () => {
|
|
3835
3856
|
o += 1;
|
|
3836
|
-
for (const [h,
|
|
3857
|
+
for (const [h, E, m] of c)
|
|
3837
3858
|
try {
|
|
3838
|
-
h.removeEventListener?.(
|
|
3859
|
+
h.removeEventListener?.(E, m);
|
|
3839
3860
|
} catch {
|
|
3840
3861
|
}
|
|
3841
3862
|
c = [];
|
|
@@ -3854,8 +3875,8 @@ function Ei({
|
|
|
3854
3875
|
}
|
|
3855
3876
|
}
|
|
3856
3877
|
l?.status && (l.status.textContent = ""), l = null;
|
|
3857
|
-
}, p = (h,
|
|
3858
|
-
h.addEventListener?.(
|
|
3878
|
+
}, p = (h, E, m) => {
|
|
3879
|
+
h.addEventListener?.(E, m), c.push([h, E, m]);
|
|
3859
3880
|
}, g = () => {
|
|
3860
3881
|
if (f(), a || t.isUiGenerationCurrent?.(s) !== !0)
|
|
3861
3882
|
return r.replaceChildren(), r.hidden = !0, !1;
|
|
@@ -3868,25 +3889,25 @@ function Ei({
|
|
|
3868
3889
|
if (!Array.isArray(h) || h.length === 0)
|
|
3869
3890
|
return r.replaceChildren(), r.hidden = !0, !1;
|
|
3870
3891
|
r.hidden = !1, l = is(r, h, { document: n });
|
|
3871
|
-
const
|
|
3892
|
+
const E = o;
|
|
3872
3893
|
for (const m of l.rows) {
|
|
3873
|
-
const { entry:
|
|
3874
|
-
if (
|
|
3875
|
-
if (
|
|
3876
|
-
u("Quarantined record is too large to export.",
|
|
3894
|
+
const { entry: O } = m, I = async (H) => {
|
|
3895
|
+
if (H?.isTrusted !== !0 || !d(E)) return;
|
|
3896
|
+
if (O.exportable !== !0) {
|
|
3897
|
+
u("Quarantined record is too large to export.", E);
|
|
3877
3898
|
return;
|
|
3878
3899
|
}
|
|
3879
|
-
let
|
|
3900
|
+
let N;
|
|
3880
3901
|
try {
|
|
3881
|
-
if (
|
|
3882
|
-
await e.writeText(
|
|
3902
|
+
if (N = t.exportQuarantinedWalletRecord(O.key), typeof e?.writeText != "function") throw new Error("clipboard unavailable");
|
|
3903
|
+
await e.writeText(N), u("Quarantined record exported to the clipboard.", E);
|
|
3883
3904
|
} catch {
|
|
3884
|
-
u("Quarantined record export failed.",
|
|
3905
|
+
u("Quarantined record export failed.", E);
|
|
3885
3906
|
} finally {
|
|
3886
|
-
|
|
3907
|
+
N = null;
|
|
3887
3908
|
}
|
|
3888
|
-
},
|
|
3889
|
-
if (!(
|
|
3909
|
+
}, B = (H) => {
|
|
3910
|
+
if (!(H?.isTrusted !== !0 || !d(E))) {
|
|
3890
3911
|
try {
|
|
3891
3912
|
m.confirmation.value = "";
|
|
3892
3913
|
} catch {
|
|
@@ -3895,14 +3916,14 @@ function Ei({
|
|
|
3895
3916
|
m.confirmation.defaultValue = "";
|
|
3896
3917
|
} catch {
|
|
3897
3918
|
}
|
|
3898
|
-
m.confirmationGroup.hidden = !1, u(`Type ${
|
|
3919
|
+
m.confirmationGroup.hidden = !1, u(`Type ${O.key} to confirm deletion.`, E);
|
|
3899
3920
|
try {
|
|
3900
3921
|
m.confirmation.focus?.();
|
|
3901
3922
|
} catch {
|
|
3902
3923
|
}
|
|
3903
3924
|
}
|
|
3904
|
-
},
|
|
3905
|
-
if (!(
|
|
3925
|
+
}, P = (H) => {
|
|
3926
|
+
if (!(H?.isTrusted !== !0 || !d(E))) {
|
|
3906
3927
|
try {
|
|
3907
3928
|
m.confirmation.value = "";
|
|
3908
3929
|
} catch {
|
|
@@ -3911,19 +3932,19 @@ function Ei({
|
|
|
3911
3932
|
m.confirmation.defaultValue = "";
|
|
3912
3933
|
} catch {
|
|
3913
3934
|
}
|
|
3914
|
-
m.confirmationGroup.hidden = !0, u("",
|
|
3935
|
+
m.confirmationGroup.hidden = !0, u("", E);
|
|
3915
3936
|
}
|
|
3916
|
-
},
|
|
3917
|
-
if (
|
|
3918
|
-
const
|
|
3919
|
-
if (
|
|
3920
|
-
u("Type the exact storage key to confirm deletion.",
|
|
3937
|
+
}, L = (H) => {
|
|
3938
|
+
if (H?.isTrusted !== !0 || !d(E)) return;
|
|
3939
|
+
const N = m.confirmation.value;
|
|
3940
|
+
if (N !== O.key) {
|
|
3941
|
+
u("Type the exact storage key to confirm deletion.", E);
|
|
3921
3942
|
return;
|
|
3922
3943
|
}
|
|
3923
3944
|
try {
|
|
3924
|
-
t.deleteQuarantinedWalletRecord(
|
|
3945
|
+
t.deleteQuarantinedWalletRecord(O.key, N);
|
|
3925
3946
|
} catch {
|
|
3926
|
-
u("Quarantined record deletion failed.",
|
|
3947
|
+
u("Quarantined record deletion failed.", E);
|
|
3927
3948
|
return;
|
|
3928
3949
|
}
|
|
3929
3950
|
try {
|
|
@@ -3936,20 +3957,20 @@ function Ei({
|
|
|
3936
3957
|
}
|
|
3937
3958
|
g(), a || i();
|
|
3938
3959
|
};
|
|
3939
|
-
p(m.exportButton, "click",
|
|
3960
|
+
p(m.exportButton, "click", I), p(m.deleteButton, "click", B), p(m.cancel, "click", P), p(m.confirm, "click", L);
|
|
3940
3961
|
}
|
|
3941
3962
|
return !0;
|
|
3942
|
-
},
|
|
3963
|
+
}, A = g();
|
|
3943
3964
|
return Object.freeze({
|
|
3944
3965
|
container: r,
|
|
3945
3966
|
destroy() {
|
|
3946
3967
|
a || (a = !0, f(), r.replaceChildren(), r.remove?.());
|
|
3947
3968
|
},
|
|
3948
|
-
hasEntries:
|
|
3969
|
+
hasEntries: A,
|
|
3949
3970
|
refresh: g
|
|
3950
3971
|
});
|
|
3951
3972
|
}
|
|
3952
|
-
function
|
|
3973
|
+
function Ao({
|
|
3953
3974
|
clipboard: e = globalThis.navigator?.clipboard,
|
|
3954
3975
|
controller: t = null,
|
|
3955
3976
|
document: n,
|
|
@@ -3958,7 +3979,7 @@ function go({
|
|
|
3958
3979
|
title: s = "Sign in"
|
|
3959
3980
|
}) {
|
|
3960
3981
|
const a = i ?? n?.body;
|
|
3961
|
-
if (!n?.createElement || !a?.append) throw new
|
|
3982
|
+
if (!n?.createElement || !a?.append) throw new V("DOM_UNAVAILABLE");
|
|
3962
3983
|
const o = n.createElement("section");
|
|
3963
3984
|
o.className = "wallet-login";
|
|
3964
3985
|
const c = n.createElement("h1");
|
|
@@ -3970,7 +3991,7 @@ function go({
|
|
|
3970
3991
|
const u = n.createElement("input");
|
|
3971
3992
|
u.type = "text", u.name = "username", u.autocomplete = "username", u.required = !0;
|
|
3972
3993
|
const f = n.createElement("input");
|
|
3973
|
-
f.type = "password", f.name = "password", f.autocomplete = "current-password", f.required = !0,
|
|
3994
|
+
f.type = "password", f.name = "password", f.autocomplete = "current-password", f.required = !0, st(n, d, "Username", u), st(n, d, "Password", f);
|
|
3974
3995
|
let p = null;
|
|
3975
3996
|
if (t && typeof t == "object") {
|
|
3976
3997
|
p = n.createElement("input"), p.type = "checkbox", p.dataset.walletRemember = "prf-only", p.checked = !1, p.defaultChecked = !1;
|
|
@@ -3980,36 +4001,36 @@ function go({
|
|
|
3980
4001
|
} catch {
|
|
3981
4002
|
R = !1;
|
|
3982
4003
|
}
|
|
3983
|
-
p.disabled = !R,
|
|
4004
|
+
p.disabled = !R, st(n, d, "Remember on this device", p);
|
|
3984
4005
|
}
|
|
3985
4006
|
const g = n.createElement("p");
|
|
3986
4007
|
g.dataset.walletRememberStatus = "true";
|
|
3987
|
-
let
|
|
4008
|
+
let A = () => {
|
|
3988
4009
|
};
|
|
3989
|
-
const h =
|
|
4010
|
+
const h = wi({
|
|
3990
4011
|
clipboard: e,
|
|
3991
4012
|
controller: t,
|
|
3992
4013
|
document: n,
|
|
3993
|
-
onChanged: () =>
|
|
3994
|
-
}),
|
|
3995
|
-
|
|
3996
|
-
let m = null,
|
|
4014
|
+
onChanged: () => A()
|
|
4015
|
+
}), E = n.createElement("div");
|
|
4016
|
+
E.className = "wallet-login-actions";
|
|
4017
|
+
let m = null, O = !1;
|
|
3997
4018
|
try {
|
|
3998
|
-
|
|
4019
|
+
O = t?.canRestoreRememberedWallet?.() === !0;
|
|
3999
4020
|
} catch {
|
|
4000
|
-
|
|
4001
|
-
}
|
|
4002
|
-
|
|
4003
|
-
const
|
|
4004
|
-
|
|
4005
|
-
const
|
|
4006
|
-
|
|
4007
|
-
let
|
|
4008
|
-
const
|
|
4009
|
-
|
|
4010
|
-
}),
|
|
4011
|
-
d.removeEventListener?.("submit",
|
|
4012
|
-
},
|
|
4021
|
+
O = !1;
|
|
4022
|
+
}
|
|
4023
|
+
O && r && (m = n.createElement("button"), m.type = "button", m.dataset.walletAction = "unlock-remembered", m.textContent = "Unlock remembered wallet");
|
|
4024
|
+
const I = n.createElement("button");
|
|
4025
|
+
I.type = "submit", I.dataset.walletAction = "login", I.textContent = "Login";
|
|
4026
|
+
const B = n.createElement("button");
|
|
4027
|
+
B.type = "button", B.dataset.walletAction = "cancel-login", B.textContent = "Cancel", m && E.append(m), E.append(I, B), d.append(E), o.append(c, l), h?.hasEntries && o.append(h.container), o.append(d, g), a.append(o), t?.registerCredentialControls?.({ passwordControl: f, usernameControl: u });
|
|
4028
|
+
let P = !1, L, H;
|
|
4029
|
+
const N = new Promise((R, z) => {
|
|
4030
|
+
L = R, H = z;
|
|
4031
|
+
}), F = () => {
|
|
4032
|
+
d.removeEventListener?.("submit", ie), B.removeEventListener?.("click", Q), m?.removeEventListener?.("click", k);
|
|
4033
|
+
}, b = () => {
|
|
4013
4034
|
if (h?.destroy?.(), p) {
|
|
4014
4035
|
try {
|
|
4015
4036
|
p.checked = !1;
|
|
@@ -4025,56 +4046,56 @@ function go({
|
|
|
4025
4046
|
}
|
|
4026
4047
|
}
|
|
4027
4048
|
g.textContent = "";
|
|
4028
|
-
},
|
|
4029
|
-
|
|
4030
|
-
},
|
|
4031
|
-
if (!
|
|
4032
|
-
|
|
4049
|
+
}, W = () => {
|
|
4050
|
+
F(), Fe(d, [u, f]), b(), o.remove?.();
|
|
4051
|
+
}, T = (R) => {
|
|
4052
|
+
if (!P) {
|
|
4053
|
+
P = !0;
|
|
4033
4054
|
try {
|
|
4034
4055
|
t?.revokeNow?.(R);
|
|
4035
4056
|
} catch {
|
|
4036
4057
|
}
|
|
4037
|
-
|
|
4058
|
+
W(), H(new V(R));
|
|
4038
4059
|
}
|
|
4039
|
-
},
|
|
4040
|
-
R?.preventDefault?.(), !(
|
|
4041
|
-
},
|
|
4042
|
-
R?.isTrusted === !0 &&
|
|
4043
|
-
},
|
|
4044
|
-
|
|
4060
|
+
}, ie = (R) => {
|
|
4061
|
+
R?.preventDefault?.(), !(P || R?.isTrusted !== !0) && (P = !0, F(), h?.destroy?.(), L({ passwordControl: f, rememberControl: p, rememberStatus: g, usernameControl: u }));
|
|
4062
|
+
}, Q = (R) => {
|
|
4063
|
+
R?.isTrusted === !0 && T("USER_CANCELLED");
|
|
4064
|
+
}, k = (R) => {
|
|
4065
|
+
P || R?.isTrusted !== !0 || (P = !0, F(), h?.destroy?.(), Fe(d, [u, f]), L({ remembered: !0, rememberStatus: g }));
|
|
4045
4066
|
};
|
|
4046
|
-
|
|
4047
|
-
if (
|
|
4067
|
+
A = () => {
|
|
4068
|
+
if (P || !r) return;
|
|
4048
4069
|
let R = !1;
|
|
4049
4070
|
try {
|
|
4050
4071
|
R = t?.canRestoreRememberedWallet?.() === !0;
|
|
4051
4072
|
} catch {
|
|
4052
4073
|
R = !1;
|
|
4053
4074
|
}
|
|
4054
|
-
R && !m ? (m = n.createElement("button"), m.type = "button", m.dataset.walletAction = "unlock-remembered", m.textContent = "Unlock remembered wallet",
|
|
4055
|
-
}, d.addEventListener("submit",
|
|
4075
|
+
R && !m ? (m = n.createElement("button"), m.type = "button", m.dataset.walletAction = "unlock-remembered", m.textContent = "Unlock remembered wallet", E.replaceChildren(m, I, B), m.addEventListener?.("click", k)) : !R && m && (m.removeEventListener?.("click", k), m.remove?.(), m = null);
|
|
4076
|
+
}, d.addEventListener("submit", ie), B.addEventListener("click", Q), m?.addEventListener?.("click", k);
|
|
4056
4077
|
try {
|
|
4057
4078
|
u.focus?.();
|
|
4058
4079
|
} catch {
|
|
4059
4080
|
}
|
|
4060
4081
|
return Object.freeze({
|
|
4061
4082
|
cancel() {
|
|
4062
|
-
|
|
4083
|
+
P ? W() : T("STALE_CONTROLLER");
|
|
4063
4084
|
},
|
|
4064
4085
|
controls: Object.freeze({ passwordControl: f, rememberControl: p, rememberStatus: g, usernameControl: u }),
|
|
4065
4086
|
form: d,
|
|
4066
|
-
promise:
|
|
4067
|
-
remove:
|
|
4087
|
+
promise: N,
|
|
4088
|
+
remove: W
|
|
4068
4089
|
});
|
|
4069
4090
|
}
|
|
4070
|
-
function
|
|
4091
|
+
function bi({
|
|
4071
4092
|
document: e,
|
|
4072
4093
|
mount: t = null,
|
|
4073
4094
|
submitLabel: n = "Compare legacy account",
|
|
4074
4095
|
title: i = "Enter the legacy BIP-39 mnemonic"
|
|
4075
4096
|
}) {
|
|
4076
4097
|
const r = t ?? e?.body;
|
|
4077
|
-
if (!e?.createElement || !r?.append) throw new
|
|
4098
|
+
if (!e?.createElement || !r?.append) throw new V("DOM_UNAVAILABLE");
|
|
4078
4099
|
const s = e.createElement("section");
|
|
4079
4100
|
s.className = "wallet-login wallet-legacy-credentials";
|
|
4080
4101
|
const a = e.createElement("h1");
|
|
@@ -4082,41 +4103,41 @@ function wi({
|
|
|
4082
4103
|
const o = e.createElement("form");
|
|
4083
4104
|
o.noValidate = !0;
|
|
4084
4105
|
const c = e.createElement("textarea");
|
|
4085
|
-
c.name = "mnemonic", c.autocomplete = "off", c.required = !0,
|
|
4106
|
+
c.name = "mnemonic", c.autocomplete = "off", c.required = !0, st(e, o, "Mnemonic", c);
|
|
4086
4107
|
const l = e.createElement("button");
|
|
4087
4108
|
l.type = "submit", l.dataset.walletAction = "confirm-legacy-mnemonic", l.textContent = n;
|
|
4088
4109
|
const d = e.createElement("button");
|
|
4089
4110
|
d.type = "button", d.dataset.walletAction = "cancel-legacy-migration", d.textContent = "Cancel", o.append(l, d), s.append(a, o), r.append(s);
|
|
4090
4111
|
let u = !1, f, p;
|
|
4091
|
-
const g = new Promise((
|
|
4092
|
-
f =
|
|
4093
|
-
}),
|
|
4094
|
-
o.removeEventListener?.("submit", m), d.removeEventListener?.("click",
|
|
4112
|
+
const g = new Promise((I, B) => {
|
|
4113
|
+
f = I, p = B;
|
|
4114
|
+
}), A = () => {
|
|
4115
|
+
o.removeEventListener?.("submit", m), d.removeEventListener?.("click", O);
|
|
4095
4116
|
}, h = () => {
|
|
4096
|
-
|
|
4097
|
-
},
|
|
4098
|
-
u || (u = !0, h(), p(new
|
|
4099
|
-
}, m = (
|
|
4100
|
-
|
|
4101
|
-
},
|
|
4102
|
-
|
|
4117
|
+
A(), Fe(o, [c]), s.remove?.();
|
|
4118
|
+
}, E = () => {
|
|
4119
|
+
u || (u = !0, h(), p(new V("USER_CANCELLED")));
|
|
4120
|
+
}, m = (I) => {
|
|
4121
|
+
I?.preventDefault?.(), !(u || I?.isTrusted !== !0) && (u = !0, A(), f({ form: o, mnemonicControl: c, section: s }));
|
|
4122
|
+
}, O = (I) => {
|
|
4123
|
+
I?.isTrusted === !0 && E();
|
|
4103
4124
|
};
|
|
4104
|
-
o.addEventListener("submit", m), d.addEventListener("click",
|
|
4125
|
+
o.addEventListener("submit", m), d.addEventListener("click", O);
|
|
4105
4126
|
try {
|
|
4106
4127
|
c.focus?.();
|
|
4107
4128
|
} catch {
|
|
4108
4129
|
}
|
|
4109
4130
|
return Object.freeze({
|
|
4110
4131
|
cancel() {
|
|
4111
|
-
u ? h() :
|
|
4132
|
+
u ? h() : E();
|
|
4112
4133
|
},
|
|
4113
4134
|
promise: g,
|
|
4114
4135
|
remove: h
|
|
4115
4136
|
});
|
|
4116
4137
|
}
|
|
4117
|
-
function
|
|
4138
|
+
function Eo({ document: e, mount: t = null, title: n = "Choose legacy wallet profile" }) {
|
|
4118
4139
|
const i = t ?? e?.body;
|
|
4119
|
-
if (!e?.createElement || !i?.append) throw new
|
|
4140
|
+
if (!e?.createElement || !i?.append) throw new V("DOM_UNAVAILABLE");
|
|
4120
4141
|
const r = e.createElement("section");
|
|
4121
4142
|
r.className = "wallet-login wallet-legacy-profile";
|
|
4122
4143
|
const s = e.createElement("h1");
|
|
@@ -4127,53 +4148,53 @@ function Ao({ document: e, mount: t = null, title: n = "Choose legacy wallet pro
|
|
|
4127
4148
|
o.noValidate = !0;
|
|
4128
4149
|
const c = e.createElement("select");
|
|
4129
4150
|
c.dataset.walletLegacyProfile = "required", c.required = !0, c.value = "";
|
|
4130
|
-
for (const [
|
|
4151
|
+
for (const [I, B] of [
|
|
4131
4152
|
["", "Select a legacy profile"],
|
|
4132
4153
|
["password-fast-v1-legacy", "Legacy fast-password profile"],
|
|
4133
4154
|
["bip39-mnemonic-v1-legacy", "Legacy BIP-39 mnemonic import"]
|
|
4134
4155
|
]) {
|
|
4135
|
-
const
|
|
4136
|
-
|
|
4156
|
+
const P = e.createElement("option");
|
|
4157
|
+
P.value = I, P.textContent = B, I === "" && (P.disabled = !0, P.selected = !0), c.append(P);
|
|
4137
4158
|
}
|
|
4138
|
-
|
|
4159
|
+
st(e, o, "Legacy profile", c);
|
|
4139
4160
|
const l = e.createElement("button");
|
|
4140
4161
|
l.type = "submit", l.dataset.walletAction = "continue-legacy-login", l.textContent = "Continue";
|
|
4141
4162
|
const d = e.createElement("button");
|
|
4142
4163
|
d.type = "button", d.dataset.walletAction = "cancel-legacy-login", d.textContent = "Cancel", o.append(l, d), r.append(s, a, o), i.append(r);
|
|
4143
4164
|
let u = !1, f, p;
|
|
4144
|
-
const g = new Promise((
|
|
4145
|
-
f =
|
|
4146
|
-
}),
|
|
4147
|
-
o.removeEventListener?.("submit", m), d.removeEventListener?.("click",
|
|
4165
|
+
const g = new Promise((I, B) => {
|
|
4166
|
+
f = I, p = B;
|
|
4167
|
+
}), A = () => {
|
|
4168
|
+
o.removeEventListener?.("submit", m), d.removeEventListener?.("click", O);
|
|
4148
4169
|
}, h = () => {
|
|
4149
4170
|
try {
|
|
4150
4171
|
c.value = "";
|
|
4151
4172
|
} catch {
|
|
4152
4173
|
}
|
|
4153
|
-
|
|
4154
|
-
},
|
|
4155
|
-
u || (u = !0,
|
|
4156
|
-
}, m = (
|
|
4157
|
-
if (
|
|
4158
|
-
const
|
|
4159
|
-
|
|
4160
|
-
},
|
|
4161
|
-
|
|
4174
|
+
Fe(o, [c]), r.remove?.();
|
|
4175
|
+
}, E = () => {
|
|
4176
|
+
u || (u = !0, A(), h(), p(new V("USER_CANCELLED")));
|
|
4177
|
+
}, m = (I) => {
|
|
4178
|
+
if (I?.preventDefault?.(), u || I?.isTrusted !== !0) return;
|
|
4179
|
+
const B = c.value;
|
|
4180
|
+
B !== "password-fast-v1-legacy" && B !== "bip39-mnemonic-v1-legacy" || (u = !0, A(), h(), f(B));
|
|
4181
|
+
}, O = (I) => {
|
|
4182
|
+
I?.isTrusted === !0 && E();
|
|
4162
4183
|
};
|
|
4163
|
-
o.addEventListener("submit", m), d.addEventListener("click",
|
|
4184
|
+
o.addEventListener("submit", m), d.addEventListener("click", O);
|
|
4164
4185
|
try {
|
|
4165
4186
|
c.focus?.();
|
|
4166
4187
|
} catch {
|
|
4167
4188
|
}
|
|
4168
|
-
return Object.freeze({ cancel:
|
|
4189
|
+
return Object.freeze({ cancel: E, promise: g });
|
|
4169
4190
|
}
|
|
4170
|
-
function
|
|
4191
|
+
function ft(e, t, n, i) {
|
|
4171
4192
|
const r = e.createElement("div"), s = e.createElement("strong");
|
|
4172
4193
|
s.textContent = `${n}: `;
|
|
4173
4194
|
const a = e.createElement("span");
|
|
4174
4195
|
a.textContent = String(i ?? ""), r.append(s, a), t.append(r);
|
|
4175
4196
|
}
|
|
4176
|
-
function
|
|
4197
|
+
function Ii(e, t, n, i = null) {
|
|
4177
4198
|
const r = i ?? e?.body, s = e.createElement("section");
|
|
4178
4199
|
s.className = "wallet-complete";
|
|
4179
4200
|
const a = e.createElement("h1");
|
|
@@ -4189,7 +4210,7 @@ function bi(e, t, n, i = null) {
|
|
|
4189
4210
|
}
|
|
4190
4211
|
}), s.append(a, o, c), r?.replaceChildren?.(s);
|
|
4191
4212
|
}
|
|
4192
|
-
function
|
|
4213
|
+
function vi(e, t = "The wallet request could not be completed. Close this window.", n = null) {
|
|
4193
4214
|
const i = n ?? e?.body;
|
|
4194
4215
|
if (!e?.createElement || !i?.replaceChildren) return;
|
|
4195
4216
|
const r = e.createElement("section");
|
|
@@ -4199,7 +4220,7 @@ function Ii(e, t = "The wallet request could not be completed. Close this window
|
|
|
4199
4220
|
const a = e.createElement("p");
|
|
4200
4221
|
a.textContent = t, r.append(s, a), i.replaceChildren(r);
|
|
4201
4222
|
}
|
|
4202
|
-
function
|
|
4223
|
+
function wo({
|
|
4203
4224
|
clipboard: e,
|
|
4204
4225
|
controller: t,
|
|
4205
4226
|
document: n,
|
|
@@ -4216,223 +4237,223 @@ function Eo({
|
|
|
4216
4237
|
f.className = "wallet-approval-card";
|
|
4217
4238
|
const p = n.createElement("h2");
|
|
4218
4239
|
p.textContent = "Asset review approval";
|
|
4219
|
-
const g = n.createElement("p"),
|
|
4220
|
-
h.type = "button", h.dataset.walletAction = "copy-approval", h.textContent = "Copy approval configuration", h.disabled = !u.approvalAvailable, u.approvalAvailable || (g.textContent =
|
|
4221
|
-
const
|
|
4222
|
-
|
|
4240
|
+
const g = n.createElement("p"), A = n.createElement("div"), h = n.createElement("button");
|
|
4241
|
+
h.type = "button", h.dataset.walletAction = "copy-approval", h.textContent = "Copy approval configuration", h.disabled = !u.approvalAvailable, u.approvalAvailable || (g.textContent = rn), f.append(p, g, h, A);
|
|
4242
|
+
const E = n.createElement("button");
|
|
4243
|
+
E.type = "button", E.dataset.walletAction = "logout", E.textContent = "Logout";
|
|
4223
4244
|
const m = n.createElement("button");
|
|
4224
4245
|
m.type = "button", m.dataset.walletAction = "return-to-site", m.textContent = "Return to site";
|
|
4225
|
-
const
|
|
4226
|
-
|
|
4227
|
-
const
|
|
4228
|
-
let
|
|
4246
|
+
const O = n.createElement("section");
|
|
4247
|
+
O.className = "wallet-legacy-migration";
|
|
4248
|
+
const I = as(O, { document: n });
|
|
4249
|
+
let B = !1;
|
|
4229
4250
|
try {
|
|
4230
|
-
|
|
4251
|
+
B = t.canForgetRememberedWallet?.() === !0;
|
|
4231
4252
|
} catch {
|
|
4232
|
-
|
|
4253
|
+
B = !1;
|
|
4233
4254
|
}
|
|
4234
|
-
const
|
|
4235
|
-
|
|
4236
|
-
const
|
|
4255
|
+
const P = B ? n.createElement("section") : null, L = P ? ns(P, { document: n }) : null;
|
|
4256
|
+
L && (L.launch.dataset.walletAction = "forget-stored-wallet");
|
|
4257
|
+
const H = wi({
|
|
4237
4258
|
clipboard: e,
|
|
4238
4259
|
controller: t,
|
|
4239
4260
|
document: n
|
|
4240
|
-
}),
|
|
4241
|
-
|
|
4242
|
-
const
|
|
4243
|
-
credentialRound: async (
|
|
4244
|
-
const
|
|
4261
|
+
}), N = n.createElement("p");
|
|
4262
|
+
N.className = "wallet-account-exit-status", l.append(d, f), P && l.append(P), H?.hasEntries && l.append(H.container), l.append(m, E, O), a.replaceChildren(l);
|
|
4263
|
+
const F = new ss({
|
|
4264
|
+
credentialRound: async (S) => {
|
|
4265
|
+
const U = s({
|
|
4245
4266
|
controller: null,
|
|
4246
4267
|
document: n,
|
|
4247
4268
|
mount: a,
|
|
4248
|
-
title: `Confirm account (${
|
|
4269
|
+
title: `Confirm account (${S} of 2)`
|
|
4249
4270
|
});
|
|
4250
|
-
|
|
4271
|
+
U?.promise && b.add(U);
|
|
4251
4272
|
try {
|
|
4252
|
-
return
|
|
4273
|
+
return U?.promise ? await U.promise : await U;
|
|
4253
4274
|
} finally {
|
|
4254
|
-
|
|
4275
|
+
U?.promise && b.delete(U);
|
|
4255
4276
|
}
|
|
4256
4277
|
},
|
|
4257
4278
|
expectedIdentity: i,
|
|
4258
4279
|
wasm: c
|
|
4259
|
-
}),
|
|
4260
|
-
let
|
|
4261
|
-
const
|
|
4262
|
-
if (!
|
|
4263
|
-
},
|
|
4264
|
-
|
|
4265
|
-
},
|
|
4266
|
-
const
|
|
4267
|
-
|
|
4268
|
-
for (const
|
|
4269
|
-
},
|
|
4270
|
-
const
|
|
4271
|
-
m.disabled = R,
|
|
4272
|
-
},
|
|
4273
|
-
if (!
|
|
4274
|
-
if (
|
|
4275
|
-
|
|
4280
|
+
}), b = /* @__PURE__ */ new Set(), W = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set(), ie = /* @__PURE__ */ new Set();
|
|
4281
|
+
let Q = !1, k = !1, R = !1, z = null, Y = !1, G = !1, K = !1, te = 0, re = !1, ne = 0;
|
|
4282
|
+
const se = (S) => !k && ne === S, J = (S) => {
|
|
4283
|
+
if (!se(S)) throw new Error("account surface closed");
|
|
4284
|
+
}, Oe = (S) => (S instanceof Uint8Array && ie.add(S), S), Ue = (S) => {
|
|
4285
|
+
Un(S), ie.delete(S);
|
|
4286
|
+
}, ze = () => {
|
|
4287
|
+
const S = [...ie];
|
|
4288
|
+
ie.clear();
|
|
4289
|
+
for (const U of S) Un(U);
|
|
4290
|
+
}, be = () => {
|
|
4291
|
+
const S = Q || K || Y;
|
|
4292
|
+
m.disabled = R, E.disabled = R, k || (h.disabled = S || !u.approvalAvailable, I.launch.disabled = S, L && (L.launch.disabled = S || G, L.confirm.disabled = S, L.cancel.disabled = S));
|
|
4293
|
+
}, je = (S) => {
|
|
4294
|
+
if (!W.has(S)) return !0;
|
|
4295
|
+
if (T.has(S)) return !1;
|
|
4296
|
+
T.add(S);
|
|
4276
4297
|
try {
|
|
4277
|
-
return (c?.sdn ?? c).destroySdnIdentity(
|
|
4298
|
+
return (c?.sdn ?? c).destroySdnIdentity(S), W.delete(S), !0;
|
|
4278
4299
|
} catch {
|
|
4279
4300
|
return !1;
|
|
4280
4301
|
} finally {
|
|
4281
|
-
|
|
4302
|
+
T.delete(S);
|
|
4282
4303
|
}
|
|
4283
|
-
},
|
|
4284
|
-
for (const
|
|
4285
|
-
return
|
|
4286
|
-
},
|
|
4287
|
-
if (
|
|
4288
|
-
const
|
|
4289
|
-
|
|
4304
|
+
}, qe = () => {
|
|
4305
|
+
for (const S of [...W]) je(S);
|
|
4306
|
+
return W.size === 0;
|
|
4307
|
+
}, He = async (S) => {
|
|
4308
|
+
if (S?.isTrusted !== !0 || Q || K || Y) return;
|
|
4309
|
+
const U = ne;
|
|
4310
|
+
Q = !0, be(), g.textContent = "Confirm the same account twice to enable Copy.";
|
|
4290
4311
|
try {
|
|
4291
|
-
const
|
|
4292
|
-
|
|
4293
|
-
const
|
|
4294
|
-
assertCurrent: () =>
|
|
4312
|
+
const fe = await F.confirm();
|
|
4313
|
+
J(U);
|
|
4314
|
+
const X = await rs(fe, {
|
|
4315
|
+
assertCurrent: () => J(U),
|
|
4295
4316
|
clipboard: e,
|
|
4296
|
-
container:
|
|
4317
|
+
container: A,
|
|
4297
4318
|
document: n
|
|
4298
4319
|
});
|
|
4299
|
-
|
|
4320
|
+
J(U), g.textContent = X ? "Approval configuration copied." : "Clipboard unavailable. Copy the exact configuration shown below.";
|
|
4300
4321
|
} catch {
|
|
4301
|
-
|
|
4322
|
+
se(U) && (g.textContent = "The two entries did not produce the same account.");
|
|
4302
4323
|
} finally {
|
|
4303
|
-
|
|
4324
|
+
Q = !1, se(U) && be();
|
|
4304
4325
|
}
|
|
4305
|
-
},
|
|
4306
|
-
if (
|
|
4307
|
-
const
|
|
4308
|
-
if (
|
|
4309
|
-
|
|
4326
|
+
}, Ie = async (S) => {
|
|
4327
|
+
if (S?.isTrusted !== !0 || K || Q || Y) return;
|
|
4328
|
+
const U = I.select.value || "password-fast-v1-legacy";
|
|
4329
|
+
if (U !== "password-fast-v1-legacy" && U !== "bip39-mnemonic-v1-legacy") {
|
|
4330
|
+
I.result.textContent = "Legacy profile unavailable.";
|
|
4310
4331
|
return;
|
|
4311
4332
|
}
|
|
4312
|
-
const
|
|
4313
|
-
|
|
4314
|
-
let
|
|
4333
|
+
const fe = ne;
|
|
4334
|
+
K = !0, te += 1, be(), I.result.textContent = "Enter the selected legacy credentials to compare accounts.";
|
|
4335
|
+
let X = null, _e, Ct, _t, ce = null;
|
|
4315
4336
|
try {
|
|
4316
|
-
let
|
|
4317
|
-
if (
|
|
4318
|
-
|
|
4337
|
+
let xt;
|
|
4338
|
+
if (U === "password-fast-v1-legacy") {
|
|
4339
|
+
X = s({
|
|
4319
4340
|
controller: null,
|
|
4320
4341
|
document: n,
|
|
4321
4342
|
mount: a,
|
|
4322
4343
|
title: "Enter the legacy fast-password account"
|
|
4323
|
-
}),
|
|
4324
|
-
const
|
|
4325
|
-
|
|
4326
|
-
const
|
|
4327
|
-
if (!
|
|
4328
|
-
|
|
4329
|
-
const
|
|
4330
|
-
|
|
4344
|
+
}), X?.promise && b.add(X);
|
|
4345
|
+
const Z = X?.promise ? await X.promise : await X;
|
|
4346
|
+
J(fe);
|
|
4347
|
+
const Je = Z?.usernameControl?.value, fn = Z?.passwordControl?.value;
|
|
4348
|
+
if (!Bt(Je) || !Bt(fn)) throw new Error("invalid legacy credentials");
|
|
4349
|
+
_e = Oe(jt.encode(Je)), Ct = Oe(jt.encode(fn));
|
|
4350
|
+
const pn = Z?.usernameControl?.form ?? Z?.passwordControl?.form ?? X?.form, Oi = pn?.parentNode;
|
|
4351
|
+
Fe(pn, [Z?.usernameControl, Z?.passwordControl]), Oi?.remove?.(), xt = { passwordUtf8: Ct, usernameUtf8: _e };
|
|
4331
4352
|
} else {
|
|
4332
|
-
|
|
4333
|
-
const
|
|
4334
|
-
|
|
4335
|
-
const
|
|
4336
|
-
if (!
|
|
4337
|
-
|
|
4353
|
+
X = bi({ document: n, mount: a }), b.add(X);
|
|
4354
|
+
const Z = await X.promise;
|
|
4355
|
+
J(fe);
|
|
4356
|
+
const Je = Z?.mnemonicControl?.value;
|
|
4357
|
+
if (!Bt(Je)) throw new Error("invalid legacy credentials");
|
|
4358
|
+
_t = Oe(jt.encode(Je)), Fe(Z.form, [Z.mnemonicControl]), Z.section?.remove?.(), xt = { mnemonicUtf8: _t };
|
|
4338
4359
|
}
|
|
4339
|
-
if (
|
|
4360
|
+
if (X?.promise && b.delete(X), ce = await os({
|
|
4340
4361
|
accountIndex: 0,
|
|
4341
|
-
credentials:
|
|
4362
|
+
credentials: xt,
|
|
4342
4363
|
operation: "sdn.auth.raw-challenge.v1",
|
|
4343
|
-
profile:
|
|
4364
|
+
profile: U,
|
|
4344
4365
|
wasm: c,
|
|
4345
|
-
assertCurrent: () =>
|
|
4346
|
-
ownHandle: (
|
|
4347
|
-
}),
|
|
4348
|
-
const Si =
|
|
4349
|
-
if (
|
|
4366
|
+
assertCurrent: () => J(fe),
|
|
4367
|
+
ownHandle: (Z) => W.add(Z)
|
|
4368
|
+
}), J(fe), !ce?.handle) throw new Error("legacy derivation failed");
|
|
4369
|
+
const Si = U === "password-fast-v1-legacy" ? "sdn-fast-password-auth-v1-legacy" : "sdn-bip39-auth-v1-legacy", ut = Array.isArray(ce.identity?.keys) ? ce.identity.keys.find((Z) => Z?.purpose === "sdn-authentication") : null;
|
|
4370
|
+
if (ce.identity?.identityScheme !== Si || ce.identity?.seedProfile !== U || typeof ce.identity?.accountXpub != "string" || !ut || typeof ut.publicKeyHex != "string" || !/^[0-9a-f]{64}$/u.test(ut.publicKeyHex))
|
|
4350
4371
|
throw new Error("legacy identity invalid");
|
|
4351
|
-
const Ri =
|
|
4352
|
-
if (!
|
|
4353
|
-
|
|
4354
|
-
const Li = i.keys.find((
|
|
4355
|
-
|
|
4372
|
+
const Ri = ce.identity;
|
|
4373
|
+
if (!je(ce.handle)) throw new Error("legacy destruction failed");
|
|
4374
|
+
ce = null, J(fe);
|
|
4375
|
+
const Li = i.keys.find((Z) => Z.purpose === "sdn-authentication");
|
|
4376
|
+
I.result.replaceChildren(), ft(n, I.result, "Current account xpub", i.accountXpub), ft(n, I.result, "Legacy account xpub", Ri.accountXpub), ft(n, I.result, "Current authentication key", Li?.publicKeyHex), ft(n, I.result, "Legacy authentication key", ut.publicKeyHex);
|
|
4356
4377
|
} catch {
|
|
4357
|
-
|
|
4378
|
+
se(fe) && (I.result.textContent = "Legacy account comparison could not be completed.");
|
|
4358
4379
|
} finally {
|
|
4359
|
-
|
|
4380
|
+
ce?.handle && je(ce.handle), X?.promise && b.delete(X), Ue(_e), Ue(Ct), Ue(_t), qe(), te -= 1, K = !1, se(fe) && be();
|
|
4360
4381
|
}
|
|
4361
|
-
},
|
|
4362
|
-
if (
|
|
4382
|
+
}, Ne = () => {
|
|
4383
|
+
if (L) {
|
|
4363
4384
|
try {
|
|
4364
|
-
|
|
4385
|
+
L.confirmation.value = "";
|
|
4365
4386
|
} catch {
|
|
4366
4387
|
}
|
|
4367
4388
|
try {
|
|
4368
|
-
|
|
4389
|
+
L.confirmation.defaultValue = "";
|
|
4369
4390
|
} catch {
|
|
4370
4391
|
}
|
|
4371
4392
|
}
|
|
4372
|
-
},
|
|
4373
|
-
if (!(!
|
|
4374
|
-
|
|
4393
|
+
}, Ge = (S) => {
|
|
4394
|
+
if (!(!L || S?.isTrusted !== !0 || Q || K || Y || G || k)) {
|
|
4395
|
+
Ne(), L.confirmationGroup.hidden = !1, L.status.textContent = `Type ${L.confirmationKey} to confirm.`;
|
|
4375
4396
|
try {
|
|
4376
|
-
|
|
4397
|
+
L.confirmation.focus?.();
|
|
4377
4398
|
} catch {
|
|
4378
4399
|
}
|
|
4379
4400
|
}
|
|
4380
|
-
},
|
|
4381
|
-
!
|
|
4382
|
-
},
|
|
4383
|
-
if (!
|
|
4384
|
-
const
|
|
4385
|
-
if (
|
|
4386
|
-
|
|
4401
|
+
}, ct = (S) => {
|
|
4402
|
+
!L || S?.isTrusted !== !0 || Y || k || (Ne(), L.confirmationGroup.hidden = !0, L.status.textContent = "Forget cancelled.");
|
|
4403
|
+
}, Te = (S) => {
|
|
4404
|
+
if (!L || S?.isTrusted !== !0 || Q || K || Y || G || k) return;
|
|
4405
|
+
const U = L.confirmation.value;
|
|
4406
|
+
if (U !== L.confirmationKey) {
|
|
4407
|
+
L.status.textContent = "Type the exact storage key to confirm.";
|
|
4387
4408
|
return;
|
|
4388
4409
|
}
|
|
4389
|
-
|
|
4410
|
+
Y = !0, be(), Ne();
|
|
4390
4411
|
try {
|
|
4391
|
-
t.forgetRememberedWallet(
|
|
4412
|
+
t.forgetRememberedWallet(U), G = !0, L.confirmationGroup.hidden = !0, L.status.textContent = "Stored wallet forgotten. This account remains signed in.";
|
|
4392
4413
|
} catch {
|
|
4393
|
-
|
|
4414
|
+
L.status.textContent = "Stored wallet could not be forgotten.";
|
|
4394
4415
|
} finally {
|
|
4395
|
-
|
|
4416
|
+
Y = !1, k || be();
|
|
4396
4417
|
}
|
|
4397
|
-
},
|
|
4398
|
-
if (
|
|
4399
|
-
|
|
4418
|
+
}, Ke = (S) => {
|
|
4419
|
+
if (k)
|
|
4420
|
+
ze();
|
|
4400
4421
|
else {
|
|
4401
|
-
|
|
4402
|
-
for (const
|
|
4403
|
-
|
|
4422
|
+
k = !0, ne += 1, h.disabled = !0, I.launch.disabled = !0, L && (L.launch.disabled = !0, L.confirm.disabled = !0, L.cancel.disabled = !0, Ne(), L.launch.removeEventListener?.("click", Ge), L.confirm.removeEventListener?.("click", Te), L.cancel.removeEventListener?.("click", ct)), H?.destroy?.(), ze(), h.removeEventListener?.("click", He), I.launch.removeEventListener?.("click", Ie);
|
|
4423
|
+
for (const U of b) U.cancel?.();
|
|
4424
|
+
b.clear();
|
|
4404
4425
|
}
|
|
4405
|
-
|
|
4406
|
-
},
|
|
4407
|
-
const
|
|
4408
|
-
return
|
|
4409
|
-
},
|
|
4410
|
-
o(),
|
|
4426
|
+
S && !re && (N.textContent = "Secure cleanup is still pending. Retry Return or Logout.", l.replaceChildren(N, m, E), m.disabled = !1, E.disabled = !1);
|
|
4427
|
+
}, lt = () => {
|
|
4428
|
+
const S = F.destroy(), U = qe();
|
|
4429
|
+
return S && U && te === 0 && !K && !Q;
|
|
4430
|
+
}, Ce = () => (Ke(!1), re || (re = !0, m.disabled = !0, E.disabled = !0, m.removeEventListener?.("click", un), E.removeEventListener?.("click", dn), l.remove?.()), lt()), Tt = (S, U, fe, { requireTrustedEvent: X = !0 } = {}) => X && S?.isTrusted !== !0 ? Promise.resolve() : z || (R || re ? Promise.reject(new V("STALE_CONTROLLER")) : (Ke(!0), lt() ? (R = !0, m.disabled = !0, E.disabled = !0, z = (async () => {
|
|
4431
|
+
o(), Ii(n, null, fe, a);
|
|
4411
4432
|
try {
|
|
4412
|
-
const
|
|
4413
|
-
if (!r()) throw new
|
|
4414
|
-
return
|
|
4415
|
-
} catch (
|
|
4416
|
-
throw r() &&
|
|
4433
|
+
const _e = await U();
|
|
4434
|
+
if (!r()) throw new V("STALE_CONTROLLER");
|
|
4435
|
+
return _e;
|
|
4436
|
+
} catch (_e) {
|
|
4437
|
+
throw r() && vi(n, void 0, a), _e;
|
|
4417
4438
|
}
|
|
4418
|
-
})(),
|
|
4419
|
-
|
|
4420
|
-
|
|
4439
|
+
})(), z) : (N.textContent = "Secure cleanup is still pending. Retry Return or Logout.", m.disabled = !1, E.disabled = !1, Promise.reject(new V("DESTRUCTION_FAILED"))))), un = (S) => {
|
|
4440
|
+
Tt(
|
|
4441
|
+
S,
|
|
4421
4442
|
() => t.returnToSite(),
|
|
4422
4443
|
"Returning to the requesting site."
|
|
4423
4444
|
).catch(() => {
|
|
4424
4445
|
});
|
|
4425
|
-
},
|
|
4426
|
-
|
|
4427
|
-
|
|
4446
|
+
}, dn = (S) => {
|
|
4447
|
+
Tt(
|
|
4448
|
+
S,
|
|
4428
4449
|
() => t.logout(),
|
|
4429
4450
|
"Logged out. Returning to the requesting site."
|
|
4430
4451
|
).catch(() => {
|
|
4431
4452
|
});
|
|
4432
4453
|
};
|
|
4433
|
-
return h.addEventListener("click",
|
|
4434
|
-
destroy:
|
|
4435
|
-
logout: () =>
|
|
4454
|
+
return h.addEventListener("click", He), I.launch.addEventListener("click", Ie), L?.launch.addEventListener?.("click", Ge), L?.confirm.addEventListener?.("click", Te), L?.cancel.addEventListener?.("click", ct), m.addEventListener("click", un), E.addEventListener("click", dn), Object.freeze({
|
|
4455
|
+
destroy: Ce,
|
|
4456
|
+
logout: () => Tt(
|
|
4436
4457
|
null,
|
|
4437
4458
|
() => t.logout(),
|
|
4438
4459
|
"Logged out. Returning to the requesting site.",
|
|
@@ -4440,168 +4461,168 @@ function Eo({
|
|
|
4440
4461
|
)
|
|
4441
4462
|
});
|
|
4442
4463
|
}
|
|
4443
|
-
function
|
|
4464
|
+
function bo(e) {
|
|
4444
4465
|
const t = e?.pathname, n = e?.search ?? "", i = e?.hash ?? "";
|
|
4445
|
-
if (typeof t != "string" || n !== "" || i !== "") throw
|
|
4446
|
-
const r =
|
|
4447
|
-
if (!r) throw
|
|
4466
|
+
if (typeof t != "string" || n !== "" || i !== "") throw jn();
|
|
4467
|
+
const r = yo.exec(t);
|
|
4468
|
+
if (!r) throw jn();
|
|
4448
4469
|
return r[1];
|
|
4449
4470
|
}
|
|
4450
|
-
function
|
|
4451
|
-
const t = e?.window ?? globalThis.window, n = e?.document ?? t?.document ?? globalThis.document, i = e?.mount ?? n?.body, r = typeof t?.fetch == "function" ? t.fetch.bind(t) : typeof globalThis.fetch == "function" ? globalThis.fetch.bind(globalThis) : null, s = e?.relay ?? (e?.controller ? null :
|
|
4471
|
+
function Io(e) {
|
|
4472
|
+
const t = e?.window ?? globalThis.window, n = e?.document ?? t?.document ?? globalThis.document, i = e?.mount ?? n?.body, r = typeof t?.fetch == "function" ? t.fetch.bind(t) : typeof globalThis.fetch == "function" ? globalThis.fetch.bind(globalThis) : null, s = e?.relay ?? (e?.controller ? null : Hs({
|
|
4452
4473
|
fetch: e?.fetch ?? r,
|
|
4453
4474
|
location: e?.location ?? t?.location
|
|
4454
|
-
})), a = e?.registry ??
|
|
4475
|
+
})), a = e?.registry ?? go, o = e?.controller ?? new Js({
|
|
4455
4476
|
...e,
|
|
4456
4477
|
document: n,
|
|
4457
4478
|
registry: a,
|
|
4458
4479
|
relay: s,
|
|
4459
4480
|
window: t
|
|
4460
|
-
}), c = e?.credentialPrompt ?? ((
|
|
4461
|
-
let l = null, d = null, u = null, f = null, p = null, g = [],
|
|
4462
|
-
const
|
|
4481
|
+
}), c = e?.credentialPrompt ?? ((b) => Ao(b));
|
|
4482
|
+
let l = null, d = null, u = null, f = null, p = null, g = [], A = 0, h = !1;
|
|
4483
|
+
const E = () => {
|
|
4463
4484
|
(l?.destroy?.() ?? !0) && (l = null), d = null;
|
|
4464
4485
|
}, m = () => {
|
|
4465
4486
|
try {
|
|
4466
4487
|
i?.replaceChildren?.();
|
|
4467
4488
|
} catch {
|
|
4468
4489
|
}
|
|
4469
|
-
},
|
|
4470
|
-
h = !0,
|
|
4471
|
-
},
|
|
4472
|
-
if (!
|
|
4473
|
-
},
|
|
4490
|
+
}, O = () => (A = A >= Number.MAX_SAFE_INTEGER ? 1 : A + 1, A), I = () => {
|
|
4491
|
+
h = !0, O();
|
|
4492
|
+
}, B = (b) => !h && A === b, P = (b) => {
|
|
4493
|
+
if (!B(b)) throw new V("STALE_CONTROLLER");
|
|
4494
|
+
}, L = (b) => {
|
|
4474
4495
|
try {
|
|
4475
|
-
|
|
4496
|
+
b?.remove?.();
|
|
4476
4497
|
} catch {
|
|
4477
4498
|
}
|
|
4478
|
-
u ===
|
|
4479
|
-
},
|
|
4480
|
-
|
|
4481
|
-
},
|
|
4482
|
-
|
|
4483
|
-
},
|
|
4484
|
-
for (const [
|
|
4499
|
+
u === b && (u = null);
|
|
4500
|
+
}, H = () => {
|
|
4501
|
+
I(), u?.cancel?.(), u = null, E(), m();
|
|
4502
|
+
}, N = (b, W, T) => {
|
|
4503
|
+
b?.addEventListener?.(W, T), g.push([b, W, T]);
|
|
4504
|
+
}, F = () => {
|
|
4505
|
+
for (const [b, W, T] of g)
|
|
4485
4506
|
try {
|
|
4486
|
-
|
|
4507
|
+
b?.removeEventListener?.(W, T);
|
|
4487
4508
|
} catch {
|
|
4488
4509
|
}
|
|
4489
4510
|
g = [];
|
|
4490
4511
|
};
|
|
4491
|
-
return
|
|
4492
|
-
|
|
4512
|
+
return N(t, "pagehide", H), N(n, "freeze", H), N(t, "beforeunload", H), N(t, "pageshow", (b) => {
|
|
4513
|
+
b?.persisted === !0 && H();
|
|
4493
4514
|
}), Object.freeze({
|
|
4494
4515
|
controller: o,
|
|
4495
4516
|
logout() {
|
|
4496
|
-
return l ? l.logout() : (
|
|
4517
|
+
return l ? l.logout() : (I(), u?.cancel?.(), u = null, d = null, o.logout());
|
|
4497
4518
|
},
|
|
4498
4519
|
start() {
|
|
4499
4520
|
if (f) return f;
|
|
4500
|
-
const
|
|
4501
|
-
return h ? (f = Promise.reject(new
|
|
4521
|
+
const b = A;
|
|
4522
|
+
return h ? (f = Promise.reject(new V("STALE_CONTROLLER")), f) : (f = (async () => {
|
|
4502
4523
|
try {
|
|
4503
|
-
const
|
|
4524
|
+
const W = bo(t?.location);
|
|
4504
4525
|
if (typeof o.prepare != "function" || typeof o.executePrepared != "function" || typeof o.unlockPassword != "function") {
|
|
4505
|
-
const
|
|
4506
|
-
return
|
|
4526
|
+
const k = await o.execute(W);
|
|
4527
|
+
return P(b), k;
|
|
4507
4528
|
}
|
|
4508
|
-
const
|
|
4509
|
-
if (
|
|
4510
|
-
const
|
|
4529
|
+
const T = await o.prepare(W);
|
|
4530
|
+
if (P(b), T.transaction.operation === "sdn.auth.raw-challenge.v1") {
|
|
4531
|
+
const k = Eo({
|
|
4511
4532
|
document: n,
|
|
4512
4533
|
mount: i,
|
|
4513
|
-
title: `Choose the legacy profile for ${
|
|
4534
|
+
title: `Choose the legacy profile for ${T.binding.clientDisplayName}`
|
|
4514
4535
|
});
|
|
4515
|
-
u =
|
|
4516
|
-
const R = await
|
|
4517
|
-
|
|
4518
|
-
const
|
|
4536
|
+
u = k;
|
|
4537
|
+
const R = await k.promise;
|
|
4538
|
+
P(b), u === k && (u = null);
|
|
4539
|
+
const z = R === "password-fast-v1-legacy" ? c({
|
|
4519
4540
|
controller: null,
|
|
4520
4541
|
document: n,
|
|
4521
4542
|
mount: i,
|
|
4522
|
-
title: `Sign in to ${
|
|
4523
|
-
transaction:
|
|
4524
|
-
}) :
|
|
4543
|
+
title: `Sign in to ${T.binding.clientDisplayName}`,
|
|
4544
|
+
transaction: T
|
|
4545
|
+
}) : bi({
|
|
4525
4546
|
document: n,
|
|
4526
4547
|
mount: i,
|
|
4527
4548
|
submitLabel: "Continue",
|
|
4528
|
-
title: `Sign in to ${
|
|
4549
|
+
title: `Sign in to ${T.binding.clientDisplayName}`
|
|
4529
4550
|
});
|
|
4530
|
-
u =
|
|
4531
|
-
const
|
|
4532
|
-
|
|
4533
|
-
const
|
|
4534
|
-
...
|
|
4535
|
-
operation:
|
|
4551
|
+
u = z?.promise ? z : null;
|
|
4552
|
+
const Y = z?.promise ? await z.promise : await z;
|
|
4553
|
+
P(b);
|
|
4554
|
+
const G = await o.unlockLegacy({
|
|
4555
|
+
...Y,
|
|
4556
|
+
operation: T.transaction.operation,
|
|
4536
4557
|
profile: R
|
|
4537
4558
|
});
|
|
4538
|
-
|
|
4559
|
+
P(b), d = G;
|
|
4539
4560
|
} else {
|
|
4540
|
-
let
|
|
4561
|
+
let k = !1;
|
|
4541
4562
|
for (; ; ) {
|
|
4542
4563
|
const R = c({
|
|
4543
4564
|
controller: o,
|
|
4544
4565
|
document: n,
|
|
4545
4566
|
mount: i,
|
|
4546
|
-
offerRememberedUnlock: !
|
|
4547
|
-
title: `Sign in to ${
|
|
4548
|
-
transaction:
|
|
4567
|
+
offerRememberedUnlock: !k,
|
|
4568
|
+
title: `Sign in to ${T.binding.clientDisplayName}`,
|
|
4569
|
+
transaction: T
|
|
4549
4570
|
});
|
|
4550
|
-
|
|
4551
|
-
const
|
|
4552
|
-
if (
|
|
4571
|
+
k && R?.controls?.rememberStatus && (R.controls.rememberStatus.textContent = "Remembered wallet unavailable. Enter username and password."), u = R?.promise ? R : null;
|
|
4572
|
+
const z = R?.promise ? await R.promise : await R;
|
|
4573
|
+
if (P(b), z?.remembered === !0)
|
|
4553
4574
|
try {
|
|
4554
|
-
const
|
|
4555
|
-
|
|
4575
|
+
const G = await o.unlockRemembered();
|
|
4576
|
+
P(b), d = G;
|
|
4556
4577
|
break;
|
|
4557
4578
|
} catch {
|
|
4558
|
-
if (!
|
|
4559
|
-
throw
|
|
4560
|
-
|
|
4579
|
+
if (!B(b))
|
|
4580
|
+
throw L(R), new V("STALE_CONTROLLER");
|
|
4581
|
+
k = !0, L(R);
|
|
4561
4582
|
continue;
|
|
4562
4583
|
}
|
|
4563
|
-
const
|
|
4564
|
-
|
|
4584
|
+
const Y = await o.unlockPassword(z);
|
|
4585
|
+
P(b), d = Y;
|
|
4565
4586
|
break;
|
|
4566
4587
|
}
|
|
4567
4588
|
}
|
|
4568
|
-
const
|
|
4569
|
-
return
|
|
4589
|
+
const Q = await o.executePrepared(T);
|
|
4590
|
+
return P(b), L(u), T.transaction.operation === "sdn.wallet.account.v1" ? (d = o.copyPublicIdentity(), l = wo({
|
|
4570
4591
|
clipboard: e?.clipboard ?? globalThis.navigator?.clipboard,
|
|
4571
4592
|
controller: o,
|
|
4572
4593
|
document: n,
|
|
4573
4594
|
identity: d,
|
|
4574
|
-
isAppCurrent: () =>
|
|
4595
|
+
isAppCurrent: () => B(b),
|
|
4575
4596
|
makeCredentialPrompt: c,
|
|
4576
4597
|
mount: i,
|
|
4577
|
-
onClear:
|
|
4598
|
+
onClear: E,
|
|
4578
4599
|
wasm: e?.wasm
|
|
4579
|
-
})) : (d = null, n?.createElement && i?.replaceChildren &&
|
|
4600
|
+
})) : (d = null, n?.createElement && i?.replaceChildren && Ii(
|
|
4580
4601
|
n,
|
|
4581
4602
|
t,
|
|
4582
4603
|
"The wallet request completed successfully.",
|
|
4583
4604
|
i
|
|
4584
|
-
)),
|
|
4585
|
-
} catch (
|
|
4586
|
-
const
|
|
4587
|
-
throw u?.cancel?.(), u = null,
|
|
4605
|
+
)), Q;
|
|
4606
|
+
} catch (W) {
|
|
4607
|
+
const T = !B(b);
|
|
4608
|
+
throw u?.cancel?.(), u = null, E(), F(), T || vi(n, W?.code === "USER_CANCELLED" ? "Cancelled. You may close this window." : void 0, i), await (p ?? o.destroy(T ? "stale-startup" : "startup-failure")), T && W?.code !== "DESTRUCTION_FAILED" ? new V("STALE_CONTROLLER") : W;
|
|
4588
4609
|
}
|
|
4589
4610
|
})(), f);
|
|
4590
4611
|
},
|
|
4591
|
-
stop(
|
|
4592
|
-
|
|
4593
|
-
const
|
|
4594
|
-
return p || (
|
|
4612
|
+
stop(b = "close") {
|
|
4613
|
+
I(), u?.cancel?.(), u = null, E(), m();
|
|
4614
|
+
const W = o.destroy(b);
|
|
4615
|
+
return p || (F(), p = W), p;
|
|
4595
4616
|
}
|
|
4596
4617
|
});
|
|
4597
4618
|
}
|
|
4598
|
-
async function
|
|
4599
|
-
const t =
|
|
4619
|
+
async function So(e) {
|
|
4620
|
+
const t = Io(e);
|
|
4600
4621
|
return await t.start(), t;
|
|
4601
4622
|
}
|
|
4602
4623
|
export {
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4624
|
+
Ao as createPasswordCredentialPrompt,
|
|
4625
|
+
Io as createWalletOriginApp,
|
|
4626
|
+
So as mountWalletOriginApp,
|
|
4627
|
+
bo as transactionIdFromLocation
|
|
4607
4628
|
};
|