@coinbase/cdp-core 0.0.122 → 0.0.123

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 (300) hide show
  1. package/dist/esm/index.web10.js +66 -65
  2. package/dist/esm/index.web104.js +1 -1
  3. package/dist/esm/index.web113.js +3 -3
  4. package/dist/esm/index.web116.js +2 -2
  5. package/dist/esm/index.web120.js +3 -3
  6. package/dist/esm/index.web122.js +6 -6
  7. package/dist/esm/index.web134.js +13 -373
  8. package/dist/esm/index.web135.js +22 -28
  9. package/dist/esm/index.web136.js +50 -28
  10. package/dist/esm/index.web137.js +379 -2
  11. package/dist/esm/index.web138.js +28 -65
  12. package/dist/esm/index.web139.js +28 -364
  13. package/dist/esm/index.web140.js +2 -19
  14. package/dist/esm/index.web141.js +63 -20
  15. package/dist/esm/index.web142.js +351 -37
  16. package/dist/esm/index.web143.js +944 -4
  17. package/dist/esm/index.web144.js +2 -945
  18. package/dist/esm/index.web145.js +50 -2
  19. package/dist/esm/index.web146.js +26 -49
  20. package/dist/esm/index.web147.js +54 -26
  21. package/dist/esm/index.web148.js +11 -5
  22. package/dist/esm/index.web149.js +2 -48
  23. package/dist/esm/index.web150.js +44 -54
  24. package/dist/esm/index.web151.js +13 -10
  25. package/dist/esm/index.web152.js +13 -2
  26. package/dist/esm/index.web153.js +12 -45
  27. package/dist/esm/index.web154.js +5 -14
  28. package/dist/esm/index.web155.js +47 -14
  29. package/dist/esm/index.web156.js +4 -18
  30. package/dist/esm/index.web157.js +28 -7
  31. package/dist/esm/index.web158.js +7 -3
  32. package/dist/esm/index.web159.js +3 -28
  33. package/dist/esm/index.web160.js +28 -8
  34. package/dist/esm/index.web161.js +8 -7
  35. package/dist/esm/index.web162.js +7 -80
  36. package/dist/esm/index.web163.js +71 -19
  37. package/dist/esm/index.web164.js +28 -3
  38. package/dist/esm/index.web165.js +3 -15
  39. package/dist/esm/index.web166.js +15 -4
  40. package/dist/esm/index.web167.js +4 -14
  41. package/dist/esm/index.web168.js +14 -19
  42. package/dist/esm/index.web169.js +15 -57
  43. package/dist/esm/index.web170.js +60 -16
  44. package/dist/esm/index.web171.js +17 -23
  45. package/dist/esm/index.web172.js +23 -8
  46. package/dist/esm/index.web173.js +8 -42
  47. package/dist/esm/index.web174.js +42 -7
  48. package/dist/esm/index.web175.js +7 -20
  49. package/dist/esm/index.web176.js +18 -10
  50. package/dist/esm/index.web177.js +4 -11
  51. package/dist/esm/index.web198.js +1 -1
  52. package/dist/esm/index.web2.js +2 -2
  53. package/dist/esm/index.web200.js +1 -1
  54. package/dist/esm/index.web201.js +2 -2
  55. package/dist/esm/index.web209.js +2 -2
  56. package/dist/esm/index.web217.js +20 -108
  57. package/dist/esm/index.web218.js +10 -2
  58. package/dist/esm/index.web219.js +20 -2
  59. package/dist/esm/index.web220.js +93 -20
  60. package/dist/esm/index.web221.js +20 -9
  61. package/dist/esm/index.web222.js +114 -16
  62. package/dist/esm/index.web223.js +99 -89
  63. package/dist/esm/index.web224.js +78 -20
  64. package/dist/esm/index.web225.js +79 -118
  65. package/dist/esm/index.web226.js +106 -101
  66. package/dist/esm/index.web227.js +2 -79
  67. package/dist/esm/index.web228.js +2 -79
  68. package/dist/esm/index.web231.js +1 -1
  69. package/dist/esm/index.web238.js +1 -1
  70. package/dist/esm/index.web244.js +3 -17
  71. package/dist/esm/index.web245.js +18 -28
  72. package/dist/esm/index.web246.js +26 -6
  73. package/dist/esm/index.web247.js +6 -9
  74. package/dist/esm/index.web248.js +11 -13
  75. package/dist/esm/index.web249.js +11 -8
  76. package/dist/esm/index.web250.js +7 -14
  77. package/dist/esm/index.web251.js +16 -80
  78. package/dist/esm/index.web252.js +81 -2
  79. package/dist/esm/index.web253.js +2 -4
  80. package/dist/esm/index.web89.js +46 -48
  81. package/dist/esm/index.web9.js +1 -1
  82. package/dist/native/index.native101.js +1 -1
  83. package/dist/native/index.native11.js +1 -1
  84. package/dist/native/index.native110.js +3 -3
  85. package/dist/native/index.native113.js +2 -2
  86. package/dist/native/index.native117.js +3 -3
  87. package/dist/native/index.native118.js +6 -6
  88. package/dist/native/index.native12.js +62 -61
  89. package/dist/native/index.native129.js +12 -12
  90. package/dist/native/index.native130.js +2 -2
  91. package/dist/native/index.native131.js +373 -13
  92. package/dist/native/index.native132.js +2 -25
  93. package/dist/native/index.native133.js +63 -48
  94. package/dist/native/index.native134.js +177 -189
  95. package/dist/native/index.native135.js +31 -2
  96. package/dist/native/index.native136.js +28 -65
  97. package/dist/native/index.native137.js +12 -360
  98. package/dist/native/index.native138.js +22 -28
  99. package/dist/native/index.native139.js +50 -28
  100. package/dist/native/index.native140.js +11 -943
  101. package/dist/native/index.native141.js +12 -2
  102. package/dist/native/index.native142.js +4 -49
  103. package/dist/native/index.native143.js +944 -26
  104. package/dist/native/index.native144.js +2 -5
  105. package/dist/native/index.native145.js +45 -43
  106. package/dist/native/index.native146.js +26 -12
  107. package/dist/native/index.native147.js +5 -12
  108. package/dist/native/index.native148.js +48 -36
  109. package/dist/native/index.native149.js +35 -67
  110. package/dist/native/index.native150.js +67 -4
  111. package/dist/native/index.native151.js +13 -54
  112. package/dist/native/index.native152.js +27 -10
  113. package/dist/native/index.native153.js +8 -2
  114. package/dist/native/index.native154.js +4 -45
  115. package/dist/native/index.native155.js +27 -13
  116. package/dist/native/index.native156.js +9 -2
  117. package/dist/native/index.native157.js +8 -2
  118. package/dist/native/index.native158.js +79 -13
  119. package/dist/native/index.native159.js +26 -54
  120. package/dist/native/index.native160.js +3 -6
  121. package/dist/native/index.native161.js +14 -21
  122. package/dist/native/index.native162.js +4 -17
  123. package/dist/native/index.native163.js +13 -45
  124. package/dist/native/index.native164.js +19 -3
  125. package/dist/native/index.native165.js +60 -3
  126. package/dist/native/index.native166.js +17 -34
  127. package/dist/native/index.native167.js +21 -10
  128. package/dist/native/index.native168.js +8 -4
  129. package/dist/native/index.native169.js +40 -27
  130. package/dist/native/index.native170.js +7 -6
  131. package/dist/native/index.native171.js +19 -31
  132. package/dist/native/index.native172.js +52 -10
  133. package/dist/native/index.native173.js +10 -55
  134. package/dist/native/index.native174.js +2 -43
  135. package/dist/native/index.native175.js +43 -126
  136. package/dist/native/index.native176.js +13 -104
  137. package/dist/native/index.native177.js +13 -6
  138. package/dist/native/index.native178.js +56 -3
  139. package/dist/native/index.native179.js +6 -78
  140. package/dist/native/index.native180.js +22 -2
  141. package/dist/native/index.native181.js +18 -2
  142. package/dist/native/index.native182.js +40 -32
  143. package/dist/native/index.native183.js +3 -6
  144. package/dist/native/index.native184.js +3 -34
  145. package/dist/native/index.native185.js +34 -14
  146. package/dist/native/index.native186.js +9 -31
  147. package/dist/native/index.native187.js +4 -18
  148. package/dist/native/index.native188.js +28 -8
  149. package/dist/native/index.native189.js +6 -10
  150. package/dist/native/index.native190.js +32 -11
  151. package/dist/native/index.native191.js +12 -13
  152. package/dist/native/index.native192.js +55 -5
  153. package/dist/native/index.native193.js +43 -5
  154. package/dist/native/index.native194.js +127 -10
  155. package/dist/native/index.native195.js +104 -13
  156. package/dist/native/index.native196.js +6 -27
  157. package/dist/native/index.native197.js +3 -8
  158. package/dist/native/index.native198.js +78 -3
  159. package/dist/native/index.native199.js +2 -28
  160. package/dist/native/index.native2.js +2 -2
  161. package/dist/native/index.native200.js +2 -9
  162. package/dist/native/index.native201.js +37 -7
  163. package/dist/native/index.native202.js +6 -79
  164. package/dist/native/index.native203.js +32 -25
  165. package/dist/native/index.native204.js +14 -3
  166. package/dist/native/index.native205.js +34 -14
  167. package/dist/native/index.native206.js +18 -4
  168. package/dist/native/index.native207.js +8 -13
  169. package/dist/native/index.native208.js +9 -18
  170. package/dist/native/index.native209.js +11 -60
  171. package/dist/native/index.native210.js +13 -17
  172. package/dist/native/index.native211.js +5 -23
  173. package/dist/native/index.native212.js +5 -9
  174. package/dist/native/index.native213.js +10 -41
  175. package/dist/native/index.native214.js +2 -8
  176. package/dist/native/index.native215.js +2 -21
  177. package/dist/native/index.native222.js +7 -20
  178. package/dist/native/index.native223.js +2 -10
  179. package/dist/native/index.native224.js +361 -20
  180. package/dist/native/index.native225.js +852 -93
  181. package/dist/native/index.native226.js +39 -21
  182. package/dist/native/index.native227.js +2 -118
  183. package/dist/native/index.native228.js +67 -36
  184. package/dist/native/index.native229.js +35 -2
  185. package/dist/native/index.native230.js +14 -69
  186. package/dist/native/index.native231.js +20 -34
  187. package/dist/native/index.native232.js +10 -15
  188. package/dist/native/index.native233.js +20 -8
  189. package/dist/native/index.native234.js +94 -2
  190. package/dist/native/index.native235.js +21 -361
  191. package/dist/native/index.native236.js +118 -853
  192. package/dist/native/index.native237.js +40 -14
  193. package/dist/native/index.native238.js +21 -2
  194. package/dist/native/index.native239.js +2 -20
  195. package/dist/native/index.native240.js +18 -31
  196. package/dist/native/index.native241.js +32 -6
  197. package/dist/native/index.native242.js +6 -3
  198. package/dist/native/index.native243.js +2 -47
  199. package/dist/native/index.native244.js +2 -2
  200. package/dist/native/index.native245.js +2 -2
  201. package/dist/native/index.native246.js +4 -2
  202. package/dist/native/index.native248.js +1 -1
  203. package/dist/native/index.native250.js +1 -1
  204. package/dist/native/index.native253.js +1 -1
  205. package/dist/native/index.native254.js +1 -1
  206. package/dist/native/index.native256.js +14 -78
  207. package/dist/native/index.native257.js +78 -14
  208. package/dist/native/index.native3.js +1 -1
  209. package/dist/native/index.native87.js +46 -48
  210. package/dist/native-types/auth/authManager.d.ts +6 -2
  211. package/dist/native-types/auth/createAuthManager.d.ts +5 -1
  212. package/dist/native-types/version.d.ts +1 -1
  213. package/dist/types/auth/authManager.d.ts +6 -2
  214. package/dist/types/auth/createAuthManager.d.ts +5 -1
  215. package/dist/types/version.d.ts +1 -1
  216. package/dist/web/index.web10.js +66 -65
  217. package/dist/web/index.web104.js +1 -1
  218. package/dist/web/index.web113.js +3 -3
  219. package/dist/web/index.web116.js +2 -2
  220. package/dist/web/index.web120.js +3 -3
  221. package/dist/web/index.web122.js +6 -6
  222. package/dist/web/index.web134.js +13 -373
  223. package/dist/web/index.web135.js +22 -28
  224. package/dist/web/index.web136.js +50 -28
  225. package/dist/web/index.web137.js +379 -2
  226. package/dist/web/index.web138.js +28 -65
  227. package/dist/web/index.web139.js +28 -364
  228. package/dist/web/index.web140.js +2 -19
  229. package/dist/web/index.web141.js +63 -20
  230. package/dist/web/index.web142.js +351 -37
  231. package/dist/web/index.web143.js +944 -4
  232. package/dist/web/index.web144.js +2 -945
  233. package/dist/web/index.web145.js +50 -2
  234. package/dist/web/index.web146.js +26 -49
  235. package/dist/web/index.web147.js +54 -26
  236. package/dist/web/index.web148.js +11 -5
  237. package/dist/web/index.web149.js +2 -48
  238. package/dist/web/index.web150.js +44 -54
  239. package/dist/web/index.web151.js +13 -10
  240. package/dist/web/index.web152.js +13 -2
  241. package/dist/web/index.web153.js +12 -45
  242. package/dist/web/index.web154.js +5 -14
  243. package/dist/web/index.web155.js +47 -14
  244. package/dist/web/index.web156.js +4 -18
  245. package/dist/web/index.web157.js +28 -7
  246. package/dist/web/index.web158.js +7 -3
  247. package/dist/web/index.web159.js +3 -28
  248. package/dist/web/index.web160.js +28 -8
  249. package/dist/web/index.web161.js +8 -7
  250. package/dist/web/index.web162.js +7 -80
  251. package/dist/web/index.web163.js +71 -19
  252. package/dist/web/index.web164.js +28 -3
  253. package/dist/web/index.web165.js +3 -15
  254. package/dist/web/index.web166.js +15 -4
  255. package/dist/web/index.web167.js +4 -14
  256. package/dist/web/index.web168.js +14 -19
  257. package/dist/web/index.web169.js +15 -57
  258. package/dist/web/index.web170.js +60 -16
  259. package/dist/web/index.web171.js +17 -23
  260. package/dist/web/index.web172.js +23 -8
  261. package/dist/web/index.web173.js +8 -42
  262. package/dist/web/index.web174.js +42 -7
  263. package/dist/web/index.web175.js +7 -20
  264. package/dist/web/index.web176.js +18 -10
  265. package/dist/web/index.web177.js +4 -11
  266. package/dist/web/index.web198.js +1 -1
  267. package/dist/web/index.web2.js +2 -2
  268. package/dist/web/index.web200.js +1 -1
  269. package/dist/web/index.web201.js +2 -2
  270. package/dist/web/index.web209.js +2 -2
  271. package/dist/web/index.web217.js +20 -108
  272. package/dist/web/index.web218.js +10 -2
  273. package/dist/web/index.web219.js +20 -2
  274. package/dist/web/index.web220.js +93 -20
  275. package/dist/web/index.web221.js +20 -9
  276. package/dist/web/index.web222.js +114 -16
  277. package/dist/web/index.web223.js +99 -89
  278. package/dist/web/index.web224.js +78 -20
  279. package/dist/web/index.web225.js +79 -118
  280. package/dist/web/index.web226.js +106 -101
  281. package/dist/web/index.web227.js +2 -79
  282. package/dist/web/index.web228.js +2 -79
  283. package/dist/web/index.web231.js +1 -1
  284. package/dist/web/index.web238.js +1 -1
  285. package/dist/web/index.web244.js +3 -17
  286. package/dist/web/index.web245.js +18 -28
  287. package/dist/web/index.web246.js +26 -6
  288. package/dist/web/index.web247.js +6 -9
  289. package/dist/web/index.web248.js +11 -13
  290. package/dist/web/index.web249.js +11 -8
  291. package/dist/web/index.web250.js +7 -14
  292. package/dist/web/index.web251.js +16 -80
  293. package/dist/web/index.web252.js +81 -2
  294. package/dist/web/index.web253.js +2 -4
  295. package/dist/web/index.web89.js +46 -48
  296. package/dist/web/index.web9.js +1 -1
  297. package/dist/web-types/auth/authManager.d.ts +6 -2
  298. package/dist/web-types/auth/createAuthManager.d.ts +5 -1
  299. package/dist/web-types/version.d.ts +1 -1
  300. package/package.json +2 -2
@@ -1,83 +1,19 @@
1
- import { JOSENotSupported as s } from "./index.web141.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 n from "./index.web151.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";
74
13
  }
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
14
  export {
82
- i as default
15
+ r as isJWK,
16
+ o as isPrivateJWK,
17
+ e as isPublicJWK,
18
+ c as isSecretJWK
83
19
  };
@@ -1,4 +1,83 @@
1
- var r = { exports: {} };
1
+ import { JOSENotSupported as s } from "./index.web135.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,6 +1,4 @@
1
- function e(t) {
2
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
3
- }
1
+ var r = { exports: {} };
4
2
  export {
5
- e as getDefaultExportFromCjs
3
+ r as __module
6
4
  };
@@ -13,24 +13,24 @@ const l = 60 * 1e3, R = {
13
13
  baseDelayMs: 1e3,
14
14
  maxDelayMs: 1e4
15
15
  };
16
- function g(s, e, r) {
17
- const n = e * Math.pow(2, s), o = Math.random() * 0.3 * n;
18
- return Math.min(n + o, r);
16
+ function g(r, e, t) {
17
+ const n = e * Math.pow(2, r), o = Math.random() * 0.3 * n;
18
+ return Math.min(n + o, t);
19
19
  }
20
- function A(s) {
21
- return new Promise((e) => setTimeout(e, s));
20
+ function A(r) {
21
+ return new Promise((e) => setTimeout(e, r));
22
22
  }
23
- function E(s) {
24
- if (s instanceof TypeError && s.message.includes("fetch"))
23
+ function E(r) {
24
+ if (r instanceof TypeError && r.message.includes("fetch"))
25
25
  return !0;
26
- if (s instanceof y) {
27
- if (s.statusCode >= 500 && s.statusCode < 600 || s.statusCode === 408 || s.statusCode === 429)
26
+ if (r instanceof y) {
27
+ if (r.statusCode >= 500 && r.statusCode < 600 || r.statusCode === 408 || r.statusCode === 429)
28
28
  return !0;
29
- if (s.statusCode === 401)
29
+ if (r.statusCode === 401)
30
30
  return !1;
31
31
  }
32
- if (s instanceof Error) {
33
- const e = s.message.toLowerCase();
32
+ if (r instanceof Error) {
33
+ const e = r.message.toLowerCase();
34
34
  if (e.includes("network") || e.includes("timeout") || e.includes("econnrefused") || e.includes("enotfound") || e.includes("socket"))
35
35
  return !0;
36
36
  }
@@ -48,9 +48,11 @@ class j {
48
48
  * Initializes the token manager.
49
49
  *
50
50
  * @param projectId - The project ID.
51
+ * @param options - Options that control initial session refresh behavior.
52
+ * @param options.deferInitialization - Whether to defer the initial session refresh until ensureInitialized is called.
51
53
  */
52
- constructor(e) {
53
- this.projectId = e, this.initPromise = this._doInitialize();
54
+ constructor(e, t = {}) {
55
+ this.projectId = e, t.deferInitialization || (this.initPromise = this._doInitialize());
54
56
  }
55
57
  /**
56
58
  * Gets the current user, or null if there is no user signed in.
@@ -139,12 +141,12 @@ class j {
139
141
  if (!await this.isSignedIn())
140
142
  throw new Error("Cannot get X-Wallet-Auth header if the user is not signed in");
141
143
  this.shouldRefreshWalletSecret() && await this.refreshWalletSecret();
142
- const r = `${e.requestMethod} ${e.requestHost}${e.requestPath}`, n = Math.floor(Date.now() / 1e3), o = c(), a = {
143
- uris: [r]
144
+ const t = `${e.requestMethod} ${e.requestHost}${e.requestPath}`, n = Math.floor(Date.now() / 1e3), o = c(), a = {
145
+ uris: [t]
144
146
  };
145
147
  if (e.requestData && Object.keys(e.requestData).length > 0) {
146
- const t = p(e.requestData);
147
- a.reqHash = await o.hash(new TextEncoder().encode(JSON.stringify(t)));
148
+ const s = p(e.requestData);
149
+ a.reqHash = await o.hash(new TextEncoder().encode(JSON.stringify(s)));
148
150
  }
149
151
  return await new _(a).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuedAt(n).setNotBefore(n).setJti(o.generateRandomId()).sign(this.walletSecret.keyPair.privateKey);
150
152
  }
@@ -162,7 +164,7 @@ class j {
162
164
  * @param authState - The authentication state.
163
165
  */
164
166
  async setAuthState(e) {
165
- this.authState = e, i.endUserIdentifier = e.user.userId, this.authStateChangeCallbacks.forEach((r) => r(this.authState?.user ?? null)), this.scheduleTokenRefresh();
167
+ this.authState = e, i.endUserIdentifier = e.user.userId, this.authStateChangeCallbacks.forEach((t) => t(this.authState?.user ?? null)), this.scheduleTokenRefresh();
166
168
  }
167
169
  /**
168
170
  * Clears the authentication state.
@@ -172,14 +174,10 @@ class j {
172
174
  }
173
175
  /**
174
176
  * Ensures the AuthManager is initialized before proceeding.
175
- * If initialization is already in progress, waits for it to complete.
177
+ * Starts deferred initialization when necessary, otherwise waits for initialization already in progress.
176
178
  */
177
179
  async ensureInitialized() {
178
- if (this.initPromise) {
179
- await this.initPromise;
180
- return;
181
- }
182
- throw new Error("AuthManager not initialized");
180
+ this.initPromise ??= this._doInitialize(), await this.initPromise;
183
181
  }
184
182
  /**
185
183
  * Internal async initialization logic.
@@ -210,19 +208,19 @@ class j {
210
208
  * @returns The new access token.
211
209
  */
212
210
  async refreshAccessToken(e = "on_demand") {
213
- const { maxRetries: r, baseDelayMs: n, maxDelayMs: o } = R;
211
+ const { maxRetries: t, baseDelayMs: n, maxDelayMs: o } = R;
214
212
  i.sendSessionRefreshEvent({
215
213
  name: "refresh_token_start",
216
214
  trigger: e
217
215
  });
218
- for (let a = 0; a <= r; a++)
216
+ for (let a = 0; a <= t; a++)
219
217
  try {
220
- const t = await d(this.projectId, {
218
+ const s = await d(this.projectId, {
221
219
  grantType: "refresh_token"
222
220
  }), h = k(
223
- t.accessToken,
224
- t.validUntil,
225
- t.endUser
221
+ s.accessToken,
222
+ s.validUntil,
223
+ s.endUser
226
224
  );
227
225
  await this.setAuthState(h), i.sendSessionRefreshEvent({
228
226
  name: "refresh_token_success",
@@ -230,15 +228,15 @@ class j {
230
228
  attempt: a
231
229
  });
232
230
  return;
233
- } catch (t) {
234
- const h = t instanceof Error ? t.message : String(t);
235
- if (m(t)) {
236
- if (S(t)) {
231
+ } catch (s) {
232
+ const h = s instanceof Error ? s.message : String(s);
233
+ if (m(s)) {
234
+ if (S(s)) {
237
235
  i.sendSessionRefreshEvent({
238
236
  name: "refresh_token_skipped_transient",
239
237
  trigger: e,
240
238
  attempt: a,
241
- read_outcome: t.outcome,
239
+ read_outcome: s.outcome,
242
240
  error_message: h
243
241
  });
244
242
  return;
@@ -248,12 +246,12 @@ class j {
248
246
  trigger: e,
249
247
  attempt: a,
250
248
  error_type: "non_transient",
251
- read_outcome: t.outcome,
249
+ read_outcome: s.outcome,
252
250
  error_message: h
253
251
  }), await this.signOut();
254
252
  return;
255
253
  }
256
- if (!E(t)) {
254
+ if (!E(s)) {
257
255
  i.sendSessionRefreshEvent({
258
256
  name: "refresh_token_failure",
259
257
  trigger: e,
@@ -263,7 +261,7 @@ class j {
263
261
  }), await this.signOut();
264
262
  return;
265
263
  }
266
- if (a === r) {
264
+ if (a === t) {
267
265
  i.sendSessionRefreshEvent({
268
266
  name: "refresh_token_exhausted",
269
267
  trigger: e,
@@ -291,13 +289,13 @@ class j {
291
289
  scheduleTokenRefresh() {
292
290
  if (this.cancelTokenRefresh(), !this.authState)
293
291
  return;
294
- const r = this.authState.expiresAt - l - Date.now();
295
- r <= 0 || (i.sendSessionRefreshEvent({
292
+ const t = this.authState.expiresAt - l - Date.now();
293
+ t <= 0 || (i.sendSessionRefreshEvent({
296
294
  name: "refresh_token_scheduled",
297
- time_until_refresh_ms: r
295
+ time_until_refresh_ms: t
298
296
  }), this.refreshTimeout = setTimeout(async () => {
299
297
  await this.refreshAccessToken("scheduled"), this.scheduleTokenRefresh();
300
- }, r));
298
+ }, t));
301
299
  }
302
300
  /**
303
301
  * Cancels any scheduled token refresh.
@@ -334,20 +332,20 @@ class j {
334
332
  * Internal wallet secret refresh logic.
335
333
  */
336
334
  async _doRefreshWalletSecret() {
337
- const e = c(), r = this.walletSecret?.walletSecretId ?? e.generateRandomId(), n = this.walletSecret?.keyPair ?? await e.createKeyPair(), o = this.authState.expiresAt, a = new Date(o).toISOString();
338
- this.walletSecret = { walletSecretId: r, keyPair: n, expiresAt: o };
335
+ const e = c(), t = this.walletSecret?.walletSecretId ?? e.generateRandomId(), n = this.walletSecret?.keyPair ?? await e.createKeyPair(), o = this.authState.expiresAt, a = new Date(o).toISOString();
336
+ this.walletSecret = { walletSecretId: t, keyPair: n, expiresAt: o };
339
337
  try {
340
338
  await w(
341
339
  this.authState.user.userId,
342
340
  {
343
- walletSecretId: r,
341
+ walletSecretId: t,
344
342
  publicKey: n.publicKeyBase64,
345
343
  validUntil: a
346
344
  },
347
345
  { projectID: this.projectId }
348
346
  );
349
- } catch (t) {
350
- throw this.walletSecret = null, t;
347
+ } catch (s) {
348
+ throw this.walletSecret = null, s;
351
349
  }
352
350
  }
353
351
  }
@@ -1,4 +1,4 @@
1
- const o = "0.0.122";
1
+ const o = "0.0.123";
2
2
  export {
3
3
  o as VERSION
4
4
  };
@@ -1,4 +1,4 @@
1
- import { __require as r } from "./index.native140.js";
1
+ import { __require as r } from "./index.native143.js";
2
2
  var f = r();
3
3
  export {
4
4
  f as b
@@ -1,4 +1,4 @@
1
- const o = "0.0.122";
1
+ const o = "0.0.123";
2
2
  export {
3
3
  o as VERSION
4
4
  };
@@ -1,6 +1,6 @@
1
- import { CompactSign as i } from "./index.native131.js";
2
- import { JWTInvalid as r } from "./index.native132.js";
3
- import { JWTClaimsBuilder as n } from "./index.native133.js";
1
+ import { CompactSign as i } from "./index.native137.js";
2
+ import { JWTInvalid as r } from "./index.native138.js";
3
+ import { JWTClaimsBuilder as n } from "./index.native139.js";
4
4
  class d {
5
5
  #s;
6
6
  #t;
@@ -1,5 +1,5 @@
1
- import { InvalidAddressError as s } from "./index.native146.js";
2
- import { isAddress as a } from "./index.native147.js";
1
+ import { InvalidAddressError as s } from "./index.native140.js";
2
+ import { isAddress as a } from "./index.native141.js";
3
3
  function r(n) {
4
4
  if (typeof n == "string") {
5
5
  if (!a(n, { strict: !1 }))
@@ -1,7 +1,7 @@
1
- import { DisconnectedError as l, from as d } from "./index.native134.js";
1
+ import { DisconnectedError as l, from as d } from "./index.native131.js";
2
2
  import { validateRequest as h, EIP1193ProviderError as m, STANDARD_ERROR_CODES as _ } from "./index.native93.js";
3
- import { createEOAHandlers as p } from "./index.native138.js";
4
- import { createSmartAccountHandlers as g } from "./index.native139.js";
3
+ import { createEOAHandlers as p } from "./index.native135.js";
4
+ import { createSmartAccountHandlers as g } from "./index.native136.js";
5
5
  import "viem";
6
6
  import "zustand";
7
7
  import "@coinbase/cdp-api-client";
@@ -1,11 +1,11 @@
1
- import { AuthManager as r } from "./index.native87.js";
2
- import { CustomAuthManager as o } from "./index.native125.js";
1
+ import { AuthManager as o } from "./index.native87.js";
2
+ import { CustomAuthManager as n } from "./index.native125.js";
3
3
  import "@coinbase/cdp-api-client";
4
4
  import "viem";
5
- import { getConfig as n } from "./index.native76.js";
6
- function a(t) {
7
- return n().customAuth?.getJwt ? new o(t) : new r(t);
5
+ import { getConfig as e } from "./index.native76.js";
6
+ function c(t, r = {}) {
7
+ return e().customAuth?.getJwt ? new n(t, r) : new o(t, r);
8
8
  }
9
9
  export {
10
- a as createAuthManager
10
+ c as createAuthManager
11
11
  };
@@ -1,27 +1,27 @@
1
- import { configureCdpApiClient as C, setAuthManager as M, getMfaConfig as v, APIError as m, getProjectConfig as S } from "@coinbase/cdp-api-client";
2
- import { Analytics as d } from "./index.native2.js";
1
+ import { setCookieDomain as p, configureCdpApiClient as C, setAuthManager as M, getProjectConfig as S, APIError as m, getMfaConfig as v } from "@coinbase/cdp-api-client";
2
+ import { Analytics as f } from "./index.native2.js";
3
3
  import "./index.native3.js";
4
- import { createAuthManager as y } from "./index.native118.js";
5
- import { OAuthManager as w } from "./index.native119.js";
4
+ import { createAuthManager as w } from "./index.native118.js";
5
+ import { OAuthManager as y } from "./index.native119.js";
6
6
  import { MockAuthManager as P } from "./index.native120.js";
7
7
  import { MockOAuthManager as _ } from "./index.native121.js";
8
8
  import { getAttestationModule as O } from "./index.native95.js";
9
9
  import { getPlatformServices as h } from "./index.native10.js";
10
- import { getConfig as i, setCoreAuthManager as I, setCoreOAuthManager as A, setMfaConfig as k, setProjectConfig as b, getCoreAuthManager as R, setConfig as E } from "./index.native76.js";
10
+ import { getConfig as a, setCoreAuthManager as I, setCoreOAuthManager as k, setMfaConfig as A, setProjectConfig as b, getCoreAuthManager as E, setConfig as R } from "./index.native76.js";
11
11
  import "viem";
12
12
  const V = async (t) => {
13
13
  if (!t.projectId)
14
14
  throw new Error("Project ID is required");
15
- t.disableAnalytics === void 0 || t.disableAnalytics === !1 ? (d.developerIdentifier = t.projectId, d.isUsingMocks = t.useMock === !0, d.isProduction = !t.basePath || t.basePath === "https://api.cdp.coinbase.com/platform") : d.enabled = !1;
16
- let a;
15
+ t.disableAnalytics === void 0 || t.disableAnalytics === !1 ? (f.developerIdentifier = t.projectId, f.isUsingMocks = t.useMock === !0, f.isProduction = !t.basePath || t.basePath === "https://api.cdp.coinbase.com/platform") : f.enabled = !1;
16
+ let o;
17
17
  try {
18
- a = i().projectId !== t.projectId;
18
+ o = a().projectId !== t.projectId;
19
19
  } catch {
20
- a = !0;
20
+ o = !0;
21
21
  }
22
- if (E(t), i().useMock) {
23
- I(new P(i().projectId)), A(new _()), k({
24
- projectId: i().projectId,
22
+ if (o && p(null), R(t), a().useMock) {
23
+ I(new P(a().projectId)), k(new _()), A({
24
+ projectId: a().projectId,
25
25
  enabled: !1,
26
26
  totpConfig: { enabled: !1 },
27
27
  smsConfig: { enabled: !1 },
@@ -31,94 +31,95 @@ const V = async (t) => {
31
31
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
32
32
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
33
33
  }), b({
34
- projectId: i().projectId,
34
+ projectId: a().projectId,
35
35
  name: "Mock Project",
36
36
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
37
37
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
38
38
  });
39
39
  return;
40
40
  }
41
- let o, c = !1, s = !1;
41
+ let n, d = !1, c = !1;
42
42
  try {
43
43
  const e = h();
44
- e.secureStorage ? (c = !0, s = !0, o = {
44
+ e.secureStorage ? (d = !0, c = !0, n = {
45
45
  getRefreshToken: () => e.secureStorage.getItem("cdp_refresh_token"),
46
46
  getRefreshTokenWithOutcome: () => j(e.secureStorage),
47
- setRefreshToken: (n) => e.secureStorage.setItem("cdp_refresh_token", n),
47
+ setRefreshToken: (s) => e.secureStorage.setItem("cdp_refresh_token", s),
48
48
  removeRefreshToken: () => e.secureStorage.removeItem("cdp_refresh_token")
49
- }) : o = {
49
+ }) : n = {
50
50
  getRefreshToken: () => e.storage.getItem("cdp_refresh_token"),
51
51
  getRefreshTokenWithOutcome: () => j(e.storage),
52
- setRefreshToken: (n) => e.storage.setItem("cdp_refresh_token", n),
52
+ setRefreshToken: (s) => e.storage.setItem("cdp_refresh_token", s),
53
53
  removeRefreshToken: () => e.storage.removeItem("cdp_refresh_token")
54
54
  };
55
55
  } catch {
56
- d.sendSessionRefreshEvent({
56
+ f.sendSessionRefreshEvent({
57
57
  name: "refresh_token_storage_not_initialized"
58
- }), o = void 0;
58
+ }), n = void 0;
59
59
  }
60
- let r, f, p;
60
+ let r, l, g;
61
61
  try {
62
62
  const e = h();
63
- p = e.deviceInfo?.getPlatform?.(), e.attestation && (r = e.attestation, f = e.deviceInfo?.getAppBundleId?.());
63
+ g = e.deviceInfo?.getPlatform?.(), e.attestation && (r = e.attestation, l = e.deviceInfo?.getAppBundleId?.());
64
64
  } catch {
65
65
  r = void 0;
66
66
  }
67
67
  if (C({
68
- debugging: i().debugging,
69
- basePath: i().basePath,
70
- refreshTokenStorage: o,
71
- retryTokenReads: c,
72
- failClosedOnMissingToken: s,
73
- platform: p,
68
+ debugging: a().debugging,
69
+ basePath: a().basePath,
70
+ refreshTokenStorage: n,
71
+ retryTokenReads: d,
72
+ failClosedOnMissingToken: c,
73
+ platform: g,
74
74
  appAttestation: r && {
75
75
  isEnabled: () => r.isEnabled,
76
- appIdentifier: f,
76
+ appIdentifier: l,
77
77
  generateAssertion: r.generateAssertion.bind(r)
78
78
  }
79
- }), a) {
80
- const e = new w();
81
- A(e);
82
- const n = y(i().projectId);
83
- I(n), M(n);
79
+ }), o) {
80
+ const e = new y();
81
+ k(e);
84
82
  }
85
- const [, l, u] = await Promise.allSettled([
86
- R().ensureInitialized(),
83
+ if (o) {
84
+ const e = w(a().projectId, {
85
+ deferInitialization: !0
86
+ });
87
+ I(e), M(e);
88
+ }
89
+ let i = null;
90
+ try {
91
+ i = await S(t.projectId);
92
+ } catch (e) {
93
+ (!(e instanceof m) || e.statusCode !== 404) && console.warn("Failed to get project config", e);
94
+ }
95
+ i && (b(i), p(i.activeCookieDomain ?? null));
96
+ const [, u] = await Promise.allSettled([
97
+ E().ensureInitialized(),
87
98
  (async () => {
88
99
  try {
89
100
  return await v(t.projectId);
90
101
  } catch (e) {
91
102
  return (!(e instanceof m) || e.statusCode !== 404) && console.warn("Failed to get MFA config", e), null;
92
103
  }
93
- })(),
94
- (async () => {
95
- try {
96
- return await S(t.projectId);
97
- } catch (e) {
98
- return (!(e instanceof m) || e.statusCode !== 404) && console.warn("Failed to get project config", e), null;
99
- }
100
104
  })()
101
105
  ]);
102
- if (l.status === "fulfilled" && l.value && k(l.value), u.status === "fulfilled" && u.value) {
103
- const e = u.value;
104
- if (b(e), e.appAttestation && r && f) {
105
- const n = T(e.appAttestation, f);
106
- n !== null && (O() || console.warn(
107
- "[Attestation] Project config has attestation enabled for this app, but no attestation provider is registered. Install @coinbase/cdp-app-attest and add `import '@coinbase/cdp-app-attest'` to your app's entry point."
108
- ), r.isEnabled = !0, r.cloudProjectNumber = n.cloudProjectNumber, r.initialize().catch((g) => {
109
- console.error(
110
- "[Attestation] Background initialization failed:",
111
- g instanceof Error ? g.message : String(g)
112
- );
113
- }));
114
- }
106
+ if (u.status === "fulfilled" && u.value && A(u.value), i && i.appAttestation && r && l) {
107
+ const e = T(i.appAttestation, l);
108
+ e !== null && (O() || console.warn(
109
+ "[Attestation] Project config has attestation enabled for this app, but no attestation provider is registered. Install @coinbase/cdp-app-attest and add `import '@coinbase/cdp-app-attest'` to your app's entry point."
110
+ ), r.isEnabled = !0, r.cloudProjectNumber = e.cloudProjectNumber, r.initialize().catch((s) => {
111
+ console.error(
112
+ "[Attestation] Background initialization failed:",
113
+ s instanceof Error ? s.message : String(s)
114
+ );
115
+ }));
115
116
  }
116
117
  }, j = async (t) => {
117
- const { value: a, outcome: o, errorMessage: c } = await t.getItemWithOutcome("cdp_refresh_token");
118
- return { token: a, outcome: o, errorMessage: c };
119
- }, T = (t, a) => {
120
- const o = t.android?.find((s) => s.identifier === a);
121
- return o ? { cloudProjectNumber: o.googleProjectNumber } : t.ios?.find((s) => s.identifier === a) ? {} : null;
118
+ const { value: o, outcome: n, errorMessage: d } = await t.getItemWithOutcome("cdp_refresh_token");
119
+ return { token: o, outcome: n, errorMessage: d };
120
+ }, T = (t, o) => {
121
+ const n = t.android?.find((c) => c.identifier === o);
122
+ return n ? { cloudProjectNumber: n.googleProjectNumber } : t.ios?.find((c) => c.identifier === o) ? {} : null;
122
123
  };
123
124
  export {
124
125
  V as initialize