@enbox/agent 0.1.2 → 0.1.4

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 (224) hide show
  1. package/dist/browser.mjs +45 -52
  2. package/dist/browser.mjs.map +4 -4
  3. package/dist/esm/crypto-api.js +6 -13
  4. package/dist/esm/crypto-api.js.map +1 -1
  5. package/dist/esm/dwn-api.js +80 -78
  6. package/dist/esm/dwn-api.js.map +1 -1
  7. package/dist/esm/hd-identity-vault.js +4 -5
  8. package/dist/esm/hd-identity-vault.js.map +1 -1
  9. package/dist/esm/identity-api.js +1 -1
  10. package/dist/esm/identity-api.js.map +1 -1
  11. package/dist/esm/index.js +0 -2
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/local-key-manager.js +31 -32
  14. package/dist/esm/local-key-manager.js.map +1 -1
  15. package/dist/esm/prototyping/crypto/jose/jwe-compact.js +1 -2
  16. package/dist/esm/prototyping/crypto/jose/jwe-compact.js.map +1 -1
  17. package/dist/esm/prototyping/crypto/jose/jwe-flattened.js +15 -4
  18. package/dist/esm/prototyping/crypto/jose/jwe-flattened.js.map +1 -1
  19. package/dist/esm/prototyping/crypto/jose/jwe.js +1 -1
  20. package/dist/esm/prototyping/crypto/jose/jwe.js.map +1 -1
  21. package/dist/esm/store-data.js +3 -3
  22. package/dist/esm/store-data.js.map +1 -1
  23. package/dist/esm/store-did.js +1 -1
  24. package/dist/esm/store-did.js.map +1 -1
  25. package/dist/esm/sync-engine-level.js +49 -11
  26. package/dist/esm/sync-engine-level.js.map +1 -1
  27. package/dist/esm/test-harness.js +24 -8
  28. package/dist/esm/test-harness.js.map +1 -1
  29. package/dist/esm/types/dwn.js +1 -1
  30. package/dist/esm/types/dwn.js.map +1 -1
  31. package/dist/esm/web5-user-agent.js +1 -1
  32. package/dist/esm/web5-user-agent.js.map +1 -1
  33. package/dist/types/crypto-api.d.ts +8 -12
  34. package/dist/types/crypto-api.d.ts.map +1 -1
  35. package/dist/types/dwn-api.d.ts +10 -10
  36. package/dist/types/dwn-api.d.ts.map +1 -1
  37. package/dist/types/hd-identity-vault.d.ts.map +1 -1
  38. package/dist/types/identity-api.d.ts.map +1 -1
  39. package/dist/types/index.d.ts +0 -2
  40. package/dist/types/index.d.ts.map +1 -1
  41. package/dist/types/local-key-manager.d.ts +15 -18
  42. package/dist/types/local-key-manager.d.ts.map +1 -1
  43. package/dist/types/prototyping/crypto/jose/jwe-compact.d.ts +1 -3
  44. package/dist/types/prototyping/crypto/jose/jwe-compact.d.ts.map +1 -1
  45. package/dist/types/prototyping/crypto/jose/jwe-flattened.d.ts +1 -3
  46. package/dist/types/prototyping/crypto/jose/jwe-flattened.d.ts.map +1 -1
  47. package/dist/types/prototyping/crypto/jose/jwe.d.ts +1 -3
  48. package/dist/types/prototyping/crypto/jose/jwe.d.ts.map +1 -1
  49. package/dist/types/store-data.d.ts +2 -2
  50. package/dist/types/store-did.d.ts.map +1 -1
  51. package/dist/types/sync-engine-level.d.ts +18 -6
  52. package/dist/types/sync-engine-level.d.ts.map +1 -1
  53. package/dist/types/test-harness.d.ts.map +1 -1
  54. package/dist/types/types/agent.d.ts +1 -1
  55. package/dist/types/types/agent.d.ts.map +1 -1
  56. package/dist/types/types/dwn.d.ts +2 -2
  57. package/dist/types/types/dwn.d.ts.map +1 -1
  58. package/dist/types/types/key-manager.d.ts +15 -22
  59. package/dist/types/types/key-manager.d.ts.map +1 -1
  60. package/dist/types/utils-internal.d.ts +1 -1
  61. package/dist/types/utils-internal.d.ts.map +1 -1
  62. package/dist/types/web5-user-agent.d.ts +1 -1
  63. package/dist/types/web5-user-agent.d.ts.map +1 -1
  64. package/package.json +13 -15
  65. package/src/crypto-api.ts +24 -20
  66. package/src/dwn-api.ts +109 -102
  67. package/src/hd-identity-vault.ts +4 -5
  68. package/src/identity-api.ts +2 -1
  69. package/src/index.ts +0 -2
  70. package/src/local-key-manager.ts +43 -44
  71. package/src/prototyping/crypto/jose/jwe-compact.ts +3 -7
  72. package/src/prototyping/crypto/jose/jwe-flattened.ts +20 -9
  73. package/src/prototyping/crypto/jose/jwe.ts +2 -6
  74. package/src/store-data.ts +3 -3
  75. package/src/store-did.ts +1 -1
  76. package/src/sync-engine-level.ts +59 -16
  77. package/src/test-harness.ts +23 -8
  78. package/src/types/agent.ts +1 -1
  79. package/src/types/dwn.ts +2 -2
  80. package/src/types/key-manager.ts +31 -22
  81. package/src/utils-internal.ts +1 -1
  82. package/src/web5-user-agent.ts +2 -2
  83. package/dist/browser.js +0 -2213
  84. package/dist/browser.js.map +0 -7
  85. package/dist/esm/dwn-registrar.js +0 -120
  86. package/dist/esm/dwn-registrar.js.map +0 -1
  87. package/dist/esm/prototyping/clients/dwn-rpc-types.js +0 -2
  88. package/dist/esm/prototyping/clients/dwn-rpc-types.js.map +0 -1
  89. package/dist/esm/prototyping/clients/dwn-server-info-cache-memory.js +0 -74
  90. package/dist/esm/prototyping/clients/dwn-server-info-cache-memory.js.map +0 -1
  91. package/dist/esm/prototyping/clients/http-dwn-rpc-client.js +0 -112
  92. package/dist/esm/prototyping/clients/http-dwn-rpc-client.js.map +0 -1
  93. package/dist/esm/prototyping/clients/json-rpc-socket.js +0 -167
  94. package/dist/esm/prototyping/clients/json-rpc-socket.js.map +0 -1
  95. package/dist/esm/prototyping/clients/json-rpc.js +0 -58
  96. package/dist/esm/prototyping/clients/json-rpc.js.map +0 -1
  97. package/dist/esm/prototyping/clients/server-info-types.js +0 -2
  98. package/dist/esm/prototyping/clients/server-info-types.js.map +0 -1
  99. package/dist/esm/prototyping/clients/web-socket-clients.js +0 -90
  100. package/dist/esm/prototyping/clients/web-socket-clients.js.map +0 -1
  101. package/dist/esm/prototyping/common/object.js +0 -14
  102. package/dist/esm/prototyping/common/object.js.map +0 -1
  103. package/dist/esm/prototyping/common/type-utils.js +0 -2
  104. package/dist/esm/prototyping/common/type-utils.js.map +0 -1
  105. package/dist/esm/prototyping/crypto/algorithms/aes-gcm.js +0 -147
  106. package/dist/esm/prototyping/crypto/algorithms/aes-gcm.js.map +0 -1
  107. package/dist/esm/prototyping/crypto/algorithms/aes-kw.js +0 -136
  108. package/dist/esm/prototyping/crypto/algorithms/aes-kw.js.map +0 -1
  109. package/dist/esm/prototyping/crypto/algorithms/ecdsa.js +0 -311
  110. package/dist/esm/prototyping/crypto/algorithms/ecdsa.js.map +0 -1
  111. package/dist/esm/prototyping/crypto/algorithms/eddsa.js +0 -268
  112. package/dist/esm/prototyping/crypto/algorithms/eddsa.js.map +0 -1
  113. package/dist/esm/prototyping/crypto/algorithms/hkdf.js +0 -38
  114. package/dist/esm/prototyping/crypto/algorithms/hkdf.js.map +0 -1
  115. package/dist/esm/prototyping/crypto/algorithms/pbkdf2.js +0 -40
  116. package/dist/esm/prototyping/crypto/algorithms/pbkdf2.js.map +0 -1
  117. package/dist/esm/prototyping/crypto/crypto-error.js +0 -41
  118. package/dist/esm/prototyping/crypto/crypto-error.js.map +0 -1
  119. package/dist/esm/prototyping/crypto/types/crypto-api.js +0 -2
  120. package/dist/esm/prototyping/crypto/types/crypto-api.js.map +0 -1
  121. package/dist/esm/prototyping/crypto/types/key-converter.js +0 -2
  122. package/dist/esm/prototyping/crypto/types/key-converter.js.map +0 -1
  123. package/dist/esm/prototyping/crypto/types/key-deriver.js +0 -2
  124. package/dist/esm/prototyping/crypto/types/key-deriver.js.map +0 -1
  125. package/dist/esm/prototyping/crypto/types/key-io.js +0 -2
  126. package/dist/esm/prototyping/crypto/types/key-io.js.map +0 -1
  127. package/dist/esm/prototyping/crypto/types/key-manager.js +0 -2
  128. package/dist/esm/prototyping/crypto/types/key-manager.js.map +0 -1
  129. package/dist/esm/prototyping/crypto/types/params-direct.js +0 -2
  130. package/dist/esm/prototyping/crypto/types/params-direct.js.map +0 -1
  131. package/dist/esm/prototyping/crypto/types/params-kms.js +0 -2
  132. package/dist/esm/prototyping/crypto/types/params-kms.js.map +0 -1
  133. package/dist/esm/prototyping/crypto/utils.js +0 -19
  134. package/dist/esm/prototyping/crypto/utils.js.map +0 -1
  135. package/dist/esm/prototyping/dids/resolver-cache-memory.js +0 -77
  136. package/dist/esm/prototyping/dids/resolver-cache-memory.js.map +0 -1
  137. package/dist/esm/prototyping/dids/utils.js +0 -9
  138. package/dist/esm/prototyping/dids/utils.js.map +0 -1
  139. package/dist/esm/rpc-client.js +0 -123
  140. package/dist/esm/rpc-client.js.map +0 -1
  141. package/dist/types/dwn-registrar.d.ts +0 -29
  142. package/dist/types/dwn-registrar.d.ts.map +0 -1
  143. package/dist/types/prototyping/clients/dwn-rpc-types.d.ts +0 -45
  144. package/dist/types/prototyping/clients/dwn-rpc-types.d.ts.map +0 -1
  145. package/dist/types/prototyping/clients/dwn-server-info-cache-memory.d.ts +0 -57
  146. package/dist/types/prototyping/clients/dwn-server-info-cache-memory.d.ts.map +0 -1
  147. package/dist/types/prototyping/clients/http-dwn-rpc-client.d.ts +0 -13
  148. package/dist/types/prototyping/clients/http-dwn-rpc-client.d.ts.map +0 -1
  149. package/dist/types/prototyping/clients/json-rpc-socket.d.ts +0 -43
  150. package/dist/types/prototyping/clients/json-rpc-socket.d.ts.map +0 -1
  151. package/dist/types/prototyping/clients/json-rpc.d.ts +0 -49
  152. package/dist/types/prototyping/clients/json-rpc.d.ts.map +0 -1
  153. package/dist/types/prototyping/clients/server-info-types.d.ts +0 -20
  154. package/dist/types/prototyping/clients/server-info-types.d.ts.map +0 -1
  155. package/dist/types/prototyping/clients/web-socket-clients.d.ts +0 -10
  156. package/dist/types/prototyping/clients/web-socket-clients.d.ts.map +0 -1
  157. package/dist/types/prototyping/common/object.d.ts +0 -2
  158. package/dist/types/prototyping/common/object.d.ts.map +0 -1
  159. package/dist/types/prototyping/common/type-utils.d.ts +0 -7
  160. package/dist/types/prototyping/common/type-utils.d.ts.map +0 -1
  161. package/dist/types/prototyping/crypto/algorithms/aes-gcm.d.ts +0 -151
  162. package/dist/types/prototyping/crypto/algorithms/aes-gcm.d.ts.map +0 -1
  163. package/dist/types/prototyping/crypto/algorithms/aes-kw.d.ts +0 -108
  164. package/dist/types/prototyping/crypto/algorithms/aes-kw.d.ts.map +0 -1
  165. package/dist/types/prototyping/crypto/algorithms/ecdsa.d.ts +0 -160
  166. package/dist/types/prototyping/crypto/algorithms/ecdsa.d.ts.map +0 -1
  167. package/dist/types/prototyping/crypto/algorithms/eddsa.d.ts +0 -157
  168. package/dist/types/prototyping/crypto/algorithms/eddsa.d.ts.map +0 -1
  169. package/dist/types/prototyping/crypto/algorithms/hkdf.d.ts +0 -20
  170. package/dist/types/prototyping/crypto/algorithms/hkdf.d.ts.map +0 -1
  171. package/dist/types/prototyping/crypto/algorithms/pbkdf2.d.ts +0 -20
  172. package/dist/types/prototyping/crypto/algorithms/pbkdf2.d.ts.map +0 -1
  173. package/dist/types/prototyping/crypto/crypto-error.d.ts +0 -29
  174. package/dist/types/prototyping/crypto/crypto-error.d.ts.map +0 -1
  175. package/dist/types/prototyping/crypto/types/crypto-api.d.ts +0 -34
  176. package/dist/types/prototyping/crypto/types/crypto-api.d.ts.map +0 -1
  177. package/dist/types/prototyping/crypto/types/key-converter.d.ts +0 -49
  178. package/dist/types/prototyping/crypto/types/key-converter.d.ts.map +0 -1
  179. package/dist/types/prototyping/crypto/types/key-deriver.d.ts +0 -50
  180. package/dist/types/prototyping/crypto/types/key-deriver.d.ts.map +0 -1
  181. package/dist/types/prototyping/crypto/types/key-io.d.ts +0 -49
  182. package/dist/types/prototyping/crypto/types/key-io.d.ts.map +0 -1
  183. package/dist/types/prototyping/crypto/types/key-manager.d.ts +0 -69
  184. package/dist/types/prototyping/crypto/types/key-manager.d.ts.map +0 -1
  185. package/dist/types/prototyping/crypto/types/params-direct.d.ts +0 -75
  186. package/dist/types/prototyping/crypto/types/params-direct.d.ts.map +0 -1
  187. package/dist/types/prototyping/crypto/types/params-kms.d.ts +0 -63
  188. package/dist/types/prototyping/crypto/types/params-kms.d.ts.map +0 -1
  189. package/dist/types/prototyping/crypto/utils.d.ts +0 -7
  190. package/dist/types/prototyping/crypto/utils.d.ts.map +0 -1
  191. package/dist/types/prototyping/dids/resolver-cache-memory.d.ts +0 -57
  192. package/dist/types/prototyping/dids/resolver-cache-memory.d.ts.map +0 -1
  193. package/dist/types/prototyping/dids/utils.d.ts +0 -3
  194. package/dist/types/prototyping/dids/utils.d.ts.map +0 -1
  195. package/dist/types/rpc-client.d.ts +0 -51
  196. package/dist/types/rpc-client.d.ts.map +0 -1
  197. package/src/dwn-registrar.ts +0 -127
  198. package/src/prototyping/clients/dwn-rpc-types.ts +0 -55
  199. package/src/prototyping/clients/dwn-server-info-cache-memory.ts +0 -79
  200. package/src/prototyping/clients/http-dwn-rpc-client.ts +0 -119
  201. package/src/prototyping/clients/json-rpc-socket.ts +0 -189
  202. package/src/prototyping/clients/json-rpc.ts +0 -113
  203. package/src/prototyping/clients/server-info-types.ts +0 -21
  204. package/src/prototyping/clients/web-socket-clients.ts +0 -103
  205. package/src/prototyping/common/object.ts +0 -15
  206. package/src/prototyping/common/type-utils.ts +0 -6
  207. package/src/prototyping/crypto/algorithms/aes-gcm.ts +0 -211
  208. package/src/prototyping/crypto/algorithms/aes-kw.ts +0 -160
  209. package/src/prototyping/crypto/algorithms/ecdsa.ts +0 -366
  210. package/src/prototyping/crypto/algorithms/eddsa.ts +0 -311
  211. package/src/prototyping/crypto/algorithms/hkdf.ts +0 -38
  212. package/src/prototyping/crypto/algorithms/pbkdf2.ts +0 -41
  213. package/src/prototyping/crypto/crypto-error.ts +0 -45
  214. package/src/prototyping/crypto/types/crypto-api.ts +0 -77
  215. package/src/prototyping/crypto/types/key-converter.ts +0 -53
  216. package/src/prototyping/crypto/types/key-deriver.ts +0 -56
  217. package/src/prototyping/crypto/types/key-io.ts +0 -51
  218. package/src/prototyping/crypto/types/key-manager.ts +0 -83
  219. package/src/prototyping/crypto/types/params-direct.ts +0 -95
  220. package/src/prototyping/crypto/types/params-kms.ts +0 -76
  221. package/src/prototyping/crypto/utils.ts +0 -41
  222. package/src/prototyping/dids/resolver-cache-memory.ts +0 -83
  223. package/src/prototyping/dids/utils.ts +0 -10
  224. package/src/rpc-client.ts +0 -160
@@ -1,40 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __rest = (this && this.__rest) || function (s, e) {
11
- var t = {};
12
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
- t[p] = s[p];
14
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
- t[p[i]] = s[p[i]];
18
- }
19
- return t;
20
- };
21
- import { CryptoAlgorithm, Pbkdf2 } from '@enbox/crypto';
22
- export class Pbkdf2Algorithm extends CryptoAlgorithm {
23
- deriveKeyBytes(_a) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- var { algorithm } = _a, params = __rest(_a, ["algorithm"]);
26
- // Extract the hash function component of the `algorithm` parameter.
27
- const [, hashFunction] = algorithm.split(/[-+]/);
28
- // Map from JOSE algorithm name to "SHA" hash function identifier.
29
- const hash = {
30
- 'HS256': 'SHA-256',
31
- 'HS384': 'SHA-384',
32
- 'HS512': 'SHA-512'
33
- }[hashFunction];
34
- // Derive a cryptographic byte array using PBKDF2.
35
- const derivedKeyBytes = yield Pbkdf2.deriveKeyBytes(Object.assign(Object.assign({}, params), { hash }));
36
- return derivedKeyBytes;
37
- });
38
- }
39
- }
40
- //# sourceMappingURL=pbkdf2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../../../../../src/prototyping/crypto/algorithms/pbkdf2.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAgBxD,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAGrC,cAAc,CAAC,EAC6B;;gBAD7B,EAAE,SAAS,OACkB,EADb,MAAM,cAAtB,aAAwB,CAAF;YAGhD,oEAAoE;YACpE,MAAM,CAAC,EAAE,YAAY,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAEjD,kEAAkE;YAClE,MAAM,IAAI,GAAG;gBACX,OAAO,EAAG,SAAkB;gBAC5B,OAAO,EAAG,SAAkB;gBAC5B,OAAO,EAAG,SAAkB;aAC7B,CAAC,YAAY,CAAE,CAAC;YAEjB,kDAAkD;YAClD,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,cAAc,iCAAM,MAAM,KAAE,IAAI,IAAG,CAAC;YAEzE,OAAO,eAAe,CAAC;QACzB,CAAC;KAAA;CACF"}
@@ -1,41 +0,0 @@
1
- /**
2
- * A custom error class for Crypto-related errors.
3
- */
4
- export class CryptoError extends Error {
5
- /**
6
- * Constructs an instance of CryptoError, a custom error class for handling Crypto-related errors.
7
- *
8
- * @param code - A {@link CryptoErrorCode} representing the specific type of error encountered.
9
- * @param message - A human-readable description of the error.
10
- */
11
- constructor(code, message) {
12
- super(message);
13
- this.code = code;
14
- this.name = 'CryptoError';
15
- // Ensures that instanceof works properly, the correct prototype chain when using inheritance,
16
- // and that V8 stack traces (like Chrome, Edge, and Node.js) are more readable and relevant.
17
- Object.setPrototypeOf(this, new.target.prototype);
18
- // Captures the stack trace in V8 engines (like Chrome, Edge, and Node.js).
19
- // In non-V8 environments, the stack trace will still be captured.
20
- if (Error.captureStackTrace) {
21
- Error.captureStackTrace(this, CryptoError);
22
- }
23
- }
24
- }
25
- /**
26
- * An enumeration of possible Crypto error codes.
27
- */
28
- export var CryptoErrorCode;
29
- (function (CryptoErrorCode) {
30
- /** The supplied algorithm identifier is not supported by the implementation. */
31
- CryptoErrorCode["AlgorithmNotSupported"] = "algorithmNotSupported";
32
- /** The encoding operation (either encoding or decoding) failed. */
33
- CryptoErrorCode["EncodingError"] = "encodingError";
34
- /** The JWE supplied does not conform to valid syntax. */
35
- CryptoErrorCode["InvalidJwe"] = "invalidJwe";
36
- /** The JWK supplied does not conform to valid syntax. */
37
- CryptoErrorCode["InvalidJwk"] = "invalidJwk";
38
- /** The requested operation is not supported by the implementation. */
39
- CryptoErrorCode["OperationNotSupported"] = "operationNotSupported";
40
- })(CryptoErrorCode || (CryptoErrorCode = {}));
41
- //# sourceMappingURL=crypto-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto-error.js","sourceRoot":"","sources":["../../../../src/prototyping/crypto/crypto-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC;;;;;OAKG;IACH,YAAmB,IAAqB,EAAE,OAAe;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,SAAI,GAAJ,IAAI,CAAiB;QAEtC,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAE1B,8FAA8F;QAC9F,4FAA4F;QAC5F,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAElD,2EAA2E;QAC3E,kEAAkE;QAClE,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,eAeX;AAfD,WAAY,eAAe;IACzB,gFAAgF;IAChF,kEAA+C,CAAA;IAE/C,mEAAmE;IACnE,kDAA+B,CAAA;IAE/B,yDAAyD;IACzD,4CAAyB,CAAA;IAEzB,yDAAyD;IACzD,4CAAyB,CAAA;IAEzB,sEAAsE;IACtE,kEAA+C,CAAA;AACjD,CAAC,EAfW,eAAe,KAAf,eAAe,QAe1B"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=crypto-api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto-api.js","sourceRoot":"","sources":["../../../../../src/prototyping/crypto/types/crypto-api.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=key-converter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"key-converter.js","sourceRoot":"","sources":["../../../../../src/prototyping/crypto/types/key-converter.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=key-deriver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"key-deriver.js","sourceRoot":"","sources":["../../../../../src/prototyping/crypto/types/key-deriver.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=key-io.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"key-io.js","sourceRoot":"","sources":["../../../../../src/prototyping/crypto/types/key-io.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=key-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"key-manager.js","sourceRoot":"","sources":["../../../../../src/prototyping/crypto/types/key-manager.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=params-direct.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"params-direct.js","sourceRoot":"","sources":["../../../../../src/prototyping/crypto/types/params-direct.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=params-kms.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"params-kms.js","sourceRoot":"","sources":["../../../../../src/prototyping/crypto/types/params-kms.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- export function isCipher(obj) {
2
- return (obj !== null && typeof obj === 'object'
3
- && 'encrypt' in obj && typeof obj.encrypt === 'function'
4
- && 'decrypt' in obj && typeof obj.decrypt === 'function');
5
- }
6
- export function isKeyExporter(obj) {
7
- return (obj !== null && typeof obj === 'object'
8
- && 'exportKey' in obj && typeof obj.exportKey === 'function');
9
- }
10
- export function isKeyImporter(obj) {
11
- return (obj !== null && typeof obj === 'object'
12
- && 'importKey' in obj && typeof obj.importKey === 'function');
13
- }
14
- export function isKeyWrapper(obj) {
15
- return (obj !== null && typeof obj === 'object'
16
- && 'wrapKey' in obj && typeof obj.wrapKey === 'function'
17
- && 'unwrapKey' in obj && typeof obj.unwrapKey === 'function');
18
- }
19
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/prototyping/crypto/utils.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,QAAQ,CACtB,GAAY;IAEZ,OAAO,CACL,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;WACpC,SAAS,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU;WACrD,SAAS,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CACzD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,GAAY;IAEZ,OAAO,CACL,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;WACpC,WAAW,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,CAC7D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,GAAY;IAEZ,OAAO,CACL,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;WACpC,WAAW,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,CAC7D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,GAAY;IAEZ,OAAO,CACL,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;WACpC,SAAS,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU;WACrD,WAAW,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,CAC7D,CAAC;AACJ,CAAC"}
@@ -1,77 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import ms from 'ms';
11
- import { TtlCache } from '@enbox/common';
12
- export class DidResolverCacheMemory {
13
- constructor({ ttl = '15m' } = {}) {
14
- this.cache = new TtlCache({ ttl: ms(ttl) });
15
- }
16
- /**
17
- * Retrieves a DID resolution result from the cache.
18
- *
19
- * If the cached item has exceeded its TTL, it's scheduled for deletion and undefined is returned.
20
- *
21
- * @param didUri - The DID string used as the key for retrieving the cached result.
22
- * @returns The cached DID resolution result or undefined if not found or expired.
23
- */
24
- get(didUri) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- if (!didUri) {
27
- throw new Error('Key cannot be null or undefined');
28
- }
29
- return this.cache.get(didUri);
30
- });
31
- }
32
- /**
33
- * Stores a DID resolution result in the cache with a TTL.
34
- *
35
- * @param didUri - The DID string used as the key for storing the result.
36
- * @param resolutionResult - The DID resolution result to be cached.
37
- * @returns A promise that resolves when the operation is complete.
38
- */
39
- set(didUri, resolutionResult) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- this.cache.set(didUri, resolutionResult);
42
- });
43
- }
44
- /**
45
- * Deletes a DID resolution result from the cache.
46
- *
47
- * @param didUri - The DID string used as the key for deletion.
48
- * @returns A promise that resolves when the operation is complete.
49
- */
50
- delete(didUri) {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- this.cache.delete(didUri);
53
- });
54
- }
55
- /**
56
- * Clears all entries from the cache.
57
- *
58
- * @returns A promise that resolves when the operation is complete.
59
- */
60
- clear() {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- this.cache.clear();
63
- });
64
- }
65
- /**
66
- * This method is a no-op but exists to be consistent with other DID Resolver Cache
67
- * implementations.
68
- *
69
- * @returns A promise that resolves immediately.
70
- */
71
- close() {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- // No-op since there is no underlying store to close.
74
- });
75
- }
76
- }
77
- //# sourceMappingURL=resolver-cache-memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolver-cache-memory.js","sourceRoot":"","sources":["../../../../src/prototyping/dids/resolver-cache-memory.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAiBzC,MAAM,OAAO,sBAAsB;IAGjC,YAAY,EAAE,GAAG,GAAG,KAAK,KAAmC,EAAE;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;OAOG;IACU,GAAG,CAAC,MAAc;;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACrD,CAAC;YAED,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;KAAA;IAED;;;;;;OAMG;IACU,GAAG,CAAC,MAAc,EAAE,gBAAqC;;YACpE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QAC3C,CAAC;KAAA;IAED;;;;;OAKG;IACU,MAAM,CAAC,MAAc;;YAChC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;KAAA;IAED;;;;OAIG;IACU,KAAK;;YAChB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;KAAA;IAED;;;;;OAKG;IACU,KAAK;;YAChB,qDAAqD;QACvD,CAAC;KAAA;CACF"}
@@ -1,9 +0,0 @@
1
- export function isPortableDid(obj) {
2
- // Validate that the given value is an object that has the necessary properties of PortableDid.
3
- return !(!obj || typeof obj !== 'object' || obj === null)
4
- && 'uri' in obj
5
- && 'document' in obj
6
- && 'metadata' in obj
7
- && (!('keyManager' in obj) || obj.keyManager === undefined);
8
- }
9
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/prototyping/dids/utils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,+FAA+F;IAC/F,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,CAAC;WACpD,KAAK,IAAI,GAAG;WACZ,UAAU,IAAI,GAAG;WACjB,UAAU,IAAI,GAAG;WACjB,CAAC,CAAC,CAAC,YAAY,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC;AAChE,CAAC"}
@@ -1,123 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { createJsonRpcRequest } from './prototyping/clients/json-rpc.js';
11
- import { CryptoUtils } from '@enbox/crypto';
12
- import { HttpDwnRpcClient } from './prototyping/clients/http-dwn-rpc-client.js';
13
- import { WebSocketDwnRpcClient } from './prototyping/clients/web-socket-clients.js';
14
- export var DidRpcMethod;
15
- (function (DidRpcMethod) {
16
- DidRpcMethod["Create"] = "did.create";
17
- DidRpcMethod["Resolve"] = "did.resolve";
18
- })(DidRpcMethod || (DidRpcMethod = {}));
19
- /**
20
- * Client used to communicate with Dwn Servers
21
- */
22
- export class Web5RpcClient {
23
- constructor(clients = []) {
24
- this.transportClients = new Map();
25
- // include http and socket clients as default.
26
- // can be overwritten for 'http:', 'https:', 'ws: or ':wss' if instantiated with other clients.
27
- clients = [new HttpWeb5RpcClient(), new WebSocketWeb5RpcClient(), ...clients];
28
- for (const client of clients) {
29
- for (const transportScheme of client.transportProtocols) {
30
- this.transportClients.set(transportScheme, client);
31
- }
32
- }
33
- }
34
- get transportProtocols() {
35
- return Array.from(this.transportClients.keys());
36
- }
37
- sendDidRequest(request) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- // URL() will throw if provided `url` is invalid.
40
- const url = new URL(request.url);
41
- const transportClient = this.transportClients.get(url.protocol);
42
- if (!transportClient) {
43
- const error = new Error(`no ${url.protocol} transport client available`);
44
- error.name = 'NO_TRANSPORT_CLIENT';
45
- throw error;
46
- }
47
- return transportClient.sendDidRequest(request);
48
- });
49
- }
50
- sendDwnRequest(request) {
51
- // will throw if url is invalid
52
- const url = new URL(request.dwnUrl);
53
- const transportClient = this.transportClients.get(url.protocol);
54
- if (!transportClient) {
55
- const error = new Error(`no ${url.protocol} transport client available`);
56
- error.name = 'NO_TRANSPORT_CLIENT';
57
- throw error;
58
- }
59
- return transportClient.sendDwnRequest(request);
60
- }
61
- getServerInfo(dwnUrl) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- // will throw if url is invalid
64
- const url = new URL(dwnUrl);
65
- const transportClient = this.transportClients.get(url.protocol);
66
- if (!transportClient) {
67
- const error = new Error(`no ${url.protocol} transport client available`);
68
- error.name = 'NO_TRANSPORT_CLIENT';
69
- throw error;
70
- }
71
- return transportClient.getServerInfo(dwnUrl);
72
- });
73
- }
74
- }
75
- export class HttpWeb5RpcClient extends HttpDwnRpcClient {
76
- sendDidRequest(request) {
77
- return __awaiter(this, void 0, void 0, function* () {
78
- const requestId = CryptoUtils.randomUuid();
79
- const jsonRpcRequest = createJsonRpcRequest(requestId, request.method, {
80
- data: request.data
81
- });
82
- const httpRequest = new Request(request.url, {
83
- method: 'POST',
84
- headers: {
85
- 'Content-Type': 'application/json',
86
- },
87
- body: JSON.stringify(jsonRpcRequest),
88
- });
89
- let jsonRpcResponse;
90
- try {
91
- const response = yield fetch(httpRequest);
92
- if (response.ok) {
93
- jsonRpcResponse = yield response.json();
94
- // If the response is an error, throw an error.
95
- if (jsonRpcResponse.error) {
96
- const { code, message } = jsonRpcResponse.error;
97
- throw new Error(`JSON RPC (${code}) - ${message}`);
98
- }
99
- }
100
- else {
101
- throw new Error(`HTTP (${response.status}) - ${response.statusText}`);
102
- }
103
- }
104
- catch (error) {
105
- throw new Error(`Error encountered while processing response from ${request.url}: ${error.message}`);
106
- }
107
- return jsonRpcResponse.result;
108
- });
109
- }
110
- }
111
- export class WebSocketWeb5RpcClient extends WebSocketDwnRpcClient {
112
- sendDidRequest(_request) {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- throw new Error(`not implemented for transports [${this.transportProtocols.join(', ')}]`);
115
- });
116
- }
117
- getServerInfo(_dwnUrl) {
118
- return __awaiter(this, void 0, void 0, function* () {
119
- throw new Error(`not implemented for transports [${this.transportProtocols.join(', ')}]`);
120
- });
121
- }
122
- }
123
- //# sourceMappingURL=rpc-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rpc-client.js","sourceRoot":"","sources":["../../src/rpc-client.ts"],"names":[],"mappings":"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"}
@@ -1,29 +0,0 @@
1
- /**
2
- * A client for registering tenants with a DWN.
3
- */
4
- export declare class DwnRegistrar {
5
- /**
6
- * Registers a new tenant with the given DWN.
7
- * NOTE: Assumes the user has already accepted the terms of service.
8
- * NOTE: Currently the DWN Server from `dwn-server` does not require user signature.
9
- * TODO: bring in types from `dwn-server`.
10
- */
11
- static registerTenant(dwnEndpoint: string, did: string): Promise<void>;
12
- /**
13
- * Computes the SHA-256 hash of the given array of strings.
14
- */
15
- static hashAsHexString(input: string): Promise<string>;
16
- /**
17
- * Finds a response nonce that qualifies the difficulty requirement for the given proof-of-work challenge and request data.
18
- */
19
- static findQualifiedResponseNonce(input: {
20
- maximumAllowedHashValue: string;
21
- challengeNonce: string;
22
- requestData: string;
23
- }): Promise<string>;
24
- /**
25
- * Generates 32 random bytes expressed as a HEX string.
26
- */
27
- static generateNonce(): Promise<string>;
28
- }
29
- //# sourceMappingURL=dwn-registrar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dwn-registrar.d.ts","sourceRoot":"","sources":["../../src/dwn-registrar.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,qBAAa,YAAY;IACvB;;;;;OAKG;WACiB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6DnF;;OAEG;WACiB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMnE;;OAEG;WACiB,0BAA0B,CAAC,KAAK,EAAE;QACpD,uBAAuB,EAAE,MAAM,CAAC;QAChC,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,MAAM,CAAC;IA2BnB;;OAEG;WACiB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAKrD"}
@@ -1,45 +0,0 @@
1
- import type { MessageSubscriptionHandler, RecordsReadReply, RecordSubscriptionHandler, UnionMessageReply } from '@enbox/dwn-sdk-js';
2
- export interface SerializableDwnMessage {
3
- toJSON(): string;
4
- }
5
- export type DwnSubscriptionHandler = MessageSubscriptionHandler | RecordSubscriptionHandler;
6
- /**
7
- * Interface for communicating with {@link https://github.com/enboxorg/enbox | DWN Servers}
8
- * via JSON-RPC, supporting operations like sending DWN requests.
9
- */
10
- export interface DwnRpc {
11
- /**
12
- * Lists the transport protocols supported by the DWN RPC client, such as HTTP or HTTPS.
13
- * @returns An array of strings representing the supported transport protocols.
14
- */
15
- get transportProtocols(): string[];
16
- /**
17
- * Sends a request to a DWN Server using the specified DWN RPC request parameters.
18
- *
19
- * @param request - The DWN RPC request containing the URL, target DID, message, and optional data.
20
- * @returns A promise that resolves to the response from the DWN server.
21
- */
22
- sendDwnRequest(request: DwnRpcRequest): Promise<DwnRpcResponse>;
23
- }
24
- /**
25
- * Represents a JSON RPC request to a DWN server, including the URL, target DID, the message to be
26
- * processed, and optional data.
27
- */
28
- export type DwnRpcRequest = {
29
- /** Optional data to be sent with the request. */
30
- data?: any;
31
- /** The URL of the DWN server to which the request is sent. */
32
- dwnUrl: string;
33
- /** The message to be processed by the DWN server, which can be a serializable DWN message. */
34
- message: SerializableDwnMessage | any;
35
- /** The DID of the target to which the message is addressed. */
36
- targetDid: string;
37
- /** Optional subscription handler for DWN message events. */
38
- subscriptionHandler?: DwnSubscriptionHandler;
39
- };
40
- /**
41
- * Represents the JSON RPC response from a DWN server to a request, combining the results of various
42
- * DWN operations.
43
- */
44
- export type DwnRpcResponse = UnionMessageReply & RecordsReadReply;
45
- //# sourceMappingURL=dwn-rpc-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dwn-rpc-types.d.ts","sourceRoot":"","sources":["../../../../src/prototyping/clients/dwn-rpc-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEpI,MAAM,WAAW,sBAAsB;IACrC,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG,yBAAyB,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB;;;OAGG;IACH,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAAA;IAElC;;;;;OAKG;IACH,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;CAChE;AAGD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iDAAiD;IACjD,IAAI,CAAC,EAAE,GAAG,CAAC;IAEX,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IAEf,8FAA8F;IAC9F,OAAO,EAAE,sBAAsB,GAAG,GAAG,CAAC;IAEtC,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAElB,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,sBAAsB,CAAC;CAC9C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,gBAAgB,CAAC"}
@@ -1,57 +0,0 @@
1
- import type { DwnServerInfoCache, ServerInfo } from './server-info-types.js';
2
- /**
3
- * Configuration parameters for creating an in-memory cache for DWN ServerInfo entries.
4
- *
5
- * Allows customization of the cache time-to-live (TTL) setting.
6
- */
7
- export type DwnServerInfoCacheMemoryParams = {
8
- /**
9
- * Optional. The time-to-live for cache entries, expressed as a string (e.g., '1h', '15m').
10
- * Determines how long a cache entry should remain valid before being considered expired.
11
- *
12
- * Defaults to '15m' if not specified.
13
- */
14
- ttl?: string;
15
- };
16
- export declare class DwnServerInfoCacheMemory implements DwnServerInfoCache {
17
- private cache;
18
- constructor({ ttl }?: DwnServerInfoCacheMemoryParams);
19
- /**
20
- * Retrieves a DWN ServerInfo entry from the cache.
21
- *
22
- * If the cached item has exceeded its TTL, it's scheduled for deletion and undefined is returned.
23
- *
24
- * @param dwnUrl - The DWN URL endpoint string used as the key for getting the entry.
25
- * @returns The cached DWN ServerInfo entry or undefined if not found or expired.
26
- */
27
- get(dwnUrl: string): Promise<ServerInfo | undefined>;
28
- /**
29
- * Stores a DWN ServerInfo entry in the cache with a TTL.
30
- *
31
- * @param dwnUrl - The DWN URL endpoint string used as the key for storing the entry.
32
- * @param value - The DWN ServerInfo entry to be cached.
33
- * @returns A promise that resolves when the operation is complete.
34
- */
35
- set(dwnUrl: string, value: ServerInfo): Promise<void>;
36
- /**
37
- * Deletes a DWN ServerInfo entry from the cache.
38
- *
39
- * @param dwnUrl - The DWN URL endpoint string used as the key for deletion.
40
- * @returns A promise that resolves when the operation is complete.
41
- */
42
- delete(dwnUrl: string): Promise<void>;
43
- /**
44
- * Clears all entries from the cache.
45
- *
46
- * @returns A promise that resolves when the operation is complete.
47
- */
48
- clear(): Promise<void>;
49
- /**
50
- * This method is a no-op but exists to be consistent with other DWN ServerInfo Cache
51
- * implementations.
52
- *
53
- * @returns A promise that resolves immediately.
54
- */
55
- close(): Promise<void>;
56
- }
57
- //# sourceMappingURL=dwn-server-info-cache-memory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dwn-server-info-cache-memory.d.ts","sourceRoot":"","sources":["../../../../src/prototyping/clients/dwn-server-info-cache-memory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,wBAAyB,YAAW,kBAAkB;IACjE,OAAO,CAAC,KAAK,CAA+B;gBAEhC,EAAE,GAAW,EAAE,GAAE,8BAAkC;IAI/D;;;;;;;OAOG;IACU,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAE,SAAS,CAAC;IAIhE;;;;;;OAMG;IACU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlE;;;;;OAKG;IACU,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD;;;;OAIG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;;;;OAKG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC"}
@@ -1,13 +0,0 @@
1
- import type { DwnRpc, DwnRpcRequest, DwnRpcResponse } from './dwn-rpc-types.js';
2
- import type { DwnServerInfoCache, ServerInfo } from './server-info-types.js';
3
- /**
4
- * HTTP client that can be used to communicate with Dwn Servers
5
- */
6
- export declare class HttpDwnRpcClient implements DwnRpc {
7
- private serverInfoCache;
8
- constructor(serverInfoCache?: DwnServerInfoCache);
9
- get transportProtocols(): string[];
10
- sendDwnRequest(request: DwnRpcRequest): Promise<DwnRpcResponse>;
11
- getServerInfo(dwnUrl: string): Promise<ServerInfo>;
12
- }
13
- //# sourceMappingURL=http-dwn-rpc-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-dwn-rpc-client.d.ts","sourceRoot":"","sources":["../../../../src/prototyping/clients/http-dwn-rpc-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAO7E;;GAEG;AACH,qBAAa,gBAAiB,YAAW,MAAM;IAC7C,OAAO,CAAC,eAAe,CAAqB;gBAChC,eAAe,CAAC,EAAE,kBAAkB;IAIhD,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAAgC;IAE5D,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAkE/D,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAgCzD"}
@@ -1,43 +0,0 @@
1
- import type { JsonRpcRequest, JsonRpcResponse } from './json-rpc.js';
2
- export interface JsonRpcSocketOptions {
3
- /** socket connection timeout in milliseconds */
4
- connectTimeout?: number;
5
- /** response timeout for rpc requests in milliseconds */
6
- responseTimeout?: number;
7
- /** optional connection close handler */
8
- onclose?: () => void;
9
- /** optional socket error handler */
10
- onerror?: (error?: any) => void;
11
- }
12
- /**
13
- * JSON RPC Socket Client for WebSocket request/response and long-running subscriptions.
14
- *
15
- * NOTE: This is temporarily copied over from https://github.com/enboxorg/enbox/blob/main/packages/dwn-server/src/json-rpc-socket.ts
16
- * This was done in order to avoid taking a dependency on the `dwn-server`, until a future time when there will be a `clients` package.
17
- */
18
- export declare class JsonRpcSocket {
19
- private socket;
20
- private responseTimeout;
21
- private messageHandlers;
22
- private constructor();
23
- static connect(url: string, options?: JsonRpcSocketOptions): Promise<JsonRpcSocket>;
24
- close(): void;
25
- /**
26
- * Sends a JSON-RPC request through the socket and waits for a single response.
27
- */
28
- request(request: JsonRpcRequest): Promise<JsonRpcResponse>;
29
- /**
30
- * Sends a JSON-RPC request through the socket and keeps a listener open to read associated responses as they arrive.
31
- * Returns a close method to clean up the listener.
32
- */
33
- subscribe(request: JsonRpcRequest, listener: (response: JsonRpcResponse) => void): Promise<{
34
- response: JsonRpcResponse;
35
- close?: () => Promise<void>;
36
- }>;
37
- private closeSubscription;
38
- /**
39
- * Sends a JSON-RPC request through the socket. You must subscribe to a message listener separately to capture the response.
40
- */
41
- send(request: JsonRpcRequest): void;
42
- }
43
- //# sourceMappingURL=json-rpc-socket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-rpc-socket.d.ts","sourceRoot":"","sources":["../../../../src/prototyping/clients/json-rpc-socket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA4BhF,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CACjC;AAED;;;;;GAKG;AACH,qBAAa,aAAa;IAGJ,OAAO,CAAC,MAAM;IAAa,OAAO,CAAC,eAAe;IAFtE,OAAO,CAAC,eAAe,CAA6D;IAEpF,OAAO;WAEM,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC;IA4C7F,KAAK,IAAI,IAAI;IAIb;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAyBhE;;;OAGG;IACG,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC;QAC/F,QAAQ,EAAE,eAAe,CAAC;QAC1B,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC5B,CAAC;IA2CH,OAAO,CAAC,iBAAiB;IAMzB;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,cAAc,GAAE,IAAI;CAGnC"}