@coinbase/cdp-core 0.0.56 → 0.0.58

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.
Files changed (222) hide show
  1. package/dist/esm/index.native103.js +1 -1
  2. package/dist/esm/index.native115.js +1 -1
  3. package/dist/esm/index.native119.js +6 -6
  4. package/dist/esm/index.native127.js +2 -2
  5. package/dist/esm/index.native131.js +1 -1
  6. package/dist/esm/index.native134.js +19 -77
  7. package/dist/esm/index.native135.js +10 -47
  8. package/dist/esm/index.native136.js +20 -4
  9. package/dist/esm/index.native137.js +93 -20
  10. package/dist/esm/index.native138.js +20 -9
  11. package/dist/esm/index.native139.js +114 -16
  12. package/dist/esm/index.native140.js +75 -90
  13. package/dist/esm/index.native141.js +4 -21
  14. package/dist/esm/index.native142.js +44 -115
  15. package/dist/esm/index.native146.js +7 -38
  16. package/dist/esm/index.native148.js +375 -67
  17. package/dist/esm/index.native149.js +832 -34
  18. package/dist/esm/index.native150.js +38 -20
  19. package/dist/esm/index.native151.js +2 -8
  20. package/dist/esm/index.native152.js +70 -2
  21. package/dist/esm/index.native153.js +30 -373
  22. package/dist/esm/index.native154.js +20 -832
  23. package/dist/esm/index.native156.js +17 -14
  24. package/dist/esm/index.native157.js +28 -18
  25. package/dist/esm/index.native158.js +6 -26
  26. package/dist/esm/index.native159.js +9 -6
  27. package/dist/esm/index.native160.js +13 -11
  28. package/dist/esm/index.native161.js +8 -11
  29. package/dist/esm/index.native162.js +14 -7
  30. package/dist/esm/index.native163.js +80 -16
  31. package/dist/esm/index.native164.js +14 -80
  32. package/dist/esm/index.native165.js +2 -2
  33. package/dist/esm/index.native166.js +2 -2
  34. package/dist/esm/index.native167.js +2 -2
  35. package/dist/esm/index.native25.js +1 -1
  36. package/dist/esm/index.native45.js +1 -1
  37. package/dist/esm/index.native46.js +1 -1
  38. package/dist/esm/index.native47.js +1 -1
  39. package/dist/esm/index.native48.js +3 -3
  40. package/dist/esm/index.native54.js +2 -4
  41. package/dist/esm/index.native55.js +66 -2
  42. package/dist/esm/index.native56.js +367 -2
  43. package/dist/esm/index.native57.js +2 -66
  44. package/dist/esm/index.native58.js +2 -365
  45. package/dist/esm/index.web100.js +4 -2
  46. package/dist/esm/index.web101.js +19 -44
  47. package/dist/esm/index.web102.js +8 -13
  48. package/dist/esm/index.web103.js +7 -4
  49. package/dist/esm/index.web104.js +70 -17
  50. package/dist/esm/index.web105.js +18 -7
  51. package/dist/esm/index.web106.js +3 -3
  52. package/dist/esm/index.web107.js +4 -19
  53. package/dist/esm/index.web108.js +4 -8
  54. package/dist/esm/index.web109.js +4 -7
  55. package/dist/esm/index.web110.js +18 -70
  56. package/dist/esm/index.web111.js +47 -13
  57. package/dist/esm/index.web112.js +17 -3
  58. package/dist/esm/index.web113.js +20 -4
  59. package/dist/esm/index.web114.js +8 -4
  60. package/dist/esm/index.web115.js +30 -4
  61. package/dist/esm/index.web116.js +7 -19
  62. package/dist/esm/index.web117.js +16 -48
  63. package/dist/esm/index.web118.js +4 -17
  64. package/dist/esm/index.web119.js +53 -19
  65. package/dist/esm/index.web120.js +10 -8
  66. package/dist/esm/index.web121.js +2 -31
  67. package/dist/esm/index.web122.js +45 -8
  68. package/dist/esm/index.web123.js +13 -20
  69. package/dist/esm/index.web126.js +1 -1
  70. package/dist/esm/index.web130.js +1 -1
  71. package/dist/esm/index.web131.js +6 -32
  72. package/dist/esm/index.web132.js +32 -6
  73. package/dist/esm/index.web133.js +2 -79
  74. package/dist/esm/index.web134.js +109 -2
  75. package/dist/esm/index.web135.js +2 -109
  76. package/dist/esm/index.web136.js +79 -2
  77. package/dist/esm/index.web137.js +46 -3
  78. package/dist/esm/index.web138.js +3 -20
  79. package/dist/esm/index.web139.js +21 -10
  80. package/dist/esm/index.web140.js +9 -19
  81. package/dist/esm/index.web141.js +15 -89
  82. package/dist/esm/index.web142.js +92 -19
  83. package/dist/esm/index.web143.js +18 -115
  84. package/dist/esm/index.web144.js +115 -44
  85. package/dist/esm/index.web155.js +14 -17
  86. package/dist/esm/index.web156.js +18 -28
  87. package/dist/esm/index.web157.js +26 -6
  88. package/dist/esm/index.web158.js +6 -9
  89. package/dist/esm/index.web159.js +11 -13
  90. package/dist/esm/index.web160.js +11 -8
  91. package/dist/esm/index.web161.js +7 -14
  92. package/dist/esm/index.web162.js +16 -80
  93. package/dist/esm/index.web163.js +80 -14
  94. package/dist/esm/index.web40.js +1 -1
  95. package/dist/esm/index.web41.js +3 -3
  96. package/dist/esm/index.web46.js +2 -377
  97. package/dist/esm/index.web47.js +379 -2
  98. package/dist/esm/index.web48.js +28 -65
  99. package/dist/esm/index.web49.js +28 -364
  100. package/dist/esm/index.web50.js +2 -4
  101. package/dist/esm/index.web51.js +65 -28
  102. package/dist/esm/index.web52.js +364 -28
  103. package/dist/esm/index.web53.js +1 -1
  104. package/dist/esm/index.web55.js +4 -4
  105. package/dist/esm/index.web91.js +1 -1
  106. package/dist/esm/index.web92.js +1 -1
  107. package/dist/esm/index.web97.js +4 -4
  108. package/dist/esm/index.web98.js +17 -53
  109. package/dist/esm/index.web99.js +7 -10
  110. package/dist/native/index.native103.js +1 -1
  111. package/dist/native/index.native115.js +1 -1
  112. package/dist/native/index.native119.js +6 -6
  113. package/dist/native/index.native127.js +2 -2
  114. package/dist/native/index.native131.js +1 -1
  115. package/dist/native/index.native134.js +19 -77
  116. package/dist/native/index.native135.js +10 -47
  117. package/dist/native/index.native136.js +20 -4
  118. package/dist/native/index.native137.js +93 -20
  119. package/dist/native/index.native138.js +20 -9
  120. package/dist/native/index.native139.js +114 -16
  121. package/dist/native/index.native140.js +75 -90
  122. package/dist/native/index.native141.js +4 -21
  123. package/dist/native/index.native142.js +44 -115
  124. package/dist/native/index.native146.js +7 -38
  125. package/dist/native/index.native148.js +375 -67
  126. package/dist/native/index.native149.js +832 -34
  127. package/dist/native/index.native150.js +38 -20
  128. package/dist/native/index.native151.js +2 -8
  129. package/dist/native/index.native152.js +70 -2
  130. package/dist/native/index.native153.js +30 -373
  131. package/dist/native/index.native154.js +20 -832
  132. package/dist/native/index.native156.js +17 -14
  133. package/dist/native/index.native157.js +28 -18
  134. package/dist/native/index.native158.js +6 -26
  135. package/dist/native/index.native159.js +9 -6
  136. package/dist/native/index.native160.js +13 -11
  137. package/dist/native/index.native161.js +8 -11
  138. package/dist/native/index.native162.js +14 -7
  139. package/dist/native/index.native163.js +80 -16
  140. package/dist/native/index.native164.js +14 -80
  141. package/dist/native/index.native165.js +2 -2
  142. package/dist/native/index.native166.js +2 -2
  143. package/dist/native/index.native167.js +2 -2
  144. package/dist/native/index.native25.js +1 -1
  145. package/dist/native/index.native45.js +1 -1
  146. package/dist/native/index.native46.js +1 -1
  147. package/dist/native/index.native47.js +1 -1
  148. package/dist/native/index.native48.js +3 -3
  149. package/dist/native/index.native54.js +2 -4
  150. package/dist/native/index.native55.js +66 -2
  151. package/dist/native/index.native56.js +367 -2
  152. package/dist/native/index.native57.js +2 -66
  153. package/dist/native/index.native58.js +2 -365
  154. package/dist/native-types/version.d.ts +1 -1
  155. package/dist/types/version.d.ts +1 -1
  156. package/dist/web/index.web100.js +4 -2
  157. package/dist/web/index.web101.js +19 -44
  158. package/dist/web/index.web102.js +8 -13
  159. package/dist/web/index.web103.js +7 -4
  160. package/dist/web/index.web104.js +70 -17
  161. package/dist/web/index.web105.js +18 -7
  162. package/dist/web/index.web106.js +3 -3
  163. package/dist/web/index.web107.js +4 -19
  164. package/dist/web/index.web108.js +4 -8
  165. package/dist/web/index.web109.js +4 -7
  166. package/dist/web/index.web110.js +18 -70
  167. package/dist/web/index.web111.js +47 -13
  168. package/dist/web/index.web112.js +17 -3
  169. package/dist/web/index.web113.js +20 -4
  170. package/dist/web/index.web114.js +8 -4
  171. package/dist/web/index.web115.js +30 -4
  172. package/dist/web/index.web116.js +7 -19
  173. package/dist/web/index.web117.js +16 -48
  174. package/dist/web/index.web118.js +4 -17
  175. package/dist/web/index.web119.js +53 -19
  176. package/dist/web/index.web120.js +10 -8
  177. package/dist/web/index.web121.js +2 -31
  178. package/dist/web/index.web122.js +45 -8
  179. package/dist/web/index.web123.js +13 -20
  180. package/dist/web/index.web126.js +1 -1
  181. package/dist/web/index.web130.js +1 -1
  182. package/dist/web/index.web131.js +6 -32
  183. package/dist/web/index.web132.js +32 -6
  184. package/dist/web/index.web133.js +2 -79
  185. package/dist/web/index.web134.js +109 -2
  186. package/dist/web/index.web135.js +2 -109
  187. package/dist/web/index.web136.js +79 -2
  188. package/dist/web/index.web137.js +46 -3
  189. package/dist/web/index.web138.js +3 -20
  190. package/dist/web/index.web139.js +21 -10
  191. package/dist/web/index.web140.js +9 -19
  192. package/dist/web/index.web141.js +15 -89
  193. package/dist/web/index.web142.js +92 -19
  194. package/dist/web/index.web143.js +18 -115
  195. package/dist/web/index.web144.js +115 -44
  196. package/dist/web/index.web155.js +14 -17
  197. package/dist/web/index.web156.js +18 -28
  198. package/dist/web/index.web157.js +26 -6
  199. package/dist/web/index.web158.js +6 -9
  200. package/dist/web/index.web159.js +11 -13
  201. package/dist/web/index.web160.js +11 -8
  202. package/dist/web/index.web161.js +7 -14
  203. package/dist/web/index.web162.js +16 -80
  204. package/dist/web/index.web163.js +80 -14
  205. package/dist/web/index.web40.js +1 -1
  206. package/dist/web/index.web41.js +3 -3
  207. package/dist/web/index.web46.js +2 -377
  208. package/dist/web/index.web47.js +379 -2
  209. package/dist/web/index.web48.js +28 -65
  210. package/dist/web/index.web49.js +28 -364
  211. package/dist/web/index.web50.js +2 -4
  212. package/dist/web/index.web51.js +65 -28
  213. package/dist/web/index.web52.js +364 -28
  214. package/dist/web/index.web53.js +1 -1
  215. package/dist/web/index.web55.js +4 -4
  216. package/dist/web/index.web91.js +1 -1
  217. package/dist/web/index.web92.js +1 -1
  218. package/dist/web/index.web97.js +4 -4
  219. package/dist/web/index.web98.js +17 -53
  220. package/dist/web/index.web99.js +7 -10
  221. package/dist/web-types/version.d.ts +1 -1
  222. package/package.json +3 -3
