@keetanetwork/anchor 0.0.38 → 0.0.39

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 (45) hide show
  1. package/lib/encrypted-container.d.ts +53 -3
  2. package/lib/encrypted-container.d.ts.map +1 -1
  3. package/lib/encrypted-container.js +549 -93
  4. package/lib/encrypted-container.js.map +1 -1
  5. package/lib/http-server/index.d.ts.map +1 -1
  6. package/lib/http-server/index.js +58 -5
  7. package/lib/http-server/index.js.map +1 -1
  8. package/lib/queue/drivers/queue_firestore.d.ts +29 -0
  9. package/lib/queue/drivers/queue_firestore.d.ts.map +1 -0
  10. package/lib/queue/drivers/queue_firestore.js +279 -0
  11. package/lib/queue/drivers/queue_firestore.js.map +1 -0
  12. package/lib/queue/index.d.ts +56 -0
  13. package/lib/queue/index.d.ts.map +1 -1
  14. package/lib/queue/index.js +111 -21
  15. package/lib/queue/index.js.map +1 -1
  16. package/lib/resolver.d.ts +4 -15
  17. package/lib/resolver.d.ts.map +1 -1
  18. package/lib/resolver.js +468 -636
  19. package/lib/resolver.js.map +1 -1
  20. package/lib/utils/signing.d.ts +12 -3
  21. package/lib/utils/signing.d.ts.map +1 -1
  22. package/lib/utils/signing.js +7 -13
  23. package/lib/utils/signing.js.map +1 -1
  24. package/npm-shrinkwrap.json +4 -4
  25. package/package.json +2 -1
  26. package/services/asset-movement/client.d.ts +2 -2
  27. package/services/asset-movement/client.d.ts.map +1 -1
  28. package/services/asset-movement/client.js +2 -2
  29. package/services/asset-movement/client.js.map +1 -1
  30. package/services/asset-movement/common.d.ts +56 -22
  31. package/services/asset-movement/common.d.ts.map +1 -1
  32. package/services/asset-movement/common.js +295 -70
  33. package/services/asset-movement/common.js.map +1 -1
  34. package/services/fx/client.d.ts +15 -3
  35. package/services/fx/client.d.ts.map +1 -1
  36. package/services/fx/client.js +18 -0
  37. package/services/fx/client.js.map +1 -1
  38. package/services/fx/server.d.ts +22 -3
  39. package/services/fx/server.d.ts.map +1 -1
  40. package/services/fx/server.js +158 -102
  41. package/services/fx/server.js.map +1 -1
  42. package/services/fx/util.d.ts +26 -8
  43. package/services/fx/util.d.ts.map +1 -1
  44. package/services/fx/util.js +92 -4
  45. package/services/fx/util.js.map +1 -1
@@ -1,7 +1,42 @@
1
1
  import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
2
2
  import { Buffer } from './utils/buffer.js';
3
+ import { KeetaAnchorError } from './error.js';
4
+ /**
5
+ * Error codes for EncryptedContainer operations
6
+ */
7
+ export declare const EncryptedContainerErrorCodes: readonly ["MALFORMED_BASE_FORMAT", "MALFORMED_VERSION", "MALFORMED_DATA_STRUCTURE", "MALFORMED_KEY_INFO", "MALFORMED_SIGNER_INFO", "UNSUPPORTED_VERSION", "UNSUPPORTED_CIPHER_ALGORITHM", "UNSUPPORTED_DIGEST_ALGORITHM", "UNSUPPORTED_SIGNATURE_ALGORITHM", "UNSUPPORTED_KEY_TYPE", "NO_KEYS_PROVIDED", "NO_MATCHING_KEY", "DECRYPTION_FAILED", "DECOMPRESSION_FAILED", "SIGNER_REQUIRES_PRIVATE_KEY", "NOT_SIGNED", "SIGNATURE_VERIFICATION_FAILED", "NO_PLAINTEXT_AVAILABLE", "NO_ENCODED_DATA_AVAILABLE", "PLAINTEXT_DISABLED", "ENCRYPTION_REQUIRED", "INVALID_PRINCIPALS", "ACCESS_MANAGEMENT_NOT_ALLOWED", "INTERNAL_ERROR"];
8
+ /**
9
+ * Error code type
10
+ */
11
+ export type EncryptedContainerErrorCode = typeof EncryptedContainerErrorCodes[number];
12
+ /**
13
+ * Error class for EncryptedContainer operations
14
+ */
15
+ export declare class EncryptedContainerError extends KeetaAnchorError {
16
+ static readonly name: string;
17
+ private readonly encryptedContainerErrorObjectTypeID;
18
+ private static readonly encryptedContainerErrorObjectTypeID;
19
+ readonly code: EncryptedContainerErrorCode;
20
+ /**
21
+ * Check if a string is a valid EncryptedContainerErrorCode
22
+ */
23
+ static isValidCode(code: string): code is EncryptedContainerErrorCode;
24
+ constructor(code: EncryptedContainerErrorCode, message: string);
25
+ static isInstance(input: unknown): input is EncryptedContainerError;
26
+ toJSON(): ReturnType<KeetaAnchorError['toJSON']> & {
27
+ code: EncryptedContainerErrorCode;
28
+ };
29
+ static fromJSON(input: unknown): Promise<EncryptedContainerError>;
30
+ }
3
31
  declare const Account: typeof KeetaNetLib.Account;
4
32
  type Account = InstanceType<typeof KeetaNetLib.Account>;
33
+ /**
34
+ * Options for creating an EncryptedContainer from plaintext
35
+ */
36
+ export type FromPlaintextOptions = {
37
+ locked?: boolean;
38
+ signer?: Account;
39
+ };
5
40
  type CipherOptions = {
6
41
  /**
7
42
  * The symmetric cipher key (if any)
@@ -35,7 +70,7 @@ export declare class EncryptedContainer {
35
70
  * Encryption details
36
71
  */
37
72
  protected _internalState: EncryptedContainerInfo | UnencryptedContainerInfo;
38
- constructor(principals: Account[] | null);
73
+ constructor(principals: Account[] | null, signer?: Account);
39
74
  get encrypted(): boolean;
40
75
  /**
41
76
  * Create an instance of the EncryptedContainer from an encrypted blob,
@@ -54,10 +89,10 @@ export declare class EncryptedContainer {
54
89
  *
55
90
  * @param data The plaintext data to encrypt or encode
56
91
  * @param principals The list of principals who can access the data if it is null then the data is not encrypted
57
- * @param locked If true, the plaintext data will not be accessible from this instance; otherwise it will be -- default depends on principals
92
+ * @param options Options including locked (plaintext accessibility) and signer (for RFC 5652 signing). For backward compatibility, can also be a boolean for locked.
58
93
  * @returns The EncryptedContainer instance with the plaintext data and principals set
59
94
  */
60
- static fromPlaintext(data: string | ArrayBuffer | Buffer, principals: Account[] | null, locked?: boolean): EncryptedContainer;
95
+ static fromPlaintext(data: string | ArrayBuffer | Buffer, principals: Account[] | null, options?: boolean | FromPlaintextOptions): EncryptedContainer;
61
96
  /**
62
97
  * Set the plaintext buffer to the specified value
63
98
  */
@@ -101,6 +136,21 @@ export declare class EncryptedContainer {
101
136
  * this container
102
137
  */
103
138
  get principals(): Account[];
139
+ /**
140
+ * Check if this container is signed
141
+ */
142
+ get isSigned(): boolean;
143
+ /**
144
+ * Get the signing account of this container.
145
+ */
146
+ getSigningAccount(): Account | undefined;
147
+ /**
148
+ * Verify the signature on this container.
149
+ * This requires decrypting the container first to access the compressed plaintext.
150
+ *
151
+ * @returns true if signature is valid, false if invalid, or throws if not signed or plaintext unavailable
152
+ */
153
+ verifySignature(): Promise<boolean>;
104
154
  }
105
155
  export default EncryptedContainer;
106
156
  //# sourceMappingURL=encrypted-container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"encrypted-container.d.ts","sourceRoot":"","sources":["../../src/lib/encrypted-container.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,EAAE,MAAM,EAA4C,MAAM,mBAAmB,CAAC;AAOrF,QAAA,MAAM,OAAO,EAAE,OAAO,WAAW,CAAC,OAA6B,CAAC;AAChE,KAAK,OAAO,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AAyFxD,KAAK,aAAa,GAAG;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACnB,CAAA;AAkUD,KAAK,sBAAsB,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG;IACjE;;OAEG;IACH,UAAU,EAAE,OAAO,EAAE,CAAC;CACtB,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC/B;;OAEG;IACH,UAAU,EAAE,IAAI,CAAC;CACjB,CAAA;AAED,qBAAa,kBAAkB;;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAOlD;;OAEG;IACH,SAAS,CAAC,cAAc,EAAE,sBAAsB,GAAG,wBAAwB,CAAC;gBAUhE,UAAU,EAAE,OAA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