glow.ts 1.0.3 → 1.1.0

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 (121) hide show
  1. package/README.md +6 -15
  2. package/dist/glow.cjs.js +4 -0
  3. package/dist/glow.cjs.js.map +1 -0
  4. package/dist/glow.es.js +993 -0
  5. package/dist/glow.es.js.map +1 -0
  6. package/dist/index.d.ts +544 -0
  7. package/package.json +34 -26
  8. package/dist/cjs2/config.js +0 -18
  9. package/dist/cjs2/config.js.map +0 -1
  10. package/dist/cjs2/crypto-storage/crypto-storage.js +0 -118
  11. package/dist/cjs2/crypto-storage/crypto-storage.js.map +0 -1
  12. package/dist/cjs2/crypto-storage/in-memory-storage.js +0 -36
  13. package/dist/cjs2/crypto-storage/in-memory-storage.js.map +0 -1
  14. package/dist/cjs2/crypto-storage/local-storage.driver.js +0 -36
  15. package/dist/cjs2/crypto-storage/local-storage.driver.js.map +0 -1
  16. package/dist/cjs2/crypto-storage/storage-driver.interface.js +0 -3
  17. package/dist/cjs2/crypto-storage/storage-driver.interface.js.map +0 -1
  18. package/dist/cjs2/index.js +0 -28
  19. package/dist/cjs2/index.js.map +0 -1
  20. package/dist/cjs2/keyring/keyring.js +0 -151
  21. package/dist/cjs2/keyring/keyring.js.map +0 -1
  22. package/dist/cjs2/keys/keys.js +0 -40
  23. package/dist/cjs2/keys/keys.js.map +0 -1
  24. package/dist/cjs2/mailbox/mailbox.js +0 -352
  25. package/dist/cjs2/mailbox/mailbox.js.map +0 -1
  26. package/dist/cjs2/nacl/encryption.helper.js +0 -101
  27. package/dist/cjs2/nacl/encryption.helper.js.map +0 -1
  28. package/dist/cjs2/nacl/js-nacl-driver.js +0 -110
  29. package/dist/cjs2/nacl/js-nacl-driver.js.map +0 -1
  30. package/dist/cjs2/nacl/keypair.interface.js +0 -3
  31. package/dist/cjs2/nacl/keypair.interface.js.map +0 -1
  32. package/dist/cjs2/nacl/nacl-driver.interface.js +0 -3
  33. package/dist/cjs2/nacl/nacl-driver.interface.js.map +0 -1
  34. package/dist/cjs2/nacl/nacl.js +0 -29
  35. package/dist/cjs2/nacl/nacl.js.map +0 -1
  36. package/dist/cjs2/relay/network-error.js +0 -12
  37. package/dist/cjs2/relay/network-error.js.map +0 -1
  38. package/dist/cjs2/relay/relay-factory.js +0 -22
  39. package/dist/cjs2/relay/relay-factory.js.map +0 -1
  40. package/dist/cjs2/relay/relay.js +0 -300
  41. package/dist/cjs2/relay/relay.js.map +0 -1
  42. package/dist/cjs2/utils/utils.js +0 -39
  43. package/dist/cjs2/utils/utils.js.map +0 -1
  44. package/dist/cjs2/zax.interface.js +0 -46
  45. package/dist/cjs2/zax.interface.js.map +0 -1
  46. package/dist/esm/config.js +0 -15
  47. package/dist/esm/config.js.map +0 -1
  48. package/dist/esm/crypto-storage/crypto-storage.js +0 -114
  49. package/dist/esm/crypto-storage/crypto-storage.js.map +0 -1
  50. package/dist/esm/crypto-storage/in-memory-storage.js +0 -32
  51. package/dist/esm/crypto-storage/in-memory-storage.js.map +0 -1
  52. package/dist/esm/crypto-storage/local-storage.driver.js +0 -32
  53. package/dist/esm/crypto-storage/local-storage.driver.js.map +0 -1
  54. package/dist/esm/crypto-storage/storage-driver.interface.js +0 -2
  55. package/dist/esm/crypto-storage/storage-driver.interface.js.map +0 -1
  56. package/dist/esm/index.js +0 -14
  57. package/dist/esm/index.js.map +0 -1
  58. package/dist/esm/keyring/keyring.js +0 -147
  59. package/dist/esm/keyring/keyring.js.map +0 -1
  60. package/dist/esm/keys/keys.js +0 -36
  61. package/dist/esm/keys/keys.js.map +0 -1
  62. package/dist/esm/mailbox/mailbox.js +0 -348
  63. package/dist/esm/mailbox/mailbox.js.map +0 -1
  64. package/dist/esm/nacl/encryption.helper.js +0 -97
  65. package/dist/esm/nacl/encryption.helper.js.map +0 -1
  66. package/dist/esm/nacl/js-nacl-driver.js +0 -106
  67. package/dist/esm/nacl/js-nacl-driver.js.map +0 -1
  68. package/dist/esm/nacl/keypair.interface.js +0 -2
  69. package/dist/esm/nacl/keypair.interface.js.map +0 -1
  70. package/dist/esm/nacl/nacl-driver.interface.js +0 -2
  71. package/dist/esm/nacl/nacl-driver.interface.js.map +0 -1
  72. package/dist/esm/nacl/nacl.js +0 -25
  73. package/dist/esm/nacl/nacl.js.map +0 -1
  74. package/dist/esm/relay/network-error.js +0 -8
  75. package/dist/esm/relay/network-error.js.map +0 -1
  76. package/dist/esm/relay/relay-factory.js +0 -18
  77. package/dist/esm/relay/relay-factory.js.map +0 -1
  78. package/dist/esm/relay/relay.js +0 -293
  79. package/dist/esm/relay/relay.js.map +0 -1
  80. package/dist/esm/utils/utils.js +0 -35
  81. package/dist/esm/utils/utils.js.map +0 -1
  82. package/dist/esm/zax.interface.js +0 -43
  83. package/dist/esm/zax.interface.js.map +0 -1
  84. package/dist/types/config.d.ts +0 -10
  85. package/dist/types/config.d.ts.map +0 -1
  86. package/dist/types/crypto-storage/crypto-storage.d.ts +0 -20
  87. package/dist/types/crypto-storage/crypto-storage.d.ts.map +0 -1
  88. package/dist/types/crypto-storage/in-memory-storage.d.ts +0 -17
  89. package/dist/types/crypto-storage/in-memory-storage.d.ts.map +0 -1
  90. package/dist/types/crypto-storage/local-storage.driver.d.ts +0 -15
  91. package/dist/types/crypto-storage/local-storage.driver.d.ts.map +0 -1
  92. package/dist/types/crypto-storage/storage-driver.interface.d.ts +0 -11
  93. package/dist/types/crypto-storage/storage-driver.interface.d.ts.map +0 -1
  94. package/dist/types/index.d.ts +0 -16
  95. package/dist/types/index.d.ts.map +0 -1
  96. package/dist/types/keyring/keyring.d.ts +0 -43
  97. package/dist/types/keyring/keyring.d.ts.map +0 -1
  98. package/dist/types/keys/keys.d.ts +0 -16
  99. package/dist/types/keys/keys.d.ts.map +0 -1
  100. package/dist/types/mailbox/mailbox.d.ts +0 -148
  101. package/dist/types/mailbox/mailbox.d.ts.map +0 -1
  102. package/dist/types/nacl/encryption.helper.d.ts +0 -37
  103. package/dist/types/nacl/encryption.helper.d.ts.map +0 -1
  104. package/dist/types/nacl/js-nacl-driver.d.ts +0 -39
  105. package/dist/types/nacl/js-nacl-driver.d.ts.map +0 -1
  106. package/dist/types/nacl/keypair.interface.d.ts +0 -5
  107. package/dist/types/nacl/keypair.interface.d.ts.map +0 -1
  108. package/dist/types/nacl/nacl-driver.interface.d.ts +0 -28
  109. package/dist/types/nacl/nacl-driver.interface.d.ts.map +0 -1
  110. package/dist/types/nacl/nacl.d.ts +0 -13
  111. package/dist/types/nacl/nacl.d.ts.map +0 -1
  112. package/dist/types/relay/network-error.d.ts +0 -6
  113. package/dist/types/relay/network-error.d.ts.map +0 -1
  114. package/dist/types/relay/relay-factory.d.ts +0 -10
  115. package/dist/types/relay/relay-factory.d.ts.map +0 -1
  116. package/dist/types/relay/relay.d.ts +0 -88
  117. package/dist/types/relay/relay.d.ts.map +0 -1
  118. package/dist/types/utils/utils.d.ts +0 -9
  119. package/dist/types/utils/utils.d.ts.map +0 -1
  120. package/dist/types/zax.interface.d.ts +0 -101
  121. package/dist/types/zax.interface.d.ts.map +0 -1
@@ -1,43 +0,0 @@
1
- /**
2
- * Interfaces of Zax relay command requests and responses.
3
- * See https://github.com/vault12/zax for details.
4
- *
5
- * Full technical specification:
6
- * https://s3-us-west-1.amazonaws.com/vault12/crypto_relay.pdf
7
- */
8
- // In the future versions, plugins could add their own commands to specific relays
9
- export var RelayCommand;
10
- (function (RelayCommand) {
11
- // Zax message commands
12
- RelayCommand["count"] = "count";
13
- RelayCommand["upload"] = "upload";
14
- RelayCommand["download"] = "download";
15
- RelayCommand["messageStatus"] = "messageStatus";
16
- RelayCommand["delete"] = "delete";
17
- // Zax file commands
18
- RelayCommand["startFileUpload"] = "startFileUpload";
19
- RelayCommand["uploadFileChunk"] = "uploadFileChunk";
20
- RelayCommand["downloadFileChunk"] = "downloadFileChunk";
21
- RelayCommand["fileStatus"] = "fileStatus";
22
- RelayCommand["deleteFile"] = "deleteFile";
23
- })(RelayCommand || (RelayCommand = {}));
24
- /**
25
- * Status of a previously sent message equals redis TTL.
26
- * See https://redis.io/commands/ttl.
27
- * -2 : missing key
28
- * -1 : key never expires
29
- * 0+ : key time to live in seconds
30
- */
31
- export var MessageStatusResponse;
32
- (function (MessageStatusResponse) {
33
- MessageStatusResponse[MessageStatusResponse["MissingKey"] = -2] = "MissingKey";
34
- MessageStatusResponse[MessageStatusResponse["NeverExpires"] = -1] = "NeverExpires";
35
- })(MessageStatusResponse || (MessageStatusResponse = {}));
36
- // -------------- Message formats --------------
37
- export var ZaxMessageKind;
38
- (function (ZaxMessageKind) {
39
- ZaxMessageKind["message"] = "message";
40
- ZaxMessageKind["file"] = "file";
41
- ZaxMessageKind["plain"] = "plain";
42
- })(ZaxMessageKind || (ZaxMessageKind = {}));
43
- //# sourceMappingURL=zax.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zax.interface.js","sourceRoot":"","sources":["../../src/zax.interface.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,kFAAkF;AAClF,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB,uBAAuB;IACvB,+BAAe,CAAA;IACf,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,+CAA+B,CAAA;IAC/B,iCAAiB,CAAA;IACjB,oBAAoB;IACpB,mDAAmC,CAAA;IACnC,mDAAmC,CAAA;IACnC,uDAAuC,CAAA;IACvC,yCAAyB,CAAA;IACzB,yCAAyB,CAAA;AAC3B,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAED;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8EAAe,CAAA;IACf,kFAAiB,CAAA;AACnB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED,gDAAgD;AAEhD,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,iCAAe,CAAA;AACjB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB"}
@@ -1,10 +0,0 @@
1
- export declare const config: {
2
- NONCE_TAG: string;
3
- SKEY_TAG: string;
4
- STORAGE_ROOT: string;
5
- RELAY_TOKEN_LEN: number;
6
- RELAY_TOKEN_TIMEOUT: number;
7
- RELAY_SESSION_TIMEOUT: number;
8
- RELAY_AJAX_TIMEOUT: number;
9
- };
10
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM;;;;;;;;CAYlB,CAAC"}
@@ -1,20 +0,0 @@
1
- import { StorageDriver } from './storage-driver.interface';
2
- export declare class CryptoStorage {
3
- private static storageDriver;
4
- private driver?;
5
- private id?;
6
- private storageKey?;
7
- private nacl;
8
- private constructor();
9
- static new(id: string): Promise<CryptoStorage>;
10
- static getStorageDriver(): StorageDriver;
11
- static setDefaultStorageDriver(): boolean;
12
- static setStorageDriver(driver: StorageDriver): boolean;
13
- save(tag: string, data: unknown): Promise<boolean>;
14
- get(tag: string): Promise<unknown>;
15
- remove(tag: string): Promise<boolean>;
16
- selfDestruct(): Promise<void>;
17
- private addPrefix;
18
- private addNonceTag;
19
- }
20
- //# sourceMappingURL=crypto-storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto-storage.d.ts","sourceRoot":"","sources":["../../../src/crypto-storage/crypto-storage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,qBAAa,aAAa;IAExB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAgB;IAE5C,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,OAAO,CAAC,EAAE,CAAC,CAAS;IACpB,OAAO,CAAC,UAAU,CAAC,CAAa;IAChC,OAAO,CAAC,IAAI,CAAa;IAEzB,OAAO;WAOM,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAgBpD,MAAM,CAAC,gBAAgB;IAQvB,MAAM,CAAC,uBAAuB;IAI9B,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,aAAa;IAQvC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBlD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAwBlC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQrC,YAAY;IAQlB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,WAAW;CAGpB"}
@@ -1,17 +0,0 @@
1
- import { StorageDriver } from './storage-driver.interface';
2
- /**
3
- * temporary created in-memory storage for testing purposes
4
- */
5
- export declare class InMemoryStorage implements StorageDriver {
6
- private storage;
7
- get(key: string): Promise<string | null>;
8
- getMultiple(keys: string[]): Promise<(string | null)[]>;
9
- set(key: string, value: any): Promise<void>;
10
- setMultiple(values: {
11
- [key: string]: string | null;
12
- }): Promise<void>;
13
- remove(key: string): Promise<void>;
14
- removeMultiple(keys: string[]): Promise<void>;
15
- reset(): void;
16
- }
17
- //# sourceMappingURL=in-memory-storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"in-memory-storage.d.ts","sourceRoot":"","sources":["../../../src/crypto-storage/in-memory-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;GAEG;AACH,qBAAa,eAAgB,YAAW,aAAa;IAEnD,OAAO,CAAC,OAAO,CAAoC;IAE7C,GAAG,CAAC,GAAG,EAAE,MAAM;IAIf,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE;IAIhC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAIrB,WAAW,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;KAAE;IAM3D,MAAM,CAAC,GAAG,EAAE,MAAM;IAIZ,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE;IAInC,KAAK;CAGN"}
@@ -1,15 +0,0 @@
1
- import { StorageDriver } from './storage-driver.interface';
2
- export declare class LocalStorageDriver implements StorageDriver {
3
- private rootTag;
4
- constructor(root?: string);
5
- get(key: string): Promise<string | null>;
6
- getMultiple(keys: string[]): Promise<(string | null)[]>;
7
- set(key: string, value: string | null): Promise<void>;
8
- setMultiple(values: {
9
- [key: string]: string | null;
10
- }): Promise<void>;
11
- remove(key: string): Promise<void>;
12
- removeMultiple(keys: string[]): Promise<void>;
13
- private tag;
14
- }
15
- //# sourceMappingURL=local-storage.driver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local-storage.driver.d.ts","sourceRoot":"","sources":["../../../src/crypto-storage/local-storage.driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,qBAAa,kBAAmB,YAAW,aAAa;IACtD,OAAO,CAAC,OAAO,CAAS;gBAEZ,IAAI,SAAa;IAIvB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIxC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAIvD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,WAAW,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IASrE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,OAAO,CAAC,GAAG;CAGZ"}
@@ -1,11 +0,0 @@
1
- export interface StorageDriver {
2
- get(key: string): Promise<string | null>;
3
- getMultiple(keys: string[]): Promise<(string | null)[]>;
4
- set(key: string, value: string | null): Promise<void>;
5
- setMultiple(values: {
6
- [key: string]: string | null;
7
- }): Promise<void>;
8
- remove(key: string): Promise<void>;
9
- removeMultiple(keys: string[]): Promise<void>;
10
- }
11
- //# sourceMappingURL=storage-driver.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage-driver.interface.d.ts","sourceRoot":"","sources":["../../../src/crypto-storage/storage-driver.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IACxD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,WAAW,CAAC,MAAM,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C"}
@@ -1,16 +0,0 @@
1
- import { NaCl } from './nacl/nacl';
2
- import { Keys } from './keys/keys.js';
3
- import { KeyRing } from './keyring/keyring.js';
4
- import { CryptoStorage } from './crypto-storage/crypto-storage.js';
5
- import { StorageDriver } from './crypto-storage/storage-driver.interface.js';
6
- import { LocalStorageDriver } from './crypto-storage/local-storage.driver.js';
7
- import { Mailbox } from './mailbox/mailbox';
8
- import { Relay } from './relay/relay';
9
- import { ZaxMessageKind, ZaxTextMessage, ZaxFileMessage, ZaxPlainMessage, ZaxParsedMessage, FileStatusResponse } from './zax.interface';
10
- import { JsNaClDriver } from './nacl/js-nacl-driver';
11
- import { Utils } from './utils/utils';
12
- import { NaClDriver } from './nacl/nacl-driver.interface';
13
- import { NetworkError } from './relay/network-error';
14
- import { InMemoryStorage } from './crypto-storage/in-memory-storage';
15
- export { NaCl, Keys, KeyRing, Mailbox, Relay, CryptoStorage, StorageDriver, LocalStorageDriver, ZaxMessageKind, ZaxTextMessage, ZaxFileMessage, ZaxPlainMessage, ZaxParsedMessage, FileStatusResponse, NaClDriver, JsNaClDriver, Utils, NetworkError, InMemoryStorage };
16
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EACtG,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,OAAO,EACP,KAAK,EACL,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,eAAe,EAChB,CAAC"}
@@ -1,43 +0,0 @@
1
- import { Base64 } from '../utils/utils';
2
- interface KeyRecord {
3
- pk: Base64;
4
- hpk: Base64;
5
- }
6
- export declare class KeyRing {
7
- static readonly commKeyTag = "comm_key";
8
- static readonly guestRegistryTag = "guest_registry";
9
- private commKey;
10
- private storage;
11
- private guestKeys;
12
- private nacl;
13
- private constructor();
14
- static new(id: string): Promise<KeyRing>;
15
- static fromBackup(id: string, backupString: string): Promise<KeyRing>;
16
- getNumberOfGuests(): number;
17
- get guests(): Map<string, KeyRecord>;
18
- /**
19
- * Returns public identity, which is the default communication key.
20
- * Correspondents can know it, whereas Relays do not need it (other than
21
- * temporarily for internal use during the ownership proof)
22
- */
23
- getPubCommKey(): string;
24
- getPrivateCommKey(): string;
25
- /**
26
- * Returns HPK (hash of the public key) of the mailbox. This is what Zax relays
27
- * uses as the universal address of the mailbox
28
- */
29
- getHpk(): Promise<Base64>;
30
- getTagByHpk(hpk: string): string | null;
31
- getGuestKey(guestTag: string): Base64 | null;
32
- backup(): Promise<string>;
33
- setCommFromSeed(seed: Uint8Array): Promise<void>;
34
- setCommFromSecKey(rawSecretKey: Uint8Array): Promise<void>;
35
- addGuest(guestTag: string, publicKey: Base64): Promise<string>;
36
- removeGuest(guestTag: string): Promise<boolean>;
37
- private loadGuestKeys;
38
- private saveGuests;
39
- private static getCommKeyOrCreate;
40
- selfDestruct(): Promise<void>;
41
- }
42
- export {};
43
- //# sourceMappingURL=keyring.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyring.d.ts","sourceRoot":"","sources":["../../../src/keyring/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG/C,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb;AAUD,qBAAa,OAAO;IAClB,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAc;IACxC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,oBAAoB;IAEpD,OAAO,CAAC,OAAO,CAAO;IACtB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,IAAI,CAAa;IAEzB,OAAO;WAMM,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;WAUjC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAa3E,iBAAiB,IAAI,MAAM;IAI3B,IAAI,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAEnC;IAED;;;;OAIG;IACH,aAAa,IAAI,MAAM;IAIvB,iBAAiB,IAAI,MAAM;IAI3B;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAK/B,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IASvC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAUtC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAezB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhD,iBAAiB,CAAC,YAAY,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1D,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU9D,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;YAQvC,aAAa;YAWb,UAAU;mBAIH,kBAAkB;IAYjC,YAAY;CAKnB"}
@@ -1,16 +0,0 @@
1
- import { Base64 } from '../utils/utils';
2
- import { Keypair } from '../nacl/keypair.interface';
3
- /**
4
- * A simple wrapper around a public/private keys pair.
5
- * Stores keys in base64 format.
6
- */
7
- export declare class Keys {
8
- keys: string | Keypair;
9
- private keyPair;
10
- constructor(keys: string | Keypair);
11
- static isEqual(keys1: Keys, keys2: Keys): boolean;
12
- toString(): string;
13
- get publicKey(): Base64;
14
- get privateKey(): Base64;
15
- }
16
- //# sourceMappingURL=keys.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/keys/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD;;;GAGG;AACH,qBAAa,IAAI;IAGI,IAAI,EAAE,MAAM,GAAG,OAAO;IAFzC,OAAO,CAAC,OAAO,CAAU;gBAEN,IAAI,EAAE,MAAM,GAAG,OAAO;IAYzC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO;IAIjD,QAAQ,IAAI,MAAM;IAOlB,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;CACF"}
@@ -1,148 +0,0 @@
1
- import { EncryptedMessage } from '../nacl/nacl-driver.interface';
2
- import { KeyRing } from '../keyring/keyring';
3
- import { Base64 } from '../utils/utils';
4
- import { StartFileUploadResponse, UploadFileChunkResponse, FileStatusResponse, DeleteFileResponse, MessageStatusResponse, FileUploadMetadata, ZaxParsedMessage } from '../zax.interface';
5
- /**
6
- * Mailbox class represents a wrapper around a Keyring that allows to exchange
7
- * encrypted messages with other Mailboxes via a relay
8
- */
9
- export declare class Mailbox {
10
- keyRing: KeyRing;
11
- identity: string;
12
- /**
13
- * each mailbox use it's own relays for connection
14
- * this gives possibility to connect different mailboxes to same server simultaneously
15
- * because they will use different session keys, tokens, server pub keys
16
- */
17
- private relayFactory;
18
- private relayConnectionMutexes;
19
- private nacl;
20
- private constructor();
21
- static new(identity: string): Promise<Mailbox>;
22
- /**
23
- * Create a Mailbox where the secret identity key is derived from a well-known seed
24
- */
25
- static fromSeed(id: string, seed: Uint8Array | string): Promise<Mailbox>;
26
- /**
27
- * Create a Mailbox from the known secret identity key
28
- */
29
- static fromSecKey(id: string, rawSecretKey: Uint8Array | Base64): Promise<Mailbox>;
30
- /**
31
- * Create a Mailbox from the backup string
32
- */
33
- static fromBackup(identity: string, backup: string): Promise<Mailbox>;
34
- /**
35
- * Sends a free-form object to a guest we already have in our keyring. Set `encrypt` to `false` to
36
- * send a plaintext message. Returns a token that can be used with `messageStatus` command to check
37
- * the status of the message
38
- */
39
- upload(url: string, guestKey: string, message: string, encrypt?: boolean): Promise<Base64>;
40
- /**
41
- * Downloads all messages from a relay, decrypts them with a relay key,
42
- * and then parses each message to find out if it's a text message, file message,
43
- * or if it can't be decrypted because HPK is missing in the keyring.
44
- * Returns an array of mixed messages
45
- */
46
- download(url: string): Promise<ZaxParsedMessage[]>;
47
- /**
48
- * Marks a raw Zax message as one that can't be decrypted,
49
- * because sender's HPK is not found in the keyring
50
- */
51
- private parsePlainMessage;
52
- /**
53
- * Decrypts a message that represents uploaded file metadata
54
- */
55
- private parseFileMessage;
56
- /**
57
- * Attempts to decrypt a regular encrypted Zax message. Returns plain message if it was sent encrypted
58
- */
59
- private parseTextMessage;
60
- /**
61
- * Returns the number of messages in the mailbox on a given relay
62
- */
63
- count(url: string): Promise<number>;
64
- /**
65
- * Deletes messages from a relay given a list of base64 message nonces,
66
- * and returns the number of remaining messages
67
- */
68
- delete(url: string, nonceList: Base64[]): Promise<number>;
69
- /**
70
- * Gets the status of a previously sent Zax message by a storage token.
71
- * Returns "time to live" in seconds or a negative value if it's not applicable.
72
- * See `MessageStatusResponse` values for reference
73
- */
74
- messageStatus(url: string, storageToken: Base64): Promise<MessageStatusResponse | number>;
75
- /**
76
- * Asks Zax to start a new upload session, and returns a unique file identifier
77
- * required to upload file chunks.
78
- */
79
- startFileUpload(url: string, guest: string, rawMetadata: FileUploadMetadata): Promise<StartFileUploadResponse>;
80
- /**
81
- * Encrypts the file chunk symmetrically and transfers it to a relay
82
- */
83
- uploadFileChunk(url: string, uploadID: string, chunk: Uint8Array, part: number, totalParts: number, skey: Uint8Array): Promise<UploadFileChunkResponse>;
84
- /**
85
- * Returns the status of a file upload by its relay-specific uploadID. Uploader can call it
86
- * to verify the correct transfer, and downloader can check if the file exists and retrieve
87
- * the number of chunks
88
- */
89
- getFileStatus(url: string, uploadID: string): Promise<FileStatusResponse>;
90
- /**
91
- * Fetches the file metadata by uploadID, which was declared by the uploader
92
- */
93
- getFileMetadata(url: string, uploadID: string): Promise<FileUploadMetadata>;
94
- /**
95
- * Downloads a binary chunk of a file from a relay by a given uploadID. The total number of chunks
96
- * can be retrieved via a `getFileStatus` request
97
- */
98
- downloadFileChunk(url: string, uploadID: string, part: number, skey: Uint8Array | Base64): Promise<Uint8Array | null>;
99
- /**
100
- * Deletes a file from the relay (or all chunks uploaded so far, if the upload was not completed).
101
- * Can be called by either the sender or recipient
102
- */
103
- deleteFile(url: string, uploadID: string): Promise<DeleteFileResponse>;
104
- /**
105
- * Establishes a session, exchanges temp keys and proves our ownership of this
106
- * Mailbox to this specific relay. This is the first function to start
107
- * communications with any relay. Returns the number of messages in the mailbox
108
- */
109
- connectToRelay(url: string): Promise<number>;
110
- clearSession(url: string): void;
111
- private encryptSignature;
112
- /**
113
- * Gets a singleton Relay instance, and reconnects to a relay if a previous token has expired
114
- */
115
- private prepareRelay;
116
- /**
117
- * Encrypts the payload of the command and sends it to a relay
118
- */
119
- private runRelayCommand;
120
- /**
121
- * Parses relay's response to a command, for those commands that expect an encrypted message in return.
122
- * Two lines of POST response will be nonce and ctext
123
- */
124
- private decryptResponse;
125
- /**
126
- * Encodes `message` to the guest key of a guest already
127
- * added to the keyring
128
- */
129
- encodeMessage(guest: string, message: string): Promise<EncryptedMessage>;
130
- /**
131
- * Decodes a ciphertext from a guest key already in our keyring with this nonce
132
- * @returns null if failed to decode
133
- */
134
- decodeMessage(guest: string, nonce: Base64, ctext: Base64): Promise<string | null>;
135
- /**
136
- * Wrapper around `keyring.getGuestKey` that handles unknown guests
137
- */
138
- private getGuestKey;
139
- /**
140
- * Deletes a Mailbox and all its data from local CryptoStorage. This is a very
141
- * destructive operation, use with caution - it will delete the Mailbox
142
- * keyring along with all stored public keys. To restore that information, you
143
- * will need to do another key exchange with all the guests on your keyring.
144
- */
145
- selfDestruct(): Promise<void>;
146
- private getRelayConnectionMutex;
147
- }
148
- //# sourceMappingURL=mailbox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mailbox.d.ts","sourceRoot":"","sources":["../../../src/mailbox/mailbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAS,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAMlB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAK1B;;;GAGG;AACH,qBAAa,OAAO;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IAEH,OA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hC"}
@@ -1,37 +0,0 @@
1
- import { EncryptedMessage } from './nacl-driver.interface';
2
- import { Base64 } from '../utils/utils';
3
- /**
4
- * Includes several static helpers that are build on top of basic NaCl driver methods,
5
- * to avoid duplicating code in driver implementations.
6
- */
7
- export declare class EncryptionHelper {
8
- private constructor();
9
- /**
10
- * Encodes a binary message with `cryptobox`
11
- */
12
- static encodeMessage(message: Uint8Array, pkTo: Uint8Array, skFrom: Uint8Array, nonceData?: number): Promise<EncryptedMessage>;
13
- /**
14
- * Decodes a binary message with `cryptobox_open`
15
- * @returns null if failed to decode
16
- */
17
- static decodeMessage(nonce: Uint8Array, ctext: Uint8Array, pkFrom: Uint8Array, skTo: Uint8Array): Promise<string | null>;
18
- /**
19
- * Encodes a binary message with `secretbox` (used for file chunk encryption)
20
- */
21
- static encodeMessageSymmetric(message: Uint8Array, secretKey: Uint8Array): Promise<EncryptedMessage>;
22
- /**
23
- * Decodes a binary message with `secretbox_open` (used for file chunk decryption)
24
- */
25
- static decodeMessageSymmetric(nonce: Base64, ctext: Base64, secretKey: Uint8Array): Promise<Uint8Array | null>;
26
- /**
27
- * Makes a timestamp nonce that a relay expects for any crypto operations.
28
- * Timestamp is the first 8 bytes, the rest is random, unless custom `data`
29
- * is specified. `data` will be packed as next 4 bytes after timestamp.
30
- */
31
- private static makeNonce;
32
- /**
33
- * Splits an integer into an array of bytes
34
- */
35
- private static itoa;
36
- }
37
- //# sourceMappingURL=encryption.helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encryption.helper.d.ts","sourceRoot":"","sources":["../../../src/nacl/encryption.helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAS,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;GAGG;AACH,qBAAa,gBAAgB;IAE3B,OAAO;IAEP;;OAEG;WACU,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM;IAWxG;;;OAGG;WACU,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU;IAUrG;;OAEG;WACU,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAU1G;;OAEG;WACU,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAOpH;;;;OAIG;mBACkB,SAAS;IA2B9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,IAAI;CAYpB"}
@@ -1,39 +0,0 @@
1
- import { NaClDriver } from './nacl-driver.interface';
2
- import { Keypair } from './keypair.interface';
3
- /**
4
- * Implementation based on TweetNaCl.js: {@link https://github.com/dchest/tweetnacl-js}.
5
- * SHA256 is taken separately from `js-sha256` library, because TweetNacl only offers
6
- * SHA512 as hashing function, which is incompatible with the current Zax version.
7
- * {@link https://github.com/emn178/js-sha256}
8
- *
9
- * All the methods of this class are actually synchronous, but they are defined
10
- * as async to conform to the NaClDriver interface, which may have other implementations.
11
- */
12
- export declare class JsNaClDriver implements NaClDriver {
13
- crypto_secretbox_KEYBYTES: number;
14
- crypto_secretbox_random_nonce(): Promise<Uint8Array>;
15
- crypto_secretbox(message: Uint8Array, nonce: Uint8Array, key: Uint8Array): Promise<Uint8Array>;
16
- crypto_secretbox_open(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Promise<Uint8Array | null>;
17
- crypto_box_NONCEBYTES: number;
18
- crypto_box(message: Uint8Array, nonce: Uint8Array, pk: Uint8Array, sk: Uint8Array): Promise<Uint8Array>;
19
- crypto_box_open(cipher: Uint8Array, nonce: Uint8Array, pk: Uint8Array, sk: Uint8Array): Promise<Uint8Array | null>;
20
- crypto_box_random_nonce(): Promise<Uint8Array>;
21
- crypto_box_keypair(): Promise<Keypair>;
22
- crypto_box_keypair_from_raw_sk(key: Uint8Array): Promise<Keypair>;
23
- crypto_box_keypair_from_seed(seed: Uint8Array): Promise<Keypair>;
24
- crypto_hash_sha256(data: Uint8Array): Promise<Uint8Array>;
25
- random_bytes(size: number): Promise<Uint8Array>;
26
- encode_latin1(data: string): Promise<Uint8Array>;
27
- decode_latin1(data: Uint8Array): Promise<string>;
28
- encode_utf8(data: string): Promise<Uint8Array>;
29
- decode_utf8(data: Uint8Array): Promise<string>;
30
- to_hex(data: Uint8Array): Promise<string>;
31
- from_hex(data: string): Promise<Uint8Array>;
32
- /**
33
- * h2(m) = sha256(sha256(64x0 + m))
34
- * Zero out initial sha256 block, and double hash 0-padded message
35
- * http://cs.nyu.edu/~dodis/ps/h-of-h.pdf
36
- */
37
- h2(data: string | Uint8Array): Promise<Uint8Array>;
38
- }
39
- //# sourceMappingURL=js-nacl-driver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"js-nacl-driver.d.ts","sourceRoot":"","sources":["../../../src/nacl/js-nacl-driver.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI9C;;;;;;;;GAQG;AACH,qBAAa,YAAa,YAAW,UAAU;IAC7C,yBAAyB,SAAuB;IAE1C,6BAA6B,IAAI,OAAO,CAAC,UAAU,CAAC;IAIpD,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAI9F,qBAAqB,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAI5G,qBAAqB,SA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k: Uint8Array;
4
- }
5
- //# sourceMappingURL=keypair.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keypair.interface.d.ts","sourceRoot":"","sources":["../../../src/nacl/keypair.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,UAAU,CAAA;IACjB,KAAK,EAAE,UAAU,CAAA;CAClB"}
@@ -1,28 +0,0 @@
1
- import { Keypair } from './keypair.interface';
2
- export interface EncryptedMessage {
3
- nonce: string;
4
- ctext: string;
5
- }
6
- export interface NaClDriver {
7
- crypto_secretbox_KEYBYTES: number;
8
- crypto_secretbox_random_nonce(): Promise<Uint8Array>;
9
- crypto_secretbox(message: Uint8Array, nonce: Uint8Array, key: Uint8Array): Promise<Uint8Array>;
10
- crypto_secretbox_open(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Promise<Uint8Array | null>;
11
- crypto_box_NONCEBYTES: number;
12
- crypto_box(message: Uint8Array, nonce: Uint8Array, pk: Uint8Array, sk: Uint8Array): Promise<Uint8Array>;
13
- crypto_box_open(cipher: Uint8Array, nonce: Uint8Array, pk: Uint8Array, sk: Uint8Array): Promise<Uint8Array | null>;
14
- crypto_box_random_nonce(): Promise<Uint8Array>;
15
- crypto_box_keypair(): Promise<Keypair>;
16
- crypto_box_keypair_from_raw_sk(key: Uint8Array): Promise<Keypair>;
17
- crypto_box_keypair_from_seed(seed: Uint8Array): Promise<Keypair>;
18
- crypto_hash_sha256(data: Uint8Array): Promise<Uint8Array>;
19
- h2(data: string | Uint8Array): Promise<Uint8Array>;
20
- random_bytes(size: number): Promise<Uint8Array>;
21
- encode_latin1(data: string): Promise<Uint8Array>;
22
- decode_latin1(data: Uint8Array): Promise<string>;
23
- encode_utf8(data: string): Promise<Uint8Array>;
24
- decode_utf8(data: Uint8Array): Promise<string>;
25
- to_hex(data: Uint8Array): Promise<string>;
26
- from_hex(data: string): Promise<Uint8Array>;
27
- }
28
- //# sourceMappingURL=nacl-driver.interface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C,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1D,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAGnD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChD,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACjD,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/C,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC7C"}
@@ -1,13 +0,0 @@
1
- import { NaClDriver } from './nacl-driver.interface';
2
- /**
3
- * Facade singleton to access the NaCl driver.
4
- * Usage: call instance() with a chosen driver, and store the received object to perform further actions.
5
- */
6
- export declare class NaCl {
7
- private static driverInstance?;
8
- private constructor();
9
- static setDefaultInstance(): boolean;
10
- static setInstance(driver: NaClDriver): boolean;
11
- static getInstance(): NaClDriver;
12
- }
13
- //# sourceMappingURL=nacl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nacl.d.ts","sourceRoot":"","sources":["../../../src/nacl/nacl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD;;;GAGG;AACH,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAa;IAE3C,OAAO;WAEO,kBAAkB;WAIlB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;WASxC,WAAW,IAAI,UAAU;CAOxC"}
@@ -1,6 +0,0 @@
1
- export declare class NetworkError extends Error {
2
- status: number | undefined;
3
- readonly name = "NetworkError";
4
- constructor(status: number | undefined);
5
- }
6
- //# sourceMappingURL=network-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"network-error.d.ts","sourceRoot":"","sources":["../../../src/relay/network-error.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;IAGlB,MAAM,EAAE,MAAM,GAAC,SAAS;IAF3C,QAAQ,CAAC,IAAI,kBAAkB;gBAEZ,MAAM,EAAE,MAAM,GAAC,SAAS;CAG5C"}
@@ -1,10 +0,0 @@
1
- import { Relay } from './relay';
2
- export declare class RelayFactory {
3
- private relays;
4
- /**
5
- * Relay factory, that returns a Relay instance for a given URL,
6
- * or creates a new one if it hasn't yet been initialized.
7
- */
8
- getInstance(url: string): Relay;
9
- }
10
- //# sourceMappingURL=relay-factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relay-factory.d.ts","sourceRoot":"","sources":["../../../src/relay/relay-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,YAAY;IAEvB,OAAO,CAAC,MAAM,CAAgC;IAE9C;;;OAGG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM;CAOxB"}