hd-wallet-ui 2.0.33 → 2.1.0
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-host/assets/wallet-origin.172554573c501094d621ef86a43537fe0b8fcb2dc4e6d25debe542302df6b707.css +1 -0
- package/dist/wallet-origin-host/assets/{wallet-origin.a45a7426d353fe1271289e298b528361c9d226b173aed2b03abf0c1fcd8e589c.wasm → wallet-origin.4fdb6a88dea547579404b0b71649cf83d62065e0bce47a55608eddd08bb8bd68.wasm} +0 -0
- package/dist/wallet-origin-host/assets/{wallet-origin.f8122a4a747c6d4515d0f5dafd5aa2f4e0c02bcbad2e5a93092240438092798e.js → wallet-origin.72e88c0cb8690e6e9d3ee9c87639713cb3e92995eec544db1cfbebefdf0b72cb.js} +414 -366
- package/dist/wallet-origin-host/index.html +2 -2
- package/dist/wallet-origin-host/integrity.json +1 -1
- package/package.json +3 -3
- package/dist/wallet-origin-host/assets/wallet-origin.d371cf799d609d153c6731609c756febf4dab8d51adbaa7281e2cc03238c09f3.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const Ic = new URL("./wallet-origin.
|
|
1
|
+
const Ic = new URL("./wallet-origin.4fdb6a88dea547579404b0b71649cf83d62065e0bce47a55608eddd08bb8bd68.wasm", import.meta.url).href, qn = {
|
|
2
2
|
SECP256K1: 0
|
|
3
3
|
}, xe = {
|
|
4
4
|
OK: 0,
|
|
@@ -1612,20 +1612,33 @@ function Do(e) {
|
|
|
1612
1612
|
const r = String(e.curve ?? "").trim();
|
|
1613
1613
|
return r || (String(e.algorithm ?? "").trim().startsWith("ed25519") ? "ed25519" : "secp256k1");
|
|
1614
1614
|
}
|
|
1615
|
+
function Bc(e, r) {
|
|
1616
|
+
if (e.length !== r.length)
|
|
1617
|
+
return !1;
|
|
1618
|
+
let t = 0;
|
|
1619
|
+
for (let s = 0; s < e.length; s += 1)
|
|
1620
|
+
t |= e[s] ^ r[s];
|
|
1621
|
+
return t === 0;
|
|
1622
|
+
}
|
|
1615
1623
|
function Co(e, r, t) {
|
|
1616
1624
|
const s = Ge(
|
|
1617
1625
|
r.messageBytes ?? r.message ?? r.protectedRecordBytes,
|
|
1618
1626
|
"message"
|
|
1619
1627
|
);
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1628
|
+
if (t === "secp256k1") {
|
|
1629
|
+
const a = e.utils.sha256(s), d = Nt(r.digest, "digest");
|
|
1630
|
+
if (d && !Bc(d, a))
|
|
1631
|
+
throw new Error(
|
|
1632
|
+
"secp256k1-sha256 signs the message bytes; digest must be omitted or equal SHA-256(message)."
|
|
1633
|
+
);
|
|
1634
|
+
return { messageBytes: s, digest: a };
|
|
1635
|
+
}
|
|
1636
|
+
return {
|
|
1624
1637
|
messageBytes: s,
|
|
1625
1638
|
digest: Nt(r.digest, "digest")
|
|
1626
1639
|
};
|
|
1627
1640
|
}
|
|
1628
|
-
function
|
|
1641
|
+
function Vc(e, r, t) {
|
|
1629
1642
|
const s = Do(r), { messageBytes: a, digest: d } = Co(e, r, s);
|
|
1630
1643
|
if (!r.signerPrivateKey && typeof t != "function")
|
|
1631
1644
|
throw new Error(
|
|
@@ -1636,7 +1649,7 @@ function Bc(e, r, t) {
|
|
|
1636
1649
|
curve: s,
|
|
1637
1650
|
payload: r,
|
|
1638
1651
|
messageBytes: a,
|
|
1639
|
-
digest: d
|
|
1652
|
+
digest: s === "secp256k1" ? null : d
|
|
1640
1653
|
});
|
|
1641
1654
|
if (!E || typeof E != "object")
|
|
1642
1655
|
throw new Error("walletSign capability must return a signature envelope.");
|
|
@@ -1666,12 +1679,12 @@ function Bc(e, r, t) {
|
|
|
1666
1679
|
algorithm: r.algorithm ?? "secp256k1-sha256",
|
|
1667
1680
|
messageBytes: a,
|
|
1668
1681
|
digest: d,
|
|
1669
|
-
signature: e.curves.secp256k1.sign(
|
|
1682
|
+
signature: e.curves.secp256k1.sign(a, b),
|
|
1670
1683
|
publicKey: Nt(r.publicKey, "publicKey") ?? e.curves.publicKeyFromPrivate(b, 0)
|
|
1671
1684
|
};
|
|
1672
1685
|
}
|
|
1673
|
-
function
|
|
1674
|
-
const t = Do(r), s = Ge(r.signature, "signature"), a = Ge(r.publicKey, "publicKey"), { messageBytes: d, digest: b } = Co(e, r, t), E = t === "secp256k1" ?
|
|
1686
|
+
function Hc(e, r) {
|
|
1687
|
+
const t = Do(r), s = Ge(r.signature, "signature"), a = Ge(r.publicKey, "publicKey"), { messageBytes: d, digest: b } = Co(e, r, t), E = t === "secp256k1" ? d : b ?? d, I = t === "ed25519" ? e.curves.ed25519.verify(E, s, a) : e.curves.secp256k1.verify(E, s, a);
|
|
1675
1688
|
return {
|
|
1676
1689
|
curve: t,
|
|
1677
1690
|
algorithm: r.algorithm ?? (t === "ed25519" ? b ? "ed25519-prehash-sha256" : "ed25519" : "secp256k1-sha256"),
|
|
@@ -1692,7 +1705,7 @@ function Fo(e, r, t, s) {
|
|
|
1692
1705
|
return e.curves.x25519.ecdh(t, s);
|
|
1693
1706
|
throw new Error(`encrypt_fields does not support curve "${r}".`);
|
|
1694
1707
|
}
|
|
1695
|
-
function
|
|
1708
|
+
function zc(e, r, t) {
|
|
1696
1709
|
if (r === "secp256k1")
|
|
1697
1710
|
return e.curves.publicKeyFromPrivate(t, 0);
|
|
1698
1711
|
if (r === "x25519")
|
|
@@ -1702,7 +1715,7 @@ function Hc(e, r, t) {
|
|
|
1702
1715
|
function Mo(e) {
|
|
1703
1716
|
return e === "secp256k1" ? "secp256k1-hkdf-aes-256-gcm" : "x25519-hkdf-aes-256-gcm";
|
|
1704
1717
|
}
|
|
1705
|
-
function
|
|
1718
|
+
function $c(e, r, t) {
|
|
1706
1719
|
if (r.senderPrivateKey)
|
|
1707
1720
|
return Ge(r.senderPrivateKey, "senderPrivateKey");
|
|
1708
1721
|
if (t === "x25519")
|
|
@@ -1717,7 +1730,7 @@ function zc(e, r, t) {
|
|
|
1717
1730
|
function Bo(e, r) {
|
|
1718
1731
|
return Nt(e?.aad, "aad") ?? Nt(r?.aad, "aad") ?? new Uint8Array();
|
|
1719
1732
|
}
|
|
1720
|
-
function
|
|
1733
|
+
function Wc(e, r, t) {
|
|
1721
1734
|
const s = Array.isArray(r.fields) ? r.fields : [];
|
|
1722
1735
|
if (s.length === 0)
|
|
1723
1736
|
throw new Error("encrypt_fields requires at least one field entry.");
|
|
@@ -1726,7 +1739,7 @@ function $c(e, r, t) {
|
|
|
1726
1739
|
const b = Uo(r, d), E = Ge(
|
|
1727
1740
|
r.recipientPublicKey ?? d.recipientPublicKey,
|
|
1728
1741
|
"recipientPublicKey"
|
|
1729
|
-
), I =
|
|
1742
|
+
), I = $c(t, r, b), P = Nt(d.senderPublicKey, "senderPublicKey") ?? zc(e, b, I), w = Nt(d.salt, "salt") ?? Yn(t, 32, {
|
|
1730
1743
|
methodId: "encrypt_fields",
|
|
1731
1744
|
fieldPath: d.fieldPath,
|
|
1732
1745
|
purpose: "salt"
|
|
@@ -1754,7 +1767,7 @@ function $c(e, r, t) {
|
|
|
1754
1767
|
}
|
|
1755
1768
|
return { fields: a };
|
|
1756
1769
|
}
|
|
1757
|
-
function
|
|
1770
|
+
function jc(e, r) {
|
|
1758
1771
|
const t = Array.isArray(r.fields) ? r.fields : [];
|
|
1759
1772
|
if (t.length === 0)
|
|
1760
1773
|
throw new Error("decrypt_fields requires at least one encrypted field entry.");
|
|
@@ -1774,7 +1787,7 @@ function Wc(e, r) {
|
|
|
1774
1787
|
}
|
|
1775
1788
|
return { fields: a };
|
|
1776
1789
|
}
|
|
1777
|
-
function
|
|
1790
|
+
function qc(e) {
|
|
1778
1791
|
const r = e._plugin_get_manifest_flatbuffer, t = e._plugin_get_manifest_flatbuffer_size;
|
|
1779
1792
|
if (typeof r != "function" || typeof t != "function")
|
|
1780
1793
|
throw new Error("Embedded plugin manifest exports are not available in this build.");
|
|
@@ -1801,7 +1814,7 @@ function Vo({ wallet: e, wasm: r, randomBytes: t = null, walletSign: s = null })
|
|
|
1801
1814
|
"encrypted_fields",
|
|
1802
1815
|
"EncryptedFieldSet.fbs",
|
|
1803
1816
|
"EFLD",
|
|
1804
|
-
|
|
1817
|
+
Wc(e, I, t)
|
|
1805
1818
|
)
|
|
1806
1819
|
]);
|
|
1807
1820
|
case "decrypt_fields":
|
|
@@ -1811,7 +1824,7 @@ function Vo({ wallet: e, wasm: r, randomBytes: t = null, walletSign: s = null })
|
|
|
1811
1824
|
"field_set",
|
|
1812
1825
|
"FieldSelectionBundle.fbs",
|
|
1813
1826
|
"FSLB",
|
|
1814
|
-
|
|
1827
|
+
jc(e, I)
|
|
1815
1828
|
)
|
|
1816
1829
|
]);
|
|
1817
1830
|
case "sign_detached":
|
|
@@ -1821,7 +1834,7 @@ function Vo({ wallet: e, wasm: r, randomBytes: t = null, walletSign: s = null })
|
|
|
1821
1834
|
"signature",
|
|
1822
1835
|
"DetachedSignature.fbs",
|
|
1823
1836
|
"SIGD",
|
|
1824
|
-
|
|
1837
|
+
Vc(e, I, s)
|
|
1825
1838
|
)
|
|
1826
1839
|
]);
|
|
1827
1840
|
case "verify_detached":
|
|
@@ -1831,7 +1844,7 @@ function Vo({ wallet: e, wasm: r, randomBytes: t = null, walletSign: s = null })
|
|
|
1831
1844
|
"verification",
|
|
1832
1845
|
"DetachedVerificationResult.fbs",
|
|
1833
1846
|
"SIGV",
|
|
1834
|
-
|
|
1847
|
+
Hc(e, I)
|
|
1835
1848
|
)
|
|
1836
1849
|
]);
|
|
1837
1850
|
default:
|
|
@@ -1845,7 +1858,7 @@ function Vo({ wallet: e, wasm: r, randomBytes: t = null, walletSign: s = null })
|
|
|
1845
1858
|
return Ki();
|
|
1846
1859
|
},
|
|
1847
1860
|
getManifestBytes() {
|
|
1848
|
-
return
|
|
1861
|
+
return qc(r);
|
|
1849
1862
|
},
|
|
1850
1863
|
withCapabilities(d = {}) {
|
|
1851
1864
|
return Vo({
|
|
@@ -1870,7 +1883,7 @@ function Vo({ wallet: e, wasm: r, randomBytes: t = null, walletSign: s = null })
|
|
|
1870
1883
|
}
|
|
1871
1884
|
};
|
|
1872
1885
|
}
|
|
1873
|
-
const et = 131072, Ho = 131072, Yi = 4096, tn = 256, Gi = 4096,
|
|
1886
|
+
const et = 131072, Ho = 131072, Yi = 4096, tn = 256, Gi = 4096, Kc = 1024, Yc = 16, Xi = 1024, Gc = 16n, Xc = (1n << 64n) - 1n, Ji = Object.freeze([
|
|
1874
1887
|
"INVALID_USERNAME",
|
|
1875
1888
|
"INVALID_PASSWORD",
|
|
1876
1889
|
"COMMON_PASSWORD",
|
|
@@ -1885,7 +1898,7 @@ const et = 131072, Ho = 131072, Yi = 4096, tn = 256, Gi = 4096, qc = 1024, Kc =
|
|
|
1885
1898
|
"CRYPTO_FAILURE",
|
|
1886
1899
|
"OUT_OF_MEMORY",
|
|
1887
1900
|
"FIPS_NOT_ALLOWED"
|
|
1888
|
-
]),
|
|
1901
|
+
]), Jc = Object.freeze([
|
|
1889
1902
|
"_hd_sdn_derive_password_identity",
|
|
1890
1903
|
"_hd_sdn_derive_legacy_password_identity",
|
|
1891
1904
|
"_hd_sdn_import_legacy_mnemonic_identity",
|
|
@@ -1898,14 +1911,14 @@ const et = 131072, Ho = 131072, Yi = 4096, tn = 256, Gi = 4096, qc = 1024, Kc =
|
|
|
1898
1911
|
"_hd_sdn_sign_asset_review_decision",
|
|
1899
1912
|
"_hd_sdn_seal_remembered_identity",
|
|
1900
1913
|
"_hd_sdn_destroy_identity"
|
|
1901
|
-
]),
|
|
1914
|
+
]), Qc = new TextEncoder(), zo = new TextDecoder("utf-8", { fatal: !0 }), On = Uint8Array, $o = Object.getPrototypeOf(On.prototype), Wo = Object.getOwnPropertyDescriptor(
|
|
1902
1915
|
$o,
|
|
1903
1916
|
Symbol.toStringTag
|
|
1904
|
-
).get,
|
|
1917
|
+
).get, Zc = Object.getOwnPropertyDescriptor(
|
|
1905
1918
|
$o,
|
|
1906
1919
|
"byteLength"
|
|
1907
|
-
).get, jo = On.prototype.fill,
|
|
1908
|
-
class
|
|
1920
|
+
).get, jo = On.prototype.fill, el = On.prototype.set;
|
|
1921
|
+
class tl extends Error {
|
|
1909
1922
|
constructor(r) {
|
|
1910
1923
|
super(r), this.name = "SdnWalletError", this.code = r;
|
|
1911
1924
|
}
|
|
@@ -1914,13 +1927,13 @@ class el extends Error {
|
|
|
1914
1927
|
}
|
|
1915
1928
|
}
|
|
1916
1929
|
function re(e) {
|
|
1917
|
-
throw new
|
|
1930
|
+
throw new tl(e);
|
|
1918
1931
|
}
|
|
1919
|
-
function
|
|
1932
|
+
function rl(e) {
|
|
1920
1933
|
return Number.isInteger(e) && e >= 1 && e <= Ji.length ? Ji[e - 1] : "CRYPTO_FAILURE";
|
|
1921
1934
|
}
|
|
1922
1935
|
function Dn(e) {
|
|
1923
|
-
re(
|
|
1936
|
+
re(rl(e));
|
|
1924
1937
|
}
|
|
1925
1938
|
function ht(e) {
|
|
1926
1939
|
return e !== null && typeof e == "object";
|
|
@@ -1946,7 +1959,7 @@ function gt(e, r = "INVALID_REQUEST") {
|
|
|
1946
1959
|
const t = qo(e, r);
|
|
1947
1960
|
let s;
|
|
1948
1961
|
try {
|
|
1949
|
-
s =
|
|
1962
|
+
s = Zc.call(t);
|
|
1950
1963
|
} catch {
|
|
1951
1964
|
re(r);
|
|
1952
1965
|
}
|
|
@@ -1957,7 +1970,7 @@ function gt(e, r = "INVALID_REQUEST") {
|
|
|
1957
1970
|
re("OUT_OF_MEMORY");
|
|
1958
1971
|
}
|
|
1959
1972
|
try {
|
|
1960
|
-
|
|
1973
|
+
el.call(a, t);
|
|
1961
1974
|
} catch {
|
|
1962
1975
|
jo.call(a, 0), re(r);
|
|
1963
1976
|
}
|
|
@@ -1989,7 +2002,7 @@ function rn(e) {
|
|
|
1989
2002
|
let r = !1, t = !1;
|
|
1990
2003
|
return () => (r || (r = !0, t = pn(e())), t);
|
|
1991
2004
|
}
|
|
1992
|
-
function
|
|
2005
|
+
function nl(e) {
|
|
1993
2006
|
if (typeof e != "string") return !1;
|
|
1994
2007
|
for (let r = 0; r < e.length; r += 1) {
|
|
1995
2008
|
const t = e.charCodeAt(r);
|
|
@@ -2004,8 +2017,8 @@ function rl(e) {
|
|
|
2004
2017
|
return !0;
|
|
2005
2018
|
}
|
|
2006
2019
|
function Xn(e, r = Ho) {
|
|
2007
|
-
|
|
2008
|
-
const t =
|
|
2020
|
+
nl(e) || re("INVALID_REQUEST");
|
|
2021
|
+
const t = Qc.encode(e);
|
|
2009
2022
|
return t.length > r && re("INVALID_REQUEST"), t;
|
|
2010
2023
|
}
|
|
2011
2024
|
function gr(e) {
|
|
@@ -2020,10 +2033,10 @@ function gr(e) {
|
|
|
2020
2033
|
function Cn(e) {
|
|
2021
2034
|
return e !== 0 && e !== 1 && re("INVALID_ACCOUNT"), e;
|
|
2022
2035
|
}
|
|
2023
|
-
function
|
|
2024
|
-
if (typeof e != "bigint" || e <= 0n || e >
|
|
2036
|
+
function il(e) {
|
|
2037
|
+
if (typeof e != "bigint" || e <= 0n || e > Xc) return !1;
|
|
2025
2038
|
const r = e & 0xffffffffn;
|
|
2026
|
-
return e >> 32n !== 0n && r !== 0n && r <=
|
|
2039
|
+
return e >> 32n !== 0n && r !== 0n && r <= Gc;
|
|
2027
2040
|
}
|
|
2028
2041
|
function Mt(e, r) {
|
|
2029
2042
|
return typeof e == "string" && e.length === r && /^[0-9a-f]+$/.test(e);
|
|
@@ -2031,7 +2044,7 @@ function Mt(e, r) {
|
|
|
2031
2044
|
function Jn(e) {
|
|
2032
2045
|
return typeof e == "string" && /^sha256:[0-9a-f]{64}$/.test(e);
|
|
2033
2046
|
}
|
|
2034
|
-
function
|
|
2047
|
+
function ol(e, r, t, s) {
|
|
2035
2048
|
return (!or(e, [
|
|
2036
2049
|
"purpose",
|
|
2037
2050
|
"identityScheme",
|
|
@@ -2058,7 +2071,7 @@ function il(e, r, t, s) {
|
|
|
2058
2071
|
keyId: e.keyId
|
|
2059
2072
|
});
|
|
2060
2073
|
}
|
|
2061
|
-
function
|
|
2074
|
+
function sl(e) {
|
|
2062
2075
|
(!or(e, [
|
|
2063
2076
|
"schemaVersion",
|
|
2064
2077
|
"identityScheme",
|
|
@@ -2101,7 +2114,7 @@ function ol(e) {
|
|
|
2101
2114
|
derivation: "bip32-scalar-as-ed25519-seed",
|
|
2102
2115
|
path: `${t}0/0`
|
|
2103
2116
|
}] : re("CRYPTO_FAILURE"), e.keys.length !== s.length && re("CRYPTO_FAILURE");
|
|
2104
|
-
const a = e.keys.map((d, b) =>
|
|
2117
|
+
const a = e.keys.map((d, b) => ol(d, e.identityScheme, e.seedProfile, s[b]));
|
|
2105
2118
|
return Object.freeze({
|
|
2106
2119
|
schemaVersion: 1,
|
|
2107
2120
|
identityScheme: e.identityScheme,
|
|
@@ -2114,16 +2127,16 @@ function ol(e) {
|
|
|
2114
2127
|
keys: Object.freeze(a)
|
|
2115
2128
|
});
|
|
2116
2129
|
}
|
|
2117
|
-
function
|
|
2130
|
+
function al(e) {
|
|
2118
2131
|
let r;
|
|
2119
2132
|
try {
|
|
2120
2133
|
r = JSON.parse(zo.decode(e));
|
|
2121
2134
|
} catch {
|
|
2122
2135
|
re("CRYPTO_FAILURE");
|
|
2123
2136
|
}
|
|
2124
|
-
return
|
|
2137
|
+
return sl(r);
|
|
2125
2138
|
}
|
|
2126
|
-
function
|
|
2139
|
+
function cl(e, r) {
|
|
2127
2140
|
if (r === "module-delivery-key")
|
|
2128
2141
|
return (!or(e, [
|
|
2129
2142
|
"schemaVersion",
|
|
@@ -2167,14 +2180,14 @@ function al(e, r) {
|
|
|
2167
2180
|
};
|
|
2168
2181
|
return r && (d.canonicalEnvelope = e.canonicalEnvelope, d.signedDigestSha256 = e.signedDigestSha256), d.signatureHex = e.signatureHex, Object.freeze(d);
|
|
2169
2182
|
}
|
|
2170
|
-
function
|
|
2183
|
+
function ll(e, r) {
|
|
2171
2184
|
let t;
|
|
2172
2185
|
try {
|
|
2173
2186
|
t = JSON.parse(zo.decode(e));
|
|
2174
2187
|
} catch {
|
|
2175
2188
|
re("CRYPTO_FAILURE");
|
|
2176
2189
|
}
|
|
2177
|
-
return
|
|
2190
|
+
return cl(t, r);
|
|
2178
2191
|
}
|
|
2179
2192
|
function Un(e) {
|
|
2180
2193
|
let r;
|
|
@@ -2237,7 +2250,7 @@ function Fn(e) {
|
|
|
2237
2250
|
}
|
|
2238
2251
|
};
|
|
2239
2252
|
}
|
|
2240
|
-
function
|
|
2253
|
+
function dl(e, r) {
|
|
2241
2254
|
try {
|
|
2242
2255
|
return e.view().getBigUint64(r, !0);
|
|
2243
2256
|
} catch {
|
|
@@ -2251,8 +2264,8 @@ function Mn(e, r) {
|
|
|
2251
2264
|
re("CRYPTO_FAILURE");
|
|
2252
2265
|
}
|
|
2253
2266
|
}
|
|
2254
|
-
function
|
|
2255
|
-
(!ht(e) || typeof e._malloc != "function" || typeof e._free != "function" ||
|
|
2267
|
+
function _l(e) {
|
|
2268
|
+
(!ht(e) || typeof e._malloc != "function" || typeof e._free != "function" || Jc.some((w) => typeof e[w] != "function")) && re("CRYPTO_FAILURE");
|
|
2256
2269
|
const r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new Set();
|
|
2257
2270
|
function s(w) {
|
|
2258
2271
|
if (!(typeof w != "bigint" || w === 0n)) {
|
|
@@ -2299,10 +2312,10 @@ function dl(e) {
|
|
|
2299
2312
|
} catch {
|
|
2300
2313
|
v = !0;
|
|
2301
2314
|
}
|
|
2302
|
-
B =
|
|
2315
|
+
B = dl(C, f), v && re("CRYPTO_FAILURE"), g !== 0 && Dn(g), il(B) || re("CRYPTO_FAILURE");
|
|
2303
2316
|
const k = Mn(C, h);
|
|
2304
2317
|
(k <= 0 || k > et) && re("CRYPTO_FAILURE");
|
|
2305
|
-
const R =
|
|
2318
|
+
const R = al(C.bytes(u, k));
|
|
2306
2319
|
(R.identityScheme !== L || R.seedProfile !== D || R.accountIndex !== U) && re("CRYPTO_FAILURE"), C.cleanup() && re("CRYPTO_FAILURE"), M() && re("CRYPTO_FAILURE");
|
|
2307
2320
|
const F = Object.freeze(/* @__PURE__ */ Object.create(null)), V = { nativeValue: B, state: "active" };
|
|
2308
2321
|
r.set(F, V);
|
|
@@ -2330,7 +2343,7 @@ function dl(e) {
|
|
|
2330
2343
|
}
|
|
2331
2344
|
Y !== 0 && Dn(Y);
|
|
2332
2345
|
const _ = Mn(U, C);
|
|
2333
|
-
return (_ <= 0 || _ > et) && re("CRYPTO_FAILURE"),
|
|
2346
|
+
return (_ <= 0 || _ > et) && re("CRYPTO_FAILURE"), ll(U.bytes(B, _), D);
|
|
2334
2347
|
} finally {
|
|
2335
2348
|
U.cleanup() && re("CRYPTO_FAILURE");
|
|
2336
2349
|
}
|
|
@@ -2394,7 +2407,7 @@ function dl(e) {
|
|
|
2394
2407
|
let m, N;
|
|
2395
2408
|
const L = rn(() => [N, m]);
|
|
2396
2409
|
try {
|
|
2397
|
-
ht(w) && (m = w.mnemonicUtf8), yr(w, ["mnemonicUtf8", "accountIndex"]), N = tr(m, "INVALID_MNEMONIC"), N.length >
|
|
2410
|
+
ht(w) && (m = w.mnemonicUtf8), yr(w, ["mnemonicUtf8", "accountIndex"]), N = tr(m, "INVALID_MNEMONIC"), N.length > Kc && re("INVALID_MNEMONIC");
|
|
2398
2411
|
const D = Cn(w.accountIndex);
|
|
2399
2412
|
return E(
|
|
2400
2413
|
"_hd_sdn_import_legacy_mnemonic_identity",
|
|
@@ -2422,7 +2435,7 @@ function dl(e) {
|
|
|
2422
2435
|
"canonicalAad"
|
|
2423
2436
|
]);
|
|
2424
2437
|
const D = gt(w.ciphertextAndTag), U = gt(w.hkdfSalt), M = gt(w.nonce), C = gt(w.canonicalUsernameUtf8, "INVALID_USERNAME"), B = Xn(w.canonicalAad, Yi);
|
|
2425
|
-
return N = tr(m, "INVALID_REQUEST"), (N.length !== 32 || U.length !== 32 || M.length !== 12 || D.length <
|
|
2438
|
+
return N = tr(m, "INVALID_REQUEST"), (N.length !== 32 || U.length !== 32 || M.length !== 12 || D.length < Yc || D.length > Xi || C.length > tn) && re("INVALID_REQUEST"), E(
|
|
2426
2439
|
"_hd_sdn_import_remembered_identity",
|
|
2427
2440
|
(Y) => [
|
|
2428
2441
|
Y[0],
|
|
@@ -2654,7 +2667,7 @@ function dl(e) {
|
|
|
2654
2667
|
});
|
|
2655
2668
|
}
|
|
2656
2669
|
const Ko = /* @__PURE__ */ new WeakMap();
|
|
2657
|
-
function
|
|
2670
|
+
function hl(e) {
|
|
2658
2671
|
const r = e.sdn, s = e.utils.sha256;
|
|
2659
2672
|
return Object.freeze({
|
|
2660
2673
|
sdn: r,
|
|
@@ -2663,8 +2676,8 @@ function _l(e) {
|
|
|
2663
2676
|
}
|
|
2664
2677
|
});
|
|
2665
2678
|
}
|
|
2666
|
-
function
|
|
2667
|
-
const r =
|
|
2679
|
+
function ul(e) {
|
|
2680
|
+
const r = hl(e);
|
|
2668
2681
|
Object.defineProperty(e, "walletOriginCapabilities", {
|
|
2669
2682
|
value: r,
|
|
2670
2683
|
enumerable: !1,
|
|
@@ -2702,14 +2715,14 @@ const ot = Object.freeze({
|
|
|
2702
2715
|
ITALIAN: 7,
|
|
2703
2716
|
CZECH: 8,
|
|
2704
2717
|
PORTUGUESE: 9
|
|
2705
|
-
}),
|
|
2718
|
+
}), fl = Object.freeze({
|
|
2706
2719
|
RANDOM: 0,
|
|
2707
2720
|
FILESYSTEM: 1,
|
|
2708
2721
|
NETWORK: 2,
|
|
2709
2722
|
USB_HID: 3,
|
|
2710
2723
|
CLOCK: 4,
|
|
2711
2724
|
ENVIRONMENT: 5
|
|
2712
|
-
}),
|
|
2725
|
+
}), pl = Object.freeze({
|
|
2713
2726
|
NONE: 0,
|
|
2714
2727
|
NEEDS_ENTROPY: 1,
|
|
2715
2728
|
NEEDS_BRIDGE: 2,
|
|
@@ -2764,7 +2777,7 @@ const ot = Object.freeze({
|
|
|
2764
2777
|
BRIDGE_FAILED: 701,
|
|
2765
2778
|
NEEDS_BRIDGE: 702,
|
|
2766
2779
|
FIPS_NOT_ALLOWED: 800
|
|
2767
|
-
}),
|
|
2780
|
+
}), yl = {
|
|
2768
2781
|
[W.OK]: "Success",
|
|
2769
2782
|
[W.UNKNOWN]: "Unknown error",
|
|
2770
2783
|
[W.INVALID_ARGUMENT]: "Invalid argument",
|
|
@@ -2807,7 +2820,7 @@ class $ extends Error {
|
|
|
2807
2820
|
*/
|
|
2808
2821
|
constructor(r, t) {
|
|
2809
2822
|
const s = r < 0 ? -r : r;
|
|
2810
|
-
super(t ||
|
|
2823
|
+
super(t || yl[s] || `Error code: ${r}`), this.name = "HDWalletError", this.code = s;
|
|
2811
2824
|
}
|
|
2812
2825
|
}
|
|
2813
2826
|
function te(e) {
|
|
@@ -2824,9 +2837,9 @@ function j(e, r, t = W.NOT_SUPPORTED, s) {
|
|
|
2824
2837
|
throw new $(t, s || `Function ${r} is not available in this build`);
|
|
2825
2838
|
return a;
|
|
2826
2839
|
}
|
|
2827
|
-
const Go = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
|
|
2840
|
+
const Go = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", gl = Object.freeze(Object.fromEntries(
|
|
2828
2841
|
Array.from(Go).map((e, r) => [e, r])
|
|
2829
|
-
)), Xo = "qpzry9x8gf2tvdw0s3jn54khce6mua7l",
|
|
2842
|
+
)), Xo = "qpzry9x8gf2tvdw0s3jn54khce6mua7l", vl = Object.freeze(Object.fromEntries(
|
|
2830
2843
|
Array.from(Xo).map((e, r) => [e, r])
|
|
2831
2844
|
));
|
|
2832
2845
|
function Qi(e) {
|
|
@@ -2850,7 +2863,7 @@ function Zi(e) {
|
|
|
2850
2863
|
for (; r < e.length && e[r] === "1"; ) r++;
|
|
2851
2864
|
const t = Math.floor((e.length - r) * 733 / 1e3) + 1, s = new Uint8Array(t);
|
|
2852
2865
|
for (let b = r; b < e.length; b++) {
|
|
2853
|
-
const E =
|
|
2866
|
+
const E = gl[e[b]];
|
|
2854
2867
|
if (E === void 0)
|
|
2855
2868
|
throw new $(W.INVALID_ARGUMENT, `Invalid Base58 character: ${e[b]}`);
|
|
2856
2869
|
let I = E;
|
|
@@ -2896,20 +2909,20 @@ function to(e) {
|
|
|
2896
2909
|
throw new $(W.INVALID_ARGUMENT, "Invalid base64 string");
|
|
2897
2910
|
}
|
|
2898
2911
|
}
|
|
2899
|
-
const Jo = new TextEncoder(),
|
|
2900
|
-
function
|
|
2912
|
+
const Jo = new TextEncoder(), bl = new TextDecoder();
|
|
2913
|
+
function El(e, r) {
|
|
2901
2914
|
let t = `${e}1`;
|
|
2902
2915
|
for (let s = 0; s < r.length; s++)
|
|
2903
2916
|
t += Xo[r[s] & 31];
|
|
2904
2917
|
return t;
|
|
2905
2918
|
}
|
|
2906
|
-
function
|
|
2919
|
+
function Al(e) {
|
|
2907
2920
|
const r = e.lastIndexOf("1");
|
|
2908
2921
|
if (r <= 0)
|
|
2909
2922
|
throw new $(W.INVALID_ARGUMENT, "Invalid bech32 string");
|
|
2910
2923
|
const t = e.slice(0, r), s = e.slice(r + 1), a = new Uint8Array(s.length);
|
|
2911
2924
|
for (let d = 0; d < s.length; d++) {
|
|
2912
|
-
const b =
|
|
2925
|
+
const b = vl[s[d].toLowerCase()];
|
|
2913
2926
|
if (b === void 0)
|
|
2914
2927
|
throw new $(W.INVALID_ARGUMENT, `Invalid bech32 character: ${s[d]}`);
|
|
2915
2928
|
a[d] = b;
|
|
@@ -3009,7 +3022,7 @@ function bt(e, r = "data") {
|
|
|
3009
3022
|
return new Uint8Array(e.slice(0));
|
|
3010
3023
|
throw new $(W.INVALID_ARGUMENT, `${r} must be binary data`);
|
|
3011
3024
|
}
|
|
3012
|
-
function
|
|
3025
|
+
function ml(e) {
|
|
3013
3026
|
switch (e) {
|
|
3014
3027
|
case ot.SECP256K1:
|
|
3015
3028
|
return "secp256k1";
|
|
@@ -3025,7 +3038,7 @@ function Al(e) {
|
|
|
3025
3038
|
throw new $(W.INVALID_ARGUMENT, `Unsupported curve: ${e}`);
|
|
3026
3039
|
}
|
|
3027
3040
|
}
|
|
3028
|
-
function
|
|
3041
|
+
function Il(e) {
|
|
3029
3042
|
return String(e).replace(/\\/g, "\\\\").replace(/,/g, "\\,");
|
|
3030
3043
|
}
|
|
3031
3044
|
function Kt(e, r) {
|
|
@@ -3038,13 +3051,13 @@ function Kt(e, r) {
|
|
|
3038
3051
|
function Er(e, r, t = "certificate") {
|
|
3039
3052
|
return Kt(r, "encoding"), r === Yt.PEM && typeof e == "string" ? Jo.encode(e) : bt(e, t);
|
|
3040
3053
|
}
|
|
3041
|
-
function
|
|
3054
|
+
function wl(e, r) {
|
|
3042
3055
|
return typeof e == "string" ? Jo.encode(e) : bt(e, r);
|
|
3043
3056
|
}
|
|
3044
3057
|
function Vn(e, r) {
|
|
3045
|
-
return r === Yt.PEM ?
|
|
3058
|
+
return r === Yt.PEM ? bl.decode(e) : e;
|
|
3046
3059
|
}
|
|
3047
|
-
function
|
|
3060
|
+
function Sl(e) {
|
|
3048
3061
|
return {
|
|
3049
3062
|
subjectDn: e.subject_dn ?? "",
|
|
3050
3063
|
issuerDn: e.issuer_dn ?? "",
|
|
@@ -3060,7 +3073,7 @@ function wl(e) {
|
|
|
3060
3073
|
walletAttestationValid: e.wallet_attestation_valid === !0
|
|
3061
3074
|
};
|
|
3062
3075
|
}
|
|
3063
|
-
function
|
|
3076
|
+
function kl(e) {
|
|
3064
3077
|
return {
|
|
3065
3078
|
certificatePem: e.certificate_pem ?? "",
|
|
3066
3079
|
privateKeyPem: e.private_key_pem ?? "",
|
|
@@ -3073,11 +3086,11 @@ function ro(e) {
|
|
|
3073
3086
|
const r = [], t = (a, d) => {
|
|
3074
3087
|
d == null || d === "" || r.push(`${a}=${d}`);
|
|
3075
3088
|
}, s = (a, d) => {
|
|
3076
|
-
!Array.isArray(d) || d.length === 0 || r.push(`${a}=${d.map(
|
|
3089
|
+
!Array.isArray(d) || d.length === 0 || r.push(`${a}=${d.map(Il).join(",")}`);
|
|
3077
3090
|
};
|
|
3078
3091
|
if (t("subject_dn", e.subjectDn), t("serial_hex", e.serialHex), t("not_before_unix", e.notBeforeUnix), t("not_after_unix", e.notAfterUnix), e.isCa !== void 0 && t("is_ca", e.isCa ? "true" : "false"), e.pathLen !== void 0 && e.pathLen !== null && t("path_len", e.pathLen), s("dns", e.dnsNames), s("ips", e.ipAddresses), s("emails", e.emailAddresses), s("uris", e.uriNames), s("key_usage", e.keyUsage), s("extended_key_usage", e.extendedKeyUsage), t("friendly_name", e.friendlyName), e.walletAttestation) {
|
|
3079
3092
|
const a = e.walletAttestation;
|
|
3080
|
-
t("wallet_curve",
|
|
3093
|
+
t("wallet_curve", ml(a.curve)), t("wallet_private_key_hex", kr(bt(a.privateKey, "walletAttestation.privateKey"))), t("wallet_key_label", a.keyLabel), t("wallet_comment_prefix", a.commentPrefix);
|
|
3081
3094
|
}
|
|
3082
3095
|
return r.join(`
|
|
3083
3096
|
`);
|
|
@@ -3361,13 +3374,13 @@ try {
|
|
|
3361
3374
|
}));
|
|
3362
3375
|
} catch {
|
|
3363
3376
|
}
|
|
3364
|
-
async function
|
|
3365
|
-
const r = (await Promise.resolve().then(() =>
|
|
3377
|
+
async function Ol() {
|
|
3378
|
+
const r = (await Promise.resolve().then(() => xh))?.default;
|
|
3366
3379
|
if (typeof r != "function") throw new Error("Wallet WASM loader is invalid");
|
|
3367
3380
|
const t = new URL(Ic, import.meta.url).href, s = await fetch(t, {
|
|
3368
3381
|
cache: "no-store",
|
|
3369
3382
|
credentials: "omit",
|
|
3370
|
-
integrity: "sha384-
|
|
3383
|
+
integrity: "sha384-ZAn/mcoWpv7gIG0tIB9YR5H6anhvoM3ioplvzjCRHfP8nMB7VXjsPlt9/J/pnFeI",
|
|
3371
3384
|
mode: "same-origin",
|
|
3372
3385
|
redirect: "error",
|
|
3373
3386
|
referrerPolicy: "no-referrer"
|
|
@@ -3405,7 +3418,7 @@ async function kl() {
|
|
|
3405
3418
|
I.set(w, P), P += w.byteLength;
|
|
3406
3419
|
return r({ wasmBinary: I });
|
|
3407
3420
|
}
|
|
3408
|
-
function
|
|
3421
|
+
function Pl(e) {
|
|
3409
3422
|
const r = {
|
|
3410
3423
|
/**
|
|
3411
3424
|
* Generate a random mnemonic phrase
|
|
@@ -3715,10 +3728,13 @@ function Ol(e) {
|
|
|
3715
3728
|
*/
|
|
3716
3729
|
secp256k1: {
|
|
3717
3730
|
/**
|
|
3718
|
-
* Sign message with secp256k1
|
|
3719
|
-
*
|
|
3731
|
+
* Sign a message with secp256k1 ECDSA. Hashes the message with SHA-256
|
|
3732
|
+
* internally and signs that hash (RFC 6979, low-S): pass the message, never
|
|
3733
|
+
* a hash of it, or the signature covers SHA-256(SHA-256(message)) and no
|
|
3734
|
+
* standard verifier accepts it.
|
|
3735
|
+
* @param {Uint8Array} message - Message bytes (hashed once with SHA-256 here)
|
|
3720
3736
|
* @param {Uint8Array} privateKey - 32-byte private key
|
|
3721
|
-
* @returns {Uint8Array}
|
|
3737
|
+
* @returns {Uint8Array} 64-byte compact signature r||s
|
|
3722
3738
|
*/
|
|
3723
3739
|
sign(_, f) {
|
|
3724
3740
|
const h = T(e, _), u = T(e, f), g = e._hd_alloc(72);
|
|
@@ -3731,10 +3747,12 @@ function Ol(e) {
|
|
|
3731
3747
|
}
|
|
3732
3748
|
},
|
|
3733
3749
|
/**
|
|
3734
|
-
* Sign
|
|
3735
|
-
*
|
|
3736
|
-
*
|
|
3737
|
-
* @
|
|
3750
|
+
* Sign a 32-byte hash with recovery ID. Unlike sign(), the input is NOT
|
|
3751
|
+
* hashed: pass the protocol digest you computed (e.g. Keccak-256 for
|
|
3752
|
+
* Ethereum, the Bitcoin signed-message hash).
|
|
3753
|
+
* @param {Uint8Array} message - 32-byte hash, signed as given
|
|
3754
|
+
* @param {Uint8Array} privateKey - 32-byte private key
|
|
3755
|
+
* @returns {Object} { signature: Uint8Array (64-byte r||s), recoveryId: number }
|
|
3738
3756
|
*/
|
|
3739
3757
|
signRecoverable(_, f) {
|
|
3740
3758
|
const h = j(e, "_hd_secp256k1_sign_recoverable"), u = T(e, _), g = T(e, f), v = e._hd_alloc(65);
|
|
@@ -3748,10 +3766,11 @@ function Ol(e) {
|
|
|
3748
3766
|
}
|
|
3749
3767
|
},
|
|
3750
3768
|
/**
|
|
3751
|
-
* Verify secp256k1 signature
|
|
3752
|
-
*
|
|
3753
|
-
* @param {Uint8Array}
|
|
3754
|
-
* @param {Uint8Array}
|
|
3769
|
+
* Verify a secp256k1 ECDSA signature over SHA-256(message). Hashes the
|
|
3770
|
+
* message with SHA-256 internally: pass the message, not a hash of it.
|
|
3771
|
+
* @param {Uint8Array} message - Original message bytes (hashed once with SHA-256 here)
|
|
3772
|
+
* @param {Uint8Array} signature - 64-byte compact r||s or DER signature
|
|
3773
|
+
* @param {Uint8Array} publicKey - 33- or 65-byte public key
|
|
3755
3774
|
* @returns {boolean} True if valid
|
|
3756
3775
|
*/
|
|
3757
3776
|
verify(_, f, h) {
|
|
@@ -3763,11 +3782,12 @@ function Ol(e) {
|
|
|
3763
3782
|
}
|
|
3764
3783
|
},
|
|
3765
3784
|
/**
|
|
3766
|
-
* Recover public key from signature
|
|
3767
|
-
*
|
|
3768
|
-
* @param {Uint8Array}
|
|
3785
|
+
* Recover the public key from a recoverable signature. Like
|
|
3786
|
+
* signRecoverable(), the input is the 32-byte hash, used as given.
|
|
3787
|
+
* @param {Uint8Array} message - 32-byte hash that was signed
|
|
3788
|
+
* @param {Uint8Array} signature - 64-byte r||s
|
|
3769
3789
|
* @param {number} recoveryId - Recovery ID (0-3)
|
|
3770
|
-
* @returns {Uint8Array} Recovered public key
|
|
3790
|
+
* @returns {Uint8Array} Recovered 33-byte compressed public key
|
|
3771
3791
|
*/
|
|
3772
3792
|
recover(_, f, h) {
|
|
3773
3793
|
const u = j(e, "_hd_secp256k1_recover"), g = T(e, _), v = new Uint8Array(65);
|
|
@@ -3853,6 +3873,13 @@ function Ol(e) {
|
|
|
3853
3873
|
* P-256 (secp256r1) ECDSA operations
|
|
3854
3874
|
*/
|
|
3855
3875
|
p256: {
|
|
3876
|
+
/**
|
|
3877
|
+
* Sign a message with P-256 ECDSA. Hashes the message with SHA-256
|
|
3878
|
+
* internally: pass the message, never a hash of it.
|
|
3879
|
+
* @param {Uint8Array} message - Message bytes (hashed once with SHA-256 here)
|
|
3880
|
+
* @param {Uint8Array} privateKey - 32-byte private key
|
|
3881
|
+
* @returns {Uint8Array} 64-byte compact signature r||s
|
|
3882
|
+
*/
|
|
3856
3883
|
sign(_, f) {
|
|
3857
3884
|
const h = T(e, _), u = T(e, f), g = e._hd_alloc(72);
|
|
3858
3885
|
try {
|
|
@@ -3863,6 +3890,13 @@ function Ol(e) {
|
|
|
3863
3890
|
e._hd_secure_wipe(u, 32), e._hd_dealloc(h), e._hd_dealloc(u), e._hd_dealloc(g);
|
|
3864
3891
|
}
|
|
3865
3892
|
},
|
|
3893
|
+
/**
|
|
3894
|
+
* Verify a P-256 ECDSA signature over SHA-256(message).
|
|
3895
|
+
* @param {Uint8Array} message - Original message bytes (hashed once with SHA-256 here)
|
|
3896
|
+
* @param {Uint8Array} signature - 64-byte compact signature r||s
|
|
3897
|
+
* @param {Uint8Array} publicKey - 33- or 65-byte public key
|
|
3898
|
+
* @returns {boolean} True if valid
|
|
3899
|
+
*/
|
|
3866
3900
|
verify(_, f, h) {
|
|
3867
3901
|
const u = j(e, "_hd_p256_verify"), g = T(e, _), v = T(e, f), k = T(e, h);
|
|
3868
3902
|
try {
|
|
@@ -3886,6 +3920,13 @@ function Ol(e) {
|
|
|
3886
3920
|
* P-384 (secp384r1) ECDSA operations
|
|
3887
3921
|
*/
|
|
3888
3922
|
p384: {
|
|
3923
|
+
/**
|
|
3924
|
+
* Sign a message with P-384 ECDSA. Hashes the message with SHA-384
|
|
3925
|
+
* internally: pass the message, never a hash of it.
|
|
3926
|
+
* @param {Uint8Array} message - Message bytes (hashed once with SHA-384 here)
|
|
3927
|
+
* @param {Uint8Array} privateKey - 48-byte private key
|
|
3928
|
+
* @returns {Uint8Array} 96-byte compact signature r||s
|
|
3929
|
+
*/
|
|
3889
3930
|
sign(_, f) {
|
|
3890
3931
|
const h = T(e, _), u = T(e, f), g = e._hd_alloc(104);
|
|
3891
3932
|
try {
|
|
@@ -3896,6 +3937,13 @@ function Ol(e) {
|
|
|
3896
3937
|
e._hd_secure_wipe(u, 48), e._hd_dealloc(h), e._hd_dealloc(u), e._hd_dealloc(g);
|
|
3897
3938
|
}
|
|
3898
3939
|
},
|
|
3940
|
+
/**
|
|
3941
|
+
* Verify a P-384 ECDSA signature over SHA-384(message).
|
|
3942
|
+
* @param {Uint8Array} message - Original message bytes (hashed once with SHA-384 here)
|
|
3943
|
+
* @param {Uint8Array} signature - 96-byte compact signature r||s
|
|
3944
|
+
* @param {Uint8Array} publicKey - 49- or 97-byte public key
|
|
3945
|
+
* @returns {boolean} True if valid
|
|
3946
|
+
*/
|
|
3899
3947
|
verify(_, f, h) {
|
|
3900
3948
|
const u = j(e, "_hd_p384_verify"), g = T(e, _), v = T(e, f), k = T(e, h);
|
|
3901
3949
|
try {
|
|
@@ -4753,7 +4801,7 @@ function Ol(e) {
|
|
|
4753
4801
|
*/
|
|
4754
4802
|
isAvailable() {
|
|
4755
4803
|
const _ = He(e, "_hd_wasi_has_feature");
|
|
4756
|
-
return _ ? _(
|
|
4804
|
+
return _ ? _(fl.USB_HID) !== 0 : !1;
|
|
4757
4805
|
},
|
|
4758
4806
|
/**
|
|
4759
4807
|
* Enumerate connected hardware wallets
|
|
@@ -5171,7 +5219,7 @@ function Ol(e) {
|
|
|
5171
5219
|
encodeBech32(_, f) {
|
|
5172
5220
|
const h = He(e, "_hd_encode_bech32");
|
|
5173
5221
|
if (!h)
|
|
5174
|
-
return
|
|
5222
|
+
return El(_, f);
|
|
5175
5223
|
const u = le(e, _), g = T(e, f);
|
|
5176
5224
|
try {
|
|
5177
5225
|
const v = h(u, g, f.length);
|
|
@@ -5183,7 +5231,7 @@ function Ol(e) {
|
|
|
5183
5231
|
decodeBech32(_) {
|
|
5184
5232
|
const f = He(e, "_hd_decode_bech32");
|
|
5185
5233
|
if (!f)
|
|
5186
|
-
return
|
|
5234
|
+
return Al(_);
|
|
5187
5235
|
const h = le(e, _), u = e._hd_alloc(128), g = e._hd_alloc(256), v = e._hd_alloc(4);
|
|
5188
5236
|
try {
|
|
5189
5237
|
e.setValue(v, 256, "i32");
|
|
@@ -5327,7 +5375,7 @@ function Ol(e) {
|
|
|
5327
5375
|
Kt(f, "inputEncoding");
|
|
5328
5376
|
const h = j(e, "_hd_x509_parse_certificate_json"), u = Er(_, f), g = T(e, u);
|
|
5329
5377
|
try {
|
|
5330
|
-
return
|
|
5378
|
+
return Sl(JSON.parse(
|
|
5331
5379
|
Bn(
|
|
5332
5380
|
e,
|
|
5333
5381
|
(v, k) => h(g, u.length, f, v, k)
|
|
@@ -5351,7 +5399,7 @@ function Ol(e) {
|
|
|
5351
5399
|
},
|
|
5352
5400
|
exportPkcs12(_, f, h, u, g, v = "", k = "") {
|
|
5353
5401
|
Kt(f, "certificateEncoding");
|
|
5354
|
-
const R = j(e, "_hd_x509_export_pkcs12"), F = Er(_, f), V = T(e, F), Z = bt(u, "privateKey"), ee = T(e, Z), ae = le(e, g), oe = e.lengthBytesUTF8(g) + 1, pe = le(e, v), ce =
|
|
5402
|
+
const R = j(e, "_hd_x509_export_pkcs12"), F = Er(_, f), V = T(e, F), Z = bt(u, "privateKey"), ee = T(e, Z), ae = le(e, g), oe = e.lengthBytesUTF8(g) + 1, pe = le(e, v), ce = wl(k, "chainPem"), Q = ce.length > 0 ? T(e, ce) : 0;
|
|
5355
5403
|
try {
|
|
5356
5404
|
return rr(
|
|
5357
5405
|
e,
|
|
@@ -5378,7 +5426,7 @@ function Ol(e) {
|
|
|
5378
5426
|
importPkcs12(_, f) {
|
|
5379
5427
|
const h = j(e, "_hd_x509_import_pkcs12_json"), u = bt(_, "pkcs12Bundle"), g = T(e, u), v = le(e, f), k = e.lengthBytesUTF8(f) + 1;
|
|
5380
5428
|
try {
|
|
5381
|
-
return
|
|
5429
|
+
return kl(JSON.parse(
|
|
5382
5430
|
Bn(
|
|
5383
5431
|
e,
|
|
5384
5432
|
(R, F) => h(g, u.length, v, R, F),
|
|
@@ -5430,7 +5478,7 @@ function Ol(e) {
|
|
|
5430
5478
|
},
|
|
5431
5479
|
wasiGetWarning(_) {
|
|
5432
5480
|
const f = He(e, "_hd_wasi_get_warning");
|
|
5433
|
-
return f ? f(_) :
|
|
5481
|
+
return f ? f(_) : pl.NOT_AVAILABLE_WASI;
|
|
5434
5482
|
},
|
|
5435
5483
|
wasiGetWarningMessage(_) {
|
|
5436
5484
|
return "WASI warning API unavailable in this build";
|
|
@@ -5641,8 +5689,8 @@ function Ol(e) {
|
|
|
5641
5689
|
// Key derivation helpers (convenience wrappers)
|
|
5642
5690
|
buildSigningPath: Zo,
|
|
5643
5691
|
buildEncryptionPath: es,
|
|
5644
|
-
getSigningKey:
|
|
5645
|
-
getEncryptionKey:
|
|
5692
|
+
getSigningKey: Rl,
|
|
5693
|
+
getEncryptionKey: Nl,
|
|
5646
5694
|
// Aligned binary API for efficient batch operations
|
|
5647
5695
|
get aligned() {
|
|
5648
5696
|
if (!this._aligned) {
|
|
@@ -5655,11 +5703,11 @@ function Ol(e) {
|
|
|
5655
5703
|
}
|
|
5656
5704
|
};
|
|
5657
5705
|
return Object.defineProperty(Y, "sdn", {
|
|
5658
|
-
value:
|
|
5706
|
+
value: _l(e),
|
|
5659
5707
|
enumerable: !0,
|
|
5660
5708
|
writable: !1,
|
|
5661
5709
|
configurable: !1
|
|
5662
|
-
}),
|
|
5710
|
+
}), ul(Y), Y.plugin = Vo({ wallet: Y, wasm: e }), Y;
|
|
5663
5711
|
}
|
|
5664
5712
|
function Zo(e, r = "0", t = "0") {
|
|
5665
5713
|
return `m/44'/${e}'/${r}'/0/${t}`;
|
|
@@ -5667,7 +5715,7 @@ function Zo(e, r = "0", t = "0") {
|
|
|
5667
5715
|
function es(e, r = "0", t = "0") {
|
|
5668
5716
|
return `m/44'/${e}'/${r}'/1/${t}`;
|
|
5669
5717
|
}
|
|
5670
|
-
function
|
|
5718
|
+
function Rl(e, r, t = "0", s = "0") {
|
|
5671
5719
|
const a = Zo(r, t, s), d = e.derivePath(a);
|
|
5672
5720
|
try {
|
|
5673
5721
|
return {
|
|
@@ -5679,7 +5727,7 @@ function Pl(e, r, t = "0", s = "0") {
|
|
|
5679
5727
|
d.wipe();
|
|
5680
5728
|
}
|
|
5681
5729
|
}
|
|
5682
|
-
function
|
|
5730
|
+
function Nl(e, r, t = "0", s = "0") {
|
|
5683
5731
|
const a = es(r, t, s), d = e.derivePath(a);
|
|
5684
5732
|
try {
|
|
5685
5733
|
return {
|
|
@@ -5691,23 +5739,23 @@ function Rl(e, r, t = "0", s = "0") {
|
|
|
5691
5739
|
d.wipe();
|
|
5692
5740
|
}
|
|
5693
5741
|
}
|
|
5694
|
-
async function
|
|
5695
|
-
const e = await
|
|
5696
|
-
return
|
|
5742
|
+
async function Ll() {
|
|
5743
|
+
const e = await Ol();
|
|
5744
|
+
return Pl(e);
|
|
5697
5745
|
}
|
|
5698
|
-
const
|
|
5746
|
+
const Tl = Object.freeze({
|
|
5699
5747
|
cm: 0.01,
|
|
5700
5748
|
km: 1e3,
|
|
5701
5749
|
m: 1,
|
|
5702
5750
|
mm: 1e-3
|
|
5703
|
-
}),
|
|
5704
|
-
metersPerSourceUnit:
|
|
5751
|
+
}), xl = Object.freeze({
|
|
5752
|
+
metersPerSourceUnit: Tl,
|
|
5705
5753
|
quaternionNormTolerance: 1e-6,
|
|
5706
5754
|
scaleComponentExclusiveMin: 0,
|
|
5707
5755
|
scaleComponentInclusiveMax: 1e6,
|
|
5708
5756
|
translationComponentAbsMax: 1e6,
|
|
5709
5757
|
upAxes: Object.freeze(["X_UP", "Y_UP", "Z_UP"])
|
|
5710
|
-
}),
|
|
5758
|
+
}), Dl = Object.freeze({ reviewedTransform: xl, schemaVersion: 1 }), Lt = new TextEncoder(), ts = Object.getPrototypeOf(Uint8Array.prototype), Cl = Object.getOwnPropertyDescriptor(ts, "buffer").get, Ul = Object.getOwnPropertyDescriptor(ts, "length").get, Fl = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, no = typeof SharedArrayBuffer > "u" ? null : Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get, At = "sdn-bip32-slip10-purpose-v1", gn = "password-scrypt-v2", Xt = "ed25519-over-sha256-jcs-v1", io = "ed25519-raw-32-v1", Ml = "ed25519-sdn-signed-request-v2", oo = ["protocolVersion", "providerOrigin", "method", "requestUri", "bodySha256", "bodyBytes", "schema", "entityId", "entityName", "documentCount"], so = ["schemaVersion", "keyId", "identityScheme", "algorithm", "encoding", "signatureProfile", "publicKeyHex", "signatureHex", "requestDigestSha256", "challengeId", "challengeBase64url"], rs = "https://review.spacedatanetwork.org", ns = "sdn-asset-review-v1", Bl = "asset-review:assets.ipfs.01", Vl = "asset-review-authority:assets.ipfs.01", Qn = "sdn-login:sdn.spaceaware.io", Hl = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, Je = /^[0-9a-f]{64}$/u, fi = /^[0-9a-f]{128}$/u, Qt = /^sha256:[0-9a-f]{64}$/u, zl = /^[1-9A-HJ-NP-Za-km-z]+$/u, $l = /^b[a-z2-7]{58}$/u, Zn = "abcdefghijklmnopqrstuvwxyz234567", is = 131072, Wl = [
|
|
5711
5759
|
"accountFingerprint",
|
|
5712
5760
|
"accountIndex",
|
|
5713
5761
|
"accountLabel",
|
|
@@ -5717,7 +5765,7 @@ const Ll = Object.freeze({
|
|
|
5717
5765
|
"keys",
|
|
5718
5766
|
"schemaVersion",
|
|
5719
5767
|
"seedProfile"
|
|
5720
|
-
],
|
|
5768
|
+
], jl = [
|
|
5721
5769
|
"bip32Fingerprint",
|
|
5722
5770
|
"curve",
|
|
5723
5771
|
"derivation",
|
|
@@ -5729,12 +5777,12 @@ const Ll = Object.freeze({
|
|
|
5729
5777
|
"purpose",
|
|
5730
5778
|
"seedProfile",
|
|
5731
5779
|
"signatureProfile"
|
|
5732
|
-
],
|
|
5780
|
+
], ql = [
|
|
5733
5781
|
"connectionExpiresAt",
|
|
5734
5782
|
"event",
|
|
5735
5783
|
"identity",
|
|
5736
5784
|
"schemaVersion"
|
|
5737
|
-
],
|
|
5785
|
+
], Kl = [
|
|
5738
5786
|
"algorithm",
|
|
5739
5787
|
"encoding",
|
|
5740
5788
|
"identityScheme",
|
|
@@ -5742,7 +5790,7 @@ const Ll = Object.freeze({
|
|
|
5742
5790
|
"schemaVersion",
|
|
5743
5791
|
"signatureHex",
|
|
5744
5792
|
"signatureProfile"
|
|
5745
|
-
],
|
|
5793
|
+
], Yl = [
|
|
5746
5794
|
"algorithm",
|
|
5747
5795
|
"canonicalEnvelope",
|
|
5748
5796
|
"encoding",
|
|
@@ -5782,7 +5830,7 @@ const Ll = Object.freeze({
|
|
|
5782
5830
|
"previousDecisionHead",
|
|
5783
5831
|
"protocolVersion",
|
|
5784
5832
|
"requestOrigin"
|
|
5785
|
-
],
|
|
5833
|
+
], Gl = [
|
|
5786
5834
|
"metersPerSourceUnit",
|
|
5787
5835
|
"rotation",
|
|
5788
5836
|
"scale",
|
|
@@ -5879,7 +5927,7 @@ function os(e) {
|
|
|
5879
5927
|
function ss(e) {
|
|
5880
5928
|
return typeof e == "string" ? os(e) : e;
|
|
5881
5929
|
}
|
|
5882
|
-
function
|
|
5930
|
+
function Xl(e, r) {
|
|
5883
5931
|
if (e.byteLength !== r.byteLength) return !1;
|
|
5884
5932
|
let t = 0;
|
|
5885
5933
|
for (let s = 0; s < e.byteLength; s += 1) t |= e[s] ^ r[s];
|
|
@@ -5889,7 +5937,7 @@ function qe(e, r, t) {
|
|
|
5889
5937
|
const s = ss(e);
|
|
5890
5938
|
Pn(s) || K(`${t} must be a JSON object`), Object.getOwnPropertySymbols(s).length !== 0 && K(`${t} has an unknown symbol field`);
|
|
5891
5939
|
const a = Object.getOwnPropertyNames(s).sort(), d = [...r].sort(), b = Lt.encode(a.join("\0")), E = Lt.encode(d.join("\0"));
|
|
5892
|
-
|
|
5940
|
+
Xl(b, E) || K(`${t} has missing or unknown fields`);
|
|
5893
5941
|
for (const I of a) {
|
|
5894
5942
|
const P = Object.getOwnPropertyDescriptor(s, I);
|
|
5895
5943
|
(!P || !P.enumerable || !("value" in P)) && K(`${t}.${I} must be an enumerable data field`), P.value === void 0 && K(`${t}.${I} must not be undefined`);
|
|
@@ -5913,7 +5961,7 @@ function pi(e, r, t) {
|
|
|
5913
5961
|
(!b || !b.enumerable || !("value" in b) || b.value === void 0) && K(`${t} must contain enumerable data values`);
|
|
5914
5962
|
}
|
|
5915
5963
|
}
|
|
5916
|
-
function
|
|
5964
|
+
function Jl(e) {
|
|
5917
5965
|
const r = qe(
|
|
5918
5966
|
e,
|
|
5919
5967
|
["reviewedTransform", "schemaVersion"],
|
|
@@ -5950,7 +5998,7 @@ function Xl(e) {
|
|
|
5950
5998
|
["upAxes", Object.freeze(Array.from({ length: 3 }, (a, d) => t.upAxes[d]))]
|
|
5951
5999
|
]);
|
|
5952
6000
|
}
|
|
5953
|
-
const qt =
|
|
6001
|
+
const qt = Jl(Dl);
|
|
5954
6002
|
function de(e, r, t) {
|
|
5955
6003
|
return e !== r && K(`${t} must equal ${JSON.stringify(r)}`), e;
|
|
5956
6004
|
}
|
|
@@ -5961,17 +6009,17 @@ function Be(e, r, t) {
|
|
|
5961
6009
|
return tt(e, t), r.test(e) || K(`${t} has an invalid encoding`), e;
|
|
5962
6010
|
}
|
|
5963
6011
|
function Tt(e, r) {
|
|
5964
|
-
return tt(e, r), (!
|
|
6012
|
+
return tt(e, r), (!Hl.test(e) || new Date(e).toISOString() !== e) && K(`${r} must be exact RFC3339 milliseconds UTC`), e;
|
|
5965
6013
|
}
|
|
5966
6014
|
function Rn(e, r) {
|
|
5967
6015
|
const t = Date.parse(e), s = Date.parse(r);
|
|
5968
6016
|
s > t && s - t <= 3e5 || K("request lifetime must be in (0, 300] seconds");
|
|
5969
6017
|
}
|
|
5970
|
-
function
|
|
5971
|
-
(!ArrayBuffer.isView(e) || !(e instanceof Uint8Array) || Object.getPrototypeOf(e) !== Uint8Array.prototype) && K(`${r} must be a plain Uint8Array`),
|
|
6018
|
+
function Ql(e, r) {
|
|
6019
|
+
(!ArrayBuffer.isView(e) || !(e instanceof Uint8Array) || Object.getPrototypeOf(e) !== Uint8Array.prototype) && K(`${r} must be a plain Uint8Array`), Ul.call(e) !== 32 && K(`${r} must be exactly 32 bytes`);
|
|
5972
6020
|
const s = Array.from({ length: 32 }, (w, m) => String(m)), a = Reflect.ownKeys(e);
|
|
5973
6021
|
(a.length !== s.length || a.some((w, m) => w !== s[m])) && K(`${r} Uint8Array must contain only 32 indexed bytes`);
|
|
5974
|
-
const d =
|
|
6022
|
+
const d = Cl.call(e);
|
|
5975
6023
|
let b = !1;
|
|
5976
6024
|
if (no)
|
|
5977
6025
|
try {
|
|
@@ -5981,7 +6029,7 @@ function Jl(e, r) {
|
|
|
5981
6029
|
}
|
|
5982
6030
|
b && K(`${r} must not use SharedArrayBuffer storage`);
|
|
5983
6031
|
try {
|
|
5984
|
-
|
|
6032
|
+
Fl.call(d);
|
|
5985
6033
|
} catch {
|
|
5986
6034
|
K(`${r} must use ArrayBuffer storage`);
|
|
5987
6035
|
}
|
|
@@ -6004,17 +6052,17 @@ function yi(e, r) {
|
|
|
6004
6052
|
K(`${r} must be valid base64url`);
|
|
6005
6053
|
}
|
|
6006
6054
|
const s = Uint8Array.from(t, (a) => a.charCodeAt(0));
|
|
6007
|
-
return (s.byteLength !== 32 ||
|
|
6055
|
+
return (s.byteLength !== 32 || Ql(s, r) !== e) && K(`${r} must canonically encode exactly 32 bytes`), e;
|
|
6008
6056
|
}
|
|
6009
|
-
function
|
|
6057
|
+
function Zl(e) {
|
|
6010
6058
|
let r = 0, t = 0, s = "";
|
|
6011
6059
|
for (const a of e)
|
|
6012
6060
|
for (r = r << 8 | a, t += 8; t >= 5; )
|
|
6013
6061
|
t -= 5, s += Zn[r >>> t & 31], r &= (1 << t) - 1;
|
|
6014
6062
|
return t !== 0 && (s += Zn[r << 5 - t & 31]), s;
|
|
6015
6063
|
}
|
|
6016
|
-
function
|
|
6017
|
-
tt(e, "modelCid"),
|
|
6064
|
+
function ed(e, r) {
|
|
6065
|
+
tt(e, "modelCid"), $l.test(e) || K("modelCid must be canonical CIDv1 raw sha2-256 base32");
|
|
6018
6066
|
let t = 0, s = 0;
|
|
6019
6067
|
const a = [];
|
|
6020
6068
|
for (const E of e.slice(1)) {
|
|
@@ -6023,7 +6071,7 @@ function Zl(e, r) {
|
|
|
6023
6071
|
}
|
|
6024
6072
|
(s !== 0 && t !== 0 || a.length !== 36) && K("modelCid has noncanonical base32 tail bits or length");
|
|
6025
6073
|
const d = Uint8Array.from(a);
|
|
6026
|
-
(d[0] !== 1 || d[1] !== 85 || d[2] !== 18 || d[3] !== 32) && K("modelCid must encode CIDv1 raw sha2-256 with a 32-byte digest"), `b${
|
|
6074
|
+
(d[0] !== 1 || d[1] !== 85 || d[2] !== 18 || d[3] !== 32) && K("modelCid must encode CIDv1 raw sha2-256 with a 32-byte digest"), `b${Zl(d)}` !== e && K("modelCid base32 is not canonical");
|
|
6027
6075
|
let b = 0;
|
|
6028
6076
|
for (let E = 0; E < 32; E += 1) {
|
|
6029
6077
|
const I = Number.parseInt(r.slice(E * 2, E * 2 + 2), 16);
|
|
@@ -6038,7 +6086,7 @@ function gi(e, r) {
|
|
|
6038
6086
|
for (const t of ["identityScheme", "keyId", "signatureProfile"])
|
|
6039
6087
|
e[t] !== r[t] && K(`canonicalEnvelope ${t} must match the signature result`);
|
|
6040
6088
|
}
|
|
6041
|
-
function
|
|
6089
|
+
function td(e, r) {
|
|
6042
6090
|
const s = qe(e, [
|
|
6043
6091
|
"audience",
|
|
6044
6092
|
"challengeSha256",
|
|
@@ -6055,7 +6103,7 @@ function ed(e, r) {
|
|
|
6055
6103
|
], "SDN login canonicalEnvelope");
|
|
6056
6104
|
gi(s, r), de(s.audience, Qn, "SDN login envelope audience"), Be(s.challengeSha256, Je, "SDN login envelope challengeSha256"), de(s.clientId, "sdn-node-console-v1", "SDN login envelope clientId"), Tt(s.issuedAt, "SDN login envelope issuedAt"), Tt(s.expiresAt, "SDN login envelope expiresAt"), Rn(s.issuedAt, s.expiresAt), de(s.identityScheme, At, "SDN login envelope identityScheme"), Be(s.keyId, Qt, "SDN login envelope keyId"), de(s.kind, "sdn-login", "SDN login envelope kind"), Be(s.nonce, Je, "SDN login envelope nonce"), de(s.protocolVersion, 2, "SDN login envelope protocolVersion"), de(s.requestOrigin, "https://sdn.spaceaware.io", "SDN login envelope requestOrigin"), de(s.signatureProfile, Xt, "SDN login envelope signatureProfile");
|
|
6057
6105
|
}
|
|
6058
|
-
function
|
|
6106
|
+
function rd(e, r) {
|
|
6059
6107
|
const t = qe(
|
|
6060
6108
|
e,
|
|
6061
6109
|
[...vn, "kind"],
|
|
@@ -6063,7 +6111,7 @@ function td(e, r) {
|
|
|
6063
6111
|
);
|
|
6064
6112
|
gi(t, r), de(t.kind, "asset-review-authority-activation", "activation envelope kind"), cs(Object.fromEntries(vn.map((s) => [s, t[s]])));
|
|
6065
6113
|
}
|
|
6066
|
-
function
|
|
6114
|
+
function nd(e, r) {
|
|
6067
6115
|
const t = e?.decision === "approve" ? ["note", "reviewedTransform"] : e?.decision === "disapprove" ? ["reason"] : [], s = [...ei, ...t], a = qe(e, [
|
|
6068
6116
|
...s,
|
|
6069
6117
|
"identityScheme",
|
|
@@ -6074,13 +6122,13 @@ function rd(e, r) {
|
|
|
6074
6122
|
], "asset review decision canonicalEnvelope");
|
|
6075
6123
|
gi(a, r), de(a.identityScheme, At, "decision envelope identityScheme"), Be(a.keyId, Qt, "decision envelope keyId"), de(a.kind, "asset-review-attestation", "decision envelope kind"), de(a.purpose, "asset-review-approval", "decision envelope purpose"), de(a.signatureProfile, Xt, "decision envelope signatureProfile"), ls(Object.fromEntries(s.map((d) => [d, a[d]])));
|
|
6076
6124
|
}
|
|
6077
|
-
function
|
|
6125
|
+
function id(e, r, t) {
|
|
6078
6126
|
tt(e, "canonicalEnvelope"), Lt.encode(e).byteLength > is && K("canonicalEnvelope is too large");
|
|
6079
6127
|
const s = os(e);
|
|
6080
|
-
return (!Pn(s) || s.kind !== r) && K("canonicalEnvelope kind does not match the operation"), ti(s) !== e && K("canonicalEnvelope must be exact JCS"), r === "sdn-login" ?
|
|
6128
|
+
return (!Pn(s) || s.kind !== r) && K("canonicalEnvelope kind does not match the operation"), ti(s) !== e && K("canonicalEnvelope must be exact JCS"), r === "sdn-login" ? td(s, t) : r === "asset-review-authority-activation" ? rd(s, t) : r === "asset-review-attestation" ? nd(s, t) : K("canonicalEnvelope operation is not registered"), e;
|
|
6081
6129
|
}
|
|
6082
|
-
function
|
|
6083
|
-
const t = qe(e,
|
|
6130
|
+
function od(e, r) {
|
|
6131
|
+
const t = qe(e, jl, `identity key ${r.purpose}`);
|
|
6084
6132
|
return de(t.purpose, r.purpose, "key purpose"), de(t.identityScheme, At, "key identityScheme"), de(t.seedProfile, gn, "key seedProfile"), de(t.signatureProfile, r.signatureProfile, "key signatureProfile"), de(t.curve, r.curve, "key curve"), de(t.derivation, "slip10", "key derivation"), de(t.path, r.path, "key path"), de(t.encoding, "raw", "key encoding"), Be(t.publicKeyHex, Je, "key publicKeyHex"), de(t.bip32Fingerprint, null, "key bip32Fingerprint"), Be(t.keyId, Qt, "key keyId"), rt([
|
|
6085
6133
|
["bip32Fingerprint", null],
|
|
6086
6134
|
["curve", t.curve],
|
|
@@ -6095,9 +6143,9 @@ function id(e, r) {
|
|
|
6095
6143
|
["signatureProfile", t.signatureProfile]
|
|
6096
6144
|
]);
|
|
6097
6145
|
}
|
|
6098
|
-
function
|
|
6099
|
-
const r = qe(e,
|
|
6100
|
-
de(r.schemaVersion, 1, "identity schemaVersion"), de(r.identityScheme, At, "identity identityScheme"), de(r.seedProfile, gn, "identity seedProfile"), r.accountIndex !== 0 && K("public wallet identity must use account 0"), de(r.accountLabel, null, "identity accountLabel"), tt(r.accountXpub, "identity accountXpub"), /^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(r.accountXpub) || K("identity accountXpub is invalid"), tt(r.accountPeerId, "identity accountPeerId"), (!r.accountPeerId.startsWith("16Uiu2H") || r.accountPeerId.length < 40 || r.accountPeerId.length > 64 || !
|
|
6146
|
+
function sd(e) {
|
|
6147
|
+
const r = qe(e, Wl, "WalletPublicIdentity");
|
|
6148
|
+
de(r.schemaVersion, 1, "identity schemaVersion"), de(r.identityScheme, At, "identity identityScheme"), de(r.seedProfile, gn, "identity seedProfile"), r.accountIndex !== 0 && K("public wallet identity must use account 0"), de(r.accountLabel, null, "identity accountLabel"), tt(r.accountXpub, "identity accountXpub"), /^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(r.accountXpub) || K("identity accountXpub is invalid"), tt(r.accountPeerId, "identity accountPeerId"), (!r.accountPeerId.startsWith("16Uiu2H") || r.accountPeerId.length < 40 || r.accountPeerId.length > 64 || !zl.test(r.accountPeerId)) && K("identity accountPeerId is invalid"), Be(r.accountFingerprint, /^[0-9a-f]{8}$/u, "identity accountFingerprint"), pi(r.keys, 3, "public identity keys array");
|
|
6101
6149
|
const t = [
|
|
6102
6150
|
{
|
|
6103
6151
|
purpose: "asset-review-approval",
|
|
@@ -6119,7 +6167,7 @@ function od(e) {
|
|
|
6119
6167
|
}
|
|
6120
6168
|
], s = Array.from(
|
|
6121
6169
|
{ length: 3 },
|
|
6122
|
-
(a, d) =>
|
|
6170
|
+
(a, d) => od(r.keys[d], t[d])
|
|
6123
6171
|
);
|
|
6124
6172
|
return rt([
|
|
6125
6173
|
["accountFingerprint", r.accountFingerprint],
|
|
@@ -6134,18 +6182,18 @@ function od(e) {
|
|
|
6134
6182
|
]);
|
|
6135
6183
|
}
|
|
6136
6184
|
function as(e, r) {
|
|
6137
|
-
const t = qe(e,
|
|
6185
|
+
const t = qe(e, ql, `${r} result`);
|
|
6138
6186
|
de(t.schemaVersion, 1, "connection result schemaVersion"), zr(t.event, ["connected", "disconnected"], "connection event"), r === "connect" && t.event !== "connected" && K("connect result must be connected");
|
|
6139
6187
|
let s = null, a = null;
|
|
6140
|
-
return t.event === "connected" ? (s =
|
|
6188
|
+
return t.event === "connected" ? (s = sd(t.identity), a = Tt(t.connectionExpiresAt, "connectionExpiresAt")) : (t.identity !== null || t.connectionExpiresAt !== null) && K("disconnected result must clear identity and expiry"), rt([
|
|
6141
6189
|
["connectionExpiresAt", a],
|
|
6142
6190
|
["event", t.event],
|
|
6143
6191
|
["identity", s],
|
|
6144
6192
|
["schemaVersion", 1]
|
|
6145
6193
|
]);
|
|
6146
6194
|
}
|
|
6147
|
-
function
|
|
6148
|
-
const r = qe(e,
|
|
6195
|
+
function ad(e) {
|
|
6196
|
+
const r = qe(e, Kl, "raw signature");
|
|
6149
6197
|
return de(r.schemaVersion, 1, "signature schemaVersion"), Be(r.keyId, Qt, "signature keyId"), zr(r.identityScheme, [
|
|
6150
6198
|
"sdn-fast-password-auth-v1-legacy",
|
|
6151
6199
|
"sdn-bip39-auth-v1-legacy"
|
|
@@ -6160,8 +6208,8 @@ function sd(e) {
|
|
|
6160
6208
|
]);
|
|
6161
6209
|
}
|
|
6162
6210
|
function vi(e, r) {
|
|
6163
|
-
const t = qe(e,
|
|
6164
|
-
return de(t.schemaVersion, 1, "signature schemaVersion"), Be(t.keyId, Qt, "signature keyId"), de(t.identityScheme, At, "signature identityScheme"), de(t.algorithm, "ed25519", "signature algorithm"), de(t.encoding, "raw", "signature encoding"), de(t.signatureProfile, Xt, "signature profile"),
|
|
6211
|
+
const t = qe(e, Yl, "canonical signature");
|
|
6212
|
+
return de(t.schemaVersion, 1, "signature schemaVersion"), Be(t.keyId, Qt, "signature keyId"), de(t.identityScheme, At, "signature identityScheme"), de(t.algorithm, "ed25519", "signature algorithm"), de(t.encoding, "raw", "signature encoding"), de(t.signatureProfile, Xt, "signature profile"), id(t.canonicalEnvelope, r, t), Be(t.signedDigestSha256, Je, "signedDigestSha256"), Be(t.signatureHex, fi, "signatureHex"), rt([
|
|
6165
6213
|
["algorithm", "ed25519"],
|
|
6166
6214
|
["canonicalEnvelope", t.canonicalEnvelope],
|
|
6167
6215
|
["encoding", "raw"],
|
|
@@ -6173,14 +6221,14 @@ function vi(e, r) {
|
|
|
6173
6221
|
["signedDigestSha256", t.signedDigestSha256]
|
|
6174
6222
|
]);
|
|
6175
6223
|
}
|
|
6176
|
-
function
|
|
6224
|
+
function cd(e) {
|
|
6177
6225
|
const r = qe(e, ["challengeBase64url", "protocolVersion"], "SDN login v1 request");
|
|
6178
6226
|
return de(r.protocolVersion, 1, "SDN login v1 protocolVersion"), yi(r.challengeBase64url, "challengeBase64url"), rt([
|
|
6179
6227
|
["challengeBase64url", r.challengeBase64url],
|
|
6180
6228
|
["protocolVersion", 1]
|
|
6181
6229
|
]);
|
|
6182
6230
|
}
|
|
6183
|
-
function
|
|
6231
|
+
function ld(e) {
|
|
6184
6232
|
const r = qe(e, oo, "SDN publication request");
|
|
6185
6233
|
de(r.protocolVersion, 1, "publication protocolVersion"), de(r.method, "POST", "publication method"), zr(r.schema, ["CZM", "ETM"], "publication schema"), tt(r.providerOrigin, "providerOrigin");
|
|
6186
6234
|
let t;
|
|
@@ -6201,11 +6249,11 @@ function cd(e) {
|
|
|
6201
6249
|
}
|
|
6202
6250
|
return rt(oo.map((d) => [d, r[d]]));
|
|
6203
6251
|
}
|
|
6204
|
-
function
|
|
6252
|
+
function dd(e) {
|
|
6205
6253
|
const r = qe(e, so, "SDN publication signature");
|
|
6206
|
-
return de(r.schemaVersion, 1, "publication signature schemaVersion"), de(r.identityScheme, At, "publication identityScheme"), de(r.algorithm, "ed25519", "publication algorithm"), de(r.encoding, "raw", "publication encoding"), de(r.signatureProfile,
|
|
6254
|
+
return de(r.schemaVersion, 1, "publication signature schemaVersion"), de(r.identityScheme, At, "publication identityScheme"), de(r.algorithm, "ed25519", "publication algorithm"), de(r.encoding, "raw", "publication encoding"), de(r.signatureProfile, Ml, "publication signatureProfile"), Be(r.keyId, Qt, "publication keyId"), Be(r.publicKeyHex, Je, "publication publicKeyHex"), Be(r.signatureHex, fi, "publication signatureHex"), Be(r.requestDigestSha256, Je, "publication requestDigestSha256"), Be(r.challengeId, /^[0-9a-f]{32}$/u, "publication challengeId"), yi(r.challengeBase64url, "publication challengeBase64url"), rt(so.map((t) => [t, r[t]]));
|
|
6207
6255
|
}
|
|
6208
|
-
function
|
|
6256
|
+
function _d(e) {
|
|
6209
6257
|
const r = qe(e, [
|
|
6210
6258
|
"audience",
|
|
6211
6259
|
"challengeBase64url",
|
|
@@ -6225,7 +6273,7 @@ function dd(e) {
|
|
|
6225
6273
|
}
|
|
6226
6274
|
function cs(e) {
|
|
6227
6275
|
const r = qe(e, vn, "authority activation request");
|
|
6228
|
-
return de(r.protocolVersion, 1, "activation protocolVersion"), de(r.audience,
|
|
6276
|
+
return de(r.protocolVersion, 1, "activation protocolVersion"), de(r.audience, Vl, "activation audience"), de(r.requestOrigin, rs, "activation requestOrigin"), de(r.clientId, ns, "activation clientId"), de(r.serviceInstance, "assets.ipfs.01/asset-review-attestation", "activation serviceInstance"), de(r.purpose, "asset-review-authority-activation", "activation purpose"), Be(r.nonce, Je, "activation nonce"), Tt(r.issuedAt, "activation issuedAt"), Tt(r.expiresAt, "activation expiresAt"), Rn(r.issuedAt, r.expiresAt), Be(r.publicKeyHex, Je, "activation publicKeyHex"), Be(r.keyId, Qt, "activation keyId"), de(r.identityScheme, At, "activation identityScheme"), de(r.signatureProfile, Xt, "activation signatureProfile"), rt(vn.map((t) => [t, r[t]]));
|
|
6229
6277
|
}
|
|
6230
6278
|
function Hn(e, r, t) {
|
|
6231
6279
|
pi(e, r, `${t} array`);
|
|
@@ -6235,8 +6283,8 @@ function Hn(e, r, t) {
|
|
|
6235
6283
|
});
|
|
6236
6284
|
return $r(s);
|
|
6237
6285
|
}
|
|
6238
|
-
function
|
|
6239
|
-
const r = qe(e,
|
|
6286
|
+
function hd(e) {
|
|
6287
|
+
const r = qe(e, Gl, "reviewedTransform"), t = Hn(r.translation, 3, "translation"), s = Hn(r.rotation, 4, "rotation"), a = Hn(r.scale, 3, "scale");
|
|
6240
6288
|
t.some((b) => Math.abs(b) > qt.translationComponentAbsMax) && K("translation values exceed the reviewed transform policy"), a.some((b) => b <= qt.scaleComponentExclusiveMin || b > qt.scaleComponentInclusiveMax) && K("scale values exceed the reviewed transform policy");
|
|
6241
6289
|
const d = Math.hypot(...s);
|
|
6242
6290
|
return Math.abs(d - 1) > qt.quaternionNormTolerance && K("rotation must be a unit quaternion within the reviewed tolerance"), zr(r.upAxis, qt.upAxes, "upAxis"), tt(r.sourceUnits, "sourceUnits"), Object.hasOwn(qt.metersPerSourceUnit, r.sourceUnits) || K("sourceUnits is not allowed by the reviewed transform policy"), (typeof r.metersPerSourceUnit != "number" || !Number.isFinite(r.metersPerSourceUnit) || r.metersPerSourceUnit !== qt.metersPerSourceUnit[r.sourceUnits]) && K("metersPerSourceUnit must exactly match sourceUnits"), rt([
|
|
@@ -6263,60 +6311,60 @@ function ls(e) {
|
|
|
6263
6311
|
const t = Object.getOwnPropertyDescriptor(r, "decision");
|
|
6264
6312
|
(!t || !t.enumerable || !("value" in t) || t.value === void 0) && K("asset review decision request has an invalid decision field");
|
|
6265
6313
|
const s = t.value, a = s === "approve" ? ["note", "reviewedTransform"] : s === "disapprove" ? ["reason"] : [], d = qe(r, [...ei, ...a], "asset review decision request");
|
|
6266
|
-
de(d.protocolVersion, 1, "decision protocolVersion"), de(d.audience,
|
|
6314
|
+
de(d.protocolVersion, 1, "decision protocolVersion"), de(d.audience, Bl, "decision audience"), de(d.requestOrigin, rs, "decision requestOrigin"), de(d.clientId, ns, "decision clientId"), Be(d.challengeId, Je, "challengeId"), Be(d.nonce, Je, "decision nonce"), Tt(d.issuedAt, "decision issuedAt"), Tt(d.expiresAt, "decision expiresAt"), Rn(d.issuedAt, d.expiresAt), Be(d.modelSha256, Je, "modelSha256"), Be(d.metadataSha256, Je, "metadataSha256"), d.previousDecisionHead !== null && Be(d.previousDecisionHead, Je, "previousDecisionHead"), ed(d.modelCid, d.modelSha256), (!Number.isSafeInteger(d.modelBytes) || d.modelBytes <= 0) && K("modelBytes must be a positive safe integer"), tt(d.candidateKey, "candidateKey");
|
|
6267
6315
|
const b = "asset-review:", E = `:${d.modelSha256}`;
|
|
6268
6316
|
(!d.candidateKey.startsWith(b) || !d.candidateKey.endsWith(E) || Lt.encode(d.candidateKey).byteLength > 206) && K("candidateKey does not bind the model digest");
|
|
6269
6317
|
const I = d.candidateKey.slice(b.length, -E.length);
|
|
6270
6318
|
(!/^[a-z0-9-]+\/[a-z0-9][a-z0-9-]*$/u.test(I) || Lt.encode(I).byteLength > 128) && K("candidateKey entityId is invalid");
|
|
6271
6319
|
const P = ei.map((m) => [m, d[m]]);
|
|
6272
|
-
return s === "approve" ? (P.push(["note", co(d.note, "note", !0)]), P.push(["reviewedTransform",
|
|
6320
|
+
return s === "approve" ? (P.push(["note", co(d.note, "note", !0)]), P.push(["reviewedTransform", hd(d.reviewedTransform)])) : P.push(["reason", co(d.reason, "reason", !1)]), Object.values(d).filter((m) => typeof m == "string").reduce((m, N) => m + Lt.encode(N).byteLength, 0) > 16384 && K("decision request strings exceed 16 KiB"), rt(P);
|
|
6273
6321
|
}
|
|
6274
6322
|
function ds(e, r) {
|
|
6275
6323
|
return qe(e, [], r), $r({});
|
|
6276
6324
|
}
|
|
6277
|
-
function
|
|
6325
|
+
function ud(e) {
|
|
6278
6326
|
return ds(e, "wallet connect request");
|
|
6279
6327
|
}
|
|
6280
|
-
function
|
|
6328
|
+
function fd(e) {
|
|
6281
6329
|
return as(e, "connect");
|
|
6282
6330
|
}
|
|
6283
|
-
function
|
|
6331
|
+
function pd(e) {
|
|
6284
6332
|
return ds(e, "wallet account request");
|
|
6285
6333
|
}
|
|
6286
6334
|
function _s(e) {
|
|
6287
6335
|
return as(e, "account");
|
|
6288
6336
|
}
|
|
6289
|
-
function pd(e) {
|
|
6290
|
-
return ad(e);
|
|
6291
|
-
}
|
|
6292
6337
|
function yd(e) {
|
|
6293
|
-
return
|
|
6338
|
+
return cd(e);
|
|
6294
6339
|
}
|
|
6295
6340
|
function gd(e) {
|
|
6296
|
-
return
|
|
6341
|
+
return ad(e);
|
|
6297
6342
|
}
|
|
6298
6343
|
function vd(e) {
|
|
6344
|
+
return _d(e);
|
|
6345
|
+
}
|
|
6346
|
+
function bd(e) {
|
|
6299
6347
|
return vi(e, "sdn-login");
|
|
6300
6348
|
}
|
|
6301
6349
|
function hs(e) {
|
|
6302
|
-
return
|
|
6350
|
+
return ld(e);
|
|
6303
6351
|
}
|
|
6304
6352
|
function us(e) {
|
|
6305
|
-
return
|
|
6353
|
+
return dd(e);
|
|
6306
6354
|
}
|
|
6307
|
-
function
|
|
6355
|
+
function Ed(e) {
|
|
6308
6356
|
return cs(e);
|
|
6309
6357
|
}
|
|
6310
|
-
function
|
|
6358
|
+
function Ad(e) {
|
|
6311
6359
|
return vi(e, "asset-review-authority-activation");
|
|
6312
6360
|
}
|
|
6313
|
-
function
|
|
6361
|
+
function md(e) {
|
|
6314
6362
|
return ls(e);
|
|
6315
6363
|
}
|
|
6316
|
-
function
|
|
6364
|
+
function Id(e) {
|
|
6317
6365
|
return vi(e, "asset-review-attestation");
|
|
6318
6366
|
}
|
|
6319
|
-
const
|
|
6367
|
+
const wd = Object.freeze([
|
|
6320
6368
|
"callbackUri",
|
|
6321
6369
|
"clientDisplayName",
|
|
6322
6370
|
"clientId",
|
|
@@ -6330,48 +6378,48 @@ const Id = Object.freeze([
|
|
|
6330
6378
|
"schemaVersion",
|
|
6331
6379
|
"state",
|
|
6332
6380
|
"transactionId"
|
|
6333
|
-
]), an = /^[0-9a-f]{64}$/u, fs = /^[A-Za-z0-9_-]{43}$/u,
|
|
6381
|
+
]), an = /^[0-9a-f]{64}$/u, fs = /^[A-Za-z0-9_-]{43}$/u, Sd = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, kd = new TextEncoder(), ps = Object.freeze({
|
|
6334
6382
|
"sdn.auth.publish-request.v1": Object.freeze({
|
|
6335
6383
|
parseRequest: hs,
|
|
6336
6384
|
buildResult: us,
|
|
6337
6385
|
publish: !0
|
|
6338
6386
|
}),
|
|
6339
6387
|
"sdn.auth.jcs-envelope.v2": Object.freeze({
|
|
6340
|
-
parseRequest:
|
|
6341
|
-
buildResult:
|
|
6388
|
+
parseRequest: vd,
|
|
6389
|
+
buildResult: bd,
|
|
6342
6390
|
sign(e, r, t, s) {
|
|
6343
6391
|
return e.signSdnLoginV2(r, t, s.registryRow);
|
|
6344
6392
|
}
|
|
6345
6393
|
}),
|
|
6346
6394
|
"sdn.auth.raw-challenge.v1": Object.freeze({
|
|
6347
|
-
parseRequest:
|
|
6348
|
-
buildResult:
|
|
6395
|
+
parseRequest: yd,
|
|
6396
|
+
buildResult: gd,
|
|
6349
6397
|
sign(e, r, t) {
|
|
6350
|
-
return e.signSdnLoginV1(r,
|
|
6398
|
+
return e.signSdnLoginV1(r, Nd(t.challengeBase64url));
|
|
6351
6399
|
}
|
|
6352
6400
|
}),
|
|
6353
6401
|
"sdn.asset-review.authority-activation.v1": Object.freeze({
|
|
6354
|
-
parseRequest:
|
|
6355
|
-
buildResult:
|
|
6402
|
+
parseRequest: Ed,
|
|
6403
|
+
buildResult: Ad,
|
|
6356
6404
|
sign(e, r, t, s) {
|
|
6357
6405
|
return e.signAssetReviewAuthorityActivation(r, t, s.registryRow);
|
|
6358
6406
|
}
|
|
6359
6407
|
}),
|
|
6360
6408
|
"sdn.asset-review.decision.v1": Object.freeze({
|
|
6361
|
-
parseRequest:
|
|
6362
|
-
buildResult:
|
|
6409
|
+
parseRequest: md,
|
|
6410
|
+
buildResult: Id,
|
|
6363
6411
|
sign(e, r, t, s) {
|
|
6364
6412
|
return e.signAssetReviewDecision(r, t, s.registryRow);
|
|
6365
6413
|
}
|
|
6366
6414
|
}),
|
|
6367
6415
|
"sdn.wallet.account.v1": Object.freeze({
|
|
6368
|
-
parseRequest:
|
|
6416
|
+
parseRequest: pd,
|
|
6369
6417
|
buildResult: _s,
|
|
6370
6418
|
connect: !0
|
|
6371
6419
|
}),
|
|
6372
6420
|
"sdn.wallet.connect.v1": Object.freeze({
|
|
6373
|
-
parseRequest:
|
|
6374
|
-
buildResult:
|
|
6421
|
+
parseRequest: ud,
|
|
6422
|
+
buildResult: fd,
|
|
6375
6423
|
connect: !0
|
|
6376
6424
|
})
|
|
6377
6425
|
});
|
|
@@ -6412,7 +6460,7 @@ function ri(e, r, t = "INVALID_TRANSACTION") {
|
|
|
6412
6460
|
return b;
|
|
6413
6461
|
}
|
|
6414
6462
|
function cn(e, r = "INVALID_TRANSACTION") {
|
|
6415
|
-
(typeof e != "string" || !
|
|
6463
|
+
(typeof e != "string" || !Sd.test(e)) && Se(r);
|
|
6416
6464
|
const t = Date.parse(e);
|
|
6417
6465
|
return (!Number.isFinite(t) || new Date(t).toISOString() !== e) && Se(r), t;
|
|
6418
6466
|
}
|
|
@@ -6426,17 +6474,17 @@ function Mr(e) {
|
|
|
6426
6474
|
function ni(e) {
|
|
6427
6475
|
return e === null || typeof e == "boolean" || typeof e == "string" ? JSON.stringify(e) : typeof e == "number" ? (Number.isFinite(e) || Se("INVALID_TRANSACTION"), JSON.stringify(e)) : Array.isArray(e) ? `[${e.map(ni).join(",")}]` : (bi(e) || Se("INVALID_TRANSACTION"), `{${Object.keys(e).sort().map((r) => `${JSON.stringify(r)}:${ni(e[r])}`).join(",")}}`);
|
|
6428
6476
|
}
|
|
6429
|
-
async function
|
|
6477
|
+
async function Od(e, r) {
|
|
6430
6478
|
typeof r != "function" && Se("CRYPTO_UNAVAILABLE");
|
|
6431
6479
|
let t;
|
|
6432
6480
|
try {
|
|
6433
|
-
t = await r(
|
|
6481
|
+
t = await r(kd.encode(ni(e)));
|
|
6434
6482
|
} catch {
|
|
6435
6483
|
Se("CRYPTO_UNAVAILABLE");
|
|
6436
6484
|
}
|
|
6437
6485
|
return (!(t instanceof Uint8Array) || t.byteLength !== 32) && Se("CRYPTO_UNAVAILABLE"), Array.from(t, (s) => s.toString(16).padStart(2, "0")).join("");
|
|
6438
6486
|
}
|
|
6439
|
-
function
|
|
6487
|
+
function Pd(e, r) {
|
|
6440
6488
|
if (typeof e != "string" || typeof r != "string") return !1;
|
|
6441
6489
|
const t = Math.max(e.length, r.length);
|
|
6442
6490
|
let s = e.length ^ r.length;
|
|
@@ -6444,7 +6492,7 @@ function Od(e, r) {
|
|
|
6444
6492
|
s |= (e.charCodeAt(a) || 0) ^ (r.charCodeAt(a) || 0);
|
|
6445
6493
|
return s === 0;
|
|
6446
6494
|
}
|
|
6447
|
-
function
|
|
6495
|
+
function Rd(e, r) {
|
|
6448
6496
|
try {
|
|
6449
6497
|
if (typeof e?.resolveRegistryBinding == "function")
|
|
6450
6498
|
return e.resolveRegistryBinding(r);
|
|
@@ -6473,11 +6521,11 @@ async function zn(e, {
|
|
|
6473
6521
|
now: d = () => Date.now(),
|
|
6474
6522
|
expectedTransactionId: b = null
|
|
6475
6523
|
}) {
|
|
6476
|
-
const E = ri(e,
|
|
6524
|
+
const E = ri(e, wd);
|
|
6477
6525
|
(E.schemaVersion !== 1 || typeof E.clientDisplayName != "string" || E.clientDisplayName.length < 1 || E.clientDisplayName.length > 80 || !an.test(E.transactionId) || !an.test(E.state) || !an.test(E.requestSha256) || !fs.test(E.resultToken)) && Se("INVALID_TRANSACTION"), b !== null && E.transactionId !== b && Se("INVALID_TRANSACTION");
|
|
6478
6526
|
const I = ps[E.operation];
|
|
6479
6527
|
I || Se("UNREGISTERED_TRANSACTION");
|
|
6480
|
-
const P =
|
|
6528
|
+
const P = Rd(r, {
|
|
6481
6529
|
clientId: E.clientId,
|
|
6482
6530
|
operation: E.operation,
|
|
6483
6531
|
requestOrigin: E.requestOrigin
|
|
@@ -6493,12 +6541,12 @@ async function zn(e, {
|
|
|
6493
6541
|
}
|
|
6494
6542
|
let L;
|
|
6495
6543
|
try {
|
|
6496
|
-
L = await
|
|
6544
|
+
L = await Od(N, s);
|
|
6497
6545
|
} catch (U) {
|
|
6498
6546
|
if (U instanceof xt) throw U;
|
|
6499
6547
|
Se("CRYPTO_UNAVAILABLE");
|
|
6500
6548
|
}
|
|
6501
|
-
|
|
6549
|
+
Pd(L, E.requestSha256) || Se("REQUEST_HASH_MISMATCH");
|
|
6502
6550
|
const D = { ...E, request: N };
|
|
6503
6551
|
return Object.freeze({
|
|
6504
6552
|
binding: Mr(P),
|
|
@@ -6507,7 +6555,7 @@ async function zn(e, {
|
|
|
6507
6555
|
transaction: Mr(D)
|
|
6508
6556
|
});
|
|
6509
6557
|
}
|
|
6510
|
-
function
|
|
6558
|
+
function Nd(e) {
|
|
6511
6559
|
fs.test(e) || Se("INVALID_TRANSACTION");
|
|
6512
6560
|
let r;
|
|
6513
6561
|
try {
|
|
@@ -6518,7 +6566,7 @@ function Rd(e) {
|
|
|
6518
6566
|
const t = Uint8Array.from(r, (s) => s.charCodeAt(0));
|
|
6519
6567
|
return t.byteLength !== 32 && Se("INVALID_TRANSACTION"), t;
|
|
6520
6568
|
}
|
|
6521
|
-
function
|
|
6569
|
+
function Ld(e, r, t, s) {
|
|
6522
6570
|
const a = e.createElement("div");
|
|
6523
6571
|
a.className = "wallet-confirmation-row";
|
|
6524
6572
|
const d = e.createElement("strong");
|
|
@@ -6569,7 +6617,7 @@ function ys(e, r = {}) {
|
|
|
6569
6617
|
return b(`Confirm a request from ${a}`, "", "Confirm");
|
|
6570
6618
|
}
|
|
6571
6619
|
}
|
|
6572
|
-
function
|
|
6620
|
+
function Td(e, { binding: r, document: t, request: s }) {
|
|
6573
6621
|
const a = ys(r, s ?? {});
|
|
6574
6622
|
e.replaceChildren();
|
|
6575
6623
|
const d = t.createElement("h1");
|
|
@@ -6577,10 +6625,10 @@ function Ld(e, { binding: r, document: t, request: s }) {
|
|
|
6577
6625
|
const b = t.createElement("p");
|
|
6578
6626
|
b.className = "wallet-confirmation-detail", b.textContent = a.detail, e.append(b);
|
|
6579
6627
|
}
|
|
6580
|
-
for (const [b, E] of a.facts)
|
|
6628
|
+
for (const [b, E] of a.facts) Ld(t, e, b, String(E));
|
|
6581
6629
|
return e;
|
|
6582
6630
|
}
|
|
6583
|
-
async function
|
|
6631
|
+
async function xd({ assertCurrent: e, binding: r, capabilities: t, handle: s, identity: a, transaction: d }) {
|
|
6584
6632
|
const b = hs(d.request);
|
|
6585
6633
|
(r.clientId !== "spaceaware-web-v1" || r.requestOrigin !== "https://spaceaware.io" || r.registryRow !== "spaceaware-publish-request-v1" || typeof t.signSdnPublishRequest != "function" || a?.identityScheme !== "sdn-bip32-slip10-purpose-v1" || a?.seedProfile !== "password-scrypt-v2") && Se("OPERATION_NOT_ALLOWED");
|
|
6586
6634
|
const E = a.keys?.filter((C) => C?.purpose === "sdn-authentication") ?? [];
|
|
@@ -6638,9 +6686,9 @@ async function Td({ assertCurrent: e, binding: r, capabilities: t, handle: s, id
|
|
|
6638
6686
|
const M = ri(U, ["schemaVersion", "keyId", "identityScheme", "algorithm", "encoding", "signatureProfile", "publicKeyHex", "signatureHex", "requestDigestSha256"], "INVALID_WALLET_RESULT");
|
|
6639
6687
|
return (M.keyId !== P || M.publicKeyHex !== I) && Se("INVALID_WALLET_RESULT"), us({ ...M, challengeId: L.challenge_id, challengeBase64url: D });
|
|
6640
6688
|
}
|
|
6641
|
-
function
|
|
6689
|
+
function Dd({ binding: e, document: r, request: t }) {
|
|
6642
6690
|
const s = r.activeElement ?? null, a = r.createElement("section");
|
|
6643
|
-
a.className = "wallet-confirmation", a.setAttribute?.("role", "dialog"), a.setAttribute?.("aria-modal", "true"), a.setAttribute?.("aria-labelledby", "wallet-confirmation-heading"), a.tabIndex = -1,
|
|
6691
|
+
a.className = "wallet-confirmation", a.setAttribute?.("role", "dialog"), a.setAttribute?.("aria-modal", "true"), a.setAttribute?.("aria-labelledby", "wallet-confirmation-heading"), a.tabIndex = -1, Td(a, { binding: e, document: r, request: t });
|
|
6644
6692
|
const d = r.createElement("div");
|
|
6645
6693
|
d.className = "wallet-confirmation-actions";
|
|
6646
6694
|
const b = r.createElement("button");
|
|
@@ -6690,7 +6738,7 @@ function xd({ binding: e, document: r, request: t }) {
|
|
|
6690
6738
|
}
|
|
6691
6739
|
});
|
|
6692
6740
|
}
|
|
6693
|
-
async function
|
|
6741
|
+
async function Cd({
|
|
6694
6742
|
assertCurrent: e = () => {
|
|
6695
6743
|
},
|
|
6696
6744
|
binding: r,
|
|
@@ -6700,7 +6748,7 @@ async function Dd({
|
|
|
6700
6748
|
wasm: d
|
|
6701
6749
|
}) {
|
|
6702
6750
|
const b = d?.sdn ?? d, E = ps[a.operation];
|
|
6703
|
-
if ((!E || !b) && Se("OPERATION_NOT_ALLOWED"), E.publish) return
|
|
6751
|
+
if ((!E || !b) && Se("OPERATION_NOT_ALLOWED"), E.publish) return xd({ assertCurrent: e, binding: r, capabilities: b, handle: t, identity: s, transaction: a });
|
|
6704
6752
|
if (E.connect)
|
|
6705
6753
|
return E.buildResult({
|
|
6706
6754
|
connectionExpiresAt: a.expiresAt,
|
|
@@ -6721,7 +6769,7 @@ async function Dd({
|
|
|
6721
6769
|
Se("INVALID_WALLET_RESULT");
|
|
6722
6770
|
}
|
|
6723
6771
|
}
|
|
6724
|
-
function
|
|
6772
|
+
function Ud() {
|
|
6725
6773
|
return _s({
|
|
6726
6774
|
connectionExpiresAt: null,
|
|
6727
6775
|
event: "disconnected",
|
|
@@ -6729,7 +6777,7 @@ function Cd() {
|
|
|
6729
6777
|
schemaVersion: 1
|
|
6730
6778
|
});
|
|
6731
6779
|
}
|
|
6732
|
-
const ho = "webauthn-prf-hkdf-sha256-aes256gcm-v2",
|
|
6780
|
+
const ho = "webauthn-prf-hkdf-sha256-aes256gcm-v2", Fd = "sdn-bip32-slip10-purpose-v1", Md = "password-scrypt-v2", Bd = Object.freeze([
|
|
6733
6781
|
"aad",
|
|
6734
6782
|
"canonicalUsername",
|
|
6735
6783
|
"ciphertextBase64url",
|
|
@@ -6740,14 +6788,14 @@ const ho = "webauthn-prf-hkdf-sha256-aes256gcm-v2", Ud = "sdn-bip32-slip10-purpo
|
|
|
6740
6788
|
"prfInputBase64url",
|
|
6741
6789
|
"schemaVersion",
|
|
6742
6790
|
"storageProfile"
|
|
6743
|
-
]),
|
|
6791
|
+
]), Vd = Object.freeze([
|
|
6744
6792
|
"credentialIdBase64url",
|
|
6745
6793
|
"identityScheme",
|
|
6746
6794
|
"schemaVersion",
|
|
6747
6795
|
"seedProfile",
|
|
6748
6796
|
"storageProfile",
|
|
6749
6797
|
"usernameSha256"
|
|
6750
|
-
]),
|
|
6798
|
+
]), Hd = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u, zd = /^[0-9a-f]{64}$/u, $d = /^[A-Za-z0-9_-]+$/u, Wd = new TextEncoder(), st = "sdn.wallet.remembered.v2", Bt = `${st}.pending`, ln = 16 * 1024, gs = Object.freeze([
|
|
6751
6799
|
"wallet_storage_metadata",
|
|
6752
6800
|
"wallet_storage_encrypted",
|
|
6753
6801
|
"wallet_storage_passkey_credential",
|
|
@@ -6809,17 +6857,17 @@ function Es(e) {
|
|
|
6809
6857
|
}
|
|
6810
6858
|
function As(e) {
|
|
6811
6859
|
if (!Es(e)) return !1;
|
|
6812
|
-
const r =
|
|
6860
|
+
const r = Wd.encode(e).length;
|
|
6813
6861
|
return r >= 3 && r <= 64 && !/[\u0000-\u001f\u007f-\u009f]/u.test(e) && !/^ | $/u.test(e) && !/[A-Z]/u.test(e);
|
|
6814
6862
|
}
|
|
6815
|
-
function
|
|
6863
|
+
function jd(e) {
|
|
6816
6864
|
let r = "";
|
|
6817
6865
|
for (let t = 0; t < e.length; t += 32768)
|
|
6818
6866
|
r += String.fromCharCode(...e.subarray(t, t + 32768));
|
|
6819
6867
|
return btoa(r).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
|
|
6820
6868
|
}
|
|
6821
6869
|
function Et(e, { minimum: r = 0, maximum: t = 65536, exact: s = null } = {}) {
|
|
6822
|
-
(typeof e != "string" || e.length === 0 ||
|
|
6870
|
+
(typeof e != "string" || e.length === 0 || !$d.test(e)) && me("INVALID_REMEMBERED_WALLET");
|
|
6823
6871
|
const a = e.length % 4;
|
|
6824
6872
|
a === 1 && me("INVALID_REMEMBERED_WALLET");
|
|
6825
6873
|
const d = e.replace(/-/gu, "+").replace(/_/gu, "/") + "=".repeat((4 - a) % 4);
|
|
@@ -6831,12 +6879,12 @@ function Et(e, { minimum: r = 0, maximum: t = 65536, exact: s = null } = {}) {
|
|
|
6831
6879
|
}
|
|
6832
6880
|
const E = new Uint8Array(b.length);
|
|
6833
6881
|
for (let I = 0; I < b.length; I += 1) E[I] = b.charCodeAt(I);
|
|
6834
|
-
return (
|
|
6882
|
+
return (jd(E) !== e || E.length < r || E.length > t || s !== null && E.length !== s) && me("INVALID_REMEMBERED_WALLET"), E;
|
|
6835
6883
|
}
|
|
6836
6884
|
function Ei(e) {
|
|
6837
6885
|
return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e) ? JSON.stringify(e) : (bs(e) || me("INVALID_REMEMBERED_WALLET"), `{${Object.keys(e).sort().map((r) => `${JSON.stringify(r)}:${Ei(e[r])}`).join(",")}}`);
|
|
6838
6886
|
}
|
|
6839
|
-
function
|
|
6887
|
+
function qd(e) {
|
|
6840
6888
|
return Object.freeze({
|
|
6841
6889
|
aad: Object.freeze({ ...e.aad }),
|
|
6842
6890
|
canonicalUsername: e.canonicalUsername,
|
|
@@ -6851,10 +6899,10 @@ function jd(e) {
|
|
|
6851
6899
|
});
|
|
6852
6900
|
}
|
|
6853
6901
|
function ms(e) {
|
|
6854
|
-
const r = uo(e,
|
|
6855
|
-
return (r.schemaVersion !== 2 || r.storageProfile !== ho || t.schemaVersion !== 2 || t.storageProfile !== ho || t.identityScheme !==
|
|
6902
|
+
const r = uo(e, Bd), t = uo(r.aad, Vd);
|
|
6903
|
+
return (r.schemaVersion !== 2 || r.storageProfile !== ho || t.schemaVersion !== 2 || t.storageProfile !== ho || t.identityScheme !== Fd || t.seedProfile !== Md || !As(r.canonicalUsername) || !zd.test(t.usernameSha256) || r.credentialIdBase64url !== t.credentialIdBase64url || !Es(r.createdAt) || !Hd.test(r.createdAt) || new Date(r.createdAt).toISOString() !== r.createdAt) && me("INVALID_REMEMBERED_WALLET"), Et(r.credentialIdBase64url, { minimum: 1, maximum: 1024 }), Et(r.ciphertextBase64url, { minimum: 17, maximum: 1024 }), Et(r.hkdfSaltBase64url, { exact: 32 }), Et(r.nonceBase64url, { exact: 12 }), Et(r.prfInputBase64url, { exact: 32 }), qd({ ...r, aad: t });
|
|
6856
6904
|
}
|
|
6857
|
-
function
|
|
6905
|
+
function Kd(e) {
|
|
6858
6906
|
return Ei(ms(e));
|
|
6859
6907
|
}
|
|
6860
6908
|
function Ai(e) {
|
|
@@ -6915,10 +6963,10 @@ function Is(e) {
|
|
|
6915
6963
|
pending: r
|
|
6916
6964
|
});
|
|
6917
6965
|
}
|
|
6918
|
-
function
|
|
6966
|
+
function Yd(e, r) {
|
|
6919
6967
|
const t = Is(e);
|
|
6920
6968
|
t.canSetup || me("STORAGE_QUARANTINED");
|
|
6921
|
-
const s =
|
|
6969
|
+
const s = Kd(r);
|
|
6922
6970
|
try {
|
|
6923
6971
|
e.setItem(Bt, s);
|
|
6924
6972
|
} catch (b) {
|
|
@@ -6938,7 +6986,7 @@ function Kd(e, r) {
|
|
|
6938
6986
|
});
|
|
6939
6987
|
return ii.add(d), d;
|
|
6940
6988
|
}
|
|
6941
|
-
function
|
|
6989
|
+
function Gd(e, r) {
|
|
6942
6990
|
(!ii.has(r) || r.storage !== e) && me("INVALID_STORAGE_TRANSACTION"), ii.delete(r);
|
|
6943
6991
|
let t, s;
|
|
6944
6992
|
try {
|
|
@@ -6971,7 +7019,7 @@ function mi(e, r) {
|
|
|
6971
7019
|
rawLength: t.length
|
|
6972
7020
|
});
|
|
6973
7021
|
}
|
|
6974
|
-
function
|
|
7022
|
+
function Xd(e) {
|
|
6975
7023
|
return Object.freeze({
|
|
6976
7024
|
exportable: e.exportable,
|
|
6977
7025
|
key: e.key,
|
|
@@ -6979,7 +7027,7 @@ function Gd(e) {
|
|
|
6979
7027
|
rawLength: e.rawLength
|
|
6980
7028
|
});
|
|
6981
7029
|
}
|
|
6982
|
-
function
|
|
7030
|
+
function Jd(e) {
|
|
6983
7031
|
const r = [];
|
|
6984
7032
|
for (const t of [
|
|
6985
7033
|
st,
|
|
@@ -6993,15 +7041,15 @@ function Xd(e) {
|
|
|
6993
7041
|
if (a instanceof Wr && a.code === "NOT_QUARANTINED") continue;
|
|
6994
7042
|
throw a;
|
|
6995
7043
|
}
|
|
6996
|
-
s && r.push(
|
|
7044
|
+
s && r.push(Xd(s));
|
|
6997
7045
|
}
|
|
6998
7046
|
return Object.freeze(r);
|
|
6999
7047
|
}
|
|
7000
|
-
function
|
|
7048
|
+
function Qd(e, r) {
|
|
7001
7049
|
const t = mi(e, r);
|
|
7002
7050
|
return t || me("QUARANTINE_NOT_FOUND"), t.exportable || me("QUARANTINE_EXPORT_TOO_LARGE"), t.raw;
|
|
7003
7051
|
}
|
|
7004
|
-
function
|
|
7052
|
+
function Zd(e, r, t) {
|
|
7005
7053
|
vs.has(r) || me("INVALID_STORAGE_KEY"), t !== r && me("CONFIRMATION_REQUIRED"), mi(e, r) || me("QUARANTINE_NOT_FOUND");
|
|
7006
7054
|
try {
|
|
7007
7055
|
e.removeItem(r), e.getItem(r) !== null && me("STORAGE_WRITE_FAILED");
|
|
@@ -7010,7 +7058,7 @@ function Qd(e, r, t) {
|
|
|
7010
7058
|
me("STORAGE_UNAVAILABLE");
|
|
7011
7059
|
}
|
|
7012
7060
|
}
|
|
7013
|
-
function
|
|
7061
|
+
function e_(e, r) {
|
|
7014
7062
|
r !== st && me("CONFIRMATION_REQUIRED");
|
|
7015
7063
|
const t = oi(e, st);
|
|
7016
7064
|
t.status === "empty" && me("REMEMBER_UNAVAILABLE"), t.status !== "valid" && me("STORAGE_QUARANTINED");
|
|
@@ -7024,7 +7072,7 @@ function Zd(e, r) {
|
|
|
7024
7072
|
const bn = "sdn-bip32-slip10-purpose-v1", En = "password-scrypt-v2", si = "m/44'/0'/0'/2'/0'", Ii = "Approval unavailable — migrate to the new wallet profile", fo = Object.freeze({
|
|
7025
7073
|
"bip39-mnemonic-v1-legacy": "sdn-bip39-auth-v1-legacy",
|
|
7026
7074
|
"password-fast-v1-legacy": "sdn-fast-password-auth-v1-legacy"
|
|
7027
|
-
}), po = new TextEncoder(),
|
|
7075
|
+
}), po = new TextEncoder(), t_ = Uint8Array.prototype.fill, wi = Object.freeze([
|
|
7028
7076
|
"accountFingerprint",
|
|
7029
7077
|
"accountIndex",
|
|
7030
7078
|
"accountLabel",
|
|
@@ -7077,7 +7125,7 @@ function Fe(e) {
|
|
|
7077
7125
|
function yo(e) {
|
|
7078
7126
|
if (e instanceof Uint8Array)
|
|
7079
7127
|
try {
|
|
7080
|
-
|
|
7128
|
+
t_.call(e, 0);
|
|
7081
7129
|
} catch {
|
|
7082
7130
|
}
|
|
7083
7131
|
}
|
|
@@ -7088,13 +7136,13 @@ function Jt(e) {
|
|
|
7088
7136
|
for (const t of Object.keys(e).sort()) r[t] = Jt(e[t]);
|
|
7089
7137
|
return Object.freeze(r);
|
|
7090
7138
|
}
|
|
7091
|
-
function
|
|
7139
|
+
function r_(e) {
|
|
7092
7140
|
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
7093
7141
|
const r = Object.getPrototypeOf(e);
|
|
7094
7142
|
return r === Object.prototype || r === null;
|
|
7095
7143
|
}
|
|
7096
7144
|
function mn(e, r) {
|
|
7097
|
-
|
|
7145
|
+
r_(e) || Fe("INVALID_PUBLIC_IDENTITY");
|
|
7098
7146
|
let t;
|
|
7099
7147
|
try {
|
|
7100
7148
|
t = Reflect.ownKeys(e);
|
|
@@ -7127,7 +7175,7 @@ function sr(e) {
|
|
|
7127
7175
|
}
|
|
7128
7176
|
return !0;
|
|
7129
7177
|
}
|
|
7130
|
-
function
|
|
7178
|
+
function n_(e) {
|
|
7131
7179
|
if (!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length !== An.length) return !1;
|
|
7132
7180
|
let r;
|
|
7133
7181
|
try {
|
|
@@ -7143,7 +7191,7 @@ function r_(e) {
|
|
|
7143
7191
|
}
|
|
7144
7192
|
return !0;
|
|
7145
7193
|
}
|
|
7146
|
-
function
|
|
7194
|
+
function i_(e) {
|
|
7147
7195
|
if (!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length !== 1) return !1;
|
|
7148
7196
|
let r;
|
|
7149
7197
|
try {
|
|
@@ -7157,18 +7205,18 @@ function n_(e) {
|
|
|
7157
7205
|
}
|
|
7158
7206
|
function ft(e) {
|
|
7159
7207
|
const r = mn(e, wi);
|
|
7160
|
-
(r.schemaVersion !== 1 || r.identityScheme !== bn || r.seedProfile !== En || r.accountIndex !== 0 || r.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(r.accountFingerprint) || !sr(r.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(r.accountXpub) || !sr(r.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(r.accountPeerId) || !
|
|
7208
|
+
(r.schemaVersion !== 1 || r.identityScheme !== bn || r.seedProfile !== En || r.accountIndex !== 0 || r.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(r.accountFingerprint) || !sr(r.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(r.accountXpub) || !sr(r.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(r.accountPeerId) || !n_(r.keys)) && Fe("INVALID_PUBLIC_IDENTITY");
|
|
7161
7209
|
const t = An.map((s, a) => {
|
|
7162
7210
|
const d = mn(r.keys[a], Si);
|
|
7163
7211
|
return (d.bip32Fingerprint !== null || d.curve !== s.curve || d.derivation !== "slip10" || d.encoding !== "raw" || d.identityScheme !== bn || d.path !== s.path || d.purpose !== s.purpose || d.seedProfile !== En || d.signatureProfile !== s.signatureProfile || !/^[0-9a-f]{64}$/u.test(d.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(d.keyId)) && Fe("INVALID_PUBLIC_IDENTITY"), Jt(d);
|
|
7164
7212
|
});
|
|
7165
7213
|
return Jt({ ...r, keys: t });
|
|
7166
7214
|
}
|
|
7167
|
-
function
|
|
7215
|
+
function o_(e, { accountIndex: r = 0, profile: t } = {}) {
|
|
7168
7216
|
const s = Object.hasOwn(fo, t) ? fo[t] : null;
|
|
7169
7217
|
(!s || r !== 0) && Fe("INVALID_LEGACY_PROFILE");
|
|
7170
7218
|
const a = mn(e, wi);
|
|
7171
|
-
(a.schemaVersion !== 1 || a.identityScheme !== s || a.seedProfile !== t || a.accountIndex !== r || a.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(a.accountFingerprint) || !sr(a.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(a.accountXpub) || !sr(a.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(a.accountPeerId) || !
|
|
7219
|
+
(a.schemaVersion !== 1 || a.identityScheme !== s || a.seedProfile !== t || a.accountIndex !== r || a.accountLabel !== null || !/^[0-9a-f]{8}$/u.test(a.accountFingerprint) || !sr(a.accountXpub) || !/^xpub[1-9A-HJ-NP-Za-km-z]{107}$/u.test(a.accountXpub) || !sr(a.accountPeerId) || !/^16Uiu2H[1-9A-HJ-NP-Za-km-z]{33,57}$/u.test(a.accountPeerId) || !i_(a.keys)) && Fe("INVALID_PUBLIC_IDENTITY");
|
|
7172
7220
|
const d = mn(a.keys[0], Si);
|
|
7173
7221
|
return (d.bip32Fingerprint !== null || d.curve !== "ed25519" || d.derivation !== "bip32-scalar-as-ed25519-seed" || d.encoding !== "raw" || d.identityScheme !== s || d.path !== `m/44'/0'/${r}'/0/0` || d.purpose !== "sdn-authentication" || d.seedProfile !== t || d.signatureProfile !== "ed25519-raw-32-v1" || !/^[0-9a-f]{64}$/u.test(d.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(d.keyId)) && Fe("INVALID_PUBLIC_IDENTITY"), Jt({ ...a, keys: [d] });
|
|
7174
7222
|
}
|
|
@@ -7218,7 +7266,7 @@ function vo(e, r) {
|
|
|
7218
7266
|
}
|
|
7219
7267
|
return s === 0;
|
|
7220
7268
|
}
|
|
7221
|
-
function
|
|
7269
|
+
function s_(e) {
|
|
7222
7270
|
return !e || typeof e != "object" || !Array.isArray(e.keys) ? null : e.keys.find((r) => r?.purpose === "asset-review-approval") ?? null;
|
|
7223
7271
|
}
|
|
7224
7272
|
function $n(e, r) {
|
|
@@ -7248,7 +7296,7 @@ function nr(e, r, t, s) {
|
|
|
7248
7296
|
}
|
|
7249
7297
|
function Ss(e) {
|
|
7250
7298
|
(e?.identityScheme !== bn || e?.seedProfile !== En || e?.accountIndex !== 0) && Fe("APPROVAL_UNAVAILABLE");
|
|
7251
|
-
const r =
|
|
7299
|
+
const r = s_(e);
|
|
7252
7300
|
return (!r || r.identityScheme !== e.identityScheme || r.seedProfile !== e.seedProfile || r.signatureProfile !== "ed25519-over-sha256-jcs-v1" || r.curve !== "ed25519" || r.derivation !== "slip10" || r.path !== si || r.encoding !== "raw" || !/^[0-9a-f]{64}$/u.test(r.publicKeyHex) || !/^sha256:[0-9a-f]{64}$/u.test(r.keyId)) && Fe("APPROVAL_UNAVAILABLE"), Jt({
|
|
7253
7301
|
algorithm: "Ed25519",
|
|
7254
7302
|
derivationPath: si,
|
|
@@ -7262,10 +7310,10 @@ function Ss(e) {
|
|
|
7262
7310
|
signatureProfile: "ed25519-over-sha256-jcs-v1"
|
|
7263
7311
|
});
|
|
7264
7312
|
}
|
|
7265
|
-
function
|
|
7313
|
+
function a_(e) {
|
|
7266
7314
|
return JSON.stringify(e, null, 2);
|
|
7267
7315
|
}
|
|
7268
|
-
function
|
|
7316
|
+
function c_(e, r, { document: t = e.ownerDocument } = {}) {
|
|
7269
7317
|
e.replaceChildren();
|
|
7270
7318
|
const s = t.createElement("h1");
|
|
7271
7319
|
if (s.textContent = "Account", e.append(s), nr(t, e, "Username / account", r?.accountLabel ?? "account 0"), nr(t, e, "Account xpub", r?.accountXpub), nr(t, e, "Peer ID", r?.accountPeerId), nr(t, e, "Fingerprint", r?.accountFingerprint), r?.identityScheme !== bn || r?.seedProfile !== En) {
|
|
@@ -7275,7 +7323,7 @@ function a_(e, r, { document: t = e.ownerDocument } = {}) {
|
|
|
7275
7323
|
const a = Ss(r);
|
|
7276
7324
|
return nr(t, e, "Asset approval public key", a.publicKeyHex), nr(t, e, "Asset approval key ID", a.keyId), Object.freeze({ approvalAvailable: !0, configuration: a });
|
|
7277
7325
|
}
|
|
7278
|
-
function
|
|
7326
|
+
function l_(e, { document: r = e.ownerDocument } = {}) {
|
|
7279
7327
|
e.replaceChildren();
|
|
7280
7328
|
const t = r.createElement("h2");
|
|
7281
7329
|
t.textContent = "Stored wallet";
|
|
@@ -7304,7 +7352,7 @@ function c_(e, { document: r = e.ownerDocument } = {}) {
|
|
|
7304
7352
|
status: w
|
|
7305
7353
|
});
|
|
7306
7354
|
}
|
|
7307
|
-
function
|
|
7355
|
+
function d_(e, r, { document: t = e.ownerDocument } = {}) {
|
|
7308
7356
|
e.replaceChildren();
|
|
7309
7357
|
const s = t.createElement("h2");
|
|
7310
7358
|
s.textContent = "Quarantined wallet storage";
|
|
@@ -7345,14 +7393,14 @@ function l_(e, r, { document: t = e.ownerDocument } = {}) {
|
|
|
7345
7393
|
}
|
|
7346
7394
|
return e.append(s, a, d, b), Object.freeze({ rows: Object.freeze(E), status: b });
|
|
7347
7395
|
}
|
|
7348
|
-
async function
|
|
7396
|
+
async function __(e, {
|
|
7349
7397
|
assertCurrent: r = () => {
|
|
7350
7398
|
},
|
|
7351
7399
|
clipboard: t = globalThis.navigator?.clipboard,
|
|
7352
7400
|
container: s,
|
|
7353
7401
|
document: a = s?.ownerDocument
|
|
7354
7402
|
}) {
|
|
7355
|
-
const d =
|
|
7403
|
+
const d = a_(e);
|
|
7356
7404
|
let b = !1;
|
|
7357
7405
|
try {
|
|
7358
7406
|
if (!t?.writeText) throw new Error("clipboard unavailable");
|
|
@@ -7412,7 +7460,7 @@ async function bo(e, r, t, {
|
|
|
7412
7460
|
b(w), b(m);
|
|
7413
7461
|
}
|
|
7414
7462
|
}
|
|
7415
|
-
class
|
|
7463
|
+
class h_ {
|
|
7416
7464
|
#r = null;
|
|
7417
7465
|
#c;
|
|
7418
7466
|
#_ = !1;
|
|
@@ -7488,7 +7536,7 @@ class __ {
|
|
|
7488
7536
|
for (const t of r) yo(t);
|
|
7489
7537
|
}
|
|
7490
7538
|
}
|
|
7491
|
-
async function
|
|
7539
|
+
async function u_({
|
|
7492
7540
|
wasm: e,
|
|
7493
7541
|
profile: r,
|
|
7494
7542
|
operation: t,
|
|
@@ -7508,7 +7556,7 @@ async function h_({
|
|
|
7508
7556
|
legacy: !0
|
|
7509
7557
|
});
|
|
7510
7558
|
}
|
|
7511
|
-
function
|
|
7559
|
+
function f_(e, { document: r = e.ownerDocument } = {}) {
|
|
7512
7560
|
e.replaceChildren();
|
|
7513
7561
|
const t = r.createElement("h2");
|
|
7514
7562
|
t.textContent = "Migrate legacy wallet";
|
|
@@ -7528,37 +7576,37 @@ function u_(e, { document: r = e.ownerDocument } = {}) {
|
|
|
7528
7576
|
const b = r.createElement("div");
|
|
7529
7577
|
return b.className = "wallet-legacy-comparison", e.append(t, s, a, d, b), Object.freeze({ launch: d, result: b, select: a });
|
|
7530
7578
|
}
|
|
7531
|
-
const In = Uint8Array, ks = ArrayBuffer, ki = Object.getPrototypeOf(In.prototype),
|
|
7532
|
-
class
|
|
7579
|
+
const In = Uint8Array, ks = ArrayBuffer, ki = Object.getPrototypeOf(In.prototype), p_ = Object.getOwnPropertyDescriptor(ki, "buffer").get, y_ = Object.getOwnPropertyDescriptor(ki, "byteLength").get, g_ = Object.getOwnPropertyDescriptor(ki, "byteOffset").get, v_ = Object.getOwnPropertyDescriptor(ks.prototype, "byteLength").get;
|
|
7580
|
+
class b_ extends Error {
|
|
7533
7581
|
constructor(r = "RNG_FAILURE") {
|
|
7534
7582
|
super(r), this.name = "WalletRandomError", this.code = r;
|
|
7535
7583
|
}
|
|
7536
7584
|
}
|
|
7537
7585
|
function Ft() {
|
|
7538
|
-
throw new
|
|
7586
|
+
throw new b_();
|
|
7539
7587
|
}
|
|
7540
|
-
function
|
|
7588
|
+
function E_(e) {
|
|
7541
7589
|
if (!(e instanceof In) || Object.getPrototypeOf(e) !== In.prototype) return null;
|
|
7542
7590
|
let r, t, s;
|
|
7543
7591
|
try {
|
|
7544
|
-
r = Reflect.apply(
|
|
7592
|
+
r = Reflect.apply(p_, e, []), t = Reflect.apply(y_, e, []), s = Reflect.apply(g_, e, []);
|
|
7545
7593
|
} catch {
|
|
7546
7594
|
return null;
|
|
7547
7595
|
}
|
|
7548
7596
|
let a;
|
|
7549
7597
|
try {
|
|
7550
|
-
a = Reflect.apply(
|
|
7598
|
+
a = Reflect.apply(v_, r, []);
|
|
7551
7599
|
} catch {
|
|
7552
7600
|
return null;
|
|
7553
7601
|
}
|
|
7554
7602
|
return Object.getPrototypeOf(r) !== ks.prototype || s !== 0 || t !== a || t !== 12 && t !== 32 ? null : r;
|
|
7555
7603
|
}
|
|
7556
|
-
function
|
|
7604
|
+
function A_({ getRandomValues: e, observedWrite: r } = {}) {
|
|
7557
7605
|
if (typeof e != "function")
|
|
7558
7606
|
return () => Ft();
|
|
7559
7607
|
const t = /* @__PURE__ */ new WeakSet(), s = /* @__PURE__ */ new WeakSet();
|
|
7560
7608
|
return function(d) {
|
|
7561
|
-
const b =
|
|
7609
|
+
const b = E_(d);
|
|
7562
7610
|
(!b || t.has(d) || s.has(b)) && Ft(), t.add(d), s.add(b);
|
|
7563
7611
|
let E;
|
|
7564
7612
|
try {
|
|
@@ -7584,21 +7632,21 @@ function ir(e, r) {
|
|
|
7584
7632
|
const t = new In(r);
|
|
7585
7633
|
return e(t);
|
|
7586
7634
|
}
|
|
7587
|
-
const dn = new TextEncoder(),
|
|
7588
|
-
class
|
|
7635
|
+
const dn = new TextEncoder(), m_ = new TextDecoder("utf-8", { fatal: !0 }), I_ = Uint8Array.prototype.fill, w_ = Uint8Array.prototype.slice, S_ = Uint8Array.prototype.subarray, Oi = Object.getPrototypeOf(Uint8Array.prototype), k_ = Object.getOwnPropertyDescriptor(Oi, "buffer").get, Os = Object.getOwnPropertyDescriptor(Oi, "byteLength").get, O_ = Object.getOwnPropertyDescriptor(Oi, "byteOffset").get, Ps = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get, P_ = ArrayBuffer.prototype.slice, Eo = "webauthn-prf-hkdf-sha256-aes256gcm-v2", R_ = "sdn-bip32-slip10-purpose-v1", N_ = "password-scrypt-v2", L_ = "Space Data Network Wallet", Rs = 12e4;
|
|
7636
|
+
class T_ extends Error {
|
|
7589
7637
|
constructor(r) {
|
|
7590
7638
|
super(r), this.name = "RememberedWalletError", this.code = r;
|
|
7591
7639
|
}
|
|
7592
7640
|
}
|
|
7593
7641
|
function we(e) {
|
|
7594
|
-
throw new
|
|
7642
|
+
throw new T_(e);
|
|
7595
7643
|
}
|
|
7596
7644
|
function Ao(e) {
|
|
7597
7645
|
if (typeof e != "string") return "";
|
|
7598
7646
|
const r = e.trim().toLowerCase();
|
|
7599
7647
|
return r.endsWith(".") ? r.slice(0, -1) : r;
|
|
7600
7648
|
}
|
|
7601
|
-
function
|
|
7649
|
+
function x_(e, r) {
|
|
7602
7650
|
if (e == null || e === "") return;
|
|
7603
7651
|
const t = Ao(e);
|
|
7604
7652
|
t === "" && we("INVALID_RP_ID");
|
|
@@ -7609,7 +7657,7 @@ function T_(e, r) {
|
|
|
7609
7657
|
function Ne(e) {
|
|
7610
7658
|
if (e instanceof Uint8Array)
|
|
7611
7659
|
try {
|
|
7612
|
-
|
|
7660
|
+
I_.call(e, 0);
|
|
7613
7661
|
} catch {
|
|
7614
7662
|
}
|
|
7615
7663
|
}
|
|
@@ -7651,7 +7699,7 @@ function _n(e, r = null) {
|
|
|
7651
7699
|
return !1;
|
|
7652
7700
|
let t, s, a, d;
|
|
7653
7701
|
try {
|
|
7654
|
-
t = Reflect.apply(
|
|
7702
|
+
t = Reflect.apply(k_, e, []), s = Reflect.apply(Os, e, []), a = Reflect.apply(O_, e, []), d = Reflect.apply(Ps, t, []);
|
|
7655
7703
|
} catch {
|
|
7656
7704
|
return !1;
|
|
7657
7705
|
}
|
|
@@ -7681,13 +7729,13 @@ function Ar(e) {
|
|
|
7681
7729
|
t < 0 && we("INVALID_REMEMBERED_WALLET");
|
|
7682
7730
|
for (let s = 0; s < t; s += 32768)
|
|
7683
7731
|
r += String.fromCharCode(...Reflect.apply(
|
|
7684
|
-
|
|
7732
|
+
S_,
|
|
7685
7733
|
e,
|
|
7686
7734
|
[s, s + 32768]
|
|
7687
7735
|
));
|
|
7688
7736
|
return btoa(r).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
|
|
7689
7737
|
}
|
|
7690
|
-
function
|
|
7738
|
+
function D_(e) {
|
|
7691
7739
|
let r = "";
|
|
7692
7740
|
for (const t of e) r += t.toString(16).padStart(2, "0");
|
|
7693
7741
|
return r;
|
|
@@ -7695,7 +7743,7 @@ function x_(e) {
|
|
|
7695
7743
|
function ar(e) {
|
|
7696
7744
|
return e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e) ? JSON.stringify(e) : Array.isArray(e) ? `[${e.map(ar).join(",")}]` : (wn(e) || we("INVALID_REMEMBERED_WALLET"), `{${Object.keys(e).sort().map((r) => `${JSON.stringify(r)}:${ar(e[r])}`).join(",")}}`);
|
|
7697
7745
|
}
|
|
7698
|
-
function
|
|
7746
|
+
function C_(e, r) {
|
|
7699
7747
|
if (!(e instanceof Uint8Array) || !(r instanceof Uint8Array)) return !1;
|
|
7700
7748
|
const t = Gt(e), s = Gt(r);
|
|
7701
7749
|
if (t < 0 || s < 0) return !1;
|
|
@@ -7705,7 +7753,7 @@ function D_(e, r) {
|
|
|
7705
7753
|
d |= (e[b] ?? 0) ^ (r[b] ?? 0);
|
|
7706
7754
|
return d === 0;
|
|
7707
7755
|
}
|
|
7708
|
-
function
|
|
7756
|
+
function U_(e, r) {
|
|
7709
7757
|
return ar(e) === ar(r);
|
|
7710
7758
|
}
|
|
7711
7759
|
function Ts(e) {
|
|
@@ -7717,7 +7765,7 @@ function Ts(e) {
|
|
|
7717
7765
|
we("WEBAUTHN_INVALID_RESPONSE");
|
|
7718
7766
|
}
|
|
7719
7767
|
return (r !== "public-key" || !Ls(t, 1, 1024) || typeof s != "function") && we("WEBAUTHN_INVALID_RESPONSE"), Object.freeze({
|
|
7720
|
-
rawId: new Uint8Array(Reflect.apply(
|
|
7768
|
+
rawId: new Uint8Array(Reflect.apply(P_, t, [0])),
|
|
7721
7769
|
readExtensionResults() {
|
|
7722
7770
|
try {
|
|
7723
7771
|
return Reflect.apply(s, e, []);
|
|
@@ -7727,19 +7775,19 @@ function Ts(e) {
|
|
|
7727
7775
|
}
|
|
7728
7776
|
});
|
|
7729
7777
|
}
|
|
7730
|
-
function
|
|
7778
|
+
function F_(e) {
|
|
7731
7779
|
const r = Br(e.readExtensionResults(), ["prf"]), t = r ? Br(r.prf, ["enabled"]) : null;
|
|
7732
7780
|
(!t || t.enabled !== !0) && we("WEBAUTHN_PRF_REQUIRED");
|
|
7733
7781
|
}
|
|
7734
|
-
function
|
|
7782
|
+
function M_(e, r) {
|
|
7735
7783
|
const t = Ts(e), s = t.rawId;
|
|
7736
|
-
|
|
7784
|
+
C_(s, r) || (Ne(s), we("WEBAUTHN_CREDENTIAL_MISMATCH")), Ne(s);
|
|
7737
7785
|
const a = Br(t.readExtensionResults(), ["prf"]), d = a ? Br(a.prf, ["results"]) : null, E = (d ? Br(d.results, ["first"]) : null)?.first;
|
|
7738
7786
|
Ls(E, 32, 32) || we("WEBAUTHN_PRF_REQUIRED");
|
|
7739
|
-
const I = new Uint8Array(E), P = Reflect.apply(
|
|
7787
|
+
const I = new Uint8Array(E), P = Reflect.apply(w_, I, []);
|
|
7740
7788
|
return Ne(I), P;
|
|
7741
7789
|
}
|
|
7742
|
-
function
|
|
7790
|
+
function B_({ challenge: e, credentialId: r, prfInput: t, rpId: s, signal: a }) {
|
|
7743
7791
|
return {
|
|
7744
7792
|
publicKey: {
|
|
7745
7793
|
allowCredentials: [{
|
|
@@ -7759,7 +7807,7 @@ async function mo({ assertCurrent: e, credentials: r, credentialId: t, fillRando
|
|
|
7759
7807
|
const E = ir(s, 32);
|
|
7760
7808
|
let I;
|
|
7761
7809
|
try {
|
|
7762
|
-
I = await r.get(
|
|
7810
|
+
I = await r.get(B_({
|
|
7763
7811
|
challenge: E,
|
|
7764
7812
|
credentialId: t,
|
|
7765
7813
|
prfInput: a,
|
|
@@ -7771,9 +7819,9 @@ async function mo({ assertCurrent: e, credentials: r, credentialId: t, fillRando
|
|
|
7771
7819
|
} finally {
|
|
7772
7820
|
Ne(E);
|
|
7773
7821
|
}
|
|
7774
|
-
return e(),
|
|
7822
|
+
return e(), M_(I, t);
|
|
7775
7823
|
}
|
|
7776
|
-
function
|
|
7824
|
+
function V_(e) {
|
|
7777
7825
|
if (typeof e != "string") return !1;
|
|
7778
7826
|
for (let r = 0; r < e.length; r += 1) {
|
|
7779
7827
|
const t = e.charCodeAt(r);
|
|
@@ -7785,21 +7833,21 @@ function B_(e) {
|
|
|
7785
7833
|
}
|
|
7786
7834
|
return !0;
|
|
7787
7835
|
}
|
|
7788
|
-
function
|
|
7836
|
+
function H_(e) {
|
|
7789
7837
|
if (typeof e == "string")
|
|
7790
|
-
return
|
|
7838
|
+
return V_(e) || we("INVALID_USERNAME"), dn.encode(e).length > 256 && we("INVALID_USERNAME"), e;
|
|
7791
7839
|
(!_n(e) || Gt(e) > 256) && we("INVALID_USERNAME");
|
|
7792
7840
|
try {
|
|
7793
|
-
return
|
|
7841
|
+
return m_.decode(e);
|
|
7794
7842
|
} catch {
|
|
7795
7843
|
we("INVALID_USERNAME");
|
|
7796
7844
|
}
|
|
7797
7845
|
}
|
|
7798
7846
|
function ai(e) {
|
|
7799
|
-
const r =
|
|
7847
|
+
const r = H_(e).replace(/^ +/u, "").replace(/ +$/u, "").replace(/[A-Z]/gu, (t) => t.toLowerCase());
|
|
7800
7848
|
return As(r) || we("INVALID_USERNAME"), r;
|
|
7801
7849
|
}
|
|
7802
|
-
function
|
|
7850
|
+
function z_(e) {
|
|
7803
7851
|
let r;
|
|
7804
7852
|
try {
|
|
7805
7853
|
r = Yo(e?.module);
|
|
@@ -7808,15 +7856,15 @@ function H_(e) {
|
|
|
7808
7856
|
}
|
|
7809
7857
|
return (!Ns(r, ["sdn", "sha256"]) || typeof r.sha256 != "function" || !r.sdn || typeof r.sdn != "object") && we("WASM_UNAVAILABLE"), r;
|
|
7810
7858
|
}
|
|
7811
|
-
function
|
|
7812
|
-
const r =
|
|
7859
|
+
function $_(e) {
|
|
7860
|
+
const r = z_(e), t = r.sdn, s = e?.storage, a = e?.credentials, d = A_(e?.rng), b = e?.createRequestController, E = e?.releaseRequestController, I = e?.ownHandle, P = e?.destroyHandle, w = e?.ownedHandlesClean, m = e?.now ?? (() => /* @__PURE__ */ new Date()), N = e?.rpHostname ?? e?.window?.location?.hostname ?? globalThis?.location?.hostname, L = x_(e?.rpId, N), D = typeof e?.rpName == "string" && e.rpName !== "" ? e.rpName : L_, U = () => typeof a?.create == "function" && typeof a?.get == "function", M = () => Is(s), C = () => Jd(s), B = (v) => Qd(s, v), Y = (v, k) => (Zd(s, v, k), C().some((R) => R.key === v) && we("STORAGE_WRITE_FAILED"), !0), _ = () => M().active.status === "valid", f = ({ confirmation: v } = {}) => (_() || we("REMEMBER_UNAVAILABLE"), e_(s, v), M().active.status !== "empty" && we("STORAGE_WRITE_FAILED"), !0), h = async (v) => {
|
|
7813
7861
|
let k;
|
|
7814
7862
|
try {
|
|
7815
7863
|
k = await r.sha256(dn.encode(v));
|
|
7816
7864
|
} catch {
|
|
7817
7865
|
we("WASM_FAILURE");
|
|
7818
7866
|
}
|
|
7819
|
-
return _n(k, 32) || we("WASM_FAILURE"),
|
|
7867
|
+
return _n(k, 32) || we("WASM_FAILURE"), D_(k);
|
|
7820
7868
|
};
|
|
7821
7869
|
return Object.freeze({
|
|
7822
7870
|
canForget: _,
|
|
@@ -7911,7 +7959,7 @@ function z_(e) {
|
|
|
7911
7959
|
}
|
|
7912
7960
|
v();
|
|
7913
7961
|
const Vt = Ts(It);
|
|
7914
|
-
ue = Vt.rawId,
|
|
7962
|
+
ue = Vt.rawId, F_(Vt), Ee = await mo({
|
|
7915
7963
|
assertCurrent: v,
|
|
7916
7964
|
credentialId: ue,
|
|
7917
7965
|
credentials: a,
|
|
@@ -7924,9 +7972,9 @@ function z_(e) {
|
|
|
7924
7972
|
v();
|
|
7925
7973
|
const Dt = Ar(ue), Ht = Object.freeze({
|
|
7926
7974
|
credentialIdBase64url: Dt,
|
|
7927
|
-
identityScheme:
|
|
7975
|
+
identityScheme: R_,
|
|
7928
7976
|
schemaVersion: 2,
|
|
7929
|
-
seedProfile:
|
|
7977
|
+
seedProfile: N_,
|
|
7930
7978
|
storageProfile: Eo,
|
|
7931
7979
|
usernameSha256: at
|
|
7932
7980
|
}), wt = ar(Ht);
|
|
@@ -7964,7 +8012,7 @@ function z_(e) {
|
|
|
7964
8012
|
schemaVersion: 2,
|
|
7965
8013
|
storageProfile: Eo
|
|
7966
8014
|
});
|
|
7967
|
-
v(), mt =
|
|
8015
|
+
v(), mt = Yd(s, kt);
|
|
7968
8016
|
let Ot;
|
|
7969
8017
|
const Xe = Ce;
|
|
7970
8018
|
try {
|
|
@@ -7981,7 +8029,7 @@ function z_(e) {
|
|
|
7981
8029
|
}
|
|
7982
8030
|
wn(Ot) || we("WASM_FAILURE"), Pe = Ot.handle, (Pe == null || typeof I != "function") && we("WASM_FAILURE"), I(Pe);
|
|
7983
8031
|
const Zt = ft(Ot.identity);
|
|
7984
|
-
return
|
|
8032
|
+
return U_(Z, Zt) || we("IDENTITY_MISMATCH"), v(), (typeof P != "function" || !P(Pe)) && we("DESTRUCTION_FAILED"), Pe = null, (typeof w != "function" || !w(R)) && we("DESTRUCTION_FAILED"), v(), Gd(s, mt), mt = null, Object.freeze({ remembered: !0 });
|
|
7985
8033
|
} finally {
|
|
7986
8034
|
Pe !== null && typeof P == "function" && P(Pe), Ne(V), Ne(oe), Ne(pe), Ne(Ee), Ne(Re), Ne(Ce), Ne(Q), Ne(ie), Ne(ue), typeof E == "function" && E(ae);
|
|
7987
8035
|
}
|
|
@@ -7992,7 +8040,7 @@ function z_(e) {
|
|
|
7992
8040
|
supported: U
|
|
7993
8041
|
});
|
|
7994
8042
|
}
|
|
7995
|
-
const Vr = /^[0-9a-f]{64}$/u,
|
|
8043
|
+
const Vr = /^[0-9a-f]{64}$/u, W_ = /^[A-Za-z0-9_-]{43}$/u, j_ = Object.freeze([
|
|
7996
8044
|
"callbackUri",
|
|
7997
8045
|
"clientDisplayName",
|
|
7998
8046
|
"clientId",
|
|
@@ -8006,7 +8054,7 @@ const Vr = /^[0-9a-f]{64}$/u, $_ = /^[A-Za-z0-9_-]{43}$/u, W_ = Object.freeze([
|
|
|
8006
8054
|
"schemaVersion",
|
|
8007
8055
|
"state",
|
|
8008
8056
|
"transactionId"
|
|
8009
|
-
]),
|
|
8057
|
+
]), q_ = Object.freeze(["redirectUri", "schemaVersion", "transactionId"]), K_ = 64 * 1024, Y_ = 4 * 1024, G_ = new TextEncoder(), X_ = new TextDecoder("utf-8", { fatal: !0 });
|
|
8010
8058
|
class Sn extends Error {
|
|
8011
8059
|
constructor() {
|
|
8012
8060
|
super("RELAY_FAILURE"), this.name = "WalletRelayError", this.code = "RELAY_FAILURE";
|
|
@@ -8049,8 +8097,8 @@ function ci(e) {
|
|
|
8049
8097
|
for (const t of Object.keys(e).sort()) r[t] = ci(e[t]);
|
|
8050
8098
|
return Object.freeze(r);
|
|
8051
8099
|
}
|
|
8052
|
-
function
|
|
8053
|
-
(typeof e != "string" ||
|
|
8100
|
+
function J_(e, r) {
|
|
8101
|
+
(typeof e != "string" || G_.encode(e).byteLength > r || e.charCodeAt(0) === 65279) && Oe();
|
|
8054
8102
|
let t = 0, s = 0;
|
|
8055
8103
|
const a = () => {
|
|
8056
8104
|
for (; t < e.length && /[\u0009\u000a\u000d\u0020]/u.test(e[t]); ) t += 1;
|
|
@@ -8175,7 +8223,7 @@ function Us(e, r, t = null) {
|
|
|
8175
8223
|
);
|
|
8176
8224
|
}) : s;
|
|
8177
8225
|
}
|
|
8178
|
-
async function
|
|
8226
|
+
async function Q_(e, r, t, s) {
|
|
8179
8227
|
let a = null;
|
|
8180
8228
|
try {
|
|
8181
8229
|
(!e || e.status !== r || 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") && Oe(), a = e.body.getReader(), (!a || typeof a.read != "function" || s?.aborted === !0) && Oe();
|
|
@@ -8191,7 +8239,7 @@ async function J_(e, r, t, s) {
|
|
|
8191
8239
|
let I = 0;
|
|
8192
8240
|
for (const P of d)
|
|
8193
8241
|
E.set(P, I), I += P.byteLength;
|
|
8194
|
-
return X_
|
|
8242
|
+
return J_(X_.decode(E), t);
|
|
8195
8243
|
} catch (d) {
|
|
8196
8244
|
if (Cs(e, a), d instanceof Sn) throw d;
|
|
8197
8245
|
Oe();
|
|
@@ -8203,10 +8251,10 @@ async function J_(e, r, t, s) {
|
|
|
8203
8251
|
}
|
|
8204
8252
|
}
|
|
8205
8253
|
function wo(e, r) {
|
|
8206
|
-
return Ds(e,
|
|
8254
|
+
return Ds(e, j_), (e.schemaVersion !== 1 || e.transactionId !== r || !Vr.test(e.transactionId) || !Vr.test(e.state) || !Vr.test(e.requestSha256) || !W_.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") && Oe(), ci(e);
|
|
8207
8255
|
}
|
|
8208
8256
|
function li(e, r) {
|
|
8209
|
-
Ds(r,
|
|
8257
|
+
Ds(r, q_), (r.schemaVersion !== 1 || r.transactionId !== e.transactionId || typeof r.redirectUri != "string") && Oe();
|
|
8210
8258
|
const t = `${e.callbackUri}#code=`, s = `&state=${e.state}`;
|
|
8211
8259
|
(!r.redirectUri.startsWith(t) || !r.redirectUri.endsWith(s)) && Oe();
|
|
8212
8260
|
const a = r.redirectUri.slice(t.length, r.redirectUri.length - s.length);
|
|
@@ -8229,7 +8277,7 @@ function So(e, r, t = void 0) {
|
|
|
8229
8277
|
};
|
|
8230
8278
|
return t !== void 0 && (s.body = JSON.stringify(t)), s;
|
|
8231
8279
|
}
|
|
8232
|
-
function
|
|
8280
|
+
function Z_({ fetch: e, location: r }) {
|
|
8233
8281
|
(typeof e != "function" || typeof r?.replace != "function") && Oe();
|
|
8234
8282
|
const t = /* @__PURE__ */ new Set(), s = async (a, d, b, E) => {
|
|
8235
8283
|
let I;
|
|
@@ -8238,7 +8286,7 @@ function Q_({ fetch: e, location: r }) {
|
|
|
8238
8286
|
} catch {
|
|
8239
8287
|
Oe();
|
|
8240
8288
|
}
|
|
8241
|
-
return
|
|
8289
|
+
return Q_(I, b, E, d.signal);
|
|
8242
8290
|
};
|
|
8243
8291
|
return Object.freeze({
|
|
8244
8292
|
async fetchTransaction(a, { signal: d } = {}) {
|
|
@@ -8247,7 +8295,7 @@ function Q_({ fetch: e, location: r }) {
|
|
|
8247
8295
|
`/relay/v1/transactions/${a}`,
|
|
8248
8296
|
So("GET", d),
|
|
8249
8297
|
200,
|
|
8250
|
-
|
|
8298
|
+
K_
|
|
8251
8299
|
);
|
|
8252
8300
|
return wo(b, a);
|
|
8253
8301
|
},
|
|
@@ -8261,7 +8309,7 @@ function Q_({ fetch: e, location: r }) {
|
|
|
8261
8309
|
transactionId: E.transactionId
|
|
8262
8310
|
}),
|
|
8263
8311
|
201,
|
|
8264
|
-
|
|
8312
|
+
Y_
|
|
8265
8313
|
), P = li(E, I);
|
|
8266
8314
|
return t.clear(), t.add(P.redirectUri), P;
|
|
8267
8315
|
},
|
|
@@ -8281,7 +8329,7 @@ function Q_({ fetch: e, location: r }) {
|
|
|
8281
8329
|
}
|
|
8282
8330
|
});
|
|
8283
8331
|
}
|
|
8284
|
-
const Fs = Uint8Array,
|
|
8332
|
+
const Fs = Uint8Array, eh = Fs.prototype.fill, mr = new TextEncoder();
|
|
8285
8333
|
class Ue extends Error {
|
|
8286
8334
|
constructor(r) {
|
|
8287
8335
|
super(r), this.name = "WalletOriginError", this.code = r;
|
|
@@ -8296,7 +8344,7 @@ function Ir(e) {
|
|
|
8296
8344
|
function _t(e) {
|
|
8297
8345
|
if (e instanceof Fs)
|
|
8298
8346
|
try {
|
|
8299
|
-
|
|
8347
|
+
eh.call(e, 0);
|
|
8300
8348
|
} catch {
|
|
8301
8349
|
}
|
|
8302
8350
|
}
|
|
@@ -8385,7 +8433,7 @@ function Sr(e, r) {
|
|
|
8385
8433
|
}
|
|
8386
8434
|
}
|
|
8387
8435
|
}
|
|
8388
|
-
function
|
|
8436
|
+
function th(e) {
|
|
8389
8437
|
let r;
|
|
8390
8438
|
try {
|
|
8391
8439
|
r = Yo(e);
|
|
@@ -8399,7 +8447,7 @@ function nn(e) {
|
|
|
8399
8447
|
const r = e?.AbortController ?? globalThis.AbortController;
|
|
8400
8448
|
return typeof r == "function" ? new r() : null;
|
|
8401
8449
|
}
|
|
8402
|
-
class
|
|
8450
|
+
class rh {
|
|
8403
8451
|
#r = !1;
|
|
8404
8452
|
#c;
|
|
8405
8453
|
#_ = null;
|
|
@@ -8443,8 +8491,8 @@ class th {
|
|
|
8443
8491
|
wasm: w,
|
|
8444
8492
|
window: m
|
|
8445
8493
|
}) {
|
|
8446
|
-
const N =
|
|
8447
|
-
this.#c = N.capabilities, this.#T = N.sha256, this.#L = a, this.#d = d, this.#n = t, this.#s = m, this.#y =
|
|
8494
|
+
const N = th(w);
|
|
8495
|
+
this.#c = N.capabilities, this.#T = N.sha256, this.#L = a, this.#d = d, this.#n = t, this.#s = m, this.#y = $_({
|
|
8448
8496
|
createRequestController: () => {
|
|
8449
8497
|
const L = nn(this.#s);
|
|
8450
8498
|
return L && (this.#l.add(L), this.#O.add(L)), L;
|
|
@@ -8607,7 +8655,7 @@ class th {
|
|
|
8607
8655
|
b && this.#l.add(b);
|
|
8608
8656
|
try {
|
|
8609
8657
|
this.#m(t.epoch, t.permit), it({ document: this.#n, window: this.#s }), typeof this.#d?.publishResult != "function" && ne("RELAY_UNAVAILABLE");
|
|
8610
|
-
const E = r === "connected" ? t.connectedResult :
|
|
8658
|
+
const E = r === "connected" ? t.connectedResult : Ud();
|
|
8611
8659
|
let I;
|
|
8612
8660
|
try {
|
|
8613
8661
|
I = await this.#d.publishResult(t.transaction, E, {
|
|
@@ -8896,7 +8944,7 @@ class th {
|
|
|
8896
8944
|
U == null && ne("WASM_FAILURE"), this.#a.add(U);
|
|
8897
8945
|
let M;
|
|
8898
8946
|
try {
|
|
8899
|
-
M =
|
|
8947
|
+
M = o_(D.identity, { accountIndex: r, profile: d });
|
|
8900
8948
|
} catch {
|
|
8901
8949
|
const C = this.#b(U);
|
|
8902
8950
|
D = null, C || (this.revokeNow("native-destruction-failed"), ne("DESTRUCTION_FAILED")), ne("WASM_FAILURE");
|
|
@@ -8943,7 +8991,7 @@ class th {
|
|
|
8943
8991
|
sha256: this.#T,
|
|
8944
8992
|
window: this.#s
|
|
8945
8993
|
});
|
|
8946
|
-
this.#A(s, d), it({ document: this.#n, window: this.#s }), this.#_ =
|
|
8994
|
+
this.#A(s, d), it({ document: this.#n, window: this.#s }), this.#_ = Dd({
|
|
8947
8995
|
binding: E.binding,
|
|
8948
8996
|
document: this.#n,
|
|
8949
8997
|
identity: a,
|
|
@@ -8956,7 +9004,7 @@ class th {
|
|
|
8956
9004
|
sha256: this.#T,
|
|
8957
9005
|
window: this.#s
|
|
8958
9006
|
}), this.#A(s, d), it({ document: this.#n, window: this.#s });
|
|
8959
|
-
const I = await
|
|
9007
|
+
const I = await Cd({
|
|
8960
9008
|
assertCurrent: () => this.#A(s, d),
|
|
8961
9009
|
binding: E.binding,
|
|
8962
9010
|
handle: s,
|
|
@@ -9073,7 +9121,7 @@ class th {
|
|
|
9073
9121
|
})(), s;
|
|
9074
9122
|
}
|
|
9075
9123
|
}
|
|
9076
|
-
const
|
|
9124
|
+
const nh = [
|
|
9077
9125
|
{
|
|
9078
9126
|
allowedOperations: [
|
|
9079
9127
|
"sdn.wallet.account.v1",
|
|
@@ -9414,11 +9462,11 @@ const rh = [
|
|
|
9414
9462
|
],
|
|
9415
9463
|
requestOrigin: "https://review.spacedatanetwork.org"
|
|
9416
9464
|
}
|
|
9417
|
-
],
|
|
9418
|
-
clients:
|
|
9419
|
-
registryReleaseSha256:
|
|
9420
|
-
schemaVersion:
|
|
9421
|
-
},
|
|
9465
|
+
], ih = "7674bfb019753eee8387f064467c0f6f2ff6babd1ecabbd70dc585afc31fbc1a", oh = 1, Ms = {
|
|
9466
|
+
clients: nh,
|
|
9467
|
+
registryReleaseSha256: ih,
|
|
9468
|
+
schemaVersion: oh
|
|
9469
|
+
}, sh = new TextEncoder(), ah = /^[0-9a-f]{64}$/u, ch = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u, lh = Object.freeze({
|
|
9422
9470
|
"sdn.auth.publish-request.v1": Object.freeze({
|
|
9423
9471
|
audience: null,
|
|
9424
9472
|
registryRow: "spaceaware-publish-request-v1",
|
|
@@ -9464,11 +9512,11 @@ const rh = [
|
|
|
9464
9512
|
}), vt = Object.freeze([
|
|
9465
9513
|
"sdn.wallet.account.v1",
|
|
9466
9514
|
"sdn.wallet.connect.v1"
|
|
9467
|
-
]),
|
|
9515
|
+
]), dh = Object.freeze([
|
|
9468
9516
|
"sdn.auth.jcs-envelope.v2",
|
|
9469
9517
|
"sdn.auth.raw-challenge.v1",
|
|
9470
9518
|
...vt
|
|
9471
|
-
]),
|
|
9519
|
+
]), _h = Object.freeze(["sdn.auth.publish-request.v1", ...vt]), hh = Object.freeze([
|
|
9472
9520
|
"sdn.asset-review.authority-activation.v1",
|
|
9473
9521
|
"sdn.asset-review.decision.v1",
|
|
9474
9522
|
...vt
|
|
@@ -9478,12 +9526,12 @@ const rh = [
|
|
|
9478
9526
|
Object.freeze(["sdn-flatbuffers-pages-v1", "FlatBuffers Documentation", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/flatbuffers/wallet-callback.html", vt]),
|
|
9479
9527
|
Object.freeze(["sdn-flatsql-pages-v1", "FlatSQL Documentation", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/flatsql/wallet-callback.html", vt]),
|
|
9480
9528
|
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", vt]),
|
|
9481
|
-
Object.freeze(["spaceaware-web-v1", "SpaceAware", "https://spaceaware.io", "https://spaceaware.io/wallet/callback",
|
|
9482
|
-
Object.freeze(["sdn-node-console-v1", "SDN Node Console", "https://sdn.spaceaware.io", "https://sdn.spaceaware.io/wallet/callback",
|
|
9529
|
+
Object.freeze(["spaceaware-web-v1", "SpaceAware", "https://spaceaware.io", "https://spaceaware.io/wallet/callback", _h]),
|
|
9530
|
+
Object.freeze(["sdn-node-console-v1", "SDN Node Console", "https://sdn.spaceaware.io", "https://sdn.spaceaware.io/wallet/callback", dh]),
|
|
9483
9531
|
Object.freeze(["orbpro-pages-v1", "OrbPro", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/OrbPro/wallet-callback.html", vt]),
|
|
9484
9532
|
Object.freeze(["sdn-asset-models-pages-v1", "SDN Asset Models", "https://digitalarsenal.github.io", "https://digitalarsenal.github.io/asset-models/wallet-callback.html", vt]),
|
|
9485
|
-
Object.freeze(["sdn-asset-review-v1", "SDN Asset Review", "https://review.spacedatanetwork.org", "https://review.spacedatanetwork.org/wallet/callback",
|
|
9486
|
-
]),
|
|
9533
|
+
Object.freeze(["sdn-asset-review-v1", "SDN Asset Review", "https://review.spacedatanetwork.org", "https://review.spacedatanetwork.org/wallet/callback", hh])
|
|
9534
|
+
]), uh = Object.freeze([
|
|
9487
9535
|
Object.freeze({
|
|
9488
9536
|
audience: null,
|
|
9489
9537
|
clientId: "spaceaware-web-v1",
|
|
@@ -9548,10 +9596,10 @@ function hn(e, r, t) {
|
|
|
9548
9596
|
function ut(e) {
|
|
9549
9597
|
return e === null || typeof e == "boolean" || typeof e == "string" ? JSON.stringify(e) : typeof e == "number" ? (Number.isFinite(e) || De("registry contains a non-finite number"), JSON.stringify(e)) : Array.isArray(e) ? `[${e.map(ut).join(",")}]` : (Pi(e) || De("registry contains an unsupported value"), `{${Object.keys(e).sort().map((r) => `${JSON.stringify(r)}:${ut(e[r])}`).join(",")}}`);
|
|
9550
9598
|
}
|
|
9551
|
-
async function
|
|
9599
|
+
async function fh(e) {
|
|
9552
9600
|
const r = globalThis.crypto?.subtle;
|
|
9553
9601
|
r || De("Web Crypto SHA-256 is unavailable");
|
|
9554
|
-
const t = new Uint8Array(await r.digest("SHA-256",
|
|
9602
|
+
const t = new Uint8Array(await r.digest("SHA-256", sh.encode(e)));
|
|
9555
9603
|
return Array.from(t, (s) => s.toString(16).padStart(2, "0")).join("");
|
|
9556
9604
|
}
|
|
9557
9605
|
function kn(e) {
|
|
@@ -9561,7 +9609,7 @@ function kn(e) {
|
|
|
9561
9609
|
for (const t of Object.keys(e).sort()) r[t] = kn(e[t]);
|
|
9562
9610
|
return Object.freeze(r);
|
|
9563
9611
|
}
|
|
9564
|
-
function
|
|
9612
|
+
function ph(e, r) {
|
|
9565
9613
|
(typeof e != "string" || !e.startsWith("https://") || e.includes("*")) && De(`${r} must be exact HTTPS`);
|
|
9566
9614
|
let t;
|
|
9567
9615
|
try {
|
|
@@ -9571,7 +9619,7 @@ function fh(e, r) {
|
|
|
9571
9619
|
}
|
|
9572
9620
|
(t.protocol !== "https:" || t.username || t.password || t.port || t.origin !== e || t.pathname !== "/" || t.search || t.hash) && De(`${r} must be an exact HTTPS origin`);
|
|
9573
9621
|
}
|
|
9574
|
-
function
|
|
9622
|
+
function yh(e, r) {
|
|
9575
9623
|
(typeof e != "string" || !e.startsWith("https://") || e.includes("*")) && De("callbackUri must be exact HTTPS");
|
|
9576
9624
|
let t;
|
|
9577
9625
|
try {
|
|
@@ -9581,8 +9629,8 @@ function ph(e, r) {
|
|
|
9581
9629
|
}
|
|
9582
9630
|
(t.protocol !== "https:" || t.username || t.password || t.port || t.origin !== r || t.search || t.hash || t.href !== e) && De("callbackUri must be exact and same-origin");
|
|
9583
9631
|
}
|
|
9584
|
-
function
|
|
9585
|
-
hn(e, ["clients", "registryReleaseSha256", "schemaVersion"], "registry"), e.schemaVersion !== 1 && De("registry schemaVersion must be 1"), (typeof e.registryReleaseSha256 != "string" || !
|
|
9632
|
+
function gh(e) {
|
|
9633
|
+
hn(e, ["clients", "registryReleaseSha256", "schemaVersion"], "registry"), e.schemaVersion !== 1 && De("registry schemaVersion must be 1"), (typeof e.registryReleaseSha256 != "string" || !ah.test(e.registryReleaseSha256)) && De("registryReleaseSha256 must be lowercase SHA-256"), (!Array.isArray(e.clients) || e.clients.length !== Oo.length) && De("registry must contain exactly the reviewed clients");
|
|
9586
9634
|
const r = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
9587
9635
|
e.clients.forEach((s, a) => {
|
|
9588
9636
|
hn(s, [
|
|
@@ -9595,7 +9643,7 @@ function yh(e) {
|
|
|
9595
9643
|
"requestOrigin"
|
|
9596
9644
|
], `client ${a}`);
|
|
9597
9645
|
const [d, b, E, I, P] = Oo[a];
|
|
9598
|
-
(s.clientId !== d || s.clientDisplayName !== b || s.requestOrigin !== E || s.callbackUri !== I) && De(`client ${a} differs from the reviewed row`), (!
|
|
9646
|
+
(s.clientId !== d || s.clientDisplayName !== b || s.requestOrigin !== E || s.callbackUri !== I) && De(`client ${a} differs from the reviewed row`), (!ch.test(s.clientId) || r.has(s.clientId)) && De("clientId must be unique and canonical"), r.add(s.clientId), (typeof s.clientDisplayName != "string" || s.clientDisplayName.length < 1 || s.clientDisplayName.length > 80) && De("clientDisplayName is invalid"), ph(s.requestOrigin, "requestOrigin"), yh(s.callbackUri, s.requestOrigin), (!Array.isArray(s.allowedOperations) || ut(s.allowedOperations) !== ut(P)) && De(`${s.clientId} allowedOperations differ from the reviewed allowlist`), (!Array.isArray(s.operationBindings) || s.operationBindings.length !== P.length) && De(`${s.clientId} operationBindings differ from the reviewed allowlist`), s.operationBindings.forEach((m, N) => {
|
|
9599
9647
|
hn(m, [
|
|
9600
9648
|
"audience",
|
|
9601
9649
|
"maxLifetimeSeconds",
|
|
@@ -9606,7 +9654,7 @@ function yh(e) {
|
|
|
9606
9654
|
], `${s.clientId} operation ${N}`);
|
|
9607
9655
|
const L = P[N];
|
|
9608
9656
|
m.operation !== L && De(`${s.clientId} operation allowlist order or value changed`);
|
|
9609
|
-
const D =
|
|
9657
|
+
const D = lh[m.operation];
|
|
9610
9658
|
D || De("unknown registry operation"), (m.maxLifetimeSeconds !== 300 || m.audience !== D.audience || m.registryRow !== D.registryRow || m.serviceActivationState !== D.serviceActivationState || m.serviceInstance !== D.serviceInstance) && De(`${s.clientId} operation policy differs from the reviewed binding`);
|
|
9611
9659
|
const U = `${s.clientId}\0${s.requestOrigin}\0${m.operation}`;
|
|
9612
9660
|
t.has(U) && De("duplicate registry binding"), t.add(U);
|
|
@@ -9614,7 +9662,7 @@ function yh(e) {
|
|
|
9614
9662
|
const w = [...new Set(s.operationBindings.map(({ audience: m }) => m).filter((m) => m !== null))].sort();
|
|
9615
9663
|
(!Array.isArray(s.audiences) || ut(s.audiences) !== ut(w)) && De(`${s.clientId} audiences differ from operationBindings`), ut(s.allowedOperations) !== ut(s.operationBindings.map(({ operation: m }) => m)) && De(`${s.clientId} allowedOperations differ from operationBindings`);
|
|
9616
9664
|
});
|
|
9617
|
-
for (const s of
|
|
9665
|
+
for (const s of uh) {
|
|
9618
9666
|
const a = e.clients.find((E) => E.clientId === s.clientId && E.requestOrigin === s.requestOrigin), d = a?.operationBindings.find((E) => E.operation === s.operation), b = d && {
|
|
9619
9667
|
audience: d.audience,
|
|
9620
9668
|
clientId: a.clientId,
|
|
@@ -9629,10 +9677,10 @@ function yh(e) {
|
|
|
9629
9677
|
}
|
|
9630
9678
|
return kn(e);
|
|
9631
9679
|
}
|
|
9632
|
-
const { registryReleaseSha256:
|
|
9633
|
-
|
|
9634
|
-
const Po =
|
|
9635
|
-
function
|
|
9680
|
+
const { registryReleaseSha256: vh, ...bh } = Ms, Eh = await fh(ut(bh));
|
|
9681
|
+
Eh !== vh && De("registry release SHA-256 mismatch");
|
|
9682
|
+
const Po = gh(Ms);
|
|
9683
|
+
function Ah(e) {
|
|
9636
9684
|
const r = hn(e, ["clientId", "operation", "requestOrigin"], "registry lookup");
|
|
9637
9685
|
(typeof r.clientId != "string" || typeof r.requestOrigin != "string" || typeof r.operation != "string") && De("registry lookup fields must be strings");
|
|
9638
9686
|
const t = Po.clients.find((a) => a.clientId === r.clientId && a.requestOrigin === r.requestOrigin), s = t?.operationBindings.find((a) => a.operation === r.operation);
|
|
@@ -9650,11 +9698,11 @@ function Eh(e) {
|
|
|
9650
9698
|
serviceInstance: s.serviceInstance
|
|
9651
9699
|
});
|
|
9652
9700
|
}
|
|
9653
|
-
const
|
|
9701
|
+
const mh = /^\/transaction\/([0-9a-f]{64})$/u, Wn = new TextEncoder(), Ih = Uint8Array.prototype.fill, wh = Object.freeze({ resolveRegistryBinding: Ah });
|
|
9654
9702
|
function Ro(e) {
|
|
9655
9703
|
if (e instanceof Uint8Array)
|
|
9656
9704
|
try {
|
|
9657
|
-
|
|
9705
|
+
Ih.call(e, 0);
|
|
9658
9706
|
} catch {
|
|
9659
9707
|
}
|
|
9660
9708
|
}
|
|
@@ -9766,7 +9814,7 @@ function Bs({
|
|
|
9766
9814
|
}
|
|
9767
9815
|
if (!Array.isArray(M) || M.length === 0)
|
|
9768
9816
|
return a.replaceChildren(), a.hidden = !0, !1;
|
|
9769
|
-
a.hidden = !1, P =
|
|
9817
|
+
a.hidden = !1, P = d_(a, M, { document: t });
|
|
9770
9818
|
const C = E;
|
|
9771
9819
|
for (const B of P.rows) {
|
|
9772
9820
|
const { entry: Y } = B, _ = async (g) => {
|
|
@@ -9848,7 +9896,7 @@ function Bs({
|
|
|
9848
9896
|
refresh: D
|
|
9849
9897
|
});
|
|
9850
9898
|
}
|
|
9851
|
-
function
|
|
9899
|
+
function Sh({
|
|
9852
9900
|
clipboard: e = globalThis.navigator?.clipboard,
|
|
9853
9901
|
controller: r = null,
|
|
9854
9902
|
document: t,
|
|
@@ -10013,7 +10061,7 @@ function Vs({
|
|
|
10013
10061
|
remove: M
|
|
10014
10062
|
});
|
|
10015
10063
|
}
|
|
10016
|
-
function
|
|
10064
|
+
function kh({ document: e, mount: r = null, title: t = "Choose legacy wallet profile" }) {
|
|
10017
10065
|
const s = r ?? e?.body;
|
|
10018
10066
|
if (!e?.createElement || !s?.append) throw new Ue("DOM_UNAVAILABLE");
|
|
10019
10067
|
const a = e.createElement("section");
|
|
@@ -10098,7 +10146,7 @@ function zs(e, r = "The wallet request could not be completed. Close this window
|
|
|
10098
10146
|
const b = e.createElement("p");
|
|
10099
10147
|
b.textContent = r, a.append(d, b), s.replaceChildren(a);
|
|
10100
10148
|
}
|
|
10101
|
-
function
|
|
10149
|
+
function Oh({
|
|
10102
10150
|
clipboard: e,
|
|
10103
10151
|
controller: r,
|
|
10104
10152
|
document: t,
|
|
@@ -10111,7 +10159,7 @@ function kh({
|
|
|
10111
10159
|
}) {
|
|
10112
10160
|
const P = t.createElement("section");
|
|
10113
10161
|
P.className = "wallet-account";
|
|
10114
|
-
const w = t.createElement("div"), m =
|
|
10162
|
+
const w = t.createElement("div"), m = c_(w, s, { document: t }), N = t.createElement("section");
|
|
10115
10163
|
N.className = "wallet-approval-card";
|
|
10116
10164
|
const L = t.createElement("h2");
|
|
10117
10165
|
L.textContent = "Asset review approval";
|
|
@@ -10123,14 +10171,14 @@ function kh({
|
|
|
10123
10171
|
B.type = "button", B.dataset.walletAction = "return-to-site", B.textContent = "Return to site";
|
|
10124
10172
|
const Y = t.createElement("section");
|
|
10125
10173
|
Y.className = "wallet-legacy-migration";
|
|
10126
|
-
const _ =
|
|
10174
|
+
const _ = f_(Y, { document: t });
|
|
10127
10175
|
let f = !1;
|
|
10128
10176
|
try {
|
|
10129
10177
|
f = r.canForgetRememberedWallet?.() === !0;
|
|
10130
10178
|
} catch {
|
|
10131
10179
|
f = !1;
|
|
10132
10180
|
}
|
|
10133
|
-
const h = f ? t.createElement("section") : null, u = h ?
|
|
10181
|
+
const h = f ? t.createElement("section") : null, u = h ? l_(h, { document: t }) : null;
|
|
10134
10182
|
u && (u.launch.dataset.walletAction = "forget-stored-wallet");
|
|
10135
10183
|
const g = Bs({
|
|
10136
10184
|
clipboard: e,
|
|
@@ -10138,7 +10186,7 @@ function kh({
|
|
|
10138
10186
|
document: t
|
|
10139
10187
|
}), v = t.createElement("p");
|
|
10140
10188
|
v.className = "wallet-account-exit-status", P.append(w, N), h && P.append(h), g?.hasEntries && P.append(g.container), P.append(B, C, Y), b.replaceChildren(P);
|
|
10141
|
-
const k = new
|
|
10189
|
+
const k = new h_({
|
|
10142
10190
|
credentialRound: async (fe) => {
|
|
10143
10191
|
const Te = d({
|
|
10144
10192
|
controller: null,
|
|
@@ -10189,7 +10237,7 @@ function kh({
|
|
|
10189
10237
|
try {
|
|
10190
10238
|
const nt = await k.confirm();
|
|
10191
10239
|
Pe(Te);
|
|
10192
|
-
const $e = await
|
|
10240
|
+
const $e = await __(nt, {
|
|
10193
10241
|
assertCurrent: () => Pe(Te),
|
|
10194
10242
|
clipboard: e,
|
|
10195
10243
|
container: U,
|
|
@@ -10235,7 +10283,7 @@ function kh({
|
|
|
10235
10283
|
if (!jn(lt)) throw new Error("invalid legacy credentials");
|
|
10236
10284
|
_r = mt(Wn.encode(lt)), cr(ze.form, [ze.mnemonicControl]), ze.section?.remove?.(), hr = { mnemonicUtf8: _r };
|
|
10237
10285
|
}
|
|
10238
|
-
if ($e?.promise && R.delete($e), Ae = await
|
|
10286
|
+
if ($e?.promise && R.delete($e), Ae = await u_({
|
|
10239
10287
|
accountIndex: 0,
|
|
10240
10288
|
credentials: hr,
|
|
10241
10289
|
operation: "sdn.auth.raw-challenge.v1",
|
|
@@ -10339,24 +10387,24 @@ function kh({
|
|
|
10339
10387
|
)
|
|
10340
10388
|
});
|
|
10341
10389
|
}
|
|
10342
|
-
function
|
|
10390
|
+
function Ph(e) {
|
|
10343
10391
|
const r = e?.pathname, t = e?.search ?? "", s = e?.hash ?? "";
|
|
10344
10392
|
if (typeof r != "string" || t !== "" || s !== "") throw No();
|
|
10345
|
-
const a =
|
|
10393
|
+
const a = mh.exec(r);
|
|
10346
10394
|
if (!a) throw No();
|
|
10347
10395
|
return a[1];
|
|
10348
10396
|
}
|
|
10349
|
-
function
|
|
10350
|
-
const r = e?.window ?? globalThis.window, t = e?.document ?? r?.document ?? globalThis.document, s = e?.mount ?? t?.body, a = typeof r?.fetch == "function" ? r.fetch.bind(r) : typeof globalThis.fetch == "function" ? globalThis.fetch.bind(globalThis) : null, d = e?.relay ?? (e?.controller ? null :
|
|
10397
|
+
function Rh(e) {
|
|
10398
|
+
const r = e?.window ?? globalThis.window, t = e?.document ?? r?.document ?? globalThis.document, s = e?.mount ?? t?.body, a = typeof r?.fetch == "function" ? r.fetch.bind(r) : typeof globalThis.fetch == "function" ? globalThis.fetch.bind(globalThis) : null, d = e?.relay ?? (e?.controller ? null : Z_({
|
|
10351
10399
|
fetch: e?.fetch ?? a,
|
|
10352
10400
|
location: e?.location ?? r?.location
|
|
10353
|
-
})), b = e?.registry ??
|
|
10401
|
+
})), b = e?.registry ?? wh, E = e?.controller ?? new rh({
|
|
10354
10402
|
...e,
|
|
10355
10403
|
document: t,
|
|
10356
10404
|
registry: b,
|
|
10357
10405
|
relay: d,
|
|
10358
10406
|
window: r
|
|
10359
|
-
}), I = e?.credentialPrompt ?? ((R) =>
|
|
10407
|
+
}), I = e?.credentialPrompt ?? ((R) => Sh(R));
|
|
10360
10408
|
let P = null, w = null, m = null, N = null, L = null, D = [], U = 0, M = !1;
|
|
10361
10409
|
const C = () => {
|
|
10362
10410
|
(P?.destroy?.() ?? !0) && (P = null), w = null;
|
|
@@ -10399,14 +10447,14 @@ function Ph(e) {
|
|
|
10399
10447
|
const R = U;
|
|
10400
10448
|
return M ? (N = Promise.reject(new Ue("STALE_CONTROLLER")), N) : (N = (async () => {
|
|
10401
10449
|
try {
|
|
10402
|
-
const F =
|
|
10450
|
+
const F = Ph(r?.location);
|
|
10403
10451
|
if (typeof E.prepare != "function" || typeof E.executePrepared != "function" || typeof E.unlockPassword != "function") {
|
|
10404
10452
|
const ae = await E.execute(F);
|
|
10405
10453
|
return h(R), ae;
|
|
10406
10454
|
}
|
|
10407
10455
|
const V = await E.prepare(F);
|
|
10408
10456
|
if (h(R), V.transaction.operation === "sdn.auth.raw-challenge.v1") {
|
|
10409
|
-
const ae =
|
|
10457
|
+
const ae = kh({
|
|
10410
10458
|
document: t,
|
|
10411
10459
|
mount: s,
|
|
10412
10460
|
title: `Choose the legacy profile for ${V.binding.clientDisplayName}`
|
|
@@ -10465,7 +10513,7 @@ function Ph(e) {
|
|
|
10465
10513
|
}
|
|
10466
10514
|
}
|
|
10467
10515
|
const ee = await E.executePrepared(V);
|
|
10468
|
-
return h(R), u(m), V.transaction.operation === "sdn.wallet.account.v1" ? (w = E.copyPublicIdentity(), P =
|
|
10516
|
+
return h(R), u(m), V.transaction.operation === "sdn.wallet.account.v1" ? (w = E.copyPublicIdentity(), P = Oh({
|
|
10469
10517
|
clipboard: e?.clipboard ?? globalThis.navigator?.clipboard,
|
|
10470
10518
|
controller: E,
|
|
10471
10519
|
document: t,
|
|
@@ -10494,24 +10542,24 @@ function Ph(e) {
|
|
|
10494
10542
|
}
|
|
10495
10543
|
});
|
|
10496
10544
|
}
|
|
10497
|
-
async function
|
|
10498
|
-
const r =
|
|
10545
|
+
async function Nh(e) {
|
|
10546
|
+
const r = Rh(e);
|
|
10499
10547
|
return await r.start(), r;
|
|
10500
10548
|
}
|
|
10501
10549
|
const un = document.querySelector("[data-wallet-origin-root]") ?? document.body;
|
|
10502
|
-
async function
|
|
10550
|
+
async function Lh() {
|
|
10503
10551
|
if (window.top !== window) throw new Error("Wallet origin cannot run in a frame");
|
|
10504
|
-
if (getComputedStyle(document.documentElement).getPropertyValue("--sdn-wallet-origin-style-ready").trim() !== '"2.0
|
|
10505
|
-
const r = await
|
|
10506
|
-
await
|
|
10552
|
+
if (getComputedStyle(document.documentElement).getPropertyValue("--sdn-wallet-origin-style-ready").trim() !== '"2.1.0"') throw new Error("Wallet origin style integrity failed");
|
|
10553
|
+
const r = await Ll();
|
|
10554
|
+
await Nh({ document, mount: un, wasm: r, window });
|
|
10507
10555
|
}
|
|
10508
|
-
|
|
10556
|
+
Lh().catch(() => {
|
|
10509
10557
|
if (un.childElementCount === 1 && un.firstElementChild?.classList?.contains("wallet-terminal-error") === !0)
|
|
10510
10558
|
return;
|
|
10511
10559
|
const e = document.createElement("p");
|
|
10512
10560
|
e.className = "wallet-error", e.textContent = "The wallet could not start. Close this window and try again.", un.replaceChildren(e);
|
|
10513
10561
|
});
|
|
10514
|
-
var
|
|
10562
|
+
var Th = (() => {
|
|
10515
10563
|
var e = import.meta.url;
|
|
10516
10564
|
return function(r = {}) {
|
|
10517
10565
|
if (!(r.wasmBinary instanceof Uint8Array)) throw new Error("Verified WASM bytes are required");
|
|
@@ -12738,7 +12786,7 @@ var Lh = (() => {
|
|
|
12738
12786
|
return qi(), r.ready;
|
|
12739
12787
|
};
|
|
12740
12788
|
})();
|
|
12741
|
-
const
|
|
12789
|
+
const xh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
12742
12790
|
__proto__: null,
|
|
12743
|
-
default:
|
|
12791
|
+
default: Th
|
|
12744
12792
|
}, Symbol.toStringTag, { value: "Module" }));
|