@coinbase/cdp-core 0.0.56 → 0.0.57
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.native103.js +1 -1
- package/dist/esm/index.native115.js +1 -1
- package/dist/esm/index.native119.js +6 -6
- package/dist/esm/index.native127.js +1 -1
- package/dist/esm/index.native131.js +1 -1
- package/dist/esm/index.native134.js +19 -77
- package/dist/esm/index.native135.js +10 -47
- package/dist/esm/index.native136.js +20 -4
- package/dist/esm/index.native137.js +93 -20
- package/dist/esm/index.native138.js +20 -9
- package/dist/esm/index.native139.js +114 -16
- package/dist/esm/index.native140.js +44 -91
- package/dist/esm/index.native141.js +78 -20
- package/dist/esm/index.native142.js +4 -118
- package/dist/esm/index.native156.js +17 -14
- package/dist/esm/index.native157.js +28 -18
- package/dist/esm/index.native158.js +6 -26
- package/dist/esm/index.native159.js +9 -6
- package/dist/esm/index.native160.js +13 -11
- package/dist/esm/index.native161.js +8 -11
- package/dist/esm/index.native162.js +14 -7
- package/dist/esm/index.native163.js +80 -16
- package/dist/esm/index.native164.js +14 -80
- package/dist/esm/index.native45.js +1 -1
- package/dist/esm/index.native46.js +1 -1
- package/dist/esm/index.native48.js +3 -3
- package/dist/esm/index.native54.js +2 -4
- package/dist/esm/index.native55.js +66 -2
- package/dist/esm/index.native56.js +367 -2
- package/dist/esm/index.native57.js +2 -66
- package/dist/esm/index.native58.js +2 -365
- package/dist/esm/index.web103.js +2 -5
- package/dist/esm/index.web104.js +4 -18
- package/dist/esm/index.web105.js +18 -7
- package/dist/esm/index.web106.js +7 -3
- package/dist/esm/index.web107.js +3 -19
- package/dist/esm/index.web108.js +19 -8
- package/dist/esm/index.web109.js +8 -7
- package/dist/esm/index.web110.js +7 -71
- package/dist/esm/index.web111.js +70 -17
- package/dist/esm/index.web112.js +18 -3
- package/dist/esm/index.web113.js +3 -4
- package/dist/esm/index.web114.js +4 -4
- package/dist/esm/index.web115.js +4 -4
- package/dist/esm/index.web116.js +4 -19
- package/dist/esm/index.web117.js +15 -48
- package/dist/esm/index.web118.js +52 -17
- package/dist/esm/index.web119.js +17 -20
- package/dist/esm/index.web120.js +20 -8
- package/dist/esm/index.web121.js +8 -30
- package/dist/esm/index.web122.js +30 -7
- package/dist/esm/index.web123.js +7 -20
- package/dist/esm/index.web124.js +21 -2
- package/dist/esm/index.web144.js +1 -1
- package/dist/esm/index.web40.js +1 -1
- package/dist/esm/index.web41.js +3 -3
- package/dist/esm/index.web46.js +2 -377
- package/dist/esm/index.web47.js +379 -2
- package/dist/esm/index.web48.js +28 -65
- package/dist/esm/index.web49.js +28 -364
- package/dist/esm/index.web50.js +2 -4
- package/dist/esm/index.web51.js +65 -28
- package/dist/esm/index.web52.js +364 -28
- package/dist/esm/index.web73.js +1 -1
- package/dist/native/index.native103.js +1 -1
- package/dist/native/index.native115.js +1 -1
- package/dist/native/index.native119.js +6 -6
- package/dist/native/index.native127.js +1 -1
- package/dist/native/index.native131.js +1 -1
- package/dist/native/index.native134.js +19 -77
- package/dist/native/index.native135.js +10 -47
- package/dist/native/index.native136.js +20 -4
- package/dist/native/index.native137.js +93 -20
- package/dist/native/index.native138.js +20 -9
- package/dist/native/index.native139.js +114 -16
- package/dist/native/index.native140.js +44 -91
- package/dist/native/index.native141.js +78 -20
- package/dist/native/index.native142.js +4 -118
- package/dist/native/index.native156.js +17 -14
- package/dist/native/index.native157.js +28 -18
- package/dist/native/index.native158.js +6 -26
- package/dist/native/index.native159.js +9 -6
- package/dist/native/index.native160.js +13 -11
- package/dist/native/index.native161.js +8 -11
- package/dist/native/index.native162.js +14 -7
- package/dist/native/index.native163.js +80 -16
- package/dist/native/index.native164.js +14 -80
- package/dist/native/index.native45.js +1 -1
- package/dist/native/index.native46.js +1 -1
- package/dist/native/index.native48.js +3 -3
- package/dist/native/index.native54.js +2 -4
- package/dist/native/index.native55.js +66 -2
- package/dist/native/index.native56.js +367 -2
- package/dist/native/index.native57.js +2 -66
- package/dist/native/index.native58.js +2 -365
- package/dist/web/index.web103.js +2 -5
- package/dist/web/index.web104.js +4 -18
- package/dist/web/index.web105.js +18 -7
- package/dist/web/index.web106.js +7 -3
- package/dist/web/index.web107.js +3 -19
- package/dist/web/index.web108.js +19 -8
- package/dist/web/index.web109.js +8 -7
- package/dist/web/index.web110.js +7 -71
- package/dist/web/index.web111.js +70 -17
- package/dist/web/index.web112.js +18 -3
- package/dist/web/index.web113.js +3 -4
- package/dist/web/index.web114.js +4 -4
- package/dist/web/index.web115.js +4 -4
- package/dist/web/index.web116.js +4 -19
- package/dist/web/index.web117.js +15 -48
- package/dist/web/index.web118.js +52 -17
- package/dist/web/index.web119.js +17 -20
- package/dist/web/index.web120.js +20 -8
- package/dist/web/index.web121.js +8 -30
- package/dist/web/index.web122.js +30 -7
- package/dist/web/index.web123.js +7 -20
- package/dist/web/index.web124.js +21 -2
- package/dist/web/index.web144.js +1 -1
- package/dist/web/index.web40.js +1 -1
- package/dist/web/index.web41.js +3 -3
- package/dist/web/index.web46.js +2 -377
- package/dist/web/index.web47.js +379 -2
- package/dist/web/index.web48.js +28 -65
- package/dist/web/index.web49.js +28 -364
- package/dist/web/index.web50.js +2 -4
- package/dist/web/index.web51.js +65 -28
- package/dist/web/index.web52.js +364 -28
- package/dist/web/index.web73.js +1 -1
- package/package.json +3 -3
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
function o(t) {
|
|
2
|
+
if (Uint8Array.prototype.toBase64)
|
|
3
|
+
return t.toBase64();
|
|
4
|
+
const e = 32768, n = [];
|
|
5
|
+
for (let r = 0; r < t.length; r += e)
|
|
6
|
+
n.push(String.fromCharCode.apply(null, t.subarray(r, r + e)));
|
|
7
|
+
return btoa(n.join(""));
|
|
8
|
+
}
|
|
9
|
+
function a(t) {
|
|
10
|
+
if (Uint8Array.fromBase64)
|
|
11
|
+
return Uint8Array.fromBase64(t);
|
|
12
|
+
const e = atob(t), n = new Uint8Array(e.length);
|
|
13
|
+
for (let r = 0; r < e.length; r++)
|
|
14
|
+
n[r] = e.charCodeAt(r);
|
|
15
|
+
return n;
|
|
14
16
|
}
|
|
15
17
|
export {
|
|
16
|
-
|
|
18
|
+
a as decodeBase64,
|
|
19
|
+
o as encodeBase64
|
|
17
20
|
};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
1
|
+
import { JOSENotSupported as r } from "./index.native52.js";
|
|
2
|
+
const S = (e, s) => {
|
|
3
|
+
const a = `SHA-${e.slice(-3)}`;
|
|
4
|
+
switch (e) {
|
|
5
|
+
case "HS256":
|
|
6
|
+
case "HS384":
|
|
7
|
+
case "HS512":
|
|
8
|
+
return { hash: a, name: "HMAC" };
|
|
9
|
+
case "PS256":
|
|
10
|
+
case "PS384":
|
|
11
|
+
case "PS512":
|
|
12
|
+
return { hash: a, name: "RSA-PSS", saltLength: parseInt(e.slice(-3), 10) >> 3 };
|
|
13
|
+
case "RS256":
|
|
14
|
+
case "RS384":
|
|
15
|
+
case "RS512":
|
|
16
|
+
return { hash: a, name: "RSASSA-PKCS1-v1_5" };
|
|
17
|
+
case "ES256":
|
|
18
|
+
case "ES384":
|
|
19
|
+
case "ES512":
|
|
20
|
+
return { hash: a, name: "ECDSA", namedCurve: s.namedCurve };
|
|
21
|
+
case "Ed25519":
|
|
22
|
+
case "EdDSA":
|
|
23
|
+
return { name: "Ed25519" };
|
|
24
|
+
default:
|
|
25
|
+
throw new r(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
17
28
|
export {
|
|
18
|
-
|
|
19
|
-
o as encodeBase64
|
|
29
|
+
S as default
|
|
20
30
|
};
|
|
@@ -1,30 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
case "HS384":
|
|
7
|
-
case "HS512":
|
|
8
|
-
return { hash: a, name: "HMAC" };
|
|
9
|
-
case "PS256":
|
|
10
|
-
case "PS384":
|
|
11
|
-
case "PS512":
|
|
12
|
-
return { hash: a, name: "RSA-PSS", saltLength: parseInt(e.slice(-3), 10) >> 3 };
|
|
13
|
-
case "RS256":
|
|
14
|
-
case "RS384":
|
|
15
|
-
case "RS512":
|
|
16
|
-
return { hash: a, name: "RSASSA-PKCS1-v1_5" };
|
|
17
|
-
case "ES256":
|
|
18
|
-
case "ES384":
|
|
19
|
-
case "ES512":
|
|
20
|
-
return { hash: a, name: "ECDSA", namedCurve: s.namedCurve };
|
|
21
|
-
case "Ed25519":
|
|
22
|
-
case "EdDSA":
|
|
23
|
-
return { name: "Ed25519" };
|
|
24
|
-
default:
|
|
25
|
-
throw new r(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
1
|
+
const o = (t, r) => {
|
|
2
|
+
if (t.startsWith("RS") || t.startsWith("PS")) {
|
|
3
|
+
const { modulusLength: e } = r.algorithm;
|
|
4
|
+
if (typeof e != "number" || e < 2048)
|
|
5
|
+
throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`);
|
|
26
6
|
}
|
|
27
7
|
};
|
|
28
8
|
export {
|
|
29
|
-
|
|
9
|
+
o as default
|
|
30
10
|
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { checkSigCryptoKey as i } from "./index.native168.js";
|
|
2
|
+
import o from "./index.native160.js";
|
|
3
|
+
const s = async (t, r, e) => {
|
|
4
|
+
if (r instanceof Uint8Array) {
|
|
5
|
+
if (!t.startsWith("HS"))
|
|
6
|
+
throw new TypeError(o(r, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
7
|
+
return crypto.subtle.importKey("raw", r, { hash: `SHA-${t.slice(-3)}`, name: "HMAC" }, !1, [e]);
|
|
6
8
|
}
|
|
9
|
+
return i(r, t, e), r;
|
|
7
10
|
};
|
|
8
11
|
export {
|
|
9
|
-
|
|
12
|
+
s as default
|
|
10
13
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
1
|
+
function i(n, e, ...o) {
|
|
2
|
+
if (o = o.filter(Boolean), o.length > 2) {
|
|
3
|
+
const f = o.pop();
|
|
4
|
+
n += `one of type ${o.join(", ")}, or ${f}.`;
|
|
5
|
+
} else o.length === 2 ? n += `one of type ${o[0]} or ${o[1]}.` : n += `of type ${o[0]}.`;
|
|
6
|
+
return e == null ? n += ` Received ${e}` : typeof e == "function" && e.name ? n += ` Received function ${e.name}` : typeof e == "object" && e != null && e.constructor?.name && (n += ` Received an instance of ${e.constructor.name}`), n;
|
|
7
|
+
}
|
|
8
|
+
const r = (n, ...e) => i("Key must be ", n, ...e);
|
|
9
|
+
function t(n, e, ...o) {
|
|
10
|
+
return i(`Key for the ${n} algorithm must be `, e, ...o);
|
|
11
|
+
}
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
r as default,
|
|
14
|
+
t as withAlg
|
|
13
15
|
};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
const f = o.pop();
|
|
4
|
-
n += `one of type ${o.join(", ")}, or ${f}.`;
|
|
5
|
-
} else o.length === 2 ? n += `one of type ${o[0]} or ${o[1]}.` : n += `of type ${o[0]}.`;
|
|
6
|
-
return e == null ? n += ` Received ${e}` : typeof e == "function" && e.name ? n += ` Received function ${e.name}` : typeof e == "object" && e != null && e.constructor?.name && (n += ` Received an instance of ${e.constructor.name}`), n;
|
|
1
|
+
function e(t) {
|
|
2
|
+
return t?.[Symbol.toStringTag] === "CryptoKey";
|
|
7
3
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return i(`Key for the ${n} algorithm must be `, e, ...o);
|
|
4
|
+
function r(t) {
|
|
5
|
+
return t?.[Symbol.toStringTag] === "KeyObject";
|
|
11
6
|
}
|
|
7
|
+
const n = (t) => e(t) || r(t);
|
|
12
8
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
n as default,
|
|
10
|
+
e as isCryptoKey,
|
|
11
|
+
r as isKeyObject
|
|
15
12
|
};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import n from "./index.native123.js";
|
|
2
|
+
function r(t) {
|
|
3
|
+
return n(t) && typeof t.kty == "string";
|
|
4
|
+
}
|
|
5
|
+
function o(t) {
|
|
6
|
+
return t.kty !== "oct" && typeof t.d == "string";
|
|
7
|
+
}
|
|
1
8
|
function e(t) {
|
|
2
|
-
return t
|
|
9
|
+
return t.kty !== "oct" && typeof t.d > "u";
|
|
3
10
|
}
|
|
4
|
-
function
|
|
5
|
-
return t
|
|
11
|
+
function c(t) {
|
|
12
|
+
return t.kty === "oct" && typeof t.k == "string";
|
|
6
13
|
}
|
|
7
|
-
const n = (t) => e(t) || r(t);
|
|
8
14
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
r as isJWK,
|
|
16
|
+
o as isPrivateJWK,
|
|
17
|
+
e as isPublicJWK,
|
|
18
|
+
c as isSecretJWK
|
|
12
19
|
};
|
|
@@ -1,19 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { JOSENotSupported as s } from "./index.native52.js";
|
|
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 };
|
|
13
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
|
+
};
|
|
14
81
|
export {
|
|
15
|
-
|
|
16
|
-
o as isPrivateJWK,
|
|
17
|
-
e as isPublicJWK,
|
|
18
|
-
c as isSecretJWK
|
|
82
|
+
i as default
|
|
19
83
|
};
|
|
@@ -1,83 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 };
|
|
1
|
+
import { SizeExceedsPaddingSizeError as a } from "./index.native140.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")}`;
|
|
74
14
|
}
|
|
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
|
-
};
|
|
81
15
|
export {
|
|
82
|
-
|
|
16
|
+
o as pad
|
|
83
17
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index.
|
|
2
|
-
import { BaseError as P } from "./index.
|
|
3
|
-
import { parse as y, parseError as j, InternalError as g } from "./index.
|
|
1
|
+
import "./index.native54.js";
|
|
2
|
+
import { BaseError as P } from "./index.native55.js";
|
|
3
|
+
import { parse as y, parseError as j, InternalError as g } from "./index.native56.js";
|
|
4
4
|
class u extends Error {
|
|
5
5
|
constructor(e, t) {
|
|
6
6
|
super(t), Object.defineProperty(this, "name", {
|
|
@@ -1,4 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
import { getVersion as n } from "./index.native124.js";
|
|
2
|
+
class s extends Error {
|
|
3
|
+
constructor(r, e = {}) {
|
|
4
|
+
const a = (() => {
|
|
5
|
+
if (e.cause instanceof s) {
|
|
6
|
+
if (e.cause.details)
|
|
7
|
+
return e.cause.details;
|
|
8
|
+
if (e.cause.shortMessage)
|
|
9
|
+
return e.cause.shortMessage;
|
|
10
|
+
}
|
|
11
|
+
return e.cause && "details" in e.cause && typeof e.cause.details == "string" ? e.cause.details : e.cause?.message ? e.cause.message : e.details;
|
|
12
|
+
})(), u = e.cause instanceof s && e.cause.docsPath || e.docsPath, c = `https://oxlib.sh${u ?? ""}`, l = [
|
|
13
|
+
r || "An error occurred.",
|
|
14
|
+
...e.metaMessages ? ["", ...e.metaMessages] : [],
|
|
15
|
+
...a || u ? [
|
|
16
|
+
"",
|
|
17
|
+
a ? `Details: ${a}` : void 0,
|
|
18
|
+
u ? `See: ${c}` : void 0
|
|
19
|
+
] : []
|
|
20
|
+
].filter((d) => typeof d == "string").join(`
|
|
21
|
+
`);
|
|
22
|
+
super(l, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
23
|
+
enumerable: !0,
|
|
24
|
+
configurable: !0,
|
|
25
|
+
writable: !0,
|
|
26
|
+
value: void 0
|
|
27
|
+
}), Object.defineProperty(this, "docs", {
|
|
28
|
+
enumerable: !0,
|
|
29
|
+
configurable: !0,
|
|
30
|
+
writable: !0,
|
|
31
|
+
value: void 0
|
|
32
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
33
|
+
enumerable: !0,
|
|
34
|
+
configurable: !0,
|
|
35
|
+
writable: !0,
|
|
36
|
+
value: void 0
|
|
37
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
38
|
+
enumerable: !0,
|
|
39
|
+
configurable: !0,
|
|
40
|
+
writable: !0,
|
|
41
|
+
value: void 0
|
|
42
|
+
}), Object.defineProperty(this, "cause", {
|
|
43
|
+
enumerable: !0,
|
|
44
|
+
configurable: !0,
|
|
45
|
+
writable: !0,
|
|
46
|
+
value: void 0
|
|
47
|
+
}), Object.defineProperty(this, "name", {
|
|
48
|
+
enumerable: !0,
|
|
49
|
+
configurable: !0,
|
|
50
|
+
writable: !0,
|
|
51
|
+
value: "BaseError"
|
|
52
|
+
}), Object.defineProperty(this, "version", {
|
|
53
|
+
enumerable: !0,
|
|
54
|
+
configurable: !0,
|
|
55
|
+
writable: !0,
|
|
56
|
+
value: `ox@${n()}`
|
|
57
|
+
}), this.cause = e.cause, this.details = a, this.docs = c, this.docsPath = u, this.shortMessage = r;
|
|
58
|
+
}
|
|
59
|
+
walk(r) {
|
|
60
|
+
return i(this, r);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function i(t, r) {
|
|
64
|
+
return r?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause ? i(t.cause, r) : r ? null : t;
|
|
65
|
+
}
|
|
2
66
|
export {
|
|
3
|
-
|
|
67
|
+
s as BaseError
|
|
4
68
|
};
|