@@ -1,17 +1,20 @@
1
- import { SizeExceedsPaddingSizeError as a } from "./index.native135.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")}`;
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
- o as pad
18
+ a as decodeBase64,
19
+ o as encodeBase64
17
20
  };
@@ -1,20 +1,30 @@
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;
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
- a as decodeBase64,
19
- o as encodeBase64
29
+ S as default
20
30
  };
@@ -1,30 +1,10 @@
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`);
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
- S as default
9
+ o as default
30
10
  };
@@ -1,10 +1,13 @@
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`);
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
- o as default
12
+ s as default
10
13
  };
@@ -1,13 +1,15 @@
1
- import { checkSigCryptoKey as i } from "./index.native168.js";
2
- import o from "./index.native161.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]);
8
- }
9
- return i(r, t, e), r;
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
- s as default
13
+ r as default,
14
+ t as withAlg
13
15
  };
@@ -1,15 +1,12 @@
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;
1
+ function e(t) {
2
+ return t?.[Symbol.toStringTag] === "CryptoKey";
7
3
  }
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);
4
+ function r(t) {
5
+ return t?.[Symbol.toStringTag] === "KeyObject";
11
6
  }
7
+ const n = (t) => e(t) || r(t);
12
8
  export {
13
- r as default,
14
- t as withAlg
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?.[Symbol.toStringTag] === "CryptoKey";
9
+ return t.kty !== "oct" && typeof t.d > "u";
3
10
  }
4
- function r(t) {
5
- return t?.[Symbol.toStringTag] === "KeyObject";
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
- n as default,
10
- e as isCryptoKey,
11
- r as isKeyObject
15
+ r as isJWK,
16
+ o as isPrivateJWK,
17
+ e as isPublicJWK,
18
+ c as isSecretJWK
12
19
  };
@@ -1,19 +1,83 @@
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
- }
8
- function e(t) {
9
- return t.kty !== "oct" && typeof t.d > "u";
10
- }
11
- function c(t) {
12
- return t.kty === "oct" && typeof t.k == "string";
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
- r as isJWK,
16
- o as isPrivateJWK,
17
- e as isPublicJWK,
18
- c as isSecretJWK
82
+ i as default
19
83
  };
@@ -1,83 +1,17 @@
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 };
1
+ import { SizeExceedsPaddingSizeError as a } from "./index.native142.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
- i as default
16
+ o as pad
83
17
  };
@@ -1,4 +1,4 @@
1
- var r = { exports: {} };
1
+ var r = {};
2
2
  export {
3
- r as __module
3
+ r as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var r = {};
1
+ var e = { exports: {} };
2
2
  export {
3
- r as __exports
3
+ e as __module
4
4
  };
@@ -1,4 +1,4 @@
1
- var e = { exports: {} };
1
+ var r = { exports: {} };
2
2
  export {
3
- e as __module
3
+ r as __module
4
4
  };
@@ -1,2 +1,2 @@
1
- import { __require as r } from "./index.native151.js";
1
+ import { __require as r } from "./index.native146.js";
2
2
  r();
@@ -1,4 +1,4 @@
1
- import { __exports as F } from "./index.native54.js";
1
+ import { __exports as F } from "./index.native57.js";
2
2
  var A;
3
3
  function _() {
4
4
  if (A) return F;
@@ -1,4 +1,4 @@
1
- import { __exports as n } from "./index.native55.js";
1
+ import { __exports as n } from "./index.native58.js";
2
2
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
3
3
  var d;
4
4
  function q() {
@@ -1,4 +1,4 @@
1
- const o = "0.0.56";
1
+ const o = "0.0.58";
2
2
  export {
3
3
  o as VERSION
4
4
  };
@@ -1,6 +1,6 @@
1
- import "./index.native56.js";
2
- import { BaseError as P } from "./index.native57.js";
3
- import { parse as y, parseError as j, InternalError as g } from "./index.native58.js";
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,2 @@
1
- var s = {};
2
- export {
3
- s as __exports
4
- };
1
+ import { __require as e } from "./index.native144.js";
2
+ e();
@@ -1,4 +1,68 @@
1
- var e = {};
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
- e as __exports
67
+ s as BaseError
4
68
  };