@cofhe/sdk 0.2.0 → 0.2.1

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 (57) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/chains/defineChain.ts +2 -2
  3. package/chains/types.ts +3 -3
  4. package/core/client.test.ts +111 -0
  5. package/core/client.ts +22 -2
  6. package/core/clientTypes.ts +7 -1
  7. package/core/config.test.ts +8 -0
  8. package/core/config.ts +10 -4
  9. package/core/consts.ts +18 -0
  10. package/core/decrypt/cofheMocksSealOutput.ts +2 -4
  11. package/core/encrypt/cofheMocksZkVerifySign.ts +4 -11
  12. package/core/index.ts +9 -1
  13. package/core/permits.test.ts +5 -6
  14. package/core/permits.ts +5 -4
  15. package/dist/chains.cjs +4 -7
  16. package/dist/chains.d.cts +12 -12
  17. package/dist/chains.d.ts +12 -12
  18. package/dist/chains.js +1 -1
  19. package/dist/{chunk-WGCRJCBR.js → chunk-I5WFEYXX.js} +33 -19
  20. package/dist/{chunk-UGBVZNRT.js → chunk-R3B5TMVX.js} +308 -189
  21. package/dist/{chunk-WEAZ25JO.js → chunk-TBLR7NNE.js} +4 -7
  22. package/dist/{clientTypes-Es7fyi65.d.ts → clientTypes-RqkgkV2i.d.ts} +34 -93
  23. package/dist/{clientTypes-5_1nwtUe.d.cts → clientTypes-e4filDzK.d.cts} +34 -93
  24. package/dist/core.cjs +343 -208
  25. package/dist/core.d.cts +17 -6
  26. package/dist/core.d.ts +17 -6
  27. package/dist/core.js +3 -3
  28. package/dist/node.cjs +337 -208
  29. package/dist/node.d.cts +3 -3
  30. package/dist/node.d.ts +3 -3
  31. package/dist/node.js +3 -3
  32. package/dist/{permit-fUSe6KKq.d.cts → permit-MZ502UBl.d.cts} +30 -33
  33. package/dist/{permit-fUSe6KKq.d.ts → permit-MZ502UBl.d.ts} +30 -33
  34. package/dist/permits.cjs +305 -187
  35. package/dist/permits.d.cts +111 -812
  36. package/dist/permits.d.ts +111 -812
  37. package/dist/permits.js +1 -1
  38. package/dist/types-YiAC4gig.d.cts +33 -0
  39. package/dist/types-YiAC4gig.d.ts +33 -0
  40. package/dist/web.cjs +337 -208
  41. package/dist/web.d.cts +3 -3
  42. package/dist/web.d.ts +3 -3
  43. package/dist/web.js +3 -3
  44. package/package.json +3 -3
  45. package/permits/localstorage.test.ts +9 -13
  46. package/permits/onchain-utils.ts +221 -0
  47. package/permits/permit.test.ts +51 -5
  48. package/permits/permit.ts +28 -74
  49. package/permits/store.test.ts +10 -50
  50. package/permits/store.ts +4 -14
  51. package/permits/test-utils.ts +10 -2
  52. package/permits/types.ts +22 -9
  53. package/permits/utils.ts +0 -4
  54. package/permits/validation.test.ts +29 -32
  55. package/permits/validation.ts +112 -194
  56. package/dist/types-KImPrEIe.d.cts +0 -48
  57. package/dist/types-KImPrEIe.d.ts +0 -48
package/dist/permits.js CHANGED
@@ -1 +1 @@
1
- export { GenerateSealingKey, ImportPermitOptionsValidator, ImportPermitValidator, PERMIT_STORE_DEFAULTS, PermitUtils, SealingKey, SelfPermitOptionsValidator, SelfPermitValidator, SharingPermitOptionsValidator, SharingPermitValidator, SignatureTypes, SignatureUtils, ValidationUtils, _permitStore, clearStaleStore, getActivePermit, getActivePermitHash, getPermit, getPermits, getSignatureTypesAndMessage, permitStore, removeActivePermitHash, removePermit, resetStore, setActivePermitHash, setPermit, validateImportPermit, validateImportPermitOptions, validateSelfPermit, validateSelfPermitOptions, validateSharingPermit, validateSharingPermitOptions } from './chunk-UGBVZNRT.js';
1
+ export { GenerateSealingKey, ImportPermitOptionsValidator, ImportPermitValidator, PERMIT_STORE_DEFAULTS, PermitUtils, SealingKey, SelfPermitOptionsValidator, SelfPermitValidator, SharingPermitOptionsValidator, SharingPermitValidator, SignatureTypes, SignatureUtils, ValidationUtils, _permitStore, addressNotZeroSchema, addressSchema, bytesNotEmptySchema, bytesSchema, clearStaleStore, getActivePermit, getActivePermitHash, getPermit, getPermits, getSignatureTypesAndMessage, permitStore, removeActivePermitHash, removePermit, resetStore, setActivePermitHash, setPermit, validateImportPermit, validateImportPermitOptions, validateSelfPermit, validateSelfPermitOptions, validateSharingPermit, validateSharingPermitOptions } from './chunk-R3B5TMVX.js';
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Environment schema for @cofhe/sdk chains
5
+ */
6
+ declare const EnvironmentSchema: z.ZodEnum<{
7
+ MOCK: "MOCK";
8
+ TESTNET: "TESTNET";
9
+ MAINNET: "MAINNET";
10
+ }>;
11
+ /**
12
+ * Zod schema for CofheChain validation
13
+ */
14
+ declare const CofheChainSchema: z.ZodObject<{
15
+ id: z.ZodNumber;
16
+ name: z.ZodString;
17
+ network: z.ZodString;
18
+ coFheUrl: z.ZodURL;
19
+ verifierUrl: z.ZodURL;
20
+ thresholdNetworkUrl: z.ZodURL;
21
+ environment: z.ZodEnum<{
22
+ MOCK: "MOCK";
23
+ TESTNET: "TESTNET";
24
+ MAINNET: "MAINNET";
25
+ }>;
26
+ }, z.core.$strip>;
27
+ /**
28
+ * Type inference from the schema
29
+ */
30
+ type CofheChain = z.infer<typeof CofheChainSchema>;
31
+ type Environment = z.infer<typeof EnvironmentSchema>;
32
+
33
+ export type { CofheChain as C, Environment as E };
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Environment schema for @cofhe/sdk chains
5
+ */
6
+ declare const EnvironmentSchema: z.ZodEnum<{
7
+ MOCK: "MOCK";
8
+ TESTNET: "TESTNET";
9
+ MAINNET: "MAINNET";
10
+ }>;
11
+ /**
12
+ * Zod schema for CofheChain validation
13
+ */
14
+ declare const CofheChainSchema: z.ZodObject<{
15
+ id: z.ZodNumber;
16
+ name: z.ZodString;
17
+ network: z.ZodString;
18
+ coFheUrl: z.ZodURL;
19
+ verifierUrl: z.ZodURL;
20
+ thresholdNetworkUrl: z.ZodURL;
21
+ environment: z.ZodEnum<{
22
+ MOCK: "MOCK";
23
+ TESTNET: "TESTNET";
24
+ MAINNET: "MAINNET";
25
+ }>;
26
+ }, z.core.$strip>;
27
+ /**
28
+ * Type inference from the schema
29
+ */
30
+ type CofheChain = z.infer<typeof CofheChainSchema>;
31
+ type Environment = z.infer<typeof EnvironmentSchema>;
32
+
33
+ export type { CofheChain as C, Environment as E };