@coinbase/cdp-core 0.0.117 → 0.0.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.web10.js +49 -44
- package/dist/esm/index.web107.js +3 -3
- package/dist/esm/index.web110.js +2 -2
- package/dist/esm/index.web114.js +2 -2
- package/dist/esm/index.web127.js +3 -3
- package/dist/esm/index.web128.js +31 -2
- package/dist/esm/index.web129.js +28 -65
- package/dist/esm/index.web130.js +12 -360
- package/dist/esm/index.web131.js +22 -28
- package/dist/esm/index.web132.js +50 -28
- package/dist/esm/index.web133.js +2 -19
- package/dist/esm/index.web134.js +63 -20
- package/dist/esm/index.web135.js +351 -37
- package/dist/esm/index.web138.js +1 -1
- package/dist/esm/index.web139.js +1 -1
- package/dist/esm/index.web140.js +5 -5
- package/dist/esm/index.web141.js +43 -50
- package/dist/esm/index.web142.js +2 -11
- package/dist/esm/index.web143.js +2 -2
- package/dist/esm/index.web144.js +15 -45
- package/dist/esm/index.web145.js +28 -13
- package/dist/esm/index.web146.js +7 -12
- package/dist/esm/index.web147.js +3 -11
- package/dist/esm/index.web148.js +29 -5
- package/dist/esm/index.web149.js +8 -47
- package/dist/esm/index.web150.js +7 -14
- package/dist/esm/index.web151.js +70 -18
- package/dist/esm/index.web152.js +28 -7
- package/dist/esm/index.web153.js +3 -3
- package/dist/esm/index.web154.js +6 -19
- package/dist/esm/index.web155.js +4 -8
- package/dist/esm/index.web156.js +14 -7
- package/dist/esm/index.web157.js +18 -79
- package/dist/esm/index.web158.js +48 -15
- package/dist/esm/index.web159.js +17 -3
- package/dist/esm/index.web160.js +23 -15
- package/dist/esm/index.web161.js +8 -4
- package/dist/esm/index.web162.js +33 -5
- package/dist/esm/index.web163.js +7 -19
- package/dist/esm/index.web164.js +16 -57
- package/dist/esm/index.web165.js +54 -17
- package/dist/esm/index.web166.js +10 -23
- package/dist/esm/index.web167.js +2 -9
- package/dist/esm/index.web168.js +44 -42
- package/dist/esm/index.web169.js +13 -7
- package/dist/esm/index.web170.js +10 -18
- package/dist/esm/index.web171.js +12 -2
- package/dist/esm/index.web172.js +5 -2
- package/dist/esm/index.web191.js +1 -1
- package/dist/esm/index.web193.js +1 -1
- package/dist/esm/index.web194.js +2 -2
- package/dist/esm/index.web2.js +2 -2
- package/dist/esm/index.web202.js +2 -2
- package/dist/esm/index.web210.js +8 -2
- package/dist/esm/index.web211.js +2 -109
- package/dist/esm/index.web212.js +361 -2
- package/dist/esm/index.web213.js +852 -20
- package/dist/esm/index.web214.js +39 -10
- package/dist/esm/index.web215.js +2 -20
- package/dist/esm/index.web216.js +70 -94
- package/dist/esm/index.web217.js +35 -21
- package/dist/esm/index.web218.js +13 -116
- package/dist/esm/index.web219.js +19 -102
- package/dist/esm/index.web220.js +10 -79
- package/dist/esm/index.web221.js +20 -79
- package/dist/esm/index.web222.js +94 -8
- package/dist/esm/index.web223.js +21 -2
- package/dist/esm/index.web224.js +110 -353
- package/dist/esm/index.web225.js +103 -852
- package/dist/esm/index.web226.js +77 -37
- package/dist/esm/index.web227.js +79 -2
- package/dist/esm/index.web228.js +107 -68
- package/dist/esm/index.web229.js +2 -35
- package/dist/esm/index.web230.js +2 -15
- package/dist/esm/index.web236.js +3 -46
- package/dist/esm/index.web237.js +46 -3
- package/dist/esm/index.web238.js +2 -18
- package/dist/esm/index.web239.js +2 -28
- package/dist/esm/index.web240.js +2 -8
- package/dist/esm/index.web241.js +18 -11
- package/dist/esm/index.web242.js +28 -13
- package/dist/esm/index.web243.js +8 -10
- package/dist/esm/index.web244.js +11 -17
- package/dist/esm/index.web245.js +12 -80
- package/dist/esm/index.web246.js +10 -2
- package/dist/esm/index.web247.js +17 -2
- package/dist/esm/index.web248.js +81 -2
- package/dist/esm/index.web250.js +14 -78
- package/dist/esm/index.web251.js +78 -14
- package/dist/esm/index.web3.js +1 -1
- package/dist/esm/index.web8.js +26 -12
- package/dist/esm/index.web9.js +1 -1
- package/dist/native/index.native109.js +3 -3
- package/dist/native/index.native11.js +1 -1
- package/dist/native/index.native112.js +2 -2
- package/dist/native/index.native116.js +3 -3
- package/dist/native/index.native12.js +50 -45
- package/dist/native/index.native129.js +371 -100
- package/dist/native/index.native130.js +2 -379
- package/dist/native/index.native131.js +65 -28
- package/dist/native/index.native132.js +364 -28
- package/dist/native/index.native133.js +31 -2
- package/dist/native/index.native134.js +28 -65
- package/dist/native/index.native135.js +12 -360
- package/dist/native/index.native136.js +21 -15
- package/dist/native/index.native137.js +49 -21
- package/dist/native/index.native138.js +104 -49
- package/dist/native/index.native141.js +1 -1
- package/dist/native/index.native142.js +1 -1
- package/dist/native/index.native143.js +5 -5
- package/dist/native/index.native144.js +11 -46
- package/dist/native/index.native145.js +12 -2
- package/dist/native/index.native146.js +55 -2
- package/dist/native/index.native147.js +10 -4
- package/dist/native/index.native148.js +2 -13
- package/dist/native/index.native149.js +45 -12
- package/dist/native/index.native150.js +13 -54
- package/dist/native/index.native151.js +5 -11
- package/dist/native/index.native152.js +48 -2
- package/dist/native/index.native153.js +35 -44
- package/dist/native/index.native154.js +66 -12
- package/dist/native/index.native155.js +14 -36
- package/dist/native/index.native156.js +25 -65
- package/dist/native/index.native157.js +7 -13
- package/dist/native/index.native158.js +3 -27
- package/dist/native/index.native159.js +27 -7
- package/dist/native/index.native160.js +8 -3
- package/dist/native/index.native161.js +7 -27
- package/dist/native/index.native162.js +79 -8
- package/dist/native/index.native163.js +27 -7
- package/dist/native/index.native164.js +3 -79
- package/dist/native/index.native165.js +5 -18
- package/dist/native/index.native166.js +4 -3
- package/dist/native/index.native167.js +3 -4
- package/dist/native/index.native168.js +19 -4
- package/dist/native/index.native169.js +52 -5
- package/dist/native/index.native170.js +17 -19
- package/dist/native/index.native171.js +18 -55
- package/dist/native/index.native172.js +8 -17
- package/dist/native/index.native173.js +37 -19
- package/dist/native/index.native174.js +7 -8
- package/dist/native/index.native175.js +17 -38
- package/dist/native/index.native176.js +2 -8
- package/dist/native/index.native177.js +2 -21
- package/dist/native/index.native193.js +1 -1
- package/dist/native/index.native195.js +1 -1
- package/dist/native/index.native196.js +1 -1
- package/dist/native/index.native199.js +2 -2
- package/dist/native/index.native2.js +2 -2
- package/dist/native/index.native207.js +2 -2
- package/dist/native/index.native210.js +1 -1
- package/dist/native/index.native211.js +1 -1
- package/dist/native/index.native221.js +2 -2
- package/dist/native/index.native222.js +3 -3
- package/dist/native/index.native224.js +3 -3
- package/dist/native/index.native225.js +1 -1
- package/dist/native/index.native226.js +3 -3
- package/dist/native/index.native227.js +7 -38
- package/dist/native/index.native229.js +358 -67
- package/dist/native/index.native230.js +852 -34
- package/dist/native/index.native231.js +38 -14
- package/dist/native/index.native232.js +2 -8
- package/dist/native/index.native233.js +70 -2
- package/dist/native/index.native234.js +29 -355
- package/dist/native/index.native235.js +14 -852
- package/dist/native/index.native236.js +40 -14
- package/dist/native/index.native237.js +21 -2
- package/dist/native/index.native238.js +2 -20
- package/dist/native/index.native239.js +18 -31
- package/dist/native/index.native240.js +32 -6
- package/dist/native/index.native241.js +6 -3
- package/dist/native/index.native242.js +16 -45
- package/dist/native/index.native243.js +28 -2
- package/dist/native/index.native244.js +8 -2
- package/dist/native/index.native245.js +11 -2
- package/dist/native/index.native246.js +11 -16
- package/dist/native/index.native247.js +10 -28
- package/dist/native/index.native248.js +17 -8
- package/dist/native/index.native249.js +79 -9
- package/dist/native/index.native250.js +2 -13
- package/dist/native/index.native251.js +2 -10
- package/dist/native/index.native252.js +2 -15
- package/dist/native/index.native253.js +2 -81
- package/dist/native/index.native255.js +78 -14
- package/dist/native/index.native256.js +14 -78
- package/dist/native/index.native3.js +1 -1
- package/dist/native/index.native8.js +16 -3
- package/dist/native/index.native86.js +1 -1
- package/dist/native/index.native9.js +21 -8
- package/dist/native-types/platform/types.d.ts +25 -0
- package/dist/native-types/version.d.ts +1 -1
- package/dist/types/platform/types.d.ts +25 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index.web10.js +49 -44
- package/dist/web/index.web107.js +3 -3
- package/dist/web/index.web110.js +2 -2
- package/dist/web/index.web114.js +2 -2
- package/dist/web/index.web127.js +3 -3
- package/dist/web/index.web128.js +31 -2
- package/dist/web/index.web129.js +28 -65
- package/dist/web/index.web130.js +12 -360
- package/dist/web/index.web131.js +22 -28
- package/dist/web/index.web132.js +50 -28
- package/dist/web/index.web133.js +2 -19
- package/dist/web/index.web134.js +63 -20
- package/dist/web/index.web135.js +351 -37
- package/dist/web/index.web138.js +1 -1
- package/dist/web/index.web139.js +1 -1
- package/dist/web/index.web140.js +5 -5
- package/dist/web/index.web141.js +43 -50
- package/dist/web/index.web142.js +2 -11
- package/dist/web/index.web143.js +2 -2
- package/dist/web/index.web144.js +15 -45
- package/dist/web/index.web145.js +28 -13
- package/dist/web/index.web146.js +7 -12
- package/dist/web/index.web147.js +3 -11
- package/dist/web/index.web148.js +29 -5
- package/dist/web/index.web149.js +8 -47
- package/dist/web/index.web150.js +7 -14
- package/dist/web/index.web151.js +70 -18
- package/dist/web/index.web152.js +28 -7
- package/dist/web/index.web153.js +3 -3
- package/dist/web/index.web154.js +6 -19
- package/dist/web/index.web155.js +4 -8
- package/dist/web/index.web156.js +14 -7
- package/dist/web/index.web157.js +18 -79
- package/dist/web/index.web158.js +48 -15
- package/dist/web/index.web159.js +17 -3
- package/dist/web/index.web160.js +23 -15
- package/dist/web/index.web161.js +8 -4
- package/dist/web/index.web162.js +33 -5
- package/dist/web/index.web163.js +7 -19
- package/dist/web/index.web164.js +16 -57
- package/dist/web/index.web165.js +54 -17
- package/dist/web/index.web166.js +10 -23
- package/dist/web/index.web167.js +2 -9
- package/dist/web/index.web168.js +44 -42
- package/dist/web/index.web169.js +13 -7
- package/dist/web/index.web170.js +10 -18
- package/dist/web/index.web171.js +12 -2
- package/dist/web/index.web172.js +5 -2
- package/dist/web/index.web191.js +1 -1
- package/dist/web/index.web193.js +1 -1
- package/dist/web/index.web194.js +2 -2
- package/dist/web/index.web2.js +2 -2
- package/dist/web/index.web202.js +2 -2
- package/dist/web/index.web210.js +8 -2
- package/dist/web/index.web211.js +2 -109
- package/dist/web/index.web212.js +361 -2
- package/dist/web/index.web213.js +852 -20
- package/dist/web/index.web214.js +39 -10
- package/dist/web/index.web215.js +2 -20
- package/dist/web/index.web216.js +70 -94
- package/dist/web/index.web217.js +35 -21
- package/dist/web/index.web218.js +13 -116
- package/dist/web/index.web219.js +19 -102
- package/dist/web/index.web220.js +10 -79
- package/dist/web/index.web221.js +20 -79
- package/dist/web/index.web222.js +94 -8
- package/dist/web/index.web223.js +21 -2
- package/dist/web/index.web224.js +110 -353
- package/dist/web/index.web225.js +103 -852
- package/dist/web/index.web226.js +77 -37
- package/dist/web/index.web227.js +79 -2
- package/dist/web/index.web228.js +107 -68
- package/dist/web/index.web229.js +2 -35
- package/dist/web/index.web230.js +2 -15
- package/dist/web/index.web236.js +3 -46
- package/dist/web/index.web237.js +46 -3
- package/dist/web/index.web238.js +2 -18
- package/dist/web/index.web239.js +2 -28
- package/dist/web/index.web240.js +2 -8
- package/dist/web/index.web241.js +18 -11
- package/dist/web/index.web242.js +28 -13
- package/dist/web/index.web243.js +8 -10
- package/dist/web/index.web244.js +11 -17
- package/dist/web/index.web245.js +12 -80
- package/dist/web/index.web246.js +10 -2
- package/dist/web/index.web247.js +17 -2
- package/dist/web/index.web248.js +81 -2
- package/dist/web/index.web250.js +14 -78
- package/dist/web/index.web251.js +78 -14
- package/dist/web/index.web3.js +1 -1
- package/dist/web/index.web8.js +26 -12
- package/dist/web/index.web9.js +1 -1
- package/dist/web-types/platform/types.d.ts +25 -0
- package/dist/web-types/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,83 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
function n(e) {
|
|
3
|
-
let a, r;
|
|
4
|
-
switch (e.kty) {
|
|
5
|
-
case "RSA": {
|
|
6
|
-
switch (e.alg) {
|
|
7
|
-
case "PS256":
|
|
8
|
-
case "PS384":
|
|
9
|
-
case "PS512":
|
|
10
|
-
a = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
|
|
11
|
-
break;
|
|
12
|
-
case "RS256":
|
|
13
|
-
case "RS384":
|
|
14
|
-
case "RS512":
|
|
15
|
-
a = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
|
|
16
|
-
break;
|
|
17
|
-
case "RSA-OAEP":
|
|
18
|
-
case "RSA-OAEP-256":
|
|
19
|
-
case "RSA-OAEP-384":
|
|
20
|
-
case "RSA-OAEP-512":
|
|
21
|
-
a = {
|
|
22
|
-
name: "RSA-OAEP",
|
|
23
|
-
hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
|
|
24
|
-
}, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
25
|
-
break;
|
|
26
|
-
default:
|
|
27
|
-
throw new s('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
28
|
-
}
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
case "EC": {
|
|
32
|
-
switch (e.alg) {
|
|
33
|
-
case "ES256":
|
|
34
|
-
a = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
|
|
35
|
-
break;
|
|
36
|
-
case "ES384":
|
|
37
|
-
a = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
|
|
38
|
-
break;
|
|
39
|
-
case "ES512":
|
|
40
|
-
a = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
|
|
41
|
-
break;
|
|
42
|
-
case "ECDH-ES":
|
|
43
|
-
case "ECDH-ES+A128KW":
|
|
44
|
-
case "ECDH-ES+A192KW":
|
|
45
|
-
case "ECDH-ES+A256KW":
|
|
46
|
-
a = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
throw new s('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
50
|
-
}
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
case "OKP": {
|
|
54
|
-
switch (e.alg) {
|
|
55
|
-
case "Ed25519":
|
|
56
|
-
case "EdDSA":
|
|
57
|
-
a = { name: "Ed25519" }, r = e.d ? ["sign"] : ["verify"];
|
|
58
|
-
break;
|
|
59
|
-
case "ECDH-ES":
|
|
60
|
-
case "ECDH-ES+A128KW":
|
|
61
|
-
case "ECDH-ES+A192KW":
|
|
62
|
-
case "ECDH-ES+A256KW":
|
|
63
|
-
a = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
throw new s('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
67
|
-
}
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
default:
|
|
71
|
-
throw new s('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
72
|
-
}
|
|
73
|
-
return { algorithm: a, keyUsages: r };
|
|
74
|
-
}
|
|
75
|
-
const i = async (e) => {
|
|
76
|
-
if (!e.alg)
|
|
77
|
-
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
78
|
-
const { algorithm: a, keyUsages: r } = n(e), t = { ...e };
|
|
79
|
-
return delete t.alg, delete t.use, crypto.subtle.importKey("jwk", t, a, e.ext ?? !e.d, e.key_ops ?? r);
|
|
80
|
-
};
|
|
1
|
+
var r = { exports: {} };
|
|
81
2
|
export {
|
|
82
|
-
|
|
3
|
+
r as __module
|
|
83
4
|
};
|
|
@@ -1,17 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
function r(t, e = "algorithm.name") {
|
|
2
|
+
return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`);
|
|
3
|
+
}
|
|
4
|
+
function o(t, e) {
|
|
5
|
+
return t.name === e;
|
|
6
|
+
}
|
|
7
|
+
function c(t) {
|
|
8
|
+
return parseInt(t.name.slice(4), 10);
|
|
9
|
+
}
|
|
10
|
+
function h(t) {
|
|
11
|
+
switch (t) {
|
|
12
|
+
case "ES256":
|
|
13
|
+
return "P-256";
|
|
14
|
+
case "ES384":
|
|
15
|
+
return "P-384";
|
|
16
|
+
case "ES512":
|
|
17
|
+
return "P-521";
|
|
18
|
+
default:
|
|
19
|
+
throw new Error("unreachable");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function i(t, e) {
|
|
23
|
+
if (!t.usages.includes(e))
|
|
24
|
+
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`);
|
|
25
|
+
}
|
|
26
|
+
function u(t, e, n) {
|
|
27
|
+
switch (e) {
|
|
28
|
+
case "HS256":
|
|
29
|
+
case "HS384":
|
|
30
|
+
case "HS512": {
|
|
31
|
+
if (!o(t.algorithm, "HMAC"))
|
|
32
|
+
throw r("HMAC");
|
|
33
|
+
const a = parseInt(e.slice(2), 10);
|
|
34
|
+
if (c(t.algorithm.hash) !== a)
|
|
35
|
+
throw r(`SHA-${a}`, "algorithm.hash");
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case "RS256":
|
|
39
|
+
case "RS384":
|
|
40
|
+
case "RS512": {
|
|
41
|
+
if (!o(t.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
42
|
+
throw r("RSASSA-PKCS1-v1_5");
|
|
43
|
+
const a = parseInt(e.slice(2), 10);
|
|
44
|
+
if (c(t.algorithm.hash) !== a)
|
|
45
|
+
throw r(`SHA-${a}`, "algorithm.hash");
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "PS256":
|
|
49
|
+
case "PS384":
|
|
50
|
+
case "PS512": {
|
|
51
|
+
if (!o(t.algorithm, "RSA-PSS"))
|
|
52
|
+
throw r("RSA-PSS");
|
|
53
|
+
const a = parseInt(e.slice(2), 10);
|
|
54
|
+
if (c(t.algorithm.hash) !== a)
|
|
55
|
+
throw r(`SHA-${a}`, "algorithm.hash");
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case "Ed25519":
|
|
59
|
+
case "EdDSA": {
|
|
60
|
+
if (!o(t.algorithm, "Ed25519"))
|
|
61
|
+
throw r("Ed25519");
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case "ES256":
|
|
65
|
+
case "ES384":
|
|
66
|
+
case "ES512": {
|
|
67
|
+
if (!o(t.algorithm, "ECDSA"))
|
|
68
|
+
throw r("ECDSA");
|
|
69
|
+
const a = h(e);
|
|
70
|
+
if (t.algorithm.namedCurve !== a)
|
|
71
|
+
throw r(a, "algorithm.namedCurve");
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
default:
|
|
75
|
+
throw new TypeError("CryptoKey does not support this operation");
|
|
76
|
+
}
|
|
77
|
+
i(t, n);
|
|
14
78
|
}
|
|
15
79
|
export {
|
|
16
|
-
|
|
80
|
+
u as checkSigCryptoKey
|
|
17
81
|
};
|
|
@@ -1,81 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
case "ES384":
|
|
15
|
-
return "P-384";
|
|
16
|
-
case "ES512":
|
|
17
|
-
return "P-521";
|
|
18
|
-
default:
|
|
19
|
-
throw new Error("unreachable");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function i(t, e) {
|
|
23
|
-
if (!t.usages.includes(e))
|
|
24
|
-
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`);
|
|
25
|
-
}
|
|
26
|
-
function u(t, e, n) {
|
|
27
|
-
switch (e) {
|
|
28
|
-
case "HS256":
|
|
29
|
-
case "HS384":
|
|
30
|
-
case "HS512": {
|
|
31
|
-
if (!o(t.algorithm, "HMAC"))
|
|
32
|
-
throw r("HMAC");
|
|
33
|
-
const a = parseInt(e.slice(2), 10);
|
|
34
|
-
if (c(t.algorithm.hash) !== a)
|
|
35
|
-
throw r(`SHA-${a}`, "algorithm.hash");
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
case "RS256":
|
|
39
|
-
case "RS384":
|
|
40
|
-
case "RS512": {
|
|
41
|
-
if (!o(t.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
42
|
-
throw r("RSASSA-PKCS1-v1_5");
|
|
43
|
-
const a = parseInt(e.slice(2), 10);
|
|
44
|
-
if (c(t.algorithm.hash) !== a)
|
|
45
|
-
throw r(`SHA-${a}`, "algorithm.hash");
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
case "PS256":
|
|
49
|
-
case "PS384":
|
|
50
|
-
case "PS512": {
|
|
51
|
-
if (!o(t.algorithm, "RSA-PSS"))
|
|
52
|
-
throw r("RSA-PSS");
|
|
53
|
-
const a = parseInt(e.slice(2), 10);
|
|
54
|
-
if (c(t.algorithm.hash) !== a)
|
|
55
|
-
throw r(`SHA-${a}`, "algorithm.hash");
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
case "Ed25519":
|
|
59
|
-
case "EdDSA": {
|
|
60
|
-
if (!o(t.algorithm, "Ed25519"))
|
|
61
|
-
throw r("Ed25519");
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
case "ES256":
|
|
65
|
-
case "ES384":
|
|
66
|
-
case "ES512": {
|
|
67
|
-
if (!o(t.algorithm, "ECDSA"))
|
|
68
|
-
throw r("ECDSA");
|
|
69
|
-
const a = h(e);
|
|
70
|
-
if (t.algorithm.namedCurve !== a)
|
|
71
|
-
throw r(a, "algorithm.namedCurve");
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
default:
|
|
75
|
-
throw new TypeError("CryptoKey does not support this operation");
|
|
76
|
-
}
|
|
77
|
-
i(t, n);
|
|
1
|
+
import { SizeExceedsPaddingSizeError as a } from "./index.native236.js";
|
|
2
|
+
function o(r, i = {}) {
|
|
3
|
+
const { dir: n, size: e = 32 } = i;
|
|
4
|
+
if (e === 0)
|
|
5
|
+
return r;
|
|
6
|
+
const t = r.replace("0x", "");
|
|
7
|
+
if (t.length > e * 2)
|
|
8
|
+
throw new a({
|
|
9
|
+
size: Math.ceil(t.length / 2),
|
|
10
|
+
targetSize: e,
|
|
11
|
+
type: "Hex"
|
|
12
|
+
});
|
|
13
|
+
return `0x${t[n === "right" ? "padEnd" : "padStart"](e * 2, "0")}`;
|
|
78
14
|
}
|
|
79
15
|
export {
|
|
80
|
-
|
|
16
|
+
o as pad
|
|
81
17
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { __require as r } from "./index.
|
|
1
|
+
import { __require as r } from "./index.native227.js";
|
|
2
2
|
r();
|
|
@@ -8,15 +8,28 @@ const n = {
|
|
|
8
8
|
* @returns Promise that resolves to the stored value or null if not found.
|
|
9
9
|
*/
|
|
10
10
|
async getItem(t) {
|
|
11
|
+
return (await this.getItemWithOutcome(t)).value;
|
|
12
|
+
},
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves a value from secure storage with read outcome metadata.
|
|
15
|
+
*
|
|
16
|
+
* @param key - The storage key.
|
|
17
|
+
* @returns Promise that resolves to the stored value and read outcome.
|
|
18
|
+
*/
|
|
19
|
+
async getItemWithOutcome(t) {
|
|
11
20
|
try {
|
|
12
|
-
const { getItemAsync: e } = await import("expo-secure-store");
|
|
13
|
-
return
|
|
21
|
+
const { getItemAsync: e } = await import("expo-secure-store"), r = await e(t);
|
|
22
|
+
return r === null ? { value: null, outcome: "not_found" } : { value: r, outcome: "found" };
|
|
14
23
|
} catch (e) {
|
|
15
24
|
if (e instanceof Error && e.message.includes("Cannot resolve module"))
|
|
16
25
|
throw new Error(
|
|
17
26
|
"SecureStore is not available. Please install expo-secure-store and ensure it's properly configured in your React Native project."
|
|
18
27
|
);
|
|
19
|
-
return console.warn(`Failed to get item from SecureStore: ${e}`),
|
|
28
|
+
return console.warn(`Failed to get item from SecureStore: ${e}`), {
|
|
29
|
+
value: null,
|
|
30
|
+
outcome: "error",
|
|
31
|
+
errorMessage: e instanceof Error ? e.message : String(e)
|
|
32
|
+
};
|
|
20
33
|
}
|
|
21
34
|
},
|
|
22
35
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSolanaKeyExportIframe as t, createEvmKeyExportIframe as m } from "./index.
|
|
1
|
+
import { createSolanaKeyExportIframe as t, createEvmKeyExportIframe as m } from "./index.native138.js";
|
|
2
2
|
import { signBitcoinHash as i } from "./index.native67.js";
|
|
3
3
|
import "@coinbase/cdp-api-client";
|
|
4
4
|
import "./index.native2.js";
|
|
@@ -8,15 +8,28 @@ const n = {
|
|
|
8
8
|
* @returns Promise that resolves to the value.
|
|
9
9
|
*/
|
|
10
10
|
async getItem(t) {
|
|
11
|
+
return (await this.getItemWithOutcome(t)).value;
|
|
12
|
+
},
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves a value from AsyncStorage with read outcome metadata.
|
|
15
|
+
*
|
|
16
|
+
* @param key - The storage key.
|
|
17
|
+
* @returns Promise that resolves to the stored value and read outcome.
|
|
18
|
+
*/
|
|
19
|
+
async getItemWithOutcome(t) {
|
|
11
20
|
try {
|
|
12
|
-
const { default: e } = await import("@react-native-async-storage/async-storage");
|
|
13
|
-
return
|
|
21
|
+
const { default: e } = await import("@react-native-async-storage/async-storage"), r = await e.getItem(t);
|
|
22
|
+
return r === null ? { value: null, outcome: "not_found" } : { value: r, outcome: "found" };
|
|
14
23
|
} catch (e) {
|
|
15
24
|
if (e instanceof Error && e.message.includes("Cannot resolve module"))
|
|
16
25
|
throw new Error(
|
|
17
26
|
"AsyncStorage is not available. Please install @react-native-async-storage/async-storage and ensure it's properly linked in your React Native project."
|
|
18
27
|
);
|
|
19
|
-
return console.warn(`Failed to get item from AsyncStorage: ${e}`),
|
|
28
|
+
return console.warn(`Failed to get item from AsyncStorage: ${e}`), {
|
|
29
|
+
value: null,
|
|
30
|
+
outcome: "error",
|
|
31
|
+
errorMessage: e instanceof Error ? e.message : String(e)
|
|
32
|
+
};
|
|
20
33
|
}
|
|
21
34
|
},
|
|
22
35
|
/**
|
|
@@ -27,12 +40,12 @@ const n = {
|
|
|
27
40
|
*/
|
|
28
41
|
async setItem(t, e) {
|
|
29
42
|
try {
|
|
30
|
-
const { default:
|
|
31
|
-
await
|
|
32
|
-
} catch (
|
|
33
|
-
throw
|
|
43
|
+
const { default: r } = await import("@react-native-async-storage/async-storage");
|
|
44
|
+
await r.setItem(t, e);
|
|
45
|
+
} catch (r) {
|
|
46
|
+
throw r instanceof Error && r.message.includes("Cannot resolve module") ? new Error(
|
|
34
47
|
"AsyncStorage is not available. Please install @react-native-async-storage/async-storage and ensure it's properly linked in your React Native project."
|
|
35
|
-
) : (console.warn(`Failed to set item in AsyncStorage: ${
|
|
48
|
+
) : (console.warn(`Failed to set item in AsyncStorage: ${r}`), r);
|
|
36
49
|
}
|
|
37
50
|
},
|
|
38
51
|
/**
|
|
@@ -58,6 +58,13 @@ export interface PlatformStorage {
|
|
|
58
58
|
* @returns Promise that resolves to the stored value or null if not found.
|
|
59
59
|
*/
|
|
60
60
|
getItem(key: string): Promise<string | null>;
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves a value from storage with read outcome metadata.
|
|
63
|
+
*
|
|
64
|
+
* @param key - The storage key.
|
|
65
|
+
* @returns Promise that resolves to the stored value and read outcome.
|
|
66
|
+
*/
|
|
67
|
+
getItemWithOutcome(key: string): Promise<StorageReadResult>;
|
|
61
68
|
/**
|
|
62
69
|
* Stores a value in storage.
|
|
63
70
|
*
|
|
@@ -94,6 +101,13 @@ export interface PlatformSecureStorage {
|
|
|
94
101
|
* @returns Promise that resolves to the stored value or null if not found.
|
|
95
102
|
*/
|
|
96
103
|
getItem(key: string): Promise<string | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves a value from secure storage with read outcome metadata.
|
|
106
|
+
*
|
|
107
|
+
* @param key - The storage key.
|
|
108
|
+
* @returns Promise that resolves to the stored value and read outcome.
|
|
109
|
+
*/
|
|
110
|
+
getItemWithOutcome(key: string): Promise<StorageReadResult>;
|
|
97
111
|
/**
|
|
98
112
|
* Stores a value in secure storage.
|
|
99
113
|
*
|
|
@@ -116,6 +130,17 @@ export interface PlatformSecureStorage {
|
|
|
116
130
|
*/
|
|
117
131
|
clear(): Promise<void>;
|
|
118
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Result of reading a value from storage.
|
|
135
|
+
*/
|
|
136
|
+
export interface StorageReadResult {
|
|
137
|
+
/** The stored value, or null if not found or on error. */
|
|
138
|
+
value: string | null;
|
|
139
|
+
/** The outcome of the read: found, not found, or error. */
|
|
140
|
+
outcome: "found" | "not_found" | "error";
|
|
141
|
+
/** The error message when the read failed. */
|
|
142
|
+
errorMessage?: string;
|
|
143
|
+
}
|
|
119
144
|
/**
|
|
120
145
|
* Credential returned by a native Apple Sign In flow.
|
|
121
146
|
*/
|
|
@@ -58,6 +58,13 @@ export interface PlatformStorage {
|
|
|
58
58
|
* @returns Promise that resolves to the stored value or null if not found.
|
|
59
59
|
*/
|
|
60
60
|
getItem(key: string): Promise<string | null>;
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves a value from storage with read outcome metadata.
|
|
63
|
+
*
|
|
64
|
+
* @param key - The storage key.
|
|
65
|
+
* @returns Promise that resolves to the stored value and read outcome.
|
|
66
|
+
*/
|
|
67
|
+
getItemWithOutcome(key: string): Promise<StorageReadResult>;
|
|
61
68
|
/**
|
|
62
69
|
* Stores a value in storage.
|
|
63
70
|
*
|
|
@@ -94,6 +101,13 @@ export interface PlatformSecureStorage {
|
|
|
94
101
|
* @returns Promise that resolves to the stored value or null if not found.
|
|
95
102
|
*/
|
|
96
103
|
getItem(key: string): Promise<string | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves a value from secure storage with read outcome metadata.
|
|
106
|
+
*
|
|
107
|
+
* @param key - The storage key.
|
|
108
|
+
* @returns Promise that resolves to the stored value and read outcome.
|
|
109
|
+
*/
|
|
110
|
+
getItemWithOutcome(key: string): Promise<StorageReadResult>;
|
|
97
111
|
/**
|
|
98
112
|
* Stores a value in secure storage.
|
|
99
113
|
*
|
|
@@ -116,6 +130,17 @@ export interface PlatformSecureStorage {
|
|
|
116
130
|
*/
|
|
117
131
|
clear(): Promise<void>;
|
|
118
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Result of reading a value from storage.
|
|
135
|
+
*/
|
|
136
|
+
export interface StorageReadResult {
|
|
137
|
+
/** The stored value, or null if not found or on error. */
|
|
138
|
+
value: string | null;
|
|
139
|
+
/** The outcome of the read: found, not found, or error. */
|
|
140
|
+
outcome: "found" | "not_found" | "error";
|
|
141
|
+
/** The error message when the read failed. */
|
|
142
|
+
errorMessage?: string;
|
|
143
|
+
}
|
|
119
144
|
/**
|
|
120
145
|
* Credential returned by a native Apple Sign In flow.
|
|
121
146
|
*/
|
package/dist/types/version.d.ts
CHANGED
package/dist/web/index.web10.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { configureCdpApiClient as j, setAuthManager as
|
|
2
|
-
import { Analytics as
|
|
1
|
+
import { configureCdpApiClient as j, setAuthManager as v, getMfaConfig as C, APIError as g, getProjectConfig as S } from "@coinbase/cdp-api-client";
|
|
2
|
+
import { Analytics as c } from "./index.web2.js";
|
|
3
3
|
import "./index.web3.js";
|
|
4
|
-
import { createAuthManager as
|
|
5
|
-
import { OAuthManager as
|
|
6
|
-
import { MockAuthManager as
|
|
4
|
+
import { createAuthManager as y } from "./index.web115.js";
|
|
5
|
+
import { OAuthManager as M } from "./index.web116.js";
|
|
6
|
+
import { MockAuthManager as w } from "./index.web117.js";
|
|
7
7
|
import { MockOAuthManager as P } from "./index.web118.js";
|
|
8
8
|
import { getPlatformServices as m } from "./index.web5.js";
|
|
9
|
-
import { getConfig as
|
|
9
|
+
import { getConfig as i, setCoreAuthManager as h, setCoreOAuthManager as I, setMfaConfig as A, setProjectConfig as k, getCoreAuthManager as _, setConfig as O } from "./index.web74.js";
|
|
10
10
|
import "viem";
|
|
11
11
|
const x = async (t) => {
|
|
12
12
|
if (!t.projectId)
|
|
13
13
|
throw new Error("Project ID is required");
|
|
14
|
-
t.disableAnalytics === void 0 || t.disableAnalytics === !1 ? (
|
|
15
|
-
let
|
|
14
|
+
t.disableAnalytics === void 0 || t.disableAnalytics === !1 ? (c.developerIdentifier = t.projectId, c.isUsingMocks = t.useMock === !0, c.isProduction = !t.basePath || t.basePath === "https://api.cdp.coinbase.com/platform") : c.enabled = !1;
|
|
15
|
+
let a;
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
a = i().projectId !== t.projectId;
|
|
18
18
|
} catch {
|
|
19
|
-
|
|
19
|
+
a = !0;
|
|
20
20
|
}
|
|
21
|
-
if (
|
|
22
|
-
h(new
|
|
23
|
-
projectId:
|
|
21
|
+
if (O(t), i().useMock) {
|
|
22
|
+
h(new w(i().projectId)), I(new P()), A({
|
|
23
|
+
projectId: i().projectId,
|
|
24
24
|
enabled: !1,
|
|
25
25
|
totpConfig: { enabled: !1 },
|
|
26
26
|
smsConfig: { enabled: !1 },
|
|
@@ -29,57 +29,59 @@ const x = async (t) => {
|
|
|
29
29
|
requireVerificationOnLogin: !1,
|
|
30
30
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
31
31
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
32
|
-
}),
|
|
33
|
-
projectId:
|
|
32
|
+
}), k({
|
|
33
|
+
projectId: i().projectId,
|
|
34
34
|
name: "Mock Project",
|
|
35
35
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
36
36
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
37
37
|
});
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
let
|
|
40
|
+
let o, s = !1;
|
|
41
41
|
try {
|
|
42
42
|
const e = m();
|
|
43
|
-
e.secureStorage ? (
|
|
43
|
+
e.secureStorage ? (s = !0, o = {
|
|
44
44
|
getRefreshToken: () => e.secureStorage.getItem("cdp_refresh_token"),
|
|
45
|
-
|
|
45
|
+
getRefreshTokenWithOutcome: () => b(e.secureStorage),
|
|
46
|
+
setRefreshToken: (n) => e.secureStorage.setItem("cdp_refresh_token", n),
|
|
46
47
|
removeRefreshToken: () => e.secureStorage.removeItem("cdp_refresh_token")
|
|
47
|
-
}) :
|
|
48
|
+
}) : o = {
|
|
48
49
|
getRefreshToken: () => e.storage.getItem("cdp_refresh_token"),
|
|
49
|
-
|
|
50
|
+
getRefreshTokenWithOutcome: () => b(e.storage),
|
|
51
|
+
setRefreshToken: (n) => e.storage.setItem("cdp_refresh_token", n),
|
|
50
52
|
removeRefreshToken: () => e.storage.removeItem("cdp_refresh_token")
|
|
51
53
|
};
|
|
52
54
|
} catch {
|
|
53
|
-
|
|
55
|
+
c.sendSessionRefreshEvent({
|
|
54
56
|
name: "refresh_token_storage_not_initialized"
|
|
55
|
-
}),
|
|
57
|
+
}), o = void 0;
|
|
56
58
|
}
|
|
57
|
-
let r,
|
|
59
|
+
let r, d, p;
|
|
58
60
|
try {
|
|
59
61
|
const e = m();
|
|
60
|
-
|
|
62
|
+
p = e.deviceInfo?.getPlatform?.(), e.attestation && (r = e.attestation, d = e.deviceInfo?.getAppBundleId?.());
|
|
61
63
|
} catch {
|
|
62
64
|
r = void 0;
|
|
63
65
|
}
|
|
64
66
|
if (j({
|
|
65
|
-
debugging:
|
|
66
|
-
basePath:
|
|
67
|
-
refreshTokenStorage:
|
|
68
|
-
retryTokenReads:
|
|
69
|
-
platform:
|
|
67
|
+
debugging: i().debugging,
|
|
68
|
+
basePath: i().basePath,
|
|
69
|
+
refreshTokenStorage: o,
|
|
70
|
+
retryTokenReads: s,
|
|
71
|
+
platform: p,
|
|
70
72
|
appAttestation: r && {
|
|
71
73
|
isEnabled: () => r.isEnabled,
|
|
72
|
-
appIdentifier:
|
|
74
|
+
appIdentifier: d,
|
|
73
75
|
generateAssertion: r.generateAssertion.bind(r)
|
|
74
76
|
}
|
|
75
|
-
}),
|
|
76
|
-
const e = new
|
|
77
|
+
}), a) {
|
|
78
|
+
const e = new M();
|
|
77
79
|
I(e);
|
|
78
|
-
const
|
|
79
|
-
h(
|
|
80
|
+
const n = y(i().projectId);
|
|
81
|
+
h(n), v(n);
|
|
80
82
|
}
|
|
81
83
|
const [, f, l] = await Promise.allSettled([
|
|
82
|
-
|
|
84
|
+
_().ensureInitialized(),
|
|
83
85
|
(async () => {
|
|
84
86
|
try {
|
|
85
87
|
return await C(t.projectId);
|
|
@@ -89,7 +91,7 @@ const x = async (t) => {
|
|
|
89
91
|
})(),
|
|
90
92
|
(async () => {
|
|
91
93
|
try {
|
|
92
|
-
return await
|
|
94
|
+
return await S(t.projectId);
|
|
93
95
|
} catch (e) {
|
|
94
96
|
return (!(e instanceof g) || e.statusCode !== 404) && console.warn("Failed to get project config", e), null;
|
|
95
97
|
}
|
|
@@ -97,21 +99,24 @@ const x = async (t) => {
|
|
|
97
99
|
]);
|
|
98
100
|
if (f.status === "fulfilled" && f.value && A(f.value), l.status === "fulfilled" && l.value) {
|
|
99
101
|
const e = l.value;
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
-
|
|
102
|
+
if (k(e), e.appAttestation && r && d) {
|
|
103
|
+
const n = R(e.appAttestation, d);
|
|
104
|
+
n !== null && (console.warn(
|
|
103
105
|
"[Attestation] Project config has attestation enabled for this app, but no attestation provider is registered. Install @coinbase/cdp-app-attest and add `import '@coinbase/cdp-app-attest'` to your app's entry point."
|
|
104
|
-
), r.isEnabled = !0, r.cloudProjectNumber =
|
|
106
|
+
), r.isEnabled = !0, r.cloudProjectNumber = n.cloudProjectNumber, r.initialize().catch((u) => {
|
|
105
107
|
console.error(
|
|
106
108
|
"[Attestation] Background initialization failed:",
|
|
107
|
-
|
|
109
|
+
u instanceof Error ? u.message : String(u)
|
|
108
110
|
);
|
|
109
111
|
}));
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
|
-
},
|
|
113
|
-
const a = t.
|
|
114
|
-
return
|
|
114
|
+
}, b = async (t) => {
|
|
115
|
+
const { value: a, outcome: o, errorMessage: s } = await t.getItemWithOutcome("cdp_refresh_token");
|
|
116
|
+
return { token: a, outcome: o, errorMessage: s };
|
|
117
|
+
}, R = (t, a) => {
|
|
118
|
+
const o = t.android?.find((r) => r.identifier === a);
|
|
119
|
+
return o ? { cloudProjectNumber: o.googleProjectNumber } : t.ios?.find((r) => r.identifier === a) ? {} : null;
|
|
115
120
|
};
|
|
116
121
|
export {
|
|
117
122
|
x as initialize
|
package/dist/web/index.web107.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CompactSign as i } from "./index.
|
|
2
|
-
import { JWTInvalid as r } from "./index.
|
|
3
|
-
import { JWTClaimsBuilder as n } from "./index.
|
|
1
|
+
import { CompactSign as i } from "./index.web130.js";
|
|
2
|
+
import { JWTInvalid as r } from "./index.web131.js";
|
|
3
|
+
import { JWTClaimsBuilder as n } from "./index.web132.js";
|
|
4
4
|
class d {
|
|
5
5
|
#s;
|
|
6
6
|
#t;
|
package/dist/web/index.web110.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InvalidAddressError as s } from "./index.
|
|
2
|
-
import { isAddress as a } from "./index.
|
|
1
|
+
import { InvalidAddressError as s } from "./index.web170.js";
|
|
2
|
+
import { isAddress as a } from "./index.web171.js";
|
|
3
3
|
function r(n) {
|
|
4
4
|
if (typeof n == "string") {
|
|
5
5
|
if (!a(n, { strict: !1 }))
|