@coinbase/cdp-core 0.0.81 → 0.0.82

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 (308) hide show
  1. package/dist/esm/index.native116.js +1 -1
  2. package/dist/esm/index.native117.js +1 -1
  3. package/dist/esm/index.native122.js +1 -1
  4. package/dist/esm/index.native123.js +1 -1
  5. package/dist/esm/index.native125.js +6 -6
  6. package/dist/esm/index.native155.js +1 -1
  7. package/dist/esm/index.native160.js +6 -32
  8. package/dist/esm/index.native161.js +32 -6
  9. package/dist/esm/index.native162.js +4 -20
  10. package/dist/esm/index.native163.js +21 -10
  11. package/dist/esm/index.native164.js +9 -19
  12. package/dist/esm/index.native165.js +15 -89
  13. package/dist/esm/index.native166.js +92 -19
  14. package/dist/esm/index.native167.js +18 -115
  15. package/dist/esm/index.native168.js +118 -5
  16. package/dist/esm/index.native172.js +7 -38
  17. package/dist/esm/index.native174.js +375 -67
  18. package/dist/esm/index.native175.js +835 -34
  19. package/dist/esm/index.native176.js +38 -20
  20. package/dist/esm/index.native177.js +2 -8
  21. package/dist/esm/index.native178.js +70 -2
  22. package/dist/esm/index.native179.js +30 -373
  23. package/dist/esm/index.native180.js +20 -835
  24. package/dist/esm/index.native182.js +2 -18
  25. package/dist/esm/index.native183.js +109 -28
  26. package/dist/esm/index.native184.js +2 -8
  27. package/dist/esm/index.native185.js +18 -11
  28. package/dist/esm/index.native186.js +28 -13
  29. package/dist/esm/index.native187.js +8 -10
  30. package/dist/esm/index.native188.js +11 -17
  31. package/dist/esm/index.native189.js +12 -80
  32. package/dist/esm/index.native190.js +10 -2
  33. package/dist/esm/index.native191.js +16 -108
  34. package/dist/esm/index.native192.js +81 -2
  35. package/dist/esm/index.native194.js +2 -2
  36. package/dist/esm/index.native195.js +2 -2
  37. package/dist/esm/index.native196.js +2 -2
  38. package/dist/esm/index.native3.js +1 -1
  39. package/dist/esm/index.native69.js +3 -3
  40. package/dist/esm/index.native72.js +1 -1
  41. package/dist/esm/index.native73.js +1 -1
  42. package/dist/esm/index.native78.js +2 -377
  43. package/dist/esm/index.native79.js +2 -29
  44. package/dist/esm/index.native80.js +374 -26
  45. package/dist/esm/index.native81.js +29 -2
  46. package/dist/esm/index.native82.js +29 -2
  47. package/dist/esm/index.native9.js +1 -1
  48. package/dist/esm/index.web100.js +6 -127
  49. package/dist/esm/index.web101.js +40 -21
  50. package/dist/esm/index.web102.js +53 -10
  51. package/dist/esm/index.web103.js +125 -102
  52. package/dist/esm/index.web104.js +23 -6
  53. package/dist/esm/index.web105.js +13 -3
  54. package/dist/esm/index.web106.js +104 -14
  55. package/dist/esm/index.web107.js +6 -34
  56. package/dist/esm/index.web108.js +3 -79
  57. package/dist/esm/index.web109.js +15 -2
  58. package/dist/esm/index.web110.js +35 -2
  59. package/dist/esm/index.web111.js +77 -11
  60. package/dist/esm/index.web112.js +2 -38
  61. package/dist/esm/index.web113.js +2 -7
  62. package/dist/esm/index.web114.js +10 -32
  63. package/dist/esm/index.web115.js +37 -8
  64. package/dist/esm/index.web116.js +5 -9
  65. package/dist/esm/index.web117.js +34 -11
  66. package/dist/esm/index.web118.js +8 -13
  67. package/dist/esm/index.web119.js +9 -17
  68. package/dist/esm/index.web120.js +11 -5
  69. package/dist/esm/index.web121.js +14 -5
  70. package/dist/esm/index.web122.js +18 -10
  71. package/dist/esm/index.web123.js +8 -2
  72. package/dist/esm/index.web124.js +5 -66
  73. package/dist/esm/index.web125.js +10 -364
  74. package/dist/esm/index.web131.js +5 -2
  75. package/dist/esm/index.web132.js +18 -4
  76. package/dist/esm/index.web133.js +7 -18
  77. package/dist/esm/index.web134.js +3 -7
  78. package/dist/esm/index.web135.js +19 -3
  79. package/dist/esm/index.web136.js +8 -19
  80. package/dist/esm/index.web137.js +7 -8
  81. package/dist/esm/index.web138.js +71 -7
  82. package/dist/esm/index.web139.js +17 -70
  83. package/dist/esm/index.web140.js +3 -18
  84. package/dist/esm/index.web141.js +4 -3
  85. package/dist/esm/index.web142.js +4 -4
  86. package/dist/esm/index.web143.js +4 -4
  87. package/dist/esm/index.web144.js +19 -4
  88. package/dist/esm/index.web145.js +48 -15
  89. package/dist/esm/index.web146.js +17 -52
  90. package/dist/esm/index.web147.js +23 -17
  91. package/dist/esm/index.web148.js +8 -23
  92. package/dist/esm/index.web149.js +33 -8
  93. package/dist/esm/index.web150.js +7 -33
  94. package/dist/esm/index.web151.js +20 -7
  95. package/dist/esm/index.web152.js +4 -20
  96. package/dist/esm/index.web153.js +5 -21
  97. package/dist/esm/index.web154.js +48 -5
  98. package/dist/esm/index.web155.js +2 -48
  99. package/dist/esm/index.web156.js +18 -17
  100. package/dist/esm/index.web157.js +20 -80
  101. package/dist/esm/index.web158.js +79 -103
  102. package/dist/esm/index.web159.js +101 -30
  103. package/dist/esm/index.web160.js +32 -6
  104. package/dist/esm/index.web161.js +6 -4
  105. package/dist/esm/index.web162.js +1 -1
  106. package/dist/esm/index.web169.js +2 -4
  107. package/dist/esm/index.web170.js +108 -46
  108. package/dist/esm/index.web171.js +2 -39
  109. package/dist/esm/index.web172.js +4 -2
  110. package/dist/esm/index.web173.js +36 -67
  111. package/dist/esm/index.web174.js +2 -35
  112. package/dist/esm/index.web175.js +69 -20
  113. package/dist/esm/index.web176.js +34 -7
  114. package/dist/esm/index.web177.js +21 -2
  115. package/dist/esm/index.web178.js +7 -377
  116. package/dist/esm/index.web179.js +2 -836
  117. package/dist/esm/index.web180.js +378 -5
  118. package/dist/esm/index.web181.js +836 -2
  119. package/dist/esm/index.web182.js +46 -108
  120. package/dist/esm/index.web183.js +5 -2
  121. package/dist/esm/index.web192.js +2 -15
  122. package/dist/esm/index.web193.js +2 -2
  123. package/dist/esm/index.web194.js +2 -2
  124. package/dist/esm/index.web195.js +15 -2
  125. package/dist/esm/index.web2.js +2 -2
  126. package/dist/esm/index.web3.js +1 -1
  127. package/dist/esm/index.web60.js +12 -12
  128. package/dist/esm/index.web67.js +2 -2
  129. package/dist/esm/index.web74.js +1 -1
  130. package/dist/esm/index.web75.js +1 -1
  131. package/dist/esm/index.web79.js +3 -3
  132. package/dist/esm/index.web8.js +1 -1
  133. package/dist/esm/index.web80.js +12 -12
  134. package/dist/esm/index.web81.js +12 -12
  135. package/dist/esm/index.web82.js +2 -4
  136. package/dist/esm/index.web83.js +66 -2
  137. package/dist/esm/index.web84.js +364 -17
  138. package/dist/esm/index.web85.js +2 -46
  139. package/dist/esm/index.web86.js +2 -14
  140. package/dist/esm/index.web87.js +16 -54
  141. package/dist/esm/index.web88.js +45 -6
  142. package/dist/esm/index.web89.js +13 -21
  143. package/dist/esm/index.web90.js +55 -11
  144. package/dist/esm/index.web91.js +6 -3
  145. package/dist/esm/index.web92.js +21 -3
  146. package/dist/esm/index.web93.js +11 -34
  147. package/dist/esm/index.web94.js +3 -12
  148. package/dist/esm/index.web95.js +3 -4
  149. package/dist/esm/index.web96.js +31 -25
  150. package/dist/esm/index.web97.js +12 -6
  151. package/dist/esm/index.web98.js +4 -42
  152. package/dist/esm/index.web99.js +27 -54
  153. package/dist/native/index.native116.js +1 -1
  154. package/dist/native/index.native117.js +1 -1
  155. package/dist/native/index.native122.js +1 -1
  156. package/dist/native/index.native123.js +1 -1
  157. package/dist/native/index.native125.js +6 -6
  158. package/dist/native/index.native155.js +1 -1
  159. package/dist/native/index.native160.js +6 -32
  160. package/dist/native/index.native161.js +32 -6
  161. package/dist/native/index.native162.js +4 -20
  162. package/dist/native/index.native163.js +21 -10
  163. package/dist/native/index.native164.js +9 -19
  164. package/dist/native/index.native165.js +15 -89
  165. package/dist/native/index.native166.js +92 -19
  166. package/dist/native/index.native167.js +18 -115
  167. package/dist/native/index.native168.js +118 -5
  168. package/dist/native/index.native172.js +7 -38
  169. package/dist/native/index.native174.js +375 -67
  170. package/dist/native/index.native175.js +835 -34
  171. package/dist/native/index.native176.js +38 -20
  172. package/dist/native/index.native177.js +2 -8
  173. package/dist/native/index.native178.js +70 -2
  174. package/dist/native/index.native179.js +30 -373
  175. package/dist/native/index.native180.js +20 -835
  176. package/dist/native/index.native182.js +2 -18
  177. package/dist/native/index.native183.js +109 -28
  178. package/dist/native/index.native184.js +2 -8
  179. package/dist/native/index.native185.js +18 -11
  180. package/dist/native/index.native186.js +28 -13
  181. package/dist/native/index.native187.js +8 -10
  182. package/dist/native/index.native188.js +11 -17
  183. package/dist/native/index.native189.js +12 -80
  184. package/dist/native/index.native190.js +10 -2
  185. package/dist/native/index.native191.js +16 -108
  186. package/dist/native/index.native192.js +81 -2
  187. package/dist/native/index.native194.js +2 -2
  188. package/dist/native/index.native195.js +2 -2
  189. package/dist/native/index.native196.js +2 -2
  190. package/dist/native/index.native3.js +1 -1
  191. package/dist/native/index.native69.js +3 -3
  192. package/dist/native/index.native72.js +1 -1
  193. package/dist/native/index.native73.js +1 -1
  194. package/dist/native/index.native78.js +2 -377
  195. package/dist/native/index.native79.js +2 -29
  196. package/dist/native/index.native80.js +374 -26
  197. package/dist/native/index.native81.js +29 -2
  198. package/dist/native/index.native82.js +29 -2
  199. package/dist/native/index.native9.js +1 -1
  200. package/dist/native-types/version.d.ts +1 -1
  201. package/dist/types/version.d.ts +1 -1
  202. package/dist/web/index.web100.js +6 -127
  203. package/dist/web/index.web101.js +40 -21
  204. package/dist/web/index.web102.js +53 -10
  205. package/dist/web/index.web103.js +125 -102
  206. package/dist/web/index.web104.js +23 -6
  207. package/dist/web/index.web105.js +13 -3
  208. package/dist/web/index.web106.js +104 -14
  209. package/dist/web/index.web107.js +6 -34
  210. package/dist/web/index.web108.js +3 -79
  211. package/dist/web/index.web109.js +15 -2
  212. package/dist/web/index.web110.js +35 -2
  213. package/dist/web/index.web111.js +77 -11
  214. package/dist/web/index.web112.js +2 -38
  215. package/dist/web/index.web113.js +2 -7
  216. package/dist/web/index.web114.js +10 -32
  217. package/dist/web/index.web115.js +37 -8
  218. package/dist/web/index.web116.js +5 -9
  219. package/dist/web/index.web117.js +34 -11
  220. package/dist/web/index.web118.js +8 -13
  221. package/dist/web/index.web119.js +9 -17
  222. package/dist/web/index.web120.js +11 -5
  223. package/dist/web/index.web121.js +14 -5
  224. package/dist/web/index.web122.js +18 -10
  225. package/dist/web/index.web123.js +8 -2
  226. package/dist/web/index.web124.js +5 -66
  227. package/dist/web/index.web125.js +10 -364
  228. package/dist/web/index.web131.js +5 -2
  229. package/dist/web/index.web132.js +18 -4
  230. package/dist/web/index.web133.js +7 -18
  231. package/dist/web/index.web134.js +3 -7
  232. package/dist/web/index.web135.js +19 -3
  233. package/dist/web/index.web136.js +8 -19
  234. package/dist/web/index.web137.js +7 -8
  235. package/dist/web/index.web138.js +71 -7
  236. package/dist/web/index.web139.js +17 -70
  237. package/dist/web/index.web140.js +3 -18
  238. package/dist/web/index.web141.js +4 -3
  239. package/dist/web/index.web142.js +4 -4
  240. package/dist/web/index.web143.js +4 -4
  241. package/dist/web/index.web144.js +19 -4
  242. package/dist/web/index.web145.js +48 -15
  243. package/dist/web/index.web146.js +17 -52
  244. package/dist/web/index.web147.js +23 -17
  245. package/dist/web/index.web148.js +8 -23
  246. package/dist/web/index.web149.js +33 -8
  247. package/dist/web/index.web150.js +7 -33
  248. package/dist/web/index.web151.js +20 -7
  249. package/dist/web/index.web152.js +4 -20
  250. package/dist/web/index.web153.js +5 -21
  251. package/dist/web/index.web154.js +48 -5
  252. package/dist/web/index.web155.js +2 -48
  253. package/dist/web/index.web156.js +18 -17
  254. package/dist/web/index.web157.js +20 -80
  255. package/dist/web/index.web158.js +79 -103
  256. package/dist/web/index.web159.js +101 -30
  257. package/dist/web/index.web160.js +32 -6
  258. package/dist/web/index.web161.js +6 -4
  259. package/dist/web/index.web162.js +1 -1
  260. package/dist/web/index.web169.js +2 -4
  261. package/dist/web/index.web170.js +108 -46
  262. package/dist/web/index.web171.js +2 -39
  263. package/dist/web/index.web172.js +4 -2
  264. package/dist/web/index.web173.js +36 -67
  265. package/dist/web/index.web174.js +2 -35
  266. package/dist/web/index.web175.js +69 -20
  267. package/dist/web/index.web176.js +34 -7
  268. package/dist/web/index.web177.js +21 -2
  269. package/dist/web/index.web178.js +7 -377
  270. package/dist/web/index.web179.js +2 -836
  271. package/dist/web/index.web180.js +378 -5
  272. package/dist/web/index.web181.js +836 -2
  273. package/dist/web/index.web182.js +46 -108
  274. package/dist/web/index.web183.js +5 -2
  275. package/dist/web/index.web192.js +2 -15
  276. package/dist/web/index.web193.js +2 -2
  277. package/dist/web/index.web194.js +2 -2
  278. package/dist/web/index.web195.js +15 -2
  279. package/dist/web/index.web2.js +2 -2
  280. package/dist/web/index.web3.js +1 -1
  281. package/dist/web/index.web60.js +12 -12
  282. package/dist/web/index.web67.js +2 -2
  283. package/dist/web/index.web74.js +1 -1
  284. package/dist/web/index.web75.js +1 -1
  285. package/dist/web/index.web79.js +3 -3
  286. package/dist/web/index.web8.js +1 -1
  287. package/dist/web/index.web80.js +12 -12
  288. package/dist/web/index.web81.js +12 -12
  289. package/dist/web/index.web82.js +2 -4
  290. package/dist/web/index.web83.js +66 -2
  291. package/dist/web/index.web84.js +364 -17
  292. package/dist/web/index.web85.js +2 -46
  293. package/dist/web/index.web86.js +2 -14
  294. package/dist/web/index.web87.js +16 -54
  295. package/dist/web/index.web88.js +45 -6
  296. package/dist/web/index.web89.js +13 -21
  297. package/dist/web/index.web90.js +55 -11
  298. package/dist/web/index.web91.js +6 -3
  299. package/dist/web/index.web92.js +21 -3
  300. package/dist/web/index.web93.js +11 -34
  301. package/dist/web/index.web94.js +3 -12
  302. package/dist/web/index.web95.js +3 -4
  303. package/dist/web/index.web96.js +31 -25
  304. package/dist/web/index.web97.js +12 -6
  305. package/dist/web/index.web98.js +4 -42
  306. package/dist/web/index.web99.js +27 -54
  307. package/dist/web-types/version.d.ts +1 -1
  308. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { commitmentToVersionedHash as i } from "./index.native161.js";
1
+ import { commitmentToVersionedHash as i } from "./index.native160.js";
2
2
  function r(o) {
3
3
  const { commitments: t, version: n } = o, e = o.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), s = [];
4
4
  for (const m of t)
@@ -1,6 +1,6 @@
1
1
  import { blobsToCommitments as f } from "./index.native114.js";
2
2
  import { blobsToProofs as l } from "./index.native115.js";
3
- import { toBlobs as p } from "./index.native160.js";
3
+ import { toBlobs as p } from "./index.native161.js";
4
4
  function k(t) {
5
5
  const { data: i, kzg: n, to: m } = t, s = t.blobs ?? p({ data: i, to: m }), b = t.commitments ?? f({ blobs: s, kzg: n, to: m }), r = t.proofs ?? l({ blobs: s, commitments: b, kzg: n, to: m }), c = [];
6
6
  for (let o = 0; o < s.length; o++)
@@ -1,2 +1,2 @@
1
- import { __require as e } from "./index.native191.js";
1
+ import { __require as e } from "./index.native183.js";
2
2
  e();
@@ -1,4 +1,4 @@
1
- import { getVersion as n } from "./index.native168.js";
1
+ import { getVersion as n } from "./index.native162.js";
2
2
  class s extends Error {
3
3
  constructor(r, e = {}) {
4
4
  const a = (() => {
@@ -1,11 +1,11 @@
1
- import { encode as d } from "./index.native162.js";
2
- import y from "./index.native163.js";
3
- import b from "./index.native164.js";
1
+ import { encode as d } from "./index.native163.js";
2
+ import y from "./index.native164.js";
3
+ import b from "./index.native165.js";
4
4
  import { JWSInvalid as r } from "./index.native76.js";
5
5
  import { encoder as s, concat as u, decoder as h } from "./index.native126.js";
6
- import g from "./index.native165.js";
7
- import H from "./index.native166.js";
8
- import P from "./index.native167.js";
6
+ import g from "./index.native166.js";
7
+ import H from "./index.native167.js";
8
+ import P from "./index.native168.js";
9
9
  class x {
10
10
  #r;
11
11
  #e;
@@ -1,5 +1,5 @@
1
1
  import { getDefaultExportFromCjs as r } from "./index.native170.js";
2
- import { __require as o } from "./index.native172.js";
2
+ import { __require as o } from "./index.native176.js";
3
3
  var t = o();
4
4
  const a = /* @__PURE__ */ r(t);
5
5
  export {
@@ -1,35 +1,9 @@
1
- import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index.native181.js";
2
- import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index.native111.js";
3
- import { createCursor as B } from "./index.native99.js";
4
- import { size as u } from "./index.native94.js";
5
- import { hexToBytes as x } from "./index.native86.js";
6
- import { bytesToHex as d } from "./index.native84.js";
7
- function S(e) {
8
- const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
9
- if (!o)
10
- throw new c();
11
- if (o > y)
12
- throw new h({
13
- maxSize: y,
14
- size: o
15
- });
16
- const s = [];
17
- let n = !0, r = 0;
18
- for (; n; ) {
19
- const t = B(new Uint8Array(a));
20
- let l = 0;
21
- for (; l < f; ) {
22
- const b = i.slice(r, r + (p - 1));
23
- if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
24
- t.pushByte(128), n = !1;
25
- break;
26
- }
27
- l++, r += 31;
28
- }
29
- s.push(t);
30
- }
31
- return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
1
+ import { bytesToHex as i } from "./index.native84.js";
2
+ import { sha256 as m } from "./index.native103.js";
3
+ function f(t) {
4
+ const { commitment: e, version: s = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), o = m(e);
5
+ return o.set([s], 0), n === "bytes" ? o : i(o);
32
6
  }
33
7
  export {
34
- S as toBlobs
8
+ f as commitmentToVersionedHash
35
9
  };
@@ -1,9 +1,35 @@
1
- import { bytesToHex as i } from "./index.native84.js";
2
- import { sha256 as m } from "./index.native103.js";
3
- function f(t) {
4
- const { commitment: e, version: s = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), o = m(e);
5
- return o.set([s], 0), n === "bytes" ? o : i(o);
1
+ import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index.native181.js";
2
+ import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index.native111.js";
3
+ import { createCursor as B } from "./index.native99.js";
4
+ import { size as u } from "./index.native94.js";
5
+ import { hexToBytes as x } from "./index.native86.js";
6
+ import { bytesToHex as d } from "./index.native84.js";
7
+ function S(e) {
8
+ const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
9
+ if (!o)
10
+ throw new c();
11
+ if (o > y)
12
+ throw new h({
13
+ maxSize: y,
14
+ size: o
15
+ });
16
+ const s = [];
17
+ let n = !0, r = 0;
18
+ for (; n; ) {
19
+ const t = B(new Uint8Array(a));
20
+ let l = 0;
21
+ for (; l < f; ) {
22
+ const b = i.slice(r, r + (p - 1));
23
+ if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
24
+ t.pushByte(128), n = !1;
25
+ break;
26
+ }
27
+ l++, r += 31;
28
+ }
29
+ s.push(t);
30
+ }
31
+ return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
6
32
  }
7
33
  export {
8
- f as commitmentToVersionedHash
34
+ S as toBlobs
9
35
  };
@@ -1,23 +1,7 @@
1
- import { encoder as t, decoder as o } from "./index.native126.js";
2
- import { encodeBase64 as c, decodeBase64 as a } from "./index.native182.js";
3
- function i(r) {
4
- if (Uint8Array.fromBase64)
5
- return Uint8Array.fromBase64(typeof r == "string" ? r : o.decode(r), {
6
- alphabet: "base64url"
7
- });
8
- let e = r;
9
- e instanceof Uint8Array && (e = o.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
10
- try {
11
- return a(e);
12
- } catch {
13
- throw new TypeError("The input to be decoded is not correctly encoded.");
14
- }
15
- }
16
- function p(r) {
17
- let e = r;
18
- return typeof e == "string" && (e = t.encode(e)), Uint8Array.prototype.toBase64 ? e.toBase64({ alphabet: "base64url", omitPadding: !0 }) : c(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
1
+ import { version as r } from "./index.native182.js";
2
+ function e() {
3
+ return r;
19
4
  }
20
5
  export {
21
- i as decode,
22
- p as encode
6
+ e as getVersion
23
7
  };
@@ -1,12 +1,23 @@
1
- import n from "./index.native183.js";
2
- import s from "./index.native184.js";
3
- import a from "./index.native185.js";
4
- const y = async (t, o, e) => {
5
- const r = await a(t, o, "sign");
6
- s(t, r);
7
- const i = await crypto.subtle.sign(n(t, r.algorithm), r, e);
8
- return new Uint8Array(i);
9
- };
1
+ import { encoder as t, decoder as o } from "./index.native126.js";
2
+ import { encodeBase64 as c, decodeBase64 as a } from "./index.native185.js";
3
+ function i(r) {
4
+ if (Uint8Array.fromBase64)
5
+ return Uint8Array.fromBase64(typeof r == "string" ? r : o.decode(r), {
6
+ alphabet: "base64url"
7
+ });
8
+ let e = r;
9
+ e instanceof Uint8Array && (e = o.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
10
+ try {
11
+ return a(e);
12
+ } catch {
13
+ throw new TypeError("The input to be decoded is not correctly encoded.");
14
+ }
15
+ }
16
+ function p(r) {
17
+ let e = r;
18
+ return typeof e == "string" && (e = t.encode(e)), Uint8Array.prototype.toBase64 ? e.toBase64({ alphabet: "base64url", omitPadding: !0 }) : c(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
19
+ }
10
20
  export {
11
- y as default
21
+ i as decode,
22
+ p as encode
12
23
  };
@@ -1,22 +1,12 @@
1
- const a = (...o) => {
2
- const t = o.filter(Boolean);
3
- if (t.length === 0 || t.length === 1)
4
- return !0;
5
- let e;
6
- for (const s of t) {
7
- const r = Object.keys(s);
8
- if (!e || e.size === 0) {
9
- e = new Set(r);
10
- continue;
11
- }
12
- for (const n of r) {
13
- if (e.has(n))
14
- return !1;
15
- e.add(n);
16
- }
17
- }
18
- return !0;
1
+ import n from "./index.native186.js";
2
+ import s from "./index.native187.js";
3
+ import a from "./index.native188.js";
4
+ const y = async (t, o, e) => {
5
+ const r = await a(t, o, "sign");
6
+ s(t, r);
7
+ const i = await crypto.subtle.sign(n(t, r.algorithm), r, e);
8
+ return new Uint8Array(i);
19
9
  };
20
10
  export {
21
- a as default
11
+ y as default
22
12
  };
@@ -1,96 +1,22 @@
1
- import { withAlg as n } from "./index.native186.js";
2
- import c from "./index.native187.js";
3
- import { isJWK as p, isSecretJWK as a, isPublicJWK as y, isPrivateJWK as f } from "./index.native188.js";
4
- const s = (r) => r?.[Symbol.toStringTag], o = (r, e, t) => {
5
- if (e.use !== void 0) {
6
- let i;
7
- switch (t) {
8
- case "sign":
9
- case "verify":
10
- i = "sig";
11
- break;
12
- case "encrypt":
13
- case "decrypt":
14
- i = "enc";
15
- break;
1
+ const a = (...o) => {
2
+ const t = o.filter(Boolean);
3
+ if (t.length === 0 || t.length === 1)
4
+ return !0;
5
+ let e;
6
+ for (const s of t) {
7
+ const r = Object.keys(s);
8
+ if (!e || e.size === 0) {
9
+ e = new Set(r);
10
+ continue;
16
11
  }
17
- if (e.use !== i)
18
- throw new TypeError(`Invalid key for this operation, its "use" must be "${i}" when present`);
19
- }
20
- if (e.alg !== void 0 && e.alg !== r)
21
- throw new TypeError(`Invalid key for this operation, its "alg" must be "${r}" when present`);
22
- if (Array.isArray(e.key_ops)) {
23
- let i;
24
- switch (!0) {
25
- case t === "sign":
26
- case r === "dir":
27
- case r.includes("CBC-HS"):
28
- i = t;
29
- break;
30
- case r.startsWith("PBES2"):
31
- i = "deriveBits";
32
- break;
33
- case /^A\d{3}(?:GCM)?(?:KW)?$/.test(r):
34
- !r.includes("GCM") && r.endsWith("KW") ? i = "unwrapKey" : i = t;
35
- break;
36
- case t === "encrypt":
37
- i = "wrapKey";
38
- break;
39
- case t === "decrypt":
40
- i = r.startsWith("RSA") ? "unwrapKey" : "deriveBits";
41
- break;
12
+ for (const n of r) {
13
+ if (e.has(n))
14
+ return !1;
15
+ e.add(n);
42
16
  }
43
- if (i && e.key_ops?.includes?.(i) === !1)
44
- throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`);
45
17
  }
46
18
  return !0;
47
- }, h = (r, e, t) => {
48
- if (!(e instanceof Uint8Array)) {
49
- if (p(e)) {
50
- if (a(e) && o(r, e, t))
51
- return;
52
- throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present');
53
- }
54
- if (!c(e))
55
- throw new TypeError(n(r, e, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array"));
56
- if (e.type !== "secret")
57
- throw new TypeError(`${s(e)} instances for symmetric algorithms must be of type "secret"`);
58
- }
59
- }, m = (r, e, t) => {
60
- if (p(e))
61
- switch (t) {
62
- case "decrypt":
63
- case "sign":
64
- if (f(e) && o(r, e, t))
65
- return;
66
- throw new TypeError("JSON Web Key for this operation be a private JWK");
67
- case "encrypt":
68
- case "verify":
69
- if (y(e) && o(r, e, t))
70
- return;
71
- throw new TypeError("JSON Web Key for this operation be a public JWK");
72
- }
73
- if (!c(e))
74
- throw new TypeError(n(r, e, "CryptoKey", "KeyObject", "JSON Web Key"));
75
- if (e.type === "secret")
76
- throw new TypeError(`${s(e)} instances for asymmetric algorithms must not be of type "secret"`);
77
- if (e.type === "public")
78
- switch (t) {
79
- case "sign":
80
- throw new TypeError(`${s(e)} instances for asymmetric algorithm signing must be of type "private"`);
81
- case "decrypt":
82
- throw new TypeError(`${s(e)} instances for asymmetric algorithm decryption must be of type "private"`);
83
- }
84
- if (e.type === "private")
85
- switch (t) {
86
- case "verify":
87
- throw new TypeError(`${s(e)} instances for asymmetric algorithm verifying must be of type "public"`);
88
- case "encrypt":
89
- throw new TypeError(`${s(e)} instances for asymmetric algorithm encryption must be of type "public"`);
90
- }
91
- }, d = (r, e, t) => {
92
- r.startsWith("HS") || r === "dir" || r.startsWith("PBES2") || /^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(r) || /^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(r) ? h(r, e, t) : m(r, e, t);
93
19
  };
94
20
  export {
95
- d as default
21
+ a as default
96
22
  };
@@ -1,23 +1,96 @@
1
- import { JOSENotSupported as f } from "./index.native76.js";
2
- const w = (n, r, a, e, s) => {
3
- if (s.crit !== void 0 && e?.crit === void 0)
4
- throw new n('"crit" (Critical) Header Parameter MUST be integrity protected');
5
- if (!e || e.crit === void 0)
6
- return /* @__PURE__ */ new Set();
7
- if (!Array.isArray(e.crit) || e.crit.length === 0 || e.crit.some((i) => typeof i != "string" || i.length === 0))
8
- throw new n('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
9
- let t;
10
- a !== void 0 ? t = new Map([...Object.entries(a), ...r.entries()]) : t = r;
11
- for (const i of e.crit) {
12
- if (!t.has(i))
13
- throw new f(`Extension Header Parameter "${i}" is not recognized`);
14
- if (s[i] === void 0)
15
- throw new n(`Extension Header Parameter "${i}" is missing`);
16
- if (t.get(i) && e[i] === void 0)
17
- throw new n(`Extension Header Parameter "${i}" MUST be integrity protected`);
1
+ import { withAlg as n } from "./index.native189.js";
2
+ import c from "./index.native190.js";
3
+ import { isJWK as p, isSecretJWK as a, isPublicJWK as y, isPrivateJWK as f } from "./index.native191.js";
4
+ const s = (r) => r?.[Symbol.toStringTag], o = (r, e, t) => {
5
+ if (e.use !== void 0) {
6
+ let i;
7
+ switch (t) {
8
+ case "sign":
9
+ case "verify":
10
+ i = "sig";
11
+ break;
12
+ case "encrypt":
13
+ case "decrypt":
14
+ i = "enc";
15
+ break;
16
+ }
17
+ if (e.use !== i)
18
+ throw new TypeError(`Invalid key for this operation, its "use" must be "${i}" when present`);
18
19
  }
19
- return new Set(e.crit);
20
+ if (e.alg !== void 0 && e.alg !== r)
21
+ throw new TypeError(`Invalid key for this operation, its "alg" must be "${r}" when present`);
22
+ if (Array.isArray(e.key_ops)) {
23
+ let i;
24
+ switch (!0) {
25
+ case t === "sign":
26
+ case r === "dir":
27
+ case r.includes("CBC-HS"):
28
+ i = t;
29
+ break;
30
+ case r.startsWith("PBES2"):
31
+ i = "deriveBits";
32
+ break;
33
+ case /^A\d{3}(?:GCM)?(?:KW)?$/.test(r):
34
+ !r.includes("GCM") && r.endsWith("KW") ? i = "unwrapKey" : i = t;
35
+ break;
36
+ case t === "encrypt":
37
+ i = "wrapKey";
38
+ break;
39
+ case t === "decrypt":
40
+ i = r.startsWith("RSA") ? "unwrapKey" : "deriveBits";
41
+ break;
42
+ }
43
+ if (i && e.key_ops?.includes?.(i) === !1)
44
+ throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`);
45
+ }
46
+ return !0;
47
+ }, h = (r, e, t) => {
48
+ if (!(e instanceof Uint8Array)) {
49
+ if (p(e)) {
50
+ if (a(e) && o(r, e, t))
51
+ return;
52
+ throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present');
53
+ }
54
+ if (!c(e))
55
+ throw new TypeError(n(r, e, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array"));
56
+ if (e.type !== "secret")
57
+ throw new TypeError(`${s(e)} instances for symmetric algorithms must be of type "secret"`);
58
+ }
59
+ }, m = (r, e, t) => {
60
+ if (p(e))
61
+ switch (t) {
62
+ case "decrypt":
63
+ case "sign":
64
+ if (f(e) && o(r, e, t))
65
+ return;
66
+ throw new TypeError("JSON Web Key for this operation be a private JWK");
67
+ case "encrypt":
68
+ case "verify":
69
+ if (y(e) && o(r, e, t))
70
+ return;
71
+ throw new TypeError("JSON Web Key for this operation be a public JWK");
72
+ }
73
+ if (!c(e))
74
+ throw new TypeError(n(r, e, "CryptoKey", "KeyObject", "JSON Web Key"));
75
+ if (e.type === "secret")
76
+ throw new TypeError(`${s(e)} instances for asymmetric algorithms must not be of type "secret"`);
77
+ if (e.type === "public")
78
+ switch (t) {
79
+ case "sign":
80
+ throw new TypeError(`${s(e)} instances for asymmetric algorithm signing must be of type "private"`);
81
+ case "decrypt":
82
+ throw new TypeError(`${s(e)} instances for asymmetric algorithm decryption must be of type "private"`);
83
+ }
84
+ if (e.type === "private")
85
+ switch (t) {
86
+ case "verify":
87
+ throw new TypeError(`${s(e)} instances for asymmetric algorithm verifying must be of type "public"`);
88
+ case "encrypt":
89
+ throw new TypeError(`${s(e)} instances for asymmetric algorithm encryption must be of type "public"`);
90
+ }
91
+ }, d = (r, e, t) => {
92
+ r.startsWith("HS") || r === "dir" || r.startsWith("PBES2") || /^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(r) || /^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(r) ? h(r, e, t) : m(r, e, t);
20
93
  };
21
94
  export {
22
- w as default
95
+ d as default
23
96
  };
@@ -1,120 +1,23 @@
1
- import { isJWK as p } from "./index.native188.js";
2
- import { decode as m } from "./index.native162.js";
3
- import y from "./index.native189.js";
4
- import { isCryptoKey as S, isKeyObject as K } from "./index.native187.js";
5
- let c;
6
- const f = async (e, r, s, i = !1) => {
7
- c ||= /* @__PURE__ */ new WeakMap();
8
- let n = c.get(e);
9
- if (n?.[s])
10
- return n[s];
11
- const t = await y({ ...r, alg: s });
12
- return i && Object.freeze(e), n ? n[s] = t : c.set(e, { [s]: t }), t;
13
- }, E = (e, r) => {
14
- c ||= /* @__PURE__ */ new WeakMap();
15
- let s = c.get(e);
16
- if (s?.[r])
17
- return s[r];
18
- const i = e.type === "public", n = !!i;
1
+ import { JOSENotSupported as f } from "./index.native76.js";
2
+ const w = (n, r, a, e, s) => {
3
+ if (s.crit !== void 0 && e?.crit === void 0)
4
+ throw new n('"crit" (Critical) Header Parameter MUST be integrity protected');
5
+ if (!e || e.crit === void 0)
6
+ return /* @__PURE__ */ new Set();
7
+ if (!Array.isArray(e.crit) || e.crit.length === 0 || e.crit.some((i) => typeof i != "string" || i.length === 0))
8
+ throw new n('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
19
9
  let t;
20
- if (e.asymmetricKeyType === "x25519") {
21
- switch (r) {
22
- case "ECDH-ES":
23
- case "ECDH-ES+A128KW":
24
- case "ECDH-ES+A192KW":
25
- case "ECDH-ES+A256KW":
26
- break;
27
- default:
28
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
29
- }
30
- t = e.toCryptoKey(e.asymmetricKeyType, n, i ? [] : ["deriveBits"]);
10
+ a !== void 0 ? t = new Map([...Object.entries(a), ...r.entries()]) : t = r;
11
+ for (const i of e.crit) {
12
+ if (!t.has(i))
13
+ throw new f(`Extension Header Parameter "${i}" is not recognized`);
14
+ if (s[i] === void 0)
15
+ throw new n(`Extension Header Parameter "${i}" is missing`);
16
+ if (t.get(i) && e[i] === void 0)
17
+ throw new n(`Extension Header Parameter "${i}" MUST be integrity protected`);
31
18
  }
32
- if (e.asymmetricKeyType === "ed25519") {
33
- if (r !== "EdDSA" && r !== "Ed25519")
34
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
35
- t = e.toCryptoKey(e.asymmetricKeyType, n, [
36
- i ? "verify" : "sign"
37
- ]);
38
- }
39
- if (e.asymmetricKeyType === "rsa") {
40
- let a;
41
- switch (r) {
42
- case "RSA-OAEP":
43
- a = "SHA-1";
44
- break;
45
- case "RS256":
46
- case "PS256":
47
- case "RSA-OAEP-256":
48
- a = "SHA-256";
49
- break;
50
- case "RS384":
51
- case "PS384":
52
- case "RSA-OAEP-384":
53
- a = "SHA-384";
54
- break;
55
- case "RS512":
56
- case "PS512":
57
- case "RSA-OAEP-512":
58
- a = "SHA-512";
59
- break;
60
- default:
61
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
62
- }
63
- if (r.startsWith("RSA-OAEP"))
64
- return e.toCryptoKey({
65
- name: "RSA-OAEP",
66
- hash: a
67
- }, n, i ? ["encrypt"] : ["decrypt"]);
68
- t = e.toCryptoKey({
69
- name: r.startsWith("PS") ? "RSA-PSS" : "RSASSA-PKCS1-v1_5",
70
- hash: a
71
- }, n, [i ? "verify" : "sign"]);
72
- }
73
- if (e.asymmetricKeyType === "ec") {
74
- const o = (/* @__PURE__ */ new Map([
75
- ["prime256v1", "P-256"],
76
- ["secp384r1", "P-384"],
77
- ["secp521r1", "P-521"]
78
- ])).get(e.asymmetricKeyDetails?.namedCurve);
79
- if (!o)
80
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
81
- r === "ES256" && o === "P-256" && (t = e.toCryptoKey({
82
- name: "ECDSA",
83
- namedCurve: o
84
- }, n, [i ? "verify" : "sign"])), r === "ES384" && o === "P-384" && (t = e.toCryptoKey({
85
- name: "ECDSA",
86
- namedCurve: o
87
- }, n, [i ? "verify" : "sign"])), r === "ES512" && o === "P-521" && (t = e.toCryptoKey({
88
- name: "ECDSA",
89
- namedCurve: o
90
- }, n, [i ? "verify" : "sign"])), r.startsWith("ECDH-ES") && (t = e.toCryptoKey({
91
- name: "ECDH",
92
- namedCurve: o
93
- }, n, i ? [] : ["deriveBits"]));
94
- }
95
- if (!t)
96
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
97
- return s ? s[r] = t : c.set(e, { [r]: t }), t;
98
- }, d = async (e, r) => {
99
- if (e instanceof Uint8Array || S(e))
100
- return e;
101
- if (K(e)) {
102
- if (e.type === "secret")
103
- return e.export();
104
- if ("toCryptoKey" in e && typeof e.toCryptoKey == "function")
105
- try {
106
- return E(e, r);
107
- } catch (i) {
108
- if (i instanceof TypeError)
109
- throw i;
110
- }
111
- let s = e.export({ format: "jwk" });
112
- return f(e, s, r);
113
- }
114
- if (p(e))
115
- return e.k ? m(e.k) : f(e, e, r, !0);
116
- throw new Error("unreachable");
19
+ return new Set(e.crit);
117
20
  };
118
21
  export {
119
- d as default
22
+ w as default
120
23
  };