@gardenfi/utils 2.0.6-beta.1 → 2.0.6-beta.3

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 (232) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +20 -22
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +19 -37
  5. package/dist/index100.cjs +1 -1
  6. package/dist/index100.js +128 -2
  7. package/dist/index101.cjs +1 -1
  8. package/dist/index101.js +113 -5
  9. package/dist/index102.cjs +1 -1
  10. package/dist/index102.js +78 -10
  11. package/dist/index103.cjs +1 -1
  12. package/dist/index103.js +2 -21
  13. package/dist/index104.cjs +1 -1
  14. package/dist/index104.js +17 -6
  15. package/dist/index105.cjs +1 -1
  16. package/dist/index105.js +19 -5
  17. package/dist/index106.cjs +1 -1
  18. package/dist/index106.js +15 -36
  19. package/dist/index107.cjs +1 -1
  20. package/dist/index107.js +222 -126
  21. package/dist/index108.cjs +2 -1
  22. package/dist/index108.js +3 -2
  23. package/dist/index109.cjs +1 -2
  24. package/dist/index109.js +35 -3
  25. package/dist/index11.cjs +1 -1
  26. package/dist/index11.js +134 -19
  27. package/dist/index110.cjs +1 -1
  28. package/dist/index110.js +16 -65
  29. package/dist/index111.cjs +1 -1
  30. package/dist/index111.js +2 -2
  31. package/dist/index112.cjs +1 -1
  32. package/dist/index112.js +68 -2
  33. package/dist/index113.cjs +1 -1
  34. package/dist/index113.js +2 -35
  35. package/dist/index114.cjs +1 -1
  36. package/dist/index114.js +1 -1
  37. package/dist/index115.cjs +1 -1
  38. package/dist/index115.js +1 -1
  39. package/dist/index117.cjs +1 -1
  40. package/dist/index117.js +1 -1
  41. package/dist/index12.cjs +1 -1
  42. package/dist/index12.js +10 -136
  43. package/dist/index13.cjs +1 -1
  44. package/dist/index13.js +2 -15
  45. package/dist/index14.cjs +1 -1
  46. package/dist/index14.js +34 -2
  47. package/dist/index15.cjs +1 -1
  48. package/dist/index15.js +17 -32
  49. package/dist/index16.cjs +1 -1
  50. package/dist/index16.js +183 -14
  51. package/dist/index17.cjs +1 -1
  52. package/dist/index17.js +92 -187
  53. package/dist/index18.cjs +1 -1
  54. package/dist/index18.js +34 -92
  55. package/dist/index19.cjs +1 -1
  56. package/dist/index19.js +32 -36
  57. package/dist/index20.cjs +16 -1
  58. package/dist/index20.js +112 -30
  59. package/dist/index21.cjs +1 -16
  60. package/dist/index21.js +30 -113
  61. package/dist/index22.cjs +1 -1
  62. package/dist/index22.js +18 -31
  63. package/dist/index23.cjs +1 -1
  64. package/dist/index23.js +7 -17
  65. package/dist/index24.cjs +1 -1
  66. package/dist/index24.js +44 -6
  67. package/dist/index25.cjs +1 -1
  68. package/dist/index25.js +21 -45
  69. package/dist/index26.cjs +1 -1
  70. package/dist/index26.js +8 -21
  71. package/dist/index27.cjs +1 -1
  72. package/dist/index27.js +31 -8
  73. package/dist/index28.cjs +1 -1
  74. package/dist/index28.js +26 -31
  75. package/dist/index29.cjs +2 -1
  76. package/dist/index29.js +64 -25
  77. package/dist/index30.cjs +1 -2
  78. package/dist/index30.js +50 -64
  79. package/dist/index31.cjs +1 -1
  80. package/dist/index31.js +12 -51
  81. package/dist/index32.cjs +1 -1
  82. package/dist/index32.js +24 -12
  83. package/dist/index33.cjs +1 -1
  84. package/dist/index33.js +75 -24
  85. package/dist/index34.cjs +1 -1
  86. package/dist/index34.js +22 -74
  87. package/dist/index35.cjs +1 -1
  88. package/dist/index35.js +7 -23
  89. package/dist/index36.cjs +1 -1
  90. package/dist/index36.js +32 -7
  91. package/dist/index37.cjs +1 -1
  92. package/dist/index37.js +14 -31
  93. package/dist/index38.cjs +1 -1
  94. package/dist/index38.js +2 -16
  95. package/dist/index39.cjs +1 -1
  96. package/dist/index39.js +9 -2
  97. package/dist/index4.cjs +1 -1
  98. package/dist/index4.js +2 -2
  99. package/dist/index40.cjs +1 -1
  100. package/dist/index40.js +20 -8
  101. package/dist/index41.cjs +1 -1
  102. package/dist/index41.js +12 -20
  103. package/dist/index42.cjs +1 -1
  104. package/dist/index42.js +33 -40
  105. package/dist/index43.cjs +1 -1
  106. package/dist/index43.js +6 -25
  107. package/dist/index44.cjs +2 -1
  108. package/dist/index44.js +59 -6
  109. package/dist/index45.cjs +1 -1
  110. package/dist/index45.js +2 -14
  111. package/dist/index46.cjs +1 -1
  112. package/dist/index46.js +6 -15
  113. package/dist/index47.cjs +1 -1
  114. package/dist/index47.js +4 -5
  115. package/dist/index48.cjs +1 -1
  116. package/dist/index48.js +11 -13
  117. package/dist/index49.cjs +5 -1
  118. package/dist/index49.js +56 -10
  119. package/dist/index50.cjs +2 -1
  120. package/dist/index50.js +32 -10
  121. package/dist/index51.cjs +1 -1
  122. package/dist/index51.js +5 -11
  123. package/dist/index52.cjs +1 -1
  124. package/dist/index52.js +3 -13
  125. package/dist/index53.cjs +1 -1
  126. package/dist/index53.js +20 -54
  127. package/dist/index54.cjs +1 -1
  128. package/dist/index54.js +12 -16
  129. package/dist/index55.cjs +1 -1
  130. package/dist/index55.js +55 -5
  131. package/dist/index56.cjs +1 -1
  132. package/dist/index56.js +3 -3
  133. package/dist/index57.cjs +1 -1
  134. package/dist/index57.js +19 -169
  135. package/dist/index58.cjs +1 -1
  136. package/dist/index58.js +11 -103
  137. package/dist/index59.cjs +1 -1
  138. package/dist/index59.js +8 -21
  139. package/dist/index6.cjs +1 -1
  140. package/dist/index6.js +22 -45
  141. package/dist/index60.cjs +1 -1
  142. package/dist/index60.js +9 -11
  143. package/dist/index61.cjs +1 -1
  144. package/dist/index61.js +11 -34
  145. package/dist/index62.cjs +1 -1
  146. package/dist/index62.js +6 -6
  147. package/dist/index63.cjs +1 -2
  148. package/dist/index63.js +13 -59
  149. package/dist/index64.cjs +1 -1
  150. package/dist/index64.js +33 -2
  151. package/dist/index65.cjs +1 -1
  152. package/dist/index65.js +14 -6
  153. package/dist/index66.cjs +1 -1
  154. package/dist/index66.js +64 -4
  155. package/dist/index67.cjs +1 -1
  156. package/dist/index67.js +27 -11
  157. package/dist/index68.cjs +1 -5
  158. package/dist/index68.js +3 -57
  159. package/dist/index69.cjs +1 -2
  160. package/dist/index69.js +3 -34
  161. package/dist/index7.cjs +1 -1
  162. package/dist/index7.js +2 -24
  163. package/dist/index70.cjs +1 -1
  164. package/dist/index70.js +13 -5
  165. package/dist/index71.cjs +1 -1
  166. package/dist/index71.js +41 -3
  167. package/dist/index72.cjs +1 -1
  168. package/dist/index72.js +5 -21
  169. package/dist/index73.cjs +1 -1
  170. package/dist/index73.js +8 -8
  171. package/dist/index74.cjs +1 -1
  172. package/dist/index74.js +102 -9
  173. package/dist/index75.cjs +1 -1
  174. package/dist/index75.js +190 -10
  175. package/dist/index76.cjs +1 -1
  176. package/dist/index76.js +17 -5
  177. package/dist/index77.cjs +1 -1
  178. package/dist/index77.js +10 -12
  179. package/dist/index78.cjs +1 -1
  180. package/dist/index78.js +19 -32
  181. package/dist/index79.cjs +1 -1
  182. package/dist/index79.js +25 -14
  183. package/dist/index8.cjs +1 -1
  184. package/dist/index8.js +100 -2
  185. package/dist/index80.cjs +1 -1
  186. package/dist/index80.js +6 -64
  187. package/dist/index81.cjs +1 -1
  188. package/dist/index81.js +13 -27
  189. package/dist/index82.cjs +1 -1
  190. package/dist/index82.js +16 -3
  191. package/dist/index83.cjs +1 -1
  192. package/dist/index83.js +5 -191
  193. package/dist/index84.cjs +1 -1
  194. package/dist/index84.js +13 -18
  195. package/dist/index85.cjs +1 -1
  196. package/dist/index85.js +10 -3
  197. package/dist/index86.cjs +1 -1
  198. package/dist/index86.js +16 -8
  199. package/dist/index87.cjs +1 -1
  200. package/dist/index87.js +169 -110
  201. package/dist/index88.cjs +1 -1
  202. package/dist/index88.js +6 -14
  203. package/dist/index89.cjs +1 -1
  204. package/dist/index89.js +9 -220
  205. package/dist/index9.cjs +1 -1
  206. package/dist/index9.js +34 -90
  207. package/dist/index90.cjs +1 -1
  208. package/dist/index90.js +34 -38
  209. package/dist/index91.cjs +1 -1
  210. package/dist/index91.js +2 -2
  211. package/dist/index92.cjs +1 -1
  212. package/dist/index92.js +5 -18
  213. package/dist/index93.cjs +1 -1
  214. package/dist/index93.js +10 -78
  215. package/dist/index94.cjs +1 -1
  216. package/dist/index94.js +2 -19
  217. package/dist/index95.cjs +1 -1
  218. package/dist/index95.js +40 -6
  219. package/dist/index96.cjs +1 -1
  220. package/dist/index96.js +16 -8
  221. package/dist/index97.cjs +1 -1
  222. package/dist/index97.js +6 -11
  223. package/dist/index98.cjs +1 -1
  224. package/dist/index98.js +5 -20
  225. package/dist/index99.cjs +1 -1
  226. package/dist/index99.js +33 -34
  227. package/dist/src/index.d.ts +0 -1
  228. package/dist/src/lib/auth/siwe/siwe.d.ts +1 -2
  229. package/package.json +2 -3
  230. package/dist/index118.cjs +0 -1
  231. package/dist/index118.js +0 -21
  232. package/dist/src/lib/digestKey/digestKey.d.ts +0 -12
package/dist/index99.js CHANGED
@@ -1,41 +1,40 @@
1
- import { SliceOffsetOutOfBoundsError as t } from "./index96.js";
2
- import { isHex as p } from "./index85.js";
3
- import { size as r } from "./index66.js";
4
- function w(e, f, i, { strict: o } = {}) {
5
- return p(e, { strict: !1 }) ? u(e, f, i, {
6
- strict: o
7
- }) : m(e, f, i, {
8
- strict: o
9
- });
10
- }
11
- function s(e, f) {
12
- if (typeof f == "number" && f > 0 && f > r(e) - 1)
13
- throw new t({
14
- offset: f,
15
- position: "start",
16
- size: r(e)
1
+ import { versionedHashVersionKzg as a } from "./index103.js";
2
+ import { BaseError as s } from "./index44.js";
3
+ class t extends s {
4
+ constructor({ maxSize: e, size: r }) {
5
+ super("Blob size is too large.", {
6
+ metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`],
7
+ name: "BlobSizeTooLargeError"
17
8
  });
9
+ }
18
10
  }
19
- function c(e, f, i) {
20
- if (typeof f == "number" && typeof i == "number" && r(e) !== i - f)
21
- throw new t({
22
- offset: i,
23
- position: "end",
24
- size: r(e)
25
- });
11
+ class d extends s {
12
+ constructor() {
13
+ super("Blob data must not be empty.", { name: "EmptyBlobError" });
14
+ }
26
15
  }
27
- function m(e, f, i, { strict: o } = {}) {
28
- s(e, f);
29
- const n = e.slice(f, i);
30
- return o && c(n, f, i), n;
16
+ class l extends s {
17
+ constructor({ hash: e, size: r }) {
18
+ super(`Versioned hash "${e}" size is invalid.`, {
19
+ metaMessages: ["Expected: 32", `Received: ${r}`],
20
+ name: "InvalidVersionedHashSizeError"
21
+ });
22
+ }
31
23
  }
32
- function u(e, f, i, { strict: o } = {}) {
33
- s(e, f);
34
- const n = `0x${e.replace("0x", "").slice((f ?? 0) * 2, (i ?? e.length) * 2)}`;
35
- return o && c(n, f, i), n;
24
+ class c extends s {
25
+ constructor({ hash: e, version: r }) {
26
+ super(`Versioned hash "${e}" version is invalid.`, {
27
+ metaMessages: [
28
+ `Expected: ${a}`,
29
+ `Received: ${r}`
30
+ ],
31
+ name: "InvalidVersionedHashVersionError"
32
+ });
33
+ }
36
34
  }
37
35
  export {
38
- w as slice,
39
- m as sliceBytes,
40
- u as sliceHex
36
+ t as BlobSizeTooLargeError,
37
+ d as EmptyBlobError,
38
+ l as InvalidVersionedHashSizeError,
39
+ c as InvalidVersionedHashVersionError
41
40
  };
@@ -7,4 +7,3 @@ export * from './lib/approve';
7
7
  export * from './lib/blockNumber';
8
8
  export * from './lib/eventBroker';
9
9
  export * from './lib/result';
10
- export * from './lib/digestKey/digestKey';
@@ -2,7 +2,6 @@ import { AuthHeader, IAuth, SiweOpts } from '../auth.types';
2
2
  import { AsyncResult, Result } from '@catalogfi/utils';
3
3
  import { Url } from '../../url';
4
4
  import { WalletClient } from 'viem';
5
- import { DigestKey } from '../../digestKey/digestKey';
6
5
 
7
6
  export declare class Siwe implements IAuth {
8
7
  private readonly API;
@@ -12,7 +11,7 @@ export declare class Siwe implements IAuth {
12
11
  private readonly signingStatement;
13
12
  private readonly domain;
14
13
  constructor(url: Url, walletClient: WalletClient, opts?: SiweOpts);
15
- static fromDigestKey(url: Url, digestKey: DigestKey, siweOpts?: SiweOpts): Siwe;
14
+ static fromDigestKey(url: Url, digestKey: string): Siwe;
16
15
  verifyToken(token: string, account: string): Result<boolean, string>;
17
16
  getToken(): AsyncResult<string, string>;
18
17
  private signStatement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/utils",
3
- "version": "2.0.6-beta.1",
3
+ "version": "2.0.6-beta.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",
@@ -36,8 +36,7 @@
36
36
  "sideEffects": false,
37
37
  "dependencies": {
38
38
  "@simplewebauthn/browser": "^13.1.0",
39
- "crypto-browserify": "^3.12.1",
40
39
  "jwt-decode": "^4.0.0",
41
40
  "viem": "^2.21.23"
42
41
  }
43
- }
42
+ }
package/dist/index118.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=BigInt(2**32-1),i=BigInt(32);function u(t,e=!1){return e?{h:Number(t&n),l:Number(t>>i&n)}:{h:Number(t>>i&n)|0,l:Number(t&n)|0}}function g(t,e=!1){let r=new Uint32Array(t.length),l=new Uint32Array(t.length);for(let o=0;o<t.length;o++){const{h:c,l:f}=u(t[o],e);[r[o],l[o]]=[c,f]}return[r,l]}const B=(t,e,r)=>t<<r|e>>>32-r,h=(t,e,r)=>e<<r|t>>>32-r,m=(t,e,r)=>e<<r-32|t>>>64-r,S=(t,e,r)=>t<<r-32|e>>>64-r;exports.fromBig=u;exports.rotlBH=m;exports.rotlBL=S;exports.rotlSH=B;exports.rotlSL=h;exports.split=g;
package/dist/index118.js DELETED
@@ -1,21 +0,0 @@
1
- const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
2
- function f(t, r = !1) {
3
- return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
4
- }
5
- function h(t, r = !1) {
6
- let n = new Uint32Array(t.length), l = new Uint32Array(t.length);
7
- for (let e = 0; e < t.length; e++) {
8
- const { h: c, l: u } = f(t[e], r);
9
- [n[e], l[e]] = [c, u];
10
- }
11
- return [n, l];
12
- }
13
- const g = (t, r, n) => t << n | r >>> 32 - n, m = (t, r, n) => r << n | t >>> 32 - n, A = (t, r, n) => r << n - 32 | t >>> 64 - n, B = (t, r, n) => t << n - 32 | r >>> 64 - n;
14
- export {
15
- f as fromBig,
16
- A as rotlBH,
17
- B as rotlBL,
18
- g as rotlSH,
19
- m as rotlSL,
20
- h as split
21
- };
@@ -1,12 +0,0 @@
1
- export declare class DigestKey {
2
- private _digestKey;
3
- private _userId;
4
- constructor(digestKey: string);
5
- static from(digestKey: string): import('../result').Result<never, string> | import('../result').Result<DigestKey, never>;
6
- static generateRandom(): import('../result').Result<never, string> | import('../result').Result<DigestKey, never>;
7
- private static isValidDigestKey;
8
- private static isValidPrivateKey;
9
- private static generateRandomDigestKey;
10
- get digestKey(): string;
11
- get userId(): string;
12
- }