@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.
Files changed (288) hide show
  1. package/dist/esm/index.web10.js +49 -44
  2. package/dist/esm/index.web107.js +3 -3
  3. package/dist/esm/index.web110.js +2 -2
  4. package/dist/esm/index.web114.js +2 -2
  5. package/dist/esm/index.web127.js +3 -3
  6. package/dist/esm/index.web128.js +31 -2
  7. package/dist/esm/index.web129.js +28 -65
  8. package/dist/esm/index.web130.js +12 -360
  9. package/dist/esm/index.web131.js +22 -28
  10. package/dist/esm/index.web132.js +50 -28
  11. package/dist/esm/index.web133.js +2 -19
  12. package/dist/esm/index.web134.js +63 -20
  13. package/dist/esm/index.web135.js +351 -37
  14. package/dist/esm/index.web138.js +1 -1
  15. package/dist/esm/index.web139.js +1 -1
  16. package/dist/esm/index.web140.js +5 -5
  17. package/dist/esm/index.web141.js +43 -50
  18. package/dist/esm/index.web142.js +2 -11
  19. package/dist/esm/index.web143.js +2 -2
  20. package/dist/esm/index.web144.js +15 -45
  21. package/dist/esm/index.web145.js +28 -13
  22. package/dist/esm/index.web146.js +7 -12
  23. package/dist/esm/index.web147.js +3 -11
  24. package/dist/esm/index.web148.js +29 -5
  25. package/dist/esm/index.web149.js +8 -47
  26. package/dist/esm/index.web150.js +7 -14
  27. package/dist/esm/index.web151.js +70 -18
  28. package/dist/esm/index.web152.js +28 -7
  29. package/dist/esm/index.web153.js +3 -3
  30. package/dist/esm/index.web154.js +6 -19
  31. package/dist/esm/index.web155.js +4 -8
  32. package/dist/esm/index.web156.js +14 -7
  33. package/dist/esm/index.web157.js +18 -79
  34. package/dist/esm/index.web158.js +48 -15
  35. package/dist/esm/index.web159.js +17 -3
  36. package/dist/esm/index.web160.js +23 -15
  37. package/dist/esm/index.web161.js +8 -4
  38. package/dist/esm/index.web162.js +33 -5
  39. package/dist/esm/index.web163.js +7 -19
  40. package/dist/esm/index.web164.js +16 -57
  41. package/dist/esm/index.web165.js +54 -17
  42. package/dist/esm/index.web166.js +10 -23
  43. package/dist/esm/index.web167.js +2 -9
  44. package/dist/esm/index.web168.js +44 -42
  45. package/dist/esm/index.web169.js +13 -7
  46. package/dist/esm/index.web170.js +10 -18
  47. package/dist/esm/index.web171.js +12 -2
  48. package/dist/esm/index.web172.js +5 -2
  49. package/dist/esm/index.web191.js +1 -1
  50. package/dist/esm/index.web193.js +1 -1
  51. package/dist/esm/index.web194.js +2 -2
  52. package/dist/esm/index.web2.js +2 -2
  53. package/dist/esm/index.web202.js +2 -2
  54. package/dist/esm/index.web210.js +8 -2
  55. package/dist/esm/index.web211.js +2 -109
  56. package/dist/esm/index.web212.js +361 -2
  57. package/dist/esm/index.web213.js +852 -20
  58. package/dist/esm/index.web214.js +39 -10
  59. package/dist/esm/index.web215.js +2 -20
  60. package/dist/esm/index.web216.js +70 -94
  61. package/dist/esm/index.web217.js +35 -21
  62. package/dist/esm/index.web218.js +13 -116
  63. package/dist/esm/index.web219.js +19 -102
  64. package/dist/esm/index.web220.js +10 -79
  65. package/dist/esm/index.web221.js +20 -79
  66. package/dist/esm/index.web222.js +94 -8
  67. package/dist/esm/index.web223.js +21 -2
  68. package/dist/esm/index.web224.js +110 -353
  69. package/dist/esm/index.web225.js +103 -852
  70. package/dist/esm/index.web226.js +77 -37
  71. package/dist/esm/index.web227.js +79 -2
  72. package/dist/esm/index.web228.js +107 -68
  73. package/dist/esm/index.web229.js +2 -35
  74. package/dist/esm/index.web230.js +2 -15
  75. package/dist/esm/index.web236.js +3 -46
  76. package/dist/esm/index.web237.js +46 -3
  77. package/dist/esm/index.web238.js +2 -18
  78. package/dist/esm/index.web239.js +2 -28
  79. package/dist/esm/index.web240.js +2 -8
  80. package/dist/esm/index.web241.js +18 -11
  81. package/dist/esm/index.web242.js +28 -13
  82. package/dist/esm/index.web243.js +8 -10
  83. package/dist/esm/index.web244.js +11 -17
  84. package/dist/esm/index.web245.js +12 -80
  85. package/dist/esm/index.web246.js +10 -2
  86. package/dist/esm/index.web247.js +17 -2
  87. package/dist/esm/index.web248.js +81 -2
  88. package/dist/esm/index.web250.js +14 -78
  89. package/dist/esm/index.web251.js +78 -14
  90. package/dist/esm/index.web3.js +1 -1
  91. package/dist/esm/index.web8.js +26 -12
  92. package/dist/esm/index.web9.js +1 -1
  93. package/dist/native/index.native109.js +3 -3
  94. package/dist/native/index.native11.js +1 -1
  95. package/dist/native/index.native112.js +2 -2
  96. package/dist/native/index.native116.js +3 -3
  97. package/dist/native/index.native12.js +50 -45
  98. package/dist/native/index.native129.js +371 -100
  99. package/dist/native/index.native130.js +2 -379
  100. package/dist/native/index.native131.js +65 -28
  101. package/dist/native/index.native132.js +364 -28
  102. package/dist/native/index.native133.js +31 -2
  103. package/dist/native/index.native134.js +28 -65
  104. package/dist/native/index.native135.js +12 -360
  105. package/dist/native/index.native136.js +21 -15
  106. package/dist/native/index.native137.js +49 -21
  107. package/dist/native/index.native138.js +104 -49
  108. package/dist/native/index.native141.js +1 -1
  109. package/dist/native/index.native142.js +1 -1
  110. package/dist/native/index.native143.js +5 -5
  111. package/dist/native/index.native144.js +11 -46
  112. package/dist/native/index.native145.js +12 -2
  113. package/dist/native/index.native146.js +55 -2
  114. package/dist/native/index.native147.js +10 -4
  115. package/dist/native/index.native148.js +2 -13
  116. package/dist/native/index.native149.js +45 -12
  117. package/dist/native/index.native150.js +13 -54
  118. package/dist/native/index.native151.js +5 -11
  119. package/dist/native/index.native152.js +48 -2
  120. package/dist/native/index.native153.js +35 -44
  121. package/dist/native/index.native154.js +66 -12
  122. package/dist/native/index.native155.js +14 -36
  123. package/dist/native/index.native156.js +25 -65
  124. package/dist/native/index.native157.js +7 -13
  125. package/dist/native/index.native158.js +3 -27
  126. package/dist/native/index.native159.js +27 -7
  127. package/dist/native/index.native160.js +8 -3
  128. package/dist/native/index.native161.js +7 -27
  129. package/dist/native/index.native162.js +79 -8
  130. package/dist/native/index.native163.js +27 -7
  131. package/dist/native/index.native164.js +3 -79
  132. package/dist/native/index.native165.js +5 -18
  133. package/dist/native/index.native166.js +4 -3
  134. package/dist/native/index.native167.js +3 -4
  135. package/dist/native/index.native168.js +19 -4
  136. package/dist/native/index.native169.js +52 -5
  137. package/dist/native/index.native170.js +17 -19
  138. package/dist/native/index.native171.js +18 -55
  139. package/dist/native/index.native172.js +8 -17
  140. package/dist/native/index.native173.js +37 -19
  141. package/dist/native/index.native174.js +7 -8
  142. package/dist/native/index.native175.js +17 -38
  143. package/dist/native/index.native176.js +2 -8
  144. package/dist/native/index.native177.js +2 -21
  145. package/dist/native/index.native193.js +1 -1
  146. package/dist/native/index.native195.js +1 -1
  147. package/dist/native/index.native196.js +1 -1
  148. package/dist/native/index.native199.js +2 -2
  149. package/dist/native/index.native2.js +2 -2
  150. package/dist/native/index.native207.js +2 -2
  151. package/dist/native/index.native210.js +1 -1
  152. package/dist/native/index.native211.js +1 -1
  153. package/dist/native/index.native221.js +2 -2
  154. package/dist/native/index.native222.js +3 -3
  155. package/dist/native/index.native224.js +3 -3
  156. package/dist/native/index.native225.js +1 -1
  157. package/dist/native/index.native226.js +3 -3
  158. package/dist/native/index.native227.js +7 -38
  159. package/dist/native/index.native229.js +358 -67
  160. package/dist/native/index.native230.js +852 -34
  161. package/dist/native/index.native231.js +38 -14
  162. package/dist/native/index.native232.js +2 -8
  163. package/dist/native/index.native233.js +70 -2
  164. package/dist/native/index.native234.js +29 -355
  165. package/dist/native/index.native235.js +14 -852
  166. package/dist/native/index.native236.js +40 -14
  167. package/dist/native/index.native237.js +21 -2
  168. package/dist/native/index.native238.js +2 -20
  169. package/dist/native/index.native239.js +18 -31
  170. package/dist/native/index.native240.js +32 -6
  171. package/dist/native/index.native241.js +6 -3
  172. package/dist/native/index.native242.js +16 -45
  173. package/dist/native/index.native243.js +28 -2
  174. package/dist/native/index.native244.js +8 -2
  175. package/dist/native/index.native245.js +11 -2
  176. package/dist/native/index.native246.js +11 -16
  177. package/dist/native/index.native247.js +10 -28
  178. package/dist/native/index.native248.js +17 -8
  179. package/dist/native/index.native249.js +79 -9
  180. package/dist/native/index.native250.js +2 -13
  181. package/dist/native/index.native251.js +2 -10
  182. package/dist/native/index.native252.js +2 -15
  183. package/dist/native/index.native253.js +2 -81
  184. package/dist/native/index.native255.js +78 -14
  185. package/dist/native/index.native256.js +14 -78
  186. package/dist/native/index.native3.js +1 -1
  187. package/dist/native/index.native8.js +16 -3
  188. package/dist/native/index.native86.js +1 -1
  189. package/dist/native/index.native9.js +21 -8
  190. package/dist/native-types/platform/types.d.ts +25 -0
  191. package/dist/native-types/version.d.ts +1 -1
  192. package/dist/types/platform/types.d.ts +25 -0
  193. package/dist/types/version.d.ts +1 -1
  194. package/dist/web/index.web10.js +49 -44
  195. package/dist/web/index.web107.js +3 -3
  196. package/dist/web/index.web110.js +2 -2
  197. package/dist/web/index.web114.js +2 -2
  198. package/dist/web/index.web127.js +3 -3
  199. package/dist/web/index.web128.js +31 -2
  200. package/dist/web/index.web129.js +28 -65
  201. package/dist/web/index.web130.js +12 -360
  202. package/dist/web/index.web131.js +22 -28
  203. package/dist/web/index.web132.js +50 -28
  204. package/dist/web/index.web133.js +2 -19
  205. package/dist/web/index.web134.js +63 -20
  206. package/dist/web/index.web135.js +351 -37
  207. package/dist/web/index.web138.js +1 -1
  208. package/dist/web/index.web139.js +1 -1
  209. package/dist/web/index.web140.js +5 -5
  210. package/dist/web/index.web141.js +43 -50
  211. package/dist/web/index.web142.js +2 -11
  212. package/dist/web/index.web143.js +2 -2
  213. package/dist/web/index.web144.js +15 -45
  214. package/dist/web/index.web145.js +28 -13
  215. package/dist/web/index.web146.js +7 -12
  216. package/dist/web/index.web147.js +3 -11
  217. package/dist/web/index.web148.js +29 -5
  218. package/dist/web/index.web149.js +8 -47
  219. package/dist/web/index.web150.js +7 -14
  220. package/dist/web/index.web151.js +70 -18
  221. package/dist/web/index.web152.js +28 -7
  222. package/dist/web/index.web153.js +3 -3
  223. package/dist/web/index.web154.js +6 -19
  224. package/dist/web/index.web155.js +4 -8
  225. package/dist/web/index.web156.js +14 -7
  226. package/dist/web/index.web157.js +18 -79
  227. package/dist/web/index.web158.js +48 -15
  228. package/dist/web/index.web159.js +17 -3
  229. package/dist/web/index.web160.js +23 -15
  230. package/dist/web/index.web161.js +8 -4
  231. package/dist/web/index.web162.js +33 -5
  232. package/dist/web/index.web163.js +7 -19
  233. package/dist/web/index.web164.js +16 -57
  234. package/dist/web/index.web165.js +54 -17
  235. package/dist/web/index.web166.js +10 -23
  236. package/dist/web/index.web167.js +2 -9
  237. package/dist/web/index.web168.js +44 -42
  238. package/dist/web/index.web169.js +13 -7
  239. package/dist/web/index.web170.js +10 -18
  240. package/dist/web/index.web171.js +12 -2
  241. package/dist/web/index.web172.js +5 -2
  242. package/dist/web/index.web191.js +1 -1
  243. package/dist/web/index.web193.js +1 -1
  244. package/dist/web/index.web194.js +2 -2
  245. package/dist/web/index.web2.js +2 -2
  246. package/dist/web/index.web202.js +2 -2
  247. package/dist/web/index.web210.js +8 -2
  248. package/dist/web/index.web211.js +2 -109
  249. package/dist/web/index.web212.js +361 -2
  250. package/dist/web/index.web213.js +852 -20
  251. package/dist/web/index.web214.js +39 -10
  252. package/dist/web/index.web215.js +2 -20
  253. package/dist/web/index.web216.js +70 -94
  254. package/dist/web/index.web217.js +35 -21
  255. package/dist/web/index.web218.js +13 -116
  256. package/dist/web/index.web219.js +19 -102
  257. package/dist/web/index.web220.js +10 -79
  258. package/dist/web/index.web221.js +20 -79
  259. package/dist/web/index.web222.js +94 -8
  260. package/dist/web/index.web223.js +21 -2
  261. package/dist/web/index.web224.js +110 -353
  262. package/dist/web/index.web225.js +103 -852
  263. package/dist/web/index.web226.js +77 -37
  264. package/dist/web/index.web227.js +79 -2
  265. package/dist/web/index.web228.js +107 -68
  266. package/dist/web/index.web229.js +2 -35
  267. package/dist/web/index.web230.js +2 -15
  268. package/dist/web/index.web236.js +3 -46
  269. package/dist/web/index.web237.js +46 -3
  270. package/dist/web/index.web238.js +2 -18
  271. package/dist/web/index.web239.js +2 -28
  272. package/dist/web/index.web240.js +2 -8
  273. package/dist/web/index.web241.js +18 -11
  274. package/dist/web/index.web242.js +28 -13
  275. package/dist/web/index.web243.js +8 -10
  276. package/dist/web/index.web244.js +11 -17
  277. package/dist/web/index.web245.js +12 -80
  278. package/dist/web/index.web246.js +10 -2
  279. package/dist/web/index.web247.js +17 -2
  280. package/dist/web/index.web248.js +81 -2
  281. package/dist/web/index.web250.js +14 -78
  282. package/dist/web/index.web251.js +78 -14
  283. package/dist/web/index.web3.js +1 -1
  284. package/dist/web/index.web8.js +26 -12
  285. package/dist/web/index.web9.js +1 -1
  286. package/dist/web-types/platform/types.d.ts +25 -0
  287. package/dist/web-types/version.d.ts +1 -1
  288. package/package.json +2 -2
@@ -1,13 +1,20 @@
1
- import { checkSigCryptoKey as i } from "./index.web250.js";
2
- import o from "./index.web242.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 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
+ }
11
17
  export {
12
- s as default
18
+ a as decodeBase64,
19
+ o as encodeBase64
13
20
  };
@@ -1,15 +1,30 @@
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
- }
1
+ import { JOSENotSupported as r } from "./index.web131.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
+ };
12
28
  export {
13
- r as default,
14
- t as withAlg
29
+ S as default
15
30
  };
@@ -1,12 +1,10 @@
1
- function e(t) {
2
- return t?.[Symbol.toStringTag] === "CryptoKey";
3
- }
4
- function r(t) {
5
- return t?.[Symbol.toStringTag] === "KeyObject";
6
- }
7
- const n = (t) => e(t) || r(t);
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`);
6
+ }
7
+ };
8
8
  export {
9
- n as default,
10
- e as isCryptoKey,
11
- r as isKeyObject
9
+ o as default
12
10
  };
@@ -1,19 +1,13 @@
1
- import n from "./index.web145.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";
13
- }
1
+ import { checkSigCryptoKey as i } from "./index.web251.js";
2
+ import o from "./index.web245.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
+ };
14
11
  export {
15
- r as isJWK,
16
- o as isPrivateJWK,
17
- e as isPublicJWK,
18
- c as isSecretJWK
12
+ s as default
19
13
  };
@@ -1,83 +1,15 @@
1
- import { JOSENotSupported as s } from "./index.web134.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
+ 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);
74
11
  }
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
12
  export {
82
- i as default
13
+ r as default,
14
+ t as withAlg
83
15
  };
@@ -1,4 +1,12 @@
1
- var r = {};
1
+ function e(t) {
2
+ return t?.[Symbol.toStringTag] === "CryptoKey";
3
+ }
4
+ function r(t) {
5
+ return t?.[Symbol.toStringTag] === "KeyObject";
6
+ }
7
+ const n = (t) => e(t) || r(t);
2
8
  export {
3
- r as __exports
9
+ n as default,
10
+ e as isCryptoKey,
11
+ r as isKeyObject
4
12
  };
@@ -1,4 +1,19 @@
1
- var e = { exports: {} };
1
+ import n from "./index.web169.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";
13
+ }
2
14
  export {
3
- e as __module
15
+ r as isJWK,
16
+ o as isPrivateJWK,
17
+ e as isPublicJWK,
18
+ c as isSecretJWK
4
19
  };
@@ -1,4 +1,83 @@
1
- var r = { exports: {} };
1
+ import { JOSENotSupported as s } from "./index.web131.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 };
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
+ };
2
81
  export {
3
- r as __module
82
+ i as default
4
83
  };
@@ -1,81 +1,17 @@
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);
1
+ import { SizeExceedsPaddingSizeError as a } from "./index.web237.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
- u as checkSigCryptoKey
16
+ o as pad
81
17
  };
@@ -1,17 +1,81 @@
1
- import { SizeExceedsPaddingSizeError as a } from "./index.web236.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 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
- o as pad
80
+ u as checkSigCryptoKey
17
81
  };
@@ -1,2 +1,2 @@
1
- import { __require as r } from "./index.web222.js";
1
+ import { __require as r } from "./index.web210.js";
2
2
  r();
@@ -7,11 +7,25 @@ const l = {
7
7
  * @param key - The storage key.
8
8
  * @returns Promise that resolves to the value.
9
9
  */
10
- async getItem(e) {
10
+ async getItem(t) {
11
+ return (await this.getItemWithOutcome(t)).value;
12
+ },
13
+ /**
14
+ * Retrieves a value from localStorage 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
- return localStorage.getItem(e);
13
- } catch (r) {
14
- return console.warn(`Failed to get item from localStorage: ${r}`), null;
21
+ const e = localStorage.getItem(t);
22
+ return e === null ? { value: null, outcome: "not_found" } : { value: e, outcome: "found" };
23
+ } catch (e) {
24
+ return console.warn(`Failed to get item from localStorage: ${e}`), {
25
+ value: null,
26
+ outcome: "error",
27
+ errorMessage: e instanceof Error ? e.message : String(e)
28
+ };
15
29
  }
16
30
  },
17
31
  /**
@@ -21,9 +35,9 @@ const l = {
21
35
  * @param value - The value to store.
22
36
  * @returns Promise that resolves when the value is stored.
23
37
  */
24
- async setItem(e, r) {
38
+ async setItem(t, e) {
25
39
  try {
26
- localStorage.setItem(e, r);
40
+ localStorage.setItem(t, e);
27
41
  } catch (o) {
28
42
  throw console.warn(`Failed to set item in localStorage: ${o}`), o;
29
43
  }
@@ -34,11 +48,11 @@ const l = {
34
48
  * @param key - The storage key.
35
49
  * @returns Promise that resolves when the value is removed.
36
50
  */
37
- async removeItem(e) {
51
+ async removeItem(t) {
38
52
  try {
39
- localStorage.removeItem(e);
40
- } catch (r) {
41
- throw console.warn(`Failed to remove item from localStorage: ${r}`), r;
53
+ localStorage.removeItem(t);
54
+ } catch (e) {
55
+ throw console.warn(`Failed to remove item from localStorage: ${e}`), e;
42
56
  }
43
57
  },
44
58
  /**
@@ -49,8 +63,8 @@ const l = {
49
63
  async clear() {
50
64
  try {
51
65
  localStorage.clear();
52
- } catch (e) {
53
- throw console.warn(`Failed to clear localStorage: ${e}`), e;
66
+ } catch (t) {
67
+ throw console.warn(`Failed to clear localStorage: ${t}`), t;
54
68
  }
55
69
  }
56
70
  };
@@ -1,4 +1,4 @@
1
- const o = "0.0.117";
1
+ const o = "0.0.118";
2
2
  export {
3
3
  o as VERSION
4
4
  };
@@ -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
  */