hd-wallet-ui 2.1.2 → 2.2.1

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.
@@ -37,7 +37,7 @@ const Te = Object.freeze({
37
37
  "event",
38
38
  "identity",
39
39
  "schemaVersion"
40
- ], Ye = [
40
+ ], Ue = [
41
41
  "algorithm",
42
42
  "encoding",
43
43
  "identityScheme",
@@ -45,7 +45,7 @@ const Te = Object.freeze({
45
45
  "schemaVersion",
46
46
  "signatureHex",
47
47
  "signatureProfile"
48
- ], Ue = [
48
+ ], Ye = [
49
49
  "algorithm",
50
50
  "canonicalEnvelope",
51
51
  "encoding",
@@ -84,55 +84,55 @@ function me(r) {
84
84
  for (; e < r.length && /[\u0009\u000a\u000d\u0020]/u.test(r[e]); ) e += 1;
85
85
  }, n = () => {
86
86
  r[e] !== '"' && c("invalid JSON string");
87
- const u = e;
87
+ const l = e;
88
88
  for (e += 1; e < r.length; ) {
89
- const l = r.charCodeAt(e);
90
- if (l === 34) {
89
+ const u = r.charCodeAt(e);
90
+ if (u === 34) {
91
91
  e += 1;
92
92
  let f;
93
93
  try {
94
- f = JSON.parse(r.slice(u, e));
94
+ f = JSON.parse(r.slice(l, e));
95
95
  } catch {
96
96
  c("invalid JSON string");
97
97
  }
98
98
  return g(f, "JSON string");
99
99
  }
100
- l < 32 && c("invalid JSON control character"), l === 92 && (e += 1, e >= r.length && c("unterminated JSON escape")), e += 1;
100
+ u < 32 && c("invalid JSON control character"), u === 92 && (e += 1, e >= r.length && c("unterminated JSON escape")), e += 1;
101
101
  }
102
102
  c("unterminated JSON string");
103
- }, o = (u = 0) => {
104
- u > 32 && c("wire JSON nesting is too deep"), t += 1, t > 4096 && c("wire JSON contains too many values"), i();
105
- const l = r[e];
106
- if (l === '"') return n();
107
- if (l === "{") {
103
+ }, o = (l = 0) => {
104
+ l > 32 && c("wire JSON nesting is too deep"), t += 1, t > 4096 && c("wire JSON contains too many values"), i();
105
+ const u = r[e];
106
+ if (u === '"') return n();
107
+ if (u === "{") {
108
108
  e += 1;
109
- const y = /* @__PURE__ */ Object.create(null), p = /* @__PURE__ */ new Set();
109
+ const d = /* @__PURE__ */ Object.create(null), p = /* @__PURE__ */ new Set();
110
110
  if (i(), r[e] === "}")
111
- return e += 1, y;
111
+ return e += 1, d;
112
112
  for (; e < r.length; ) {
113
113
  i();
114
114
  const R = n();
115
- if (p.has(R) && c(`duplicate JSON field: ${R}`), p.add(R), i(), r[e] !== ":" && c("missing JSON object colon"), e += 1, y[R] = o(u + 1), i(), r[e] === "}")
116
- return e += 1, y;
115
+ if (p.has(R) && c(`duplicate JSON field: ${R}`), p.add(R), i(), r[e] !== ":" && c("missing JSON object colon"), e += 1, d[R] = o(l + 1), i(), r[e] === "}")
116
+ return e += 1, d;
117
117
  r[e] !== "," && c("invalid JSON object separator"), e += 1;
118
118
  }
119
119
  c("unterminated JSON object");
120
120
  }
121
- if (l === "[") {
121
+ if (u === "[") {
122
122
  e += 1;
123
- const y = [];
123
+ const d = [];
124
124
  if (i(), r[e] === "]")
125
- return e += 1, y;
125
+ return e += 1, d;
126
126
  for (; e < r.length; ) {
127
- if (y.push(o(u + 1)), i(), r[e] === "]")
128
- return e += 1, y;
127
+ if (d.push(o(l + 1)), i(), r[e] === "]")
128
+ return e += 1, d;
129
129
  r[e] !== "," && c("invalid JSON array separator"), e += 1;
130
130
  }
131
131
  c("unterminated JSON array");
132
132
  }
133
- for (const [y, p] of [["true", !0], ["false", !1], ["null", null]])
134
- if (r.startsWith(y, e))
135
- return e += y.length, p;
133
+ for (const [d, p] of [["true", !0], ["false", !1], ["null", null]])
134
+ if (r.startsWith(d, e))
135
+ return e += d.length, p;
136
136
  const f = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/u.exec(r.slice(e));
137
137
  f || c("invalid JSON value"), e += f[0].length;
138
138
  const h = Number(f[0]);
@@ -154,11 +154,11 @@ function Fe(r, e) {
154
154
  function b(r, e, t) {
155
155
  const i = qe(r);
156
156
  X(i) || c(`${t} must be a JSON object`), Object.getOwnPropertySymbols(i).length !== 0 && c(`${t} has an unknown symbol field`);
157
- const n = Object.getOwnPropertyNames(i).sort(), o = [...e].sort(), s = C.encode(n.join("\0")), u = C.encode(o.join("\0"));
158
- Fe(s, u) || c(`${t} has missing or unknown fields`);
159
- for (const l of n) {
160
- const f = Object.getOwnPropertyDescriptor(i, l);
161
- (!f || !f.enumerable || !("value" in f)) && c(`${t}.${l} must be an enumerable data field`), f.value === void 0 && c(`${t}.${l} must not be undefined`);
157
+ const n = Object.getOwnPropertyNames(i).sort(), o = [...e].sort(), s = C.encode(n.join("\0")), l = C.encode(o.join("\0"));
158
+ Fe(s, l) || c(`${t} has missing or unknown fields`);
159
+ for (const u of n) {
160
+ const f = Object.getOwnPropertyDescriptor(i, u);
161
+ (!f || !f.enumerable || !("value" in f)) && c(`${t}.${u} must be an enumerable data field`), f.value === void 0 && c(`${t}.${u} must not be undefined`);
162
162
  }
163
163
  return i;
164
164
  }
@@ -185,7 +185,7 @@ function Je(r) {
185
185
  ["reviewedTransform", "schemaVersion"],
186
186
  "asset review protocol policy"
187
187
  );
188
- d(e.schemaVersion, 1, "asset review protocol schemaVersion");
188
+ y(e.schemaVersion, 1, "asset review protocol schemaVersion");
189
189
  const t = b(e.reviewedTransform, [
190
190
  "metersPerSourceUnit",
191
191
  "quaternionNormTolerance",
@@ -217,7 +217,7 @@ function Je(r) {
217
217
  ]);
218
218
  }
219
219
  Je(xe);
220
- function d(r, e, t) {
220
+ function y(r, e, t) {
221
221
  return r !== e && c(`${t} must equal ${JSON.stringify(e)}`), r;
222
222
  }
223
223
  function F(r, e, t) {
@@ -235,8 +235,8 @@ function be(r, e) {
235
235
  }
236
236
  function Q(r, e) {
237
237
  (!ArrayBuffer.isView(r) || !(r instanceof Uint8Array) || Object.getPrototypeOf(r) !== Uint8Array.prototype) && c(`${e} must be a plain Uint8Array`), Ce.call(r) !== 32 && c(`${e} must be exactly 32 bytes`);
238
- const i = Array.from({ length: 32 }, (h, y) => String(y)), n = Reflect.ownKeys(r);
239
- (n.length !== i.length || n.some((h, y) => h !== i[y])) && c(`${e} Uint8Array must contain only 32 indexed bytes`);
238
+ const i = Array.from({ length: 32 }, (h, d) => String(d)), n = Reflect.ownKeys(r);
239
+ (n.length !== i.length || n.some((h, d) => h !== i[d])) && c(`${e} Uint8Array must contain only 32 indexed bytes`);
240
240
  const o = Ne.call(r);
241
241
  let s = !1;
242
242
  if (re)
@@ -251,14 +251,14 @@ function Q(r, e) {
251
251
  } catch {
252
252
  c(`${e} must use ArrayBuffer storage`);
253
253
  }
254
- const u = new Uint8Array(32);
254
+ const l = new Uint8Array(32);
255
255
  for (let h = 0; h < 32; h += 1) {
256
- const y = Object.getOwnPropertyDescriptor(r, String(h));
257
- (!y || !y.enumerable || !("value" in y) || !Number.isInteger(y.value) || y.value < 0 || y.value > 255) && c(`${e} Uint8Array contains an invalid indexed byte`), u[h] = r[h];
256
+ const d = Object.getOwnPropertyDescriptor(r, String(h));
257
+ (!d || !d.enumerable || !("value" in d) || !Number.isInteger(d.value) || d.value < 0 || d.value > 255) && c(`${e} Uint8Array contains an invalid indexed byte`), l[h] = r[h];
258
258
  }
259
- let l = "";
260
- for (let h = 0; h < 32; h += 1) l += String.fromCharCode(u[h]);
261
- const f = globalThis.btoa(l).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/gu, "");
259
+ let u = "";
260
+ for (let h = 0; h < 32; h += 1) u += String.fromCharCode(l[h]);
261
+ const f = globalThis.btoa(u).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/gu, "");
262
262
  return f.length !== 43 && c(`${e} did not encode to 43 base64url characters`), f;
263
263
  }
264
264
  function Z(r, e) {
@@ -294,7 +294,7 @@ function ze(r, e) {
294
294
  "requestOrigin",
295
295
  "signatureProfile"
296
296
  ], "SDN login canonicalEnvelope");
297
- He(i, e), d(i.audience, z, "SDN login envelope audience"), m(i.challengeSha256, L, "SDN login envelope challengeSha256"), d(i.clientId, "sdn-node-console-v1", "SDN login envelope clientId"), k(i.issuedAt, "SDN login envelope issuedAt"), k(i.expiresAt, "SDN login envelope expiresAt"), be(i.issuedAt, i.expiresAt), d(i.identityScheme, v, "SDN login envelope identityScheme"), m(i.keyId, j, "SDN login envelope keyId"), d(i.kind, "sdn-login", "SDN login envelope kind"), m(i.nonce, L, "SDN login envelope nonce"), d(i.protocolVersion, 2, "SDN login envelope protocolVersion"), d(i.requestOrigin, "https://sdn.spaceaware.io", "SDN login envelope requestOrigin"), d(i.signatureProfile, D, "SDN login envelope signatureProfile");
297
+ He(i, e), y(i.audience, z, "SDN login envelope audience"), m(i.challengeSha256, L, "SDN login envelope challengeSha256"), y(i.clientId, "sdn-node-console-v1", "SDN login envelope clientId"), k(i.issuedAt, "SDN login envelope issuedAt"), k(i.expiresAt, "SDN login envelope expiresAt"), be(i.issuedAt, i.expiresAt), y(i.identityScheme, v, "SDN login envelope identityScheme"), m(i.keyId, j, "SDN login envelope keyId"), y(i.kind, "sdn-login", "SDN login envelope kind"), m(i.nonce, L, "SDN login envelope nonce"), y(i.protocolVersion, 2, "SDN login envelope protocolVersion"), y(i.requestOrigin, "https://sdn.spaceaware.io", "SDN login envelope requestOrigin"), y(i.signatureProfile, D, "SDN login envelope signatureProfile");
298
298
  }
299
299
  function We(r, e, t) {
300
300
  g(r, "canonicalEnvelope"), C.encode(r).byteLength > pe && c("canonicalEnvelope is too large");
@@ -303,7 +303,7 @@ function We(r, e, t) {
303
303
  }
304
304
  function Ke(r, e) {
305
305
  const t = b(r, Me, `identity key ${e.purpose}`);
306
- return d(t.purpose, e.purpose, "key purpose"), d(t.identityScheme, v, "key identityScheme"), d(t.seedProfile, q, "key seedProfile"), d(t.signatureProfile, e.signatureProfile, "key signatureProfile"), d(t.curve, e.curve, "key curve"), d(t.derivation, "slip10", "key derivation"), d(t.path, e.path, "key path"), d(t.encoding, "raw", "key encoding"), m(t.publicKeyHex, L, "key publicKeyHex"), d(t.bip32Fingerprint, null, "key bip32Fingerprint"), m(t.keyId, j, "key keyId"), A([
306
+ return y(t.purpose, e.purpose, "key purpose"), y(t.identityScheme, v, "key identityScheme"), y(t.seedProfile, q, "key seedProfile"), y(t.signatureProfile, e.signatureProfile, "key signatureProfile"), y(t.curve, e.curve, "key curve"), y(t.derivation, "slip10", "key derivation"), y(t.path, e.path, "key path"), y(t.encoding, "raw", "key encoding"), m(t.publicKeyHex, L, "key publicKeyHex"), y(t.bip32Fingerprint, null, "key bip32Fingerprint"), m(t.keyId, j, "key keyId"), A([
307
307
  ["bip32Fingerprint", null],
308
308
  ["curve", t.curve],
309
309
  ["derivation", "slip10"],
@@ -319,7 +319,7 @@ function Ke(r, e) {
319
319
  }
320
320
  function Xe(r) {
321
321
  const e = b(r, $e, "WalletPublicIdentity");
322
- d(e.schemaVersion, 1, "identity schemaVersion"), d(e.identityScheme, v, "identity identityScheme"), d(e.seedProfile, q, "identity seedProfile"), e.accountIndex !== 0 && c("public wallet identity must use account 0"), d(e.accountLabel, null, "identity accountLabel"), g(e.accountXpub, "identity accountXpub"), /^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(e.accountXpub) || c("identity accountXpub is invalid"), g(e.accountPeerId, "identity accountPeerId"), (!e.accountPeerId.startsWith("16Uiu2H") || e.accountPeerId.length < 40 || e.accountPeerId.length > 64 || !Ve.test(e.accountPeerId)) && c("identity accountPeerId is invalid"), m(e.accountFingerprint, /^[0-9a-f]{8}$/u, "identity accountFingerprint"), Re(e.keys, 3, "public identity keys array");
322
+ y(e.schemaVersion, 1, "identity schemaVersion"), y(e.identityScheme, v, "identity identityScheme"), y(e.seedProfile, q, "identity seedProfile"), e.accountIndex !== 0 && c("public wallet identity must use account 0"), y(e.accountLabel, null, "identity accountLabel"), g(e.accountXpub, "identity accountXpub"), /^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(e.accountXpub) || c("identity accountXpub is invalid"), g(e.accountPeerId, "identity accountPeerId"), (!e.accountPeerId.startsWith("16Uiu2H") || e.accountPeerId.length < 40 || e.accountPeerId.length > 64 || !Ve.test(e.accountPeerId)) && c("identity accountPeerId is invalid"), m(e.accountFingerprint, /^[0-9a-f]{8}$/u, "identity accountFingerprint"), Re(e.keys, 3, "public identity keys array");
323
323
  const t = [
324
324
  {
325
325
  purpose: "asset-review-approval",
@@ -357,7 +357,7 @@ function Xe(r) {
357
357
  }
358
358
  function Ee(r, e) {
359
359
  const t = b(r, Be, `${e} result`);
360
- d(t.schemaVersion, 1, "connection result schemaVersion"), F(t.event, ["connected", "disconnected"], "connection event"), e === "connect" && t.event !== "connected" && c("connect result must be connected");
360
+ y(t.schemaVersion, 1, "connection result schemaVersion"), F(t.event, ["connected", "disconnected"], "connection event"), e === "connect" && t.event !== "connected" && c("connect result must be connected");
361
361
  let i = null, n = null;
362
362
  return t.event === "connected" ? (i = Xe(t.identity), n = k(t.connectionExpiresAt, "connectionExpiresAt")) : (t.identity !== null || t.connectionExpiresAt !== null) && c("disconnected result must clear identity and expiry"), A([
363
363
  ["connectionExpiresAt", n],
@@ -367,11 +367,11 @@ function Ee(r, e) {
367
367
  ]);
368
368
  }
369
369
  function Qe(r) {
370
- const e = b(r, Ye, "raw signature");
371
- return d(e.schemaVersion, 1, "signature schemaVersion"), m(e.keyId, j, "signature keyId"), F(e.identityScheme, [
370
+ const e = b(r, Ue, "raw signature");
371
+ return y(e.schemaVersion, 1, "signature schemaVersion"), m(e.keyId, j, "signature keyId"), F(e.identityScheme, [
372
372
  "sdn-fast-password-auth-v1-legacy",
373
373
  "sdn-bip39-auth-v1-legacy"
374
- ], "raw signature identityScheme"), d(e.algorithm, "ed25519", "signature algorithm"), d(e.encoding, "raw", "signature encoding"), d(e.signatureProfile, ie, "signature profile"), m(e.signatureHex, K, "signatureHex"), A([
374
+ ], "raw signature identityScheme"), y(e.algorithm, "ed25519", "signature algorithm"), y(e.encoding, "raw", "signature encoding"), y(e.signatureProfile, ie, "signature profile"), m(e.signatureHex, K, "signatureHex"), A([
375
375
  ["algorithm", "ed25519"],
376
376
  ["encoding", "raw"],
377
377
  ["identityScheme", e.identityScheme],
@@ -382,8 +382,8 @@ function Qe(r) {
382
382
  ]);
383
383
  }
384
384
  function Ze(r, e) {
385
- const t = b(r, Ue, "canonical signature");
386
- return d(t.schemaVersion, 1, "signature schemaVersion"), m(t.keyId, j, "signature keyId"), d(t.identityScheme, v, "signature identityScheme"), d(t.algorithm, "ed25519", "signature algorithm"), d(t.encoding, "raw", "signature encoding"), d(t.signatureProfile, D, "signature profile"), We(t.canonicalEnvelope, e, t), m(t.signedDigestSha256, L, "signedDigestSha256"), m(t.signatureHex, K, "signatureHex"), A([
385
+ const t = b(r, Ye, "canonical signature");
386
+ return y(t.schemaVersion, 1, "signature schemaVersion"), m(t.keyId, j, "signature keyId"), y(t.identityScheme, v, "signature identityScheme"), y(t.algorithm, "ed25519", "signature algorithm"), y(t.encoding, "raw", "signature encoding"), y(t.signatureProfile, D, "signature profile"), We(t.canonicalEnvelope, e, t), m(t.signedDigestSha256, L, "signedDigestSha256"), m(t.signatureHex, K, "signatureHex"), A([
387
387
  ["algorithm", "ed25519"],
388
388
  ["canonicalEnvelope", t.canonicalEnvelope],
389
389
  ["encoding", "raw"],
@@ -397,14 +397,14 @@ function Ze(r, e) {
397
397
  }
398
398
  function Ge(r) {
399
399
  const e = b(r, ["challengeBase64url", "protocolVersion"], "SDN login v1 request");
400
- return d(e.protocolVersion, 1, "SDN login v1 protocolVersion"), Z(e.challengeBase64url, "challengeBase64url"), A([
400
+ return y(e.protocolVersion, 1, "SDN login v1 protocolVersion"), Z(e.challengeBase64url, "challengeBase64url"), A([
401
401
  ["challengeBase64url", e.challengeBase64url],
402
402
  ["protocolVersion", 1]
403
403
  ]);
404
404
  }
405
405
  function et(r) {
406
406
  const e = b(r, ne, "SDN publication request");
407
- d(e.protocolVersion, 1, "publication protocolVersion"), d(e.method, "POST", "publication method"), F(e.schema, ["CZM", "ETM"], "publication schema"), g(e.providerOrigin, "providerOrigin");
407
+ y(e.protocolVersion, 1, "publication protocolVersion"), y(e.method, "POST", "publication method"), F(e.schema, ["CZM", "ETM"], "publication schema"), g(e.providerOrigin, "providerOrigin");
408
408
  let t;
409
409
  try {
410
410
  t = new URL(e.providerOrigin);
@@ -425,7 +425,7 @@ function et(r) {
425
425
  }
426
426
  function tt(r) {
427
427
  const e = b(r, se, "SDN publication signature");
428
- return d(e.schemaVersion, 1, "publication signature schemaVersion"), d(e.identityScheme, v, "publication identityScheme"), d(e.algorithm, "ed25519", "publication algorithm"), d(e.encoding, "raw", "publication encoding"), d(e.signatureProfile, ke, "publication signatureProfile"), m(e.keyId, j, "publication keyId"), m(e.publicKeyHex, L, "publication publicKeyHex"), m(e.signatureHex, K, "publication signatureHex"), m(e.requestDigestSha256, L, "publication requestDigestSha256"), m(e.challengeId, /^[0-9a-f]{32}$/u, "publication challengeId"), Z(e.challengeBase64url, "publication challengeBase64url"), A(se.map((t) => [t, e[t]]));
428
+ return y(e.schemaVersion, 1, "publication signature schemaVersion"), y(e.identityScheme, v, "publication identityScheme"), y(e.algorithm, "ed25519", "publication algorithm"), y(e.encoding, "raw", "publication encoding"), y(e.signatureProfile, ke, "publication signatureProfile"), m(e.keyId, j, "publication keyId"), m(e.publicKeyHex, L, "publication publicKeyHex"), m(e.signatureHex, K, "publication signatureHex"), m(e.requestDigestSha256, L, "publication requestDigestSha256"), m(e.challengeId, /^[0-9a-f]{32}$/u, "publication challengeId"), Z(e.challengeBase64url, "publication challengeBase64url"), A(se.map((t) => [t, e[t]]));
429
429
  }
430
430
  function rt(r) {
431
431
  const e = b(r, [
@@ -436,7 +436,7 @@ function rt(r) {
436
436
  "nonce",
437
437
  "protocolVersion"
438
438
  ], "SDN login v2 request");
439
- return d(e.protocolVersion, 2, "SDN login v2 protocolVersion"), d(e.audience, z, "SDN login v2 audience"), Z(e.challengeBase64url, "challengeBase64url"), m(e.nonce, L, "SDN login nonce"), k(e.issuedAt, "SDN login issuedAt"), k(e.expiresAt, "SDN login expiresAt"), be(e.issuedAt, e.expiresAt), A([
439
+ return y(e.protocolVersion, 2, "SDN login v2 protocolVersion"), y(e.audience, z, "SDN login v2 audience"), Z(e.challengeBase64url, "challengeBase64url"), m(e.nonce, L, "SDN login nonce"), k(e.issuedAt, "SDN login issuedAt"), k(e.expiresAt, "SDN login expiresAt"), be(e.issuedAt, e.expiresAt), A([
440
440
  ["audience", z],
441
441
  ["challengeBase64url", e.challengeBase64url],
442
442
  ["expiresAt", e.expiresAt],
@@ -462,7 +462,7 @@ function ot(r) {
462
462
  }
463
463
  function ct(r) {
464
464
  const e = b(r, ["challenge", "protocolVersion"], "SDN login v1 public request");
465
- return d(e.protocolVersion, 1, "SDN login v1 protocolVersion"), Ge({
465
+ return y(e.protocolVersion, 1, "SDN login v1 protocolVersion"), Ge({
466
466
  challengeBase64url: Q(e.challenge, "challenge"),
467
467
  protocolVersion: 1
468
468
  });
@@ -505,6 +505,7 @@ const _ = "https://wallet.spacedatanetwork.org", V = "sdn.wallet.callback.v1:",
505
505
  EXPIRED: "The wallet connection expired.",
506
506
  INVALID_CLIENT: "This wallet client is not registered.",
507
507
  INVALID_REQUEST: "The wallet request is invalid.",
508
+ NOT_ADDRESSED_TO_ACCOUNT: "This data is not sealed to your wallet.",
508
509
  RELAY_ERROR: "The wallet service could not complete the request. Try again.",
509
510
  REPLACED: "A newer wallet request replaced this one.",
510
511
  WALLET_NOT_COMPLETED: "The wallet did not complete. Check popup settings and try again."
@@ -535,23 +536,23 @@ function M(r, e) {
535
536
  for (; t < r.length && /[\u0009\u000a\u000d\u0020]/u.test(r[t]); ) t += 1;
536
537
  }, o = () => {
537
538
  if (r[t] !== '"') throw a("RELAY_ERROR");
538
- const l = t;
539
+ const u = t;
539
540
  for (t += 1; t < r.length; ) {
540
541
  const f = r.charCodeAt(t);
541
542
  if (f === 34) {
542
543
  t += 1;
543
544
  let h;
544
545
  try {
545
- h = JSON.parse(r.slice(l, t));
546
+ h = JSON.parse(r.slice(u, t));
546
547
  } catch {
547
548
  throw a("RELAY_ERROR");
548
549
  }
549
- for (let y = 0; y < h.length; y += 1) {
550
- const p = h.charCodeAt(y);
550
+ for (let d = 0; d < h.length; d += 1) {
551
+ const p = h.charCodeAt(d);
551
552
  if (p >= 55296 && p <= 56319) {
552
- const R = h.charCodeAt(y + 1);
553
+ const R = h.charCodeAt(d + 1);
553
554
  if (!(R >= 56320 && R <= 57343)) throw a("RELAY_ERROR");
554
- y += 1;
555
+ d += 1;
555
556
  } else if (p >= 56320 && p <= 57343)
556
557
  throw a("RELAY_ERROR");
557
558
  }
@@ -562,8 +563,8 @@ function M(r, e) {
562
563
  t += 1;
563
564
  }
564
565
  throw a("RELAY_ERROR");
565
- }, s = (l = 0) => {
566
- if (l > 32 || ++i > 4096) throw a("RELAY_ERROR");
566
+ }, s = (u = 0) => {
567
+ if (u > 32 || ++i > 4096) throw a("RELAY_ERROR");
567
568
  n();
568
569
  const f = r[t];
569
570
  if (f === '"') return o();
@@ -576,7 +577,7 @@ function M(r, e) {
576
577
  n();
577
578
  const S = o();
578
579
  if (R.has(S) || (R.add(S), n(), r[t] !== ":")) throw a("RELAY_ERROR");
579
- if (t += 1, p[S] = s(l + 1), n(), r[t] === "}")
580
+ if (t += 1, p[S] = s(u + 1), n(), r[t] === "}")
580
581
  return t += 1, p;
581
582
  if (r[t] !== ",") throw a("RELAY_ERROR");
582
583
  t += 1;
@@ -589,7 +590,7 @@ function M(r, e) {
589
590
  if (n(), r[t] === "]")
590
591
  return t += 1, p;
591
592
  for (; t < r.length; ) {
592
- if (p.push(s(l + 1)), n(), r[t] === "]")
593
+ if (p.push(s(u + 1)), n(), r[t] === "]")
593
594
  return t += 1, p;
594
595
  if (r[t] !== ",") throw a("RELAY_ERROR");
595
596
  t += 1;
@@ -602,14 +603,14 @@ function M(r, e) {
602
603
  const h = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/u.exec(r.slice(t));
603
604
  if (!h) throw a("RELAY_ERROR");
604
605
  t += h[0].length;
605
- const y = Number(h[0]);
606
- if (!Number.isFinite(y)) throw a("RELAY_ERROR");
607
- return y;
606
+ const d = Number(h[0]);
607
+ if (!Number.isFinite(d)) throw a("RELAY_ERROR");
608
+ return d;
608
609
  };
609
610
  n();
610
- const u = s();
611
+ const l = s();
611
612
  if (n(), t !== r.length) throw a("RELAY_ERROR");
612
- return u;
613
+ return l;
613
614
  }
614
615
  function B(r, e, t = "RELAY_ERROR") {
615
616
  if (!Ot(r) || Object.getOwnPropertySymbols(r).length !== 0)
@@ -624,7 +625,7 @@ function B(r, e, t = "RELAY_ERROR") {
624
625
  }
625
626
  return r;
626
627
  }
627
- function Y(r, e = "RELAY_ERROR") {
628
+ function U(r, e = "RELAY_ERROR") {
628
629
  if (typeof r != "string" || !dt.test(r))
629
630
  throw a(e);
630
631
  const t = Date.parse(r);
@@ -703,7 +704,7 @@ function I(r, e, t = null) {
703
704
  }
704
705
  t && Se(t), x(e);
705
706
  }
706
- function U(r, e, t = null) {
707
+ function Y(r, e, t = null) {
707
708
  let i;
708
709
  try {
709
710
  i = Promise.resolve(r);
@@ -712,13 +713,13 @@ function U(r, e, t = null) {
712
713
  }
713
714
  return new Promise((n, o) => {
714
715
  let s = !1;
715
- const u = () => {
716
+ const l = () => {
716
717
  try {
717
718
  e.removeEventListener("abort", f);
718
719
  } catch {
719
720
  }
720
- }, l = (h, y) => s ? !1 : (s = !0, u(), h(y), !0), f = () => {
721
- l(o, a("RELAY_ERROR"));
721
+ }, u = (h, d) => s ? !1 : (s = !0, l(), h(d), !0), f = () => {
722
+ u(o, a("RELAY_ERROR"));
722
723
  };
723
724
  try {
724
725
  e.addEventListener("abort", f, { once: !0 }), e.aborted && f();
@@ -734,10 +735,10 @@ function U(r, e, t = null) {
734
735
  }
735
736
  return;
736
737
  }
737
- l(n, h);
738
+ u(n, h);
738
739
  },
739
740
  (h) => {
740
- s || l(o, h);
741
+ s || u(o, h);
741
742
  }
742
743
  );
743
744
  });
@@ -750,16 +751,16 @@ async function fe(r, e, t) {
750
751
  if (!St(r) || typeof r?.body?.getReader != "function")
751
752
  throw a("RELAY_ERROR");
752
753
  for (i = r.body.getReader(); ; ) {
753
- const l = i.read(), { done: f, value: h } = await U(l, t.signal);
754
+ const u = i.read(), { done: f, value: h } = await Y(u, t.signal);
754
755
  if (f) break;
755
756
  if (!(h instanceof Uint8Array) || (o += h.byteLength, o > e))
756
757
  throw a("RELAY_ERROR");
757
758
  n.push(h);
758
759
  }
759
760
  const s = new Uint8Array(o);
760
- let u = 0;
761
- for (const l of n)
762
- s.set(l, u), u += l.byteLength;
761
+ let l = 0;
762
+ for (const u of n)
763
+ s.set(u, l), l += u.byteLength;
763
764
  return gt.decode(s);
764
765
  } catch {
765
766
  try {
@@ -793,7 +794,7 @@ function vt(r, e, t) {
793
794
  }
794
795
  if (i.schemaVersion !== 1 || i.state !== e || !P.test(i.code))
795
796
  throw a("CALLBACK_ERROR");
796
- const n = Y(i.expiresAt, "CALLBACK_ERROR");
797
+ const n = U(i.expiresAt, "CALLBACK_ERROR");
797
798
  if (n <= t || n - t > bt)
798
799
  throw a("CALLBACK_ERROR");
799
800
  return { code: i.code, expiresAt: n, state: i.state };
@@ -860,7 +861,7 @@ class _t {
860
861
  this.#j = e, this.#V = t, this.#e = i ?? It(), this.#p = this.#e.window;
861
862
  }
862
863
  getSnapshot() {
863
- return this.#U(), le(this.#M);
864
+ return this.#Y(), le(this.#M);
864
865
  }
865
866
  subscribe(e) {
866
867
  if (typeof e != "function") throw a("INVALID_REQUEST");
@@ -890,41 +891,41 @@ class _t {
890
891
  if (s) return Promise.reject(s);
891
892
  if (this.#T)
892
893
  return this.#l = !0, Promise.reject(a("REPLACED"));
893
- const u = ++this.#m;
894
- if (this.#Q(), s = this.#t(u), s) return Promise.reject(s);
894
+ const l = ++this.#m;
895
+ if (this.#Q(), s = this.#t(l), s) return Promise.reject(s);
895
896
  if (this.#l)
896
897
  return Promise.reject(a("CALLBACK_ERROR"));
897
- if (this.#U(), s = this.#t(u), s) return Promise.reject(s);
898
- const l = this.#n();
899
- if (s = this.#t(u), s) return Promise.reject(s);
900
- const f = this.#s && this.#s.expiresAtMs > l ? this.#s : null;
901
- if (s = this.#t(u), s) return Promise.reject(s);
898
+ if (this.#Y(), s = this.#t(l), s) return Promise.reject(s);
899
+ const u = this.#n();
900
+ if (s = this.#t(l), s) return Promise.reject(s);
901
+ const f = this.#s && this.#s.expiresAtMs > u ? this.#s : null;
902
+ if (s = this.#t(l), s) return Promise.reject(s);
902
903
  const h = this.#o;
903
- let y, p, R;
904
+ let d, p, R;
904
905
  try {
905
906
  const E = this.#e.crypto, O = E?.getRandomValues, _e = E?.subtle?.digest, te = this.#p?.open;
906
- if (s = this.#t(u), s) throw s;
907
+ if (s = this.#t(l), s) throw s;
907
908
  if (typeof O != "function" || typeof _e != "function" || typeof te != "function")
908
909
  throw a("CRYPTO_UNAVAILABLE");
909
- if (y = he(H(E, O)), s = this.#t(u), s || (p = he(H(E, O)), s = this.#t(u), s) || (R = ue(H(E, O)), s = this.#t(u), s)) throw s;
910
- if (!P.test(y) || !P.test(p) || !oe.test(R))
910
+ if (d = he(H(E, O)), s = this.#t(l), s || (p = he(H(E, O)), s = this.#t(l), s) || (R = ue(H(E, O)), s = this.#t(l), s)) throw s;
911
+ if (!P.test(d) || !P.test(p) || !oe.test(R))
911
912
  throw a("CRYPTO_UNAVAILABLE");
912
913
  if (Reflect.apply(te, this.#p, [
913
- `${_}/transaction/${y}`,
914
+ `${_}/transaction/${d}`,
914
915
  "_blank",
915
916
  "noopener"
916
- ]), s = this.#t(u), s) throw s;
917
+ ]), s = this.#t(l), s) throw s;
917
918
  } catch (E) {
918
- if (s = this.#t(u), s) return Promise.reject(s);
919
+ if (s = this.#t(l), s) return Promise.reject(s);
919
920
  let O;
920
921
  try {
921
922
  O = E instanceof N ? E : a("CRYPTO_UNAVAILABLE");
922
923
  } catch {
923
924
  O = a("CRYPTO_UNAVAILABLE");
924
925
  }
925
- return h && (this.#I(h, "REPLACED", !1), s = this.#t(u), s) ? Promise.reject(s) : (this.#B(null, O, f, n.kind), Promise.reject(O));
926
+ return h && (this.#I(h, "REPLACED", !1), s = this.#t(l), s) ? Promise.reject(s) : (this.#B(null, O, f, n.kind), Promise.reject(O));
926
927
  }
927
- if (h && (this.#I(h, "REPLACED", !1), s = this.#t(u), s))
928
+ if (h && (this.#I(h, "REPLACED", !1), s = this.#t(l), s))
928
929
  return Promise.reject(s);
929
930
  const S = de(), Ie = Lt(), ee = {
930
931
  active: !0,
@@ -942,16 +943,17 @@ class _t {
942
943
  pollTimer: null,
943
944
  priorConnection: f,
944
945
  promise: S.promise,
945
- registrationDeadlineMs: l + pt,
946
+ registrationDeadlineMs: u + pt,
946
947
  registrationOutcome: "none",
947
948
  reject: S.reject,
949
+ openResult: null,
948
950
  request: o,
949
951
  resolve: S.resolve,
950
952
  retryResolve: null,
951
953
  retryTimer: null,
952
954
  state: p,
953
955
  transactionExpiresAtMs: null,
954
- transactionId: y,
956
+ transactionId: d,
955
957
  verifier: R
956
958
  };
957
959
  return this.#o = ee, this.#i({
@@ -1013,16 +1015,19 @@ class _t {
1013
1015
  async #J(e) {
1014
1016
  if (!(!this.#c(e) || e.cleanupFinished))
1015
1017
  try {
1016
- e.operationTimer = this.#g(() => {
1018
+ if (e.operationTimer = this.#g(() => {
1017
1019
  if (!e.cleanupFinished) {
1018
1020
  if (e.phase === "hashing") {
1019
1021
  this.#c(e) && this.#h(e, "CRYPTO_UNAVAILABLE", !1);
1020
1022
  return;
1021
1023
  }
1022
1024
  if (e.phase === "registering")
1023
- for (const u of e.controllers) u.abort();
1025
+ for (const l of e.controllers) l.abort();
1024
1026
  }
1025
- }, Math.max(0, e.registrationDeadlineMs - this.#n()));
1027
+ }, Math.max(0, e.registrationDeadlineMs - this.#n())), typeof e.adapter.seal == "function") {
1028
+ const l = await e.adapter.seal(e.request, this.#e.crypto);
1029
+ e.request = l.request, e.openResult = l.open;
1030
+ }
1026
1031
  const t = await this.#e.crypto.subtle.digest(
1027
1032
  "SHA-256",
1028
1033
  Oe.encode(e.verifier)
@@ -1037,7 +1042,7 @@ class _t {
1037
1042
  let o, s = null;
1038
1043
  try {
1039
1044
  try {
1040
- const l = this.#e.fetch(
1045
+ const u = this.#e.fetch(
1041
1046
  `${_}/relay/v1/transactions`,
1042
1047
  $({
1043
1048
  clientId: this.#V,
@@ -1050,8 +1055,8 @@ class _t {
1050
1055
  transactionId: e.transactionId
1051
1056
  }, n.signal)
1052
1057
  );
1053
- s = await U(
1054
- l,
1058
+ s = await Y(
1059
+ u,
1055
1060
  n.signal,
1056
1061
  x
1057
1062
  );
@@ -1060,29 +1065,29 @@ class _t {
1060
1065
  return;
1061
1066
  }
1062
1067
  e.registrationOutcome = "ambiguous";
1063
- let u;
1068
+ let l;
1064
1069
  try {
1065
- u = s.status;
1070
+ l = s.status;
1066
1071
  } catch {
1067
1072
  I(n, s), e.active ? this.#h(e, "RELAY_ERROR") : this.#b(e);
1068
1073
  return;
1069
1074
  }
1070
- if (u !== 201) {
1075
+ if (l !== 201) {
1071
1076
  e.registrationOutcome = "definitive-failure", I(n, s), e.active ? this.#h(e, "RELAY_ERROR", !1) : this.#a(e);
1072
1077
  return;
1073
1078
  }
1074
1079
  try {
1075
- const l = await fe(
1080
+ const u = await fe(
1076
1081
  s,
1077
1082
  ce,
1078
1083
  n
1079
1084
  ), f = B(
1080
- M(l, ce),
1085
+ M(u, ce),
1081
1086
  ["expiresAt", "schemaVersion", "transactionId"]
1082
1087
  );
1083
1088
  if (f.schemaVersion !== 1 || f.transactionId !== e.transactionId)
1084
1089
  throw a("RELAY_ERROR");
1085
- o = Y(f.expiresAt);
1090
+ o = U(f.expiresAt);
1086
1091
  const h = this.#n();
1087
1092
  if (o <= h || o - h > mt)
1088
1093
  throw a("RELAY_ERROR");
@@ -1141,9 +1146,9 @@ class _t {
1141
1146
  if (!this.#c(e)) return;
1142
1147
  e.phase = "redeeming", this.#d(e.pollTimer, !0), e.pollTimer = null;
1143
1148
  const s = this.#C(e);
1144
- let u = null;
1149
+ let l = null;
1145
1150
  try {
1146
- const l = this.#e.fetch(
1151
+ const u = this.#e.fetch(
1147
1152
  `${_}/relay/v1/codes/redeem`,
1148
1153
  $({
1149
1154
  code: o.code,
@@ -1153,13 +1158,13 @@ class _t {
1153
1158
  transactionId: e.transactionId
1154
1159
  }, s.signal)
1155
1160
  );
1156
- if (u = await U(
1157
- l,
1161
+ if (l = await Y(
1162
+ u,
1158
1163
  s.signal,
1159
1164
  x
1160
- ), u.status !== 200) throw a("RELAY_ERROR");
1165
+ ), l.status !== 200) throw a("RELAY_ERROR");
1161
1166
  const f = await fe(
1162
- u,
1167
+ l,
1163
1168
  ae,
1164
1169
  s
1165
1170
  ), h = B(
@@ -1168,17 +1173,17 @@ class _t {
1168
1173
  );
1169
1174
  if (h.schemaVersion !== 1 || h.transactionId !== e.transactionId)
1170
1175
  throw a("RELAY_ERROR");
1171
- let y;
1176
+ let d;
1172
1177
  try {
1173
- y = e.adapter.parseResult(h.result);
1178
+ d = e.adapter.parseResult(h.result);
1174
1179
  } catch {
1175
1180
  throw a("RELAY_ERROR");
1176
1181
  }
1177
- if (!this.#c(e)) return;
1178
- this.#H(e, y);
1179
- } catch (l) {
1180
- if (u && I(s, u), !this.#c(e)) return;
1181
- const f = l instanceof N ? l.code : "RELAY_ERROR";
1182
+ if (e.openResult && (d = await e.openResult(d)), !this.#c(e)) return;
1183
+ this.#H(e, d);
1184
+ } catch (u) {
1185
+ if (l && I(s, l), !this.#c(e)) return;
1186
+ const f = u instanceof N ? u.code : "RELAY_ERROR";
1182
1187
  this.#h(e, f);
1183
1188
  } finally {
1184
1189
  try {
@@ -1193,7 +1198,7 @@ class _t {
1193
1198
  let i = null;
1194
1199
  (e.adapter.kind === "connect" || e.adapter.kind === "account" && t.event === "connected") && (i = this.#z(t)), e.active = !1, this.#o = null, this.#_(e);
1195
1200
  let n = t;
1196
- e.adapter.kind === "connect" ? (this.#Y(i), n = w(t.identity)) : e.adapter.kind === "account" ? (t.event === "connected" ? this.#Y(i) : (this.#f(), this.#i({ identity: null, status: "dormant" })), n = void 0) : this.#W(e, void 0), e.resolve(n), this.#a(e);
1201
+ e.adapter.kind === "connect" ? (this.#U(i), n = w(t.identity)) : e.adapter.kind === "account" ? (t.event === "connected" ? this.#U(i) : (this.#f(), this.#i({ identity: null, status: "dormant" })), n = void 0) : this.#W(e, void 0), e.resolve(n), this.#a(e);
1197
1202
  }
1198
1203
  #h(e, t, i = !0) {
1199
1204
  this.#c(e) && this.#I(e, t, !0, i);
@@ -1202,10 +1207,10 @@ class _t {
1202
1207
  if (!e.active) return e.cleanup.promise;
1203
1208
  const o = this.#m;
1204
1209
  e.active = !1, this.#o === e && (this.#o = null), this.#w += 1, this.#_(e);
1205
- for (const l of e.controllers)
1206
- e.phase !== "registering" && l.abort();
1207
- const s = this.#t(o), u = s ?? a(t);
1208
- return e.reject(u), i && !s && this.#B(e, u, e.priorConnection, e.adapter.kind), this.#r ? (e.challenge && e.verifier && this.#q(e), this.#a(e), e.cleanup.promise) : (!n || e.registrationOutcome === "definitive-failure" || e.registrationOutcome === "not-started" ? this.#a(e) : e.phase === "hashing" ? (e.registrationOutcome = "not-started", this.#a(e)) : e.phase === "registering" && e.registrationOutcome === "none" ? this.#k(e) : (this.#k(e), this.#b(e)), e.cleanup.promise);
1210
+ for (const u of e.controllers)
1211
+ e.phase !== "registering" && u.abort();
1212
+ const s = this.#t(o), l = s ?? a(t);
1213
+ return e.reject(l), i && !s && this.#B(e, l, e.priorConnection, e.adapter.kind), this.#r ? (e.challenge && e.verifier && this.#q(e), this.#a(e), e.cleanup.promise) : (!n || e.registrationOutcome === "definitive-failure" || e.registrationOutcome === "not-started" ? this.#a(e) : e.phase === "hashing" ? (e.registrationOutcome = "not-started", this.#a(e)) : e.phase === "registering" && e.registrationOutcome === "none" ? this.#k(e) : (this.#k(e), this.#b(e)), e.cleanup.promise);
1209
1214
  }
1210
1215
  #B(e, t, i, n) {
1211
1216
  if (i?.expiresAtMs > this.#n()) {
@@ -1224,7 +1229,7 @@ class _t {
1224
1229
  });
1225
1230
  }
1226
1231
  #z(e) {
1227
- const t = Y(e.connectionExpiresAt), i = this.#n();
1232
+ const t = U(e.connectionExpiresAt), i = this.#n();
1228
1233
  if (t <= i || t - i > Rt)
1229
1234
  throw a("RELAY_ERROR");
1230
1235
  return {
@@ -1233,7 +1238,7 @@ class _t {
1233
1238
  identity: w(e.identity)
1234
1239
  };
1235
1240
  }
1236
- #Y(e) {
1241
+ #U(e) {
1237
1242
  const t = this.#n();
1238
1243
  this.#f(), this.#s = e;
1239
1244
  const i = this.#s;
@@ -1254,7 +1259,7 @@ class _t {
1254
1259
  status: "connected"
1255
1260
  })) : t ? (this.#f(), this.#i({ error: T(t), identity: null, status: "error" })) : (this.#f(), this.#i({ identity: null, status: "dormant" }));
1256
1261
  }
1257
- #U() {
1262
+ #Y() {
1258
1263
  !this.#s || this.#s.expiresAtMs > this.#n() || (this.#f(), this.#o ? this.#i({ identity: null, status: "opening" }) : this.#i({ identity: null, status: "dormant" }));
1259
1264
  }
1260
1265
  #f() {
@@ -1344,7 +1349,7 @@ class _t {
1344
1349
  const t = this.#C(e), i = e.registrationDeadlineMs - this.#n(), n = i > 0 ? Math.min(4e3, i) : 1e3, o = this.#g(() => t.abort(), Math.max(1, n));
1345
1350
  let s = null;
1346
1351
  try {
1347
- const u = this.#e.fetch(
1352
+ const l = this.#e.fetch(
1348
1353
  `${_}/relay/v1/transactions/${e.transactionId}/cancel`,
1349
1354
  $({
1350
1355
  codeVerifier: e.verifier,
@@ -1353,13 +1358,13 @@ class _t {
1353
1358
  transactionId: e.transactionId
1354
1359
  }, t.signal)
1355
1360
  );
1356
- s = await U(
1357
- u,
1361
+ s = await Y(
1362
+ l,
1358
1363
  t.signal,
1359
1364
  x
1360
1365
  );
1361
- const l = s.status;
1362
- return I(t, s), s = null, l === 204 || l === 400 || l === 403 || l === 409 || l === 410 ? "done" : "retry";
1366
+ const u = s.status;
1367
+ return I(t, s), s = null, u === 204 || u === 400 || u === 403 || u === 409 || u === 410 ? "done" : "retry";
1363
1368
  } catch {
1364
1369
  return s && I(t, s), "retry";
1365
1370
  } finally {
@@ -1426,8 +1431,8 @@ class _t {
1426
1431
  const t = (o) => {
1427
1432
  const s = this.#o;
1428
1433
  if (!s || !this.#c(s)) return;
1429
- const u = `${V}${s.state}`;
1430
- o?.key === u && this.#N(s, !0);
1434
+ const l = `${V}${s.state}`;
1435
+ o?.key === l && this.#N(s, !0);
1431
1436
  };
1432
1437
  this.#L = t;
1433
1438
  let i = !1, n = null;
@@ -1481,16 +1486,16 @@ class _t {
1481
1486
  const s = o.slice(V.length);
1482
1487
  if (P.test(s))
1483
1488
  try {
1484
- const u = e.getItem(o);
1485
- if (u === null) continue;
1486
- const l = B(
1487
- M(u, 2048),
1489
+ const l = e.getItem(o);
1490
+ if (l === null) continue;
1491
+ const u = B(
1492
+ M(l, 2048),
1488
1493
  ["code", "expiresAt", "schemaVersion", "state"],
1489
1494
  "CALLBACK_ERROR"
1490
1495
  );
1491
- if (l.schemaVersion !== 1 || l.state !== s || !P.test(l.code))
1496
+ if (u.schemaVersion !== 1 || u.state !== s || !P.test(u.code))
1492
1497
  continue;
1493
- Y(l.expiresAt, "CALLBACK_ERROR") <= this.#n() && e.removeItem(o);
1498
+ U(u.expiresAt, "CALLBACK_ERROR") <= this.#n() && e.removeItem(o);
1494
1499
  } catch {
1495
1500
  }
1496
1501
  }
@@ -1523,8 +1528,8 @@ function ve(r, e = {}) {
1523
1528
  }
1524
1529
  };
1525
1530
  for (const [n, o] of Object.entries(e))
1526
- i[n] = function(u, ...l) {
1527
- return l.length !== 0 ? Promise.reject(a("INVALID_REQUEST")) : r.execute(o, u);
1531
+ i[n] = function(l, ...u) {
1532
+ return u.length !== 0 ? Promise.reject(a("INVALID_REQUEST")) : r.execute(o, l);
1528
1533
  };
1529
1534
  return Object.freeze(i);
1530
1535
  }