@enbox/agent 0.2.1 → 0.3.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 (139) hide show
  1. package/dist/browser.mjs +9 -9
  2. package/dist/browser.mjs.map +4 -4
  3. package/dist/esm/agent-did-resolver-cache.js.map +1 -1
  4. package/dist/esm/anonymous-dwn-api.js +1 -1
  5. package/dist/esm/bearer-identity.js +1 -1
  6. package/dist/esm/connect.js +3 -3
  7. package/dist/esm/connect.js.map +1 -1
  8. package/dist/esm/did-api.js +3 -3
  9. package/dist/esm/did-api.js.map +1 -1
  10. package/dist/esm/dwn-api.js +150 -10
  11. package/dist/esm/dwn-api.js.map +1 -1
  12. package/dist/esm/dwn-discovery-file.js +244 -0
  13. package/dist/esm/dwn-discovery-file.js.map +1 -0
  14. package/dist/esm/dwn-discovery-payload.js +253 -0
  15. package/dist/esm/dwn-discovery-payload.js.map +1 -0
  16. package/dist/esm/dwn-encryption.js.map +1 -1
  17. package/dist/esm/dwn-key-delivery.js +6 -5
  18. package/dist/esm/dwn-key-delivery.js.map +1 -1
  19. package/dist/esm/dwn-protocol-cache.js +6 -7
  20. package/dist/esm/dwn-protocol-cache.js.map +1 -1
  21. package/dist/esm/dwn-record-upgrade.js.map +1 -1
  22. package/dist/esm/{web5-user-agent.js → enbox-user-agent.js} +18 -9
  23. package/dist/esm/enbox-user-agent.js.map +1 -0
  24. package/dist/esm/identity-api.js +4 -5
  25. package/dist/esm/identity-api.js.map +1 -1
  26. package/dist/esm/index.js +4 -1
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/local-dwn.js +197 -0
  29. package/dist/esm/local-dwn.js.map +1 -0
  30. package/dist/esm/local-key-manager.js +2 -2
  31. package/dist/esm/local-key-manager.js.map +1 -1
  32. package/dist/esm/oidc.js +11 -11
  33. package/dist/esm/oidc.js.map +1 -1
  34. package/dist/esm/permissions-api.js.map +1 -1
  35. package/dist/esm/store-data.js.map +1 -1
  36. package/dist/esm/sync-api.js +2 -2
  37. package/dist/esm/sync-api.js.map +1 -1
  38. package/dist/esm/sync-engine-level.js +3 -4
  39. package/dist/esm/sync-engine-level.js.map +1 -1
  40. package/dist/esm/test-harness.js +5 -4
  41. package/dist/esm/test-harness.js.map +1 -1
  42. package/dist/esm/utils-internal.js +2 -2
  43. package/dist/types/agent-did-resolver-cache.d.ts +7 -7
  44. package/dist/types/agent-did-resolver-cache.d.ts.map +1 -1
  45. package/dist/types/anonymous-dwn-api.d.ts +3 -3
  46. package/dist/types/anonymous-dwn-api.d.ts.map +1 -1
  47. package/dist/types/bearer-identity.d.ts +1 -1
  48. package/dist/types/connect.d.ts +8 -8
  49. package/dist/types/connect.d.ts.map +1 -1
  50. package/dist/types/did-api.d.ts +12 -11
  51. package/dist/types/did-api.d.ts.map +1 -1
  52. package/dist/types/dwn-api.d.ts +58 -11
  53. package/dist/types/dwn-api.d.ts.map +1 -1
  54. package/dist/types/dwn-discovery-file.d.ts +122 -0
  55. package/dist/types/dwn-discovery-file.d.ts.map +1 -0
  56. package/dist/types/dwn-discovery-payload.d.ts +105 -0
  57. package/dist/types/dwn-discovery-payload.d.ts.map +1 -0
  58. package/dist/types/dwn-encryption.d.ts +8 -8
  59. package/dist/types/dwn-encryption.d.ts.map +1 -1
  60. package/dist/types/dwn-key-delivery.d.ts +9 -7
  61. package/dist/types/dwn-key-delivery.d.ts.map +1 -1
  62. package/dist/types/dwn-protocol-cache.d.ts +6 -5
  63. package/dist/types/dwn-protocol-cache.d.ts.map +1 -1
  64. package/dist/types/dwn-record-upgrade.d.ts +2 -2
  65. package/dist/types/dwn-record-upgrade.d.ts.map +1 -1
  66. package/dist/types/{web5-user-agent.d.ts → enbox-user-agent.d.ts} +21 -13
  67. package/dist/types/enbox-user-agent.d.ts.map +1 -0
  68. package/dist/types/identity-api.d.ts +10 -10
  69. package/dist/types/identity-api.d.ts.map +1 -1
  70. package/dist/types/index.d.ts +4 -1
  71. package/dist/types/index.d.ts.map +1 -1
  72. package/dist/types/local-dwn.d.ts +121 -0
  73. package/dist/types/local-dwn.d.ts.map +1 -0
  74. package/dist/types/local-key-manager.d.ts +9 -9
  75. package/dist/types/local-key-manager.d.ts.map +1 -1
  76. package/dist/types/oidc.d.ts +23 -19
  77. package/dist/types/oidc.d.ts.map +1 -1
  78. package/dist/types/permissions-api.d.ts +4 -4
  79. package/dist/types/permissions-api.d.ts.map +1 -1
  80. package/dist/types/store-data.d.ts +3 -3
  81. package/dist/types/store-data.d.ts.map +1 -1
  82. package/dist/types/store-did.d.ts +2 -2
  83. package/dist/types/store-did.d.ts.map +1 -1
  84. package/dist/types/store-identity.d.ts +2 -2
  85. package/dist/types/store-identity.d.ts.map +1 -1
  86. package/dist/types/store-key.d.ts +2 -2
  87. package/dist/types/store-key.d.ts.map +1 -1
  88. package/dist/types/sync-api.d.ts +9 -9
  89. package/dist/types/sync-api.d.ts.map +1 -1
  90. package/dist/types/sync-engine-level.d.ts +9 -9
  91. package/dist/types/sync-engine-level.d.ts.map +1 -1
  92. package/dist/types/sync-messages.d.ts +5 -5
  93. package/dist/types/sync-messages.d.ts.map +1 -1
  94. package/dist/types/test-harness.d.ts +4 -4
  95. package/dist/types/test-harness.d.ts.map +1 -1
  96. package/dist/types/types/agent.d.ts +24 -19
  97. package/dist/types/types/agent.d.ts.map +1 -1
  98. package/dist/types/types/identity.d.ts +1 -1
  99. package/dist/types/types/key-manager.d.ts +2 -2
  100. package/dist/types/types/key-manager.d.ts.map +1 -1
  101. package/dist/types/types/sync.d.ts +2 -2
  102. package/dist/types/types/sync.d.ts.map +1 -1
  103. package/dist/types/utils-internal.d.ts +4 -4
  104. package/dist/types/utils-internal.d.ts.map +1 -1
  105. package/package.json +6 -6
  106. package/src/agent-did-resolver-cache.ts +8 -8
  107. package/src/anonymous-dwn-api.ts +4 -4
  108. package/src/bearer-identity.ts +1 -1
  109. package/src/connect.ts +12 -12
  110. package/src/did-api.ts +13 -11
  111. package/src/dwn-api.ts +196 -16
  112. package/src/dwn-discovery-file.ts +305 -0
  113. package/src/dwn-discovery-payload.ts +308 -0
  114. package/src/dwn-encryption.ts +8 -8
  115. package/src/dwn-key-delivery.ts +11 -8
  116. package/src/dwn-protocol-cache.ts +9 -8
  117. package/src/dwn-record-upgrade.ts +2 -2
  118. package/src/{web5-user-agent.ts → enbox-user-agent.ts} +39 -19
  119. package/src/identity-api.ts +12 -13
  120. package/src/index.ts +4 -1
  121. package/src/local-dwn.ts +207 -0
  122. package/src/local-key-manager.ts +10 -10
  123. package/src/oidc.ts +40 -30
  124. package/src/permissions-api.ts +5 -5
  125. package/src/store-data.ts +7 -7
  126. package/src/store-did.ts +2 -2
  127. package/src/store-identity.ts +2 -2
  128. package/src/store-key.ts +2 -2
  129. package/src/sync-api.ts +10 -10
  130. package/src/sync-engine-level.ts +13 -14
  131. package/src/sync-messages.ts +5 -5
  132. package/src/test-harness.ts +11 -10
  133. package/src/types/agent.ts +31 -20
  134. package/src/types/identity.ts +1 -1
  135. package/src/types/key-manager.ts +2 -2
  136. package/src/types/sync.ts +2 -2
  137. package/src/utils-internal.ts +4 -4
  138. package/dist/esm/web5-user-agent.js.map +0 -1
  139. package/dist/types/web5-user-agent.d.ts.map +0 -1
@@ -1,8 +1,8 @@
1
- import type { DidDhtCreateOptions, DidDocument, DidJwkCreateOptions, DidMetadata, DidMethodApi, DidResolutionOptions, DidResolutionResult, DidResolverCache, DidVerificationMethod, PortableDid } from '@enbox/dids';
1
+ import type { DidDhtCreateOptions, DidDocument, DidJwkCreateOptions, DidMetadata, DidMethodApi, DidResolutionOptions, DidResolutionResult, DidResolverCache, DidVerificationMethod, DidWebCreateOptions, PortableDid } from '@enbox/dids';
2
2
  import { BearerDid, UniversalResolver } from '@enbox/dids';
3
3
  import type { AgentDataStore } from './store-data.js';
4
4
  import type { AgentKeyManager } from './types/key-manager.js';
5
- import type { ResponseStatus, Web5PlatformAgent } from './types/agent.js';
5
+ import type { EnboxPlatformAgent, ResponseStatus } from './types/agent.js';
6
6
  export declare enum DidInterface {
7
7
  Create = "Create",
8
8
  Resolve = "Resolve"
@@ -41,10 +41,11 @@ export interface DidCreateParams<TKeyManager = AgentKeyManager, TMethod extends
41
41
  export interface DidMethodCreateOptions<TKeyManager> {
42
42
  dht: DidDhtCreateOptions<TKeyManager>;
43
43
  jwk: DidJwkCreateOptions<TKeyManager>;
44
+ web: DidWebCreateOptions<TKeyManager>;
44
45
  }
45
46
  export interface DidApiParams {
46
47
  didMethods: DidMethodApi[];
47
- agent?: Web5PlatformAgent;
48
+ agent?: EnboxPlatformAgent;
48
49
  /**
49
50
  * An optional `DidResolverCache` instance used for caching resolved DID documents.
50
51
  *
@@ -59,16 +60,16 @@ export interface DidApiParams {
59
60
  }
60
61
  export declare function isDidRequest<T extends DidInterface>(didRequest: DidRequest<DidInterface>, messageType: T): didRequest is DidRequest<T>;
61
62
  /**
62
- * This API is used to manage and interact with DIDs within the Web5 Agent framework.
63
+ * This API is used to manage and interact with DIDs within the Enbox Agent framework.
63
64
  *
64
65
  * If a DWN Data Store is used, the DID information is stored under DID's own tenant by default.
65
66
  * If a tenant property is passed, that tenant will be used to store the DID information.
66
67
  */
67
68
  export declare class AgentDidApi<TKeyManager extends AgentKeyManager = AgentKeyManager> extends UniversalResolver {
68
69
  /**
69
- * Holds the instance of a `Web5PlatformAgent` that represents the current execution context for
70
- * the `AgentDidApi`. This agent is used to interact with other Web5 agent components. It's vital
71
- * to ensure this instance is set to correctly contextualize operations within the broader Web5
70
+ * Holds the instance of a `EnboxPlatformAgent` that represents the current execution context for
71
+ * the `AgentDidApi`. This agent is used to interact with other Enbox agent components. It's vital
72
+ * to ensure this instance is set to correctly contextualize operations within the broader Enbox
72
73
  * Agent framework.
73
74
  */
74
75
  private _agent?;
@@ -76,13 +77,13 @@ export declare class AgentDidApi<TKeyManager extends AgentKeyManager = AgentKeyM
76
77
  private _store;
77
78
  constructor({ agent, didMethods, resolverCache, store }: DidApiParams);
78
79
  /**
79
- * Retrieves the `Web5PlatformAgent` execution context.
80
+ * Retrieves the `EnboxPlatformAgent` execution context.
80
81
  *
81
- * @returns The `Web5PlatformAgent` instance that represents the current execution context.
82
+ * @returns The `EnboxPlatformAgent` instance that represents the current execution context.
82
83
  * @throws Will throw an error if the `agent` instance property is undefined.
83
84
  */
84
- get agent(): Web5PlatformAgent;
85
- set agent(agent: Web5PlatformAgent);
85
+ get agent(): EnboxPlatformAgent;
86
+ set agent(agent: EnboxPlatformAgent);
86
87
  create({ method, tenant, options, store }: DidCreateParams<TKeyManager>): Promise<BearerDid>;
87
88
  export({ didUri, tenant }: {
88
89
  didUri: string;
@@ -1 +1 @@
1
- {"version":3,"file":"did-api.d.ts","sourceRoot":"","sources":["../../src/did-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACZ,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAe,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAM1E,oBAAY,YAAY;IACtB,MAAM,WAAW;IAEjB,OAAO,YAAY;CAEpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAEvC,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAE1C;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAEvC,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;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AAC,CAAC,CAAC,GACrB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAuC1B,OAAO,CAAC,SAAS;CASlB"}
@@ -1,22 +1,24 @@
1
1
  import type { DerivedPrivateJwk, DwnConfig, EncryptionKeyDeriver, ProtocolDefinition } from '@enbox/dwn-sdk-js';
2
2
  import type { PublicKeyJwk } from '@enbox/crypto';
3
3
  import { Dwn } from '@enbox/dwn-sdk-js';
4
- import type { Web5PlatformAgent } from './types/agent.js';
4
+ import type { EnboxPlatformAgent } from './types/agent.js';
5
+ import type { LocalDwnStrategy } from './local-dwn.js';
5
6
  import type { DwnResponse, ProcessDwnRequest, SendDwnRequest } from './types/dwn.js';
6
7
  import { DwnInterface } from './types/dwn.js';
7
8
  export { isDwnMessage, isDwnRequest, isMessagesPermissionScope, isRecordPermissionScope, isRecordsType } from './dwn-type-guards.js';
8
9
  type DwnApiParams = {
9
- agent?: Web5PlatformAgent;
10
+ agent?: EnboxPlatformAgent;
10
11
  dwn: Dwn;
12
+ localDwnStrategy?: LocalDwnStrategy;
11
13
  };
12
14
  interface DwnApiCreateDwnParams extends Partial<DwnConfig> {
13
15
  dataPath?: string;
14
16
  }
15
17
  export declare class AgentDwnApi {
16
18
  /**
17
- * Holds the instance of a `Web5PlatformAgent` that represents the current execution context for
18
- * the `AgentDwnApi`. This agent is used to interact with other Web5 agent components. It's vital
19
- * to ensure this instance is set to correctly contextualize operations within the broader Web5
19
+ * Holds the instance of a `EnboxPlatformAgent` that represents the current execution context for
20
+ * the `AgentDwnApi`. This agent is used to interact with other Enbox agent components. It's vital
21
+ * to ensure this instance is set to correctly contextualize operations within the broader Enbox
20
22
  * Agent framework.
21
23
  */
22
24
  private _agent?;
@@ -40,15 +42,60 @@ export declare class AgentDwnApi {
40
42
  * Keyed by `ctx~${authorDid}~${rootContextId}`. TTL 30 minutes.
41
43
  */
42
44
  private _contextDerivedKeyCache;
43
- constructor({ agent, dwn }: DwnApiParams);
44
45
  /**
45
- * Retrieves the `Web5PlatformAgent` execution context.
46
+ * Cache of locally-managed DIDs (agent DID + identities). Used to decide
47
+ * whether a target DID should be routed through the local DWN server.
48
+ */
49
+ private _localManagedDidCache;
50
+ /** Controls local DWN discovery behavior ('prefer' | 'only' | 'off'). */
51
+ private _localDwnStrategy;
52
+ /** Lazy-initialized local DWN discovery instance. */
53
+ private _localDwnDiscovery?;
54
+ constructor({ agent, dwn, localDwnStrategy }: DwnApiParams);
55
+ /**
56
+ * Retrieves the `EnboxPlatformAgent` execution context.
46
57
  *
47
- * @returns The `Web5PlatformAgent` instance that represents the current execution context.
58
+ * @returns The `EnboxPlatformAgent` instance that represents the current execution context.
48
59
  * @throws Will throw an error if the `agent` instance property is undefined.
49
60
  */
50
- get agent(): Web5PlatformAgent;
51
- set agent(agent: Web5PlatformAgent);
61
+ get agent(): EnboxPlatformAgent;
62
+ set agent(agent: EnboxPlatformAgent);
63
+ get localDwnStrategy(): LocalDwnStrategy;
64
+ setLocalDwnStrategy(strategy: LocalDwnStrategy): void;
65
+ /**
66
+ * Inject a cached local DWN endpoint (e.g. from a `dwn://register`
67
+ * browser redirect or from persisted storage). The endpoint is validated
68
+ * via `GET /info` before being accepted.
69
+ *
70
+ * @param endpoint - The local DWN server base URL.
71
+ * @returns `true` if the endpoint was validated and cached, `false` otherwise.
72
+ * @see https://github.com/enboxorg/enbox/issues/589
73
+ */
74
+ setCachedLocalDwnEndpoint(endpoint: string): Promise<boolean>;
75
+ /**
76
+ * Resolves the DWN service endpoint URLs for the given target DID, optionally
77
+ * prepending a local DWN server endpoint when local discovery is enabled and
78
+ * the target is a locally-managed DID.
79
+ *
80
+ * @param targetDid - The DID whose DWN endpoints should be resolved.
81
+ * @returns An array of endpoint URLs.
82
+ * @throws When strategy is `'only'` and no local server is available.
83
+ */
84
+ getDwnEndpointUrlsForTarget(targetDid: string): Promise<string[]>;
85
+ /** Lazily retrieves the local DWN server endpoint via discovery. */
86
+ private getLocalDwnEndpoint;
87
+ /**
88
+ * Attempt to create a {@link DwnDiscoveryFile} for file-based local DWN
89
+ * discovery. Returns `undefined` in environments where the filesystem
90
+ * is not available (e.g. browsers).
91
+ */
92
+ private static _tryCreateDiscoveryFile;
93
+ /**
94
+ * Determines whether the given target DID should be routed through the
95
+ * local DWN server. Returns `true` if the DID is the agent DID or one
96
+ * of the locally-managed identity DIDs.
97
+ */
98
+ private shouldUseLocalDwnForTarget;
52
99
  /**
53
100
  * Public getter for the DWN instance used by this API.
54
101
  *
@@ -57,7 +104,7 @@ export declare class AgentDwnApi {
57
104
  * However, it is recommended to use the `processRequest` method to interact with the DWN
58
105
  * instance to ensure that the DWN message is constructed correctly.
59
106
  * - The getter is named `node` to avoid confusion with the `dwn` property of the
60
- * `Web5PlatformAgent`. In other words, so that a developer can call `agent.dwn.node` to access
107
+ * `EnboxPlatformAgent`. In other words, so that a developer can call `agent.dwn.node` to access
61
108
  * the DWN instance and not `agent.dwn.dwn`.
62
109
  */
63
110
  get node(): Dwn;
@@ -1 +1 @@
1
- {"version":3,"file":"dwn-api.d.ts","sourceRoot":"","sources":["../../src/dwn-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EAET,oBAAoB,EAGpB,kBAAkB,EAGnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAgC,YAAY,EAAE,MAAM,eAAe,CAAC;AAGhF,OAAO,EAKL,GAAG,EAWJ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAMV,WAAW,EAGX,iBAAiB,EACjB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AAItE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA8CrI,KAAK,YAAY,GAAG;IAClB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,SAAS,CAAC;CAS3C"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * File-based local DWN discovery for CLI and native apps.
3
+ *
4
+ * When `electrobun-dwn` (or any local DWN server) starts, it writes a
5
+ * well-known file (`~/.enbox/dwn.json`) containing the DWN endpoint URL
6
+ * and the server PID. CLI tools and native apps read this file to discover
7
+ * the local DWN without port probing.
8
+ *
9
+ * The filesystem operations are abstracted behind {@link DiscoveryFileFs}
10
+ * so the module can be tested without touching the real filesystem, and
11
+ * adapted to runtimes that provide different I/O primitives.
12
+ *
13
+ * @see https://github.com/enboxorg/enbox/issues/587
14
+ * @module
15
+ */
16
+ /**
17
+ * The JSON shape persisted in the discovery file.
18
+ *
19
+ * @see https://identity.foundation/dwn-transport/#discovery-file
20
+ */
21
+ export interface DwnDiscoveryRecord {
22
+ /** Base URL of the running DWN server (e.g. `"http://127.0.0.1:55500"`). */
23
+ endpoint: string;
24
+ /** OS process ID of the DWN server. Used for liveness checking. */
25
+ pid: number;
26
+ /**
27
+ * Transport capabilities advertised by the server (e.g. `["http", "ws"]`).
28
+ * Optional per the DWN Transport Spec.
29
+ */
30
+ capabilities?: string[];
31
+ }
32
+ /**
33
+ * Minimal filesystem interface required by {@link DwnDiscoveryFile}.
34
+ *
35
+ * Consumers can provide a custom implementation for testing or for
36
+ * runtimes that do not expose Node-compatible `fs` and `os` modules.
37
+ */
38
+ export interface DiscoveryFileFs {
39
+ /** Read the file at `path` and return its UTF-8 contents, or `null` if not found. */
40
+ readFile(path: string): Promise<string | null>;
41
+ /** Write `contents` to the file at `path`, creating parent directories as needed. */
42
+ writeFile(path: string, contents: string): Promise<void>;
43
+ /** Delete the file at `path`. Must not throw if the file does not exist. */
44
+ removeFile(path: string): Promise<void>;
45
+ /** Return `true` if the process with the given PID is alive. */
46
+ isProcessAlive(pid: number): boolean;
47
+ /** Return the user's home directory (e.g. `/home/alice`). */
48
+ homedir(): string;
49
+ }
50
+ /**
51
+ * Creates a {@link DiscoveryFileFs} backed by Node.js / Bun built-in
52
+ * modules. Returns `undefined` in environments where `node:fs/promises`
53
+ * or `node:os` are not available (e.g. browsers).
54
+ */
55
+ export declare function createNodeDiscoveryFileFs(): DiscoveryFileFs | undefined;
56
+ /**
57
+ * Directory under the user's home where the discovery file lives.
58
+ * Shared with the `electrobun-dwn` app and other Enbox tooling.
59
+ */
60
+ export declare const DISCOVERY_DIR = ".enbox";
61
+ /** Filename of the discovery file. */
62
+ export declare const DISCOVERY_FILENAME = "dwn.json";
63
+ /**
64
+ * Reads, writes, and validates the `~/.enbox/dwn.json` discovery file.
65
+ *
66
+ * This is the **file-based discovery channel** for CLI and native apps.
67
+ * It is complementary to the `dwn://register` browser redirect flow.
68
+ *
69
+ * @example Reading the discovery file
70
+ * ```ts
71
+ * const discoveryFile = new DwnDiscoveryFile();
72
+ * const record = await discoveryFile.read();
73
+ *
74
+ * if (record) {
75
+ * console.log(`Local DWN at ${record.endpoint}`);
76
+ * }
77
+ * ```
78
+ *
79
+ * @example Writing the discovery file (from electrobun-dwn)
80
+ * ```ts
81
+ * const discoveryFile = new DwnDiscoveryFile();
82
+ * await discoveryFile.write({
83
+ * endpoint : 'http://127.0.0.1:55557',
84
+ * pid : process.pid,
85
+ * });
86
+ * ```
87
+ */
88
+ export declare class DwnDiscoveryFile {
89
+ private readonly _fs;
90
+ private readonly _filePath;
91
+ /**
92
+ * @param fs - Filesystem adapter. Defaults to Node/Bun built-ins.
93
+ * @param filePath - Override the discovery file path (mainly for testing).
94
+ * @throws If no filesystem adapter is available (e.g. in a browser).
95
+ */
96
+ constructor(fs?: DiscoveryFileFs, filePath?: string);
97
+ /** The absolute path of the discovery file. */
98
+ get path(): string;
99
+ /**
100
+ * Read and validate the discovery file.
101
+ *
102
+ * Returns the parsed {@link DwnDiscoveryRecord} if:
103
+ * 1. The file exists and contains valid JSON.
104
+ * 2. The `endpoint` is a non-empty string.
105
+ * 3. The `pid` is a positive integer whose process is still alive.
106
+ *
107
+ * Returns `undefined` in all other cases (missing file, parse error,
108
+ * stale PID). Stale files are automatically removed.
109
+ */
110
+ read(): Promise<DwnDiscoveryRecord | undefined>;
111
+ /**
112
+ * Write the discovery file. Creates the `~/.enbox/` directory if needed.
113
+ *
114
+ * @param record - The endpoint and PID to persist.
115
+ */
116
+ write(record: DwnDiscoveryRecord): Promise<void>;
117
+ /**
118
+ * Remove the discovery file. Does not throw if the file is already gone.
119
+ */
120
+ remove(): Promise<void>;
121
+ }
122
+ //# sourceMappingURL=dwn-discovery-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dwn-discovery-file.d.ts","sourceRoot":"","sources":["../../src/dwn-discovery-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/C,qFAAqF;IACrF,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,4EAA4E;IAC5E,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,gEAAgE;IAChE,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,6DAA6D;IAC7D,OAAO,IAAI,MAAM,CAAC;CACnB;AAID;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,eAAe,GAAG,SAAS,CA2DvE;AAID;;;GAGG;AACH,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC,sCAAsC;AACtC,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAI7C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkB;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC;;;;OAIG;gBACS,EAAE,CAAC,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,MAAM;IAoBnD,+CAA+C;IAC/C,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;;;;;;;OAUG;IACU,IAAI,IAAI,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAsC5D;;;;OAIG;IACU,KAAK,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc7D;;OAEG;IACU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAGrC"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Shared types and utilities for the `dwn://register` discovery protocol.
3
+ *
4
+ * The payload is the JSON data exchanged between the local DWN server
5
+ * (electrobun-dwn) and the requesting app during the `dwn://register`
6
+ * redirect flow. It is encoded as base64url and placed in the URL
7
+ * fragment (`#`) of the callback URL.
8
+ *
9
+ * This module intentionally avoids external dependencies so it can be
10
+ * consumed from any environment (Bun, browser, Electrobun) without
11
+ * triggering transitive dependency resolution issues.
12
+ *
13
+ * @see https://github.com/enboxorg/enbox/issues/586
14
+ * @module
15
+ */
16
+ /**
17
+ * The JSON payload delivered via the URL fragment in a `dwn://register`
18
+ * callback redirect.
19
+ *
20
+ * Intentionally minimal — everything beyond the endpoint (version,
21
+ * WebSocket support, etc.) is obtained from `GET {endpoint}/info`.
22
+ */
23
+ export type DwnDiscoveryPayload = {
24
+ /** Base URL of the running DWN server (e.g. `"http://127.0.0.1:55557"`). */
25
+ endpoint: string;
26
+ };
27
+ /**
28
+ * Parsed result from a `dwn://register` URL.
29
+ */
30
+ export type DwnRegisterUrlParams = {
31
+ /** The callback URL to redirect to with the discovery payload. */
32
+ callback: string;
33
+ };
34
+ /** The URL scheme for DWN discovery protocol handlers. */
35
+ export declare const DWN_PROTOCOL_SCHEME = "dwn";
36
+ /** The `dwn://register` path that triggers the discovery handshake. */
37
+ export declare const DWN_REGISTER_PATH = "register";
38
+ /**
39
+ * Build a `dwn://register?callback=<url>` URL that, when opened by the OS,
40
+ * triggers electrobun-dwn (or another `dwn://` scheme handler) to redirect
41
+ * back to `callbackUrl` with the local DWN endpoint in the URL fragment.
42
+ *
43
+ * This is the **trigger** side of the `dwn://register` browser flow.
44
+ * The web app opens this URL (e.g. via `window.open()` or `location.href`),
45
+ * the OS routes it to the registered handler, and the handler redirects
46
+ * back with the discovery payload.
47
+ *
48
+ * @param callbackUrl - The URL to redirect back to after discovery.
49
+ * This should be the current page (or a dedicated callback page) that
50
+ * will read the payload from `window.location.hash`.
51
+ * @returns The `dwn://register?callback=<encoded-url>` URL string.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const registerUrl = buildDwnRegisterUrl('https://myapp.com/callback');
56
+ * // => 'dwn://register?callback=https%3A%2F%2Fmyapp.com%2Fcallback'
57
+ * window.open(registerUrl);
58
+ * ```
59
+ */
60
+ export declare function buildDwnRegisterUrl(callbackUrl: string): string;
61
+ /**
62
+ * Encode a {@link DwnDiscoveryPayload} as a base64url string suitable
63
+ * for use in a URL fragment.
64
+ *
65
+ * @param payload - The discovery payload to encode.
66
+ * @returns A base64url-encoded string (no padding).
67
+ */
68
+ export declare function encodeDwnDiscoveryPayload(payload: DwnDiscoveryPayload): string;
69
+ /**
70
+ * Decode a base64url-encoded string back into a {@link DwnDiscoveryPayload}.
71
+ *
72
+ * @param encoded - The base64url string from the URL fragment.
73
+ * @returns The parsed payload, or `undefined` if decoding or parsing fails.
74
+ */
75
+ export declare function decodeDwnDiscoveryPayload(encoded: string): DwnDiscoveryPayload | undefined;
76
+ /**
77
+ * Parse a `dwn://register?callback=<url>` URL into its components.
78
+ *
79
+ * @param url - The full `dwn://register?callback=...` URL.
80
+ * @returns The parsed parameters, or `undefined` if the URL is not a
81
+ * valid `dwn://register` URL or is missing the `callback` parameter.
82
+ */
83
+ export declare function parseDwnRegisterUrl(url: string): DwnRegisterUrlParams | undefined;
84
+ /**
85
+ * Build the full callback redirect URL with the discovery payload
86
+ * encoded in the URL fragment.
87
+ *
88
+ * @param callbackUrl - The callback URL from the `dwn://register` request.
89
+ * @param payload - The discovery payload to encode in the fragment.
90
+ * @returns The full redirect URL (e.g. `https://notes.sh/dwn#eyJ...`).
91
+ */
92
+ export declare function buildDwnDiscoveryRedirectUrl(callbackUrl: string, payload: DwnDiscoveryPayload): string;
93
+ /**
94
+ * Read a {@link DwnDiscoveryPayload} from a URL's fragment (hash).
95
+ *
96
+ * Intended for use in the browser callback page that receives the
97
+ * redirect from electrobun-dwn.
98
+ *
99
+ * @param url - The full URL including the `#` fragment, or just the
100
+ * fragment string (with or without the leading `#`).
101
+ * @returns The parsed payload, or `undefined` if the fragment is missing
102
+ * or contains an invalid payload.
103
+ */
104
+ export declare function readDwnDiscoveryPayloadFromUrl(url: string): DwnDiscoveryPayload | undefined;
105
+ //# sourceMappingURL=dwn-discovery-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dwn-discovery-payload.d.ts","sourceRoot":"","sources":["../../src/dwn-discovery-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,0DAA0D;AAC1D,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAEzC,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE/D;AAID;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAG9E;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAa1F;AAID;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAkCjF;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,mBAAmB,GAC3B,MAAM,CAKR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAa3F"}
@@ -1,6 +1,6 @@
1
1
  import type { DerivedPrivateJwk, EncryptionInput, EncryptionKeyDeriver, KeyDecrypter, RecordsWriteMessage } from '@enbox/dwn-sdk-js';
2
2
  import type { KeyIdentifier, PublicKeyJwk } from '@enbox/crypto';
3
- import type { Web5PlatformAgent } from './types/agent.js';
3
+ import type { EnboxPlatformAgent } from './types/agent.js';
4
4
  import type { DwnMessageReply, ProcessDwnRequest, SendDwnRequest } from './types/dwn.js';
5
5
  import { ContentEncryptionAlgorithm, KeyDerivationScheme } from '@enbox/dwn-sdk-js';
6
6
  import { DwnInterface } from './types/dwn.js';
@@ -37,7 +37,7 @@ export declare function encryptAndComputeCid(plaintextBytes: Uint8Array, dek: Ui
37
37
  * and publicKeyJwk. No private key material is returned.
38
38
  * @throws If the DID has no keyAgreement verification method or it's not X25519.
39
39
  */
40
- export declare function getEncryptionKeyInfo(agent: Web5PlatformAgent, didUri: string): Promise<{
40
+ export declare function getEncryptionKeyInfo(agent: EnboxPlatformAgent, didUri: string): Promise<{
41
41
  keyId: string;
42
42
  keyUri: KeyIdentifier;
43
43
  publicKeyJwk: PublicKeyJwk;
@@ -54,7 +54,7 @@ export declare function getEncryptionKeyInfo(agent: Web5PlatformAgent, didUri: s
54
54
  * @param dek - Data encryption key
55
55
  * @param iv - Initialization vector
56
56
  */
57
- export declare function deriveContextEncryptionInput(agent: Web5PlatformAgent, didUri: string, contextId: string, dek: Uint8Array, iv: Uint8Array): Promise<{
57
+ export declare function deriveContextEncryptionInput(agent: EnboxPlatformAgent, didUri: string, contextId: string, dek: Uint8Array, iv: Uint8Array): Promise<{
58
58
  encryptionInput: Omit<EncryptionInput, 'authenticationTag'>;
59
59
  keyId: string;
60
60
  keyUri: KeyIdentifier;
@@ -69,7 +69,7 @@ export declare function deriveContextEncryptionInput(agent: Web5PlatformAgent, d
69
69
  * @param keyUri - The KMS key URI
70
70
  * @param derivationScheme - The key derivation scheme
71
71
  */
72
- export declare function buildKmsDecryptCallback(agent: Web5PlatformAgent, keyId: string, keyUri: KeyIdentifier, derivationScheme: typeof KeyDerivationScheme.ProtocolPath | typeof KeyDerivationScheme.ProtocolContext): KeyDecrypter;
72
+ export declare function buildKmsDecryptCallback(agent: EnboxPlatformAgent, keyId: string, keyUri: KeyIdentifier, derivationScheme: typeof KeyDerivationScheme.ProtocolPath | typeof KeyDerivationScheme.ProtocolContext): KeyDecrypter;
73
73
  /**
74
74
  * Constructs an EncryptionKeyDeriver callback for the SDK.
75
75
  * The SDK calls derivePublicKey(path), the KMS performs HKDF + public key
@@ -81,7 +81,7 @@ export declare function buildKmsDecryptCallback(agent: Web5PlatformAgent, keyId:
81
81
  * @param didUri - The DID URI to create the key deriver for
82
82
  * @returns An EncryptionKeyDeriver callback object
83
83
  */
84
- export declare function getEncryptionKeyDeriver(agent: Web5PlatformAgent, didUri: string): Promise<EncryptionKeyDeriver>;
84
+ export declare function getEncryptionKeyDeriver(agent: EnboxPlatformAgent, didUri: string): Promise<EncryptionKeyDeriver>;
85
85
  /**
86
86
  * Constructs a ProtocolPath KeyDecrypter.
87
87
  *
@@ -89,7 +89,7 @@ export declare function getEncryptionKeyDeriver(agent: Web5PlatformAgent, didUri
89
89
  * @param didUri - The DID URI to create the key decrypter for
90
90
  * @returns A KeyDecrypter callback object
91
91
  */
92
- export declare function getKeyDecrypter(agent: Web5PlatformAgent, didUri: string): Promise<KeyDecrypter>;
92
+ export declare function getKeyDecrypter(agent: EnboxPlatformAgent, didUri: string): Promise<KeyDecrypter>;
93
93
  /**
94
94
  * Builds a KeyDecrypter from a context-derived private key.
95
95
  * Uses the raw key directly (since it was shared with us via the key-delivery protocol).
@@ -112,7 +112,7 @@ export declare function buildContextKeyDecrypter(contextKey: DerivedPrivateJwk):
112
112
  * @param contextDerivedKeyCache - Cache for context-derived private keys
113
113
  * @param fetchContextKeyRecordFn - Function to fetch context key records from key-delivery protocol
114
114
  */
115
- export declare function resolveKeyDecrypter(agent: Web5PlatformAgent, authorDid: string, recordsWrite: RecordsWriteMessage, targetDid: string | undefined, contextDerivedKeyCache: {
115
+ export declare function resolveKeyDecrypter(agent: EnboxPlatformAgent, authorDid: string, recordsWrite: RecordsWriteMessage, targetDid: string | undefined, contextDerivedKeyCache: {
116
116
  get(key: string): DerivedPrivateJwk | undefined;
117
117
  set(key: string, value: DerivedPrivateJwk): void;
118
118
  }, fetchContextKeyRecordFn: (params: {
@@ -132,7 +132,7 @@ export declare function resolveKeyDecrypter(agent: Web5PlatformAgent, authorDid:
132
132
  * @param contextDerivedKeyCache - Cache for context-derived private keys
133
133
  * @param fetchContextKeyRecordFn - Function to fetch context key records
134
134
  */
135
- export declare function maybeDecryptReply<T extends DwnInterface>(request: ProcessDwnRequest<T> | SendDwnRequest<T>, reply: DwnMessageReply[T], agent: Web5PlatformAgent, contextDerivedKeyCache: {
135
+ export declare function maybeDecryptReply<T extends DwnInterface>(request: ProcessDwnRequest<T> | SendDwnRequest<T>, reply: DwnMessageReply[T], agent: EnboxPlatformAgent, contextDerivedKeyCache: {
136
136
  get(key: string): DerivedPrivateJwk | undefined;
137
137
  set(key: string, value: DerivedPrivateJwk): void;
138
138
  }, fetchContextKeyRecordFn: (params: {
@@ -1 +1 @@
1
- {"version":3,"file":"dwn-encryption.d.ts","sourceRoot":"","sources":["../../src/dwn-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,YAAY,EAGZ,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAEL,0BAA0B,EAI1B,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,0BAA0B,GAAG,MAAM,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,UAAU,EACf,EAAE,EAAE,UAAU,EACd,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,YAAY,EACvB,gBAAgB,EAAE,OAAO,mBAAmB,CAAC,YAAY,GAAG,OAAO,mBAAmB,CAAC,eAAe,GACrG,IAAI,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAU5C;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,cAAc,EAAE,UAAU,EAC1B,GAAG,EAAE,UAAU,EACf,EAAE,EAAE,UAAU,EACd,SAAS,GAAE,0BAA+D,GACzE,OAAO,CAAC;IAAE,cAAc,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,UAAU,CAAA;CAAE,CAAC,CAQ3G;AAED;;;;;;;;;;GAUG;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EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,EAC7H,uBAAuB,EAAE,CAAC,MAAM,EAAE;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,KAAK,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,GAC3C,OAAO,CAAC,YAAY,CAAC,CAuEvB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,YAAY,EAC5D,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,EACjD,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,EACzB,KAAK,EAAE,kBAAkB,EACzB,sBAAsB,EAAE;IAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,EAC7H,uBAAuB,EAAE,CAAC,MAAM,EAAE;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,KAAK,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,GAC3C,OAAO,CAAC,IAAI,CAAC,CA6Df"}
@@ -1,6 +1,6 @@
1
1
  import type { PublicKeyJwk } from '@enbox/crypto';
2
2
  import type { DerivedPrivateJwk } from '@enbox/dwn-sdk-js';
3
- import type { Web5PlatformAgent } from './types/agent.js';
3
+ import type { EnboxPlatformAgent } from './types/agent.js';
4
4
  import type { DwnMessage, DwnMessageReply, ProcessDwnRequest } from './types/dwn.js';
5
5
  import { DwnInterface } from './types/dwn.js';
6
6
  /**
@@ -43,7 +43,7 @@ type ProcessRequestFn = <T extends DwnInterface>(request: ProcessDwnRequest<T>)
43
43
  * @param getProtocolDefinition - Function to get a protocol definition
44
44
  * @param installedCache - Cache for installation status
45
45
  */
46
- export declare function ensureKeyDeliveryProtocol(agent: Web5PlatformAgent, tenantDid: string, processRequest: ProcessRequestFn, getProtocolDefinition: (tenantDid: string, protocolUri: string) => Promise<any>, installedCache: {
46
+ export declare function ensureKeyDeliveryProtocol(agent: EnboxPlatformAgent, tenantDid: string, processRequest: ProcessRequestFn, getProtocolDefinition: (tenantDid: string, protocolUri: string) => Promise<any>, installedCache: {
47
47
  get(key: string): boolean | undefined;
48
48
  set(key: string, value: boolean): void;
49
49
  delete(key: string): void;
@@ -64,7 +64,7 @@ export declare function ensureKeyDeliveryProtocol(agent: Web5PlatformAgent, tena
64
64
  * @param eagerSend - Function to eagerly send the record to the remote DWN
65
65
  * @returns The recordId of the written contextKey record
66
66
  */
67
- export declare function writeContextKeyRecord(agent: Web5PlatformAgent, params: WriteContextKeyParams, processRequest: ProcessRequestFn, ensureProtocol: (tenantDid: string) => Promise<void>, eagerSend: (tenantDid: string, message: DwnMessage[DwnInterface.RecordsWrite]) => Promise<void>): Promise<string>;
67
+ export declare function writeContextKeyRecord(agent: EnboxPlatformAgent, params: WriteContextKeyParams, processRequest: ProcessRequestFn, ensureProtocol: (tenantDid: string) => Promise<void>, eagerSend: (tenantDid: string, message: DwnMessage[DwnInterface.RecordsWrite]) => Promise<void>): Promise<string>;
68
68
  /**
69
69
  * Eagerly sends a contextKey record to the tenant's remote DWN.
70
70
  * This is best-effort — sync guarantees eventual consistency regardless.
@@ -74,8 +74,9 @@ export declare function writeContextKeyRecord(agent: Web5PlatformAgent, params:
74
74
  * @param contextKeyMessage - The context key message to send
75
75
  * @param getDwnMessage - Function to read a full message from local DWN
76
76
  * @param sendDwnRpcRequest - Function to send a DWN RPC request
77
+ * @param getDwnEndpointUrlsForTarget - Function to resolve DWN endpoint URLs (with local discovery)
77
78
  */
78
- export declare function eagerSendContextKeyRecord(agent: Web5PlatformAgent, tenantDid: string, contextKeyMessage: DwnMessage[DwnInterface.RecordsWrite], getDwnMessage: (params: {
79
+ export declare function eagerSendContextKeyRecord(agent: EnboxPlatformAgent, tenantDid: string, contextKeyMessage: DwnMessage[DwnInterface.RecordsWrite], getDwnMessage: (params: {
79
80
  author: string;
80
81
  messageType: DwnInterface;
81
82
  messageCid: string;
@@ -87,7 +88,7 @@ export declare function eagerSendContextKeyRecord(agent: Web5PlatformAgent, tena
87
88
  dwnEndpointUrls: string[];
88
89
  message: any;
89
90
  data?: Blob;
90
- }) => Promise<any>): Promise<void>;
91
+ }) => Promise<any>, getDwnEndpointUrlsForTarget: (targetDid: string) => Promise<string[]>): Promise<void>;
91
92
  /**
92
93
  * Fetches and decrypts a `contextKey` record from a DWN, returning the
93
94
  * `DerivedPrivateJwk` payload.
@@ -100,13 +101,14 @@ export declare function eagerSendContextKeyRecord(agent: Web5PlatformAgent, tena
100
101
  * @param processRequest - The agent's processRequest method (bound)
101
102
  * @param getSigner - Function to get a signer for a DID
102
103
  * @param sendDwnRpcRequest - Function to send a DWN RPC request
104
+ * @param getDwnEndpointUrlsForTarget - Function to resolve DWN endpoint URLs (with local discovery)
103
105
  * @returns The decrypted `DerivedPrivateJwk`, or `undefined` if no matching record found
104
106
  */
105
- export declare function fetchContextKeyRecord(agent: Web5PlatformAgent, params: FetchContextKeyParams, processRequest: ProcessRequestFn, getSigner: (author: string) => Promise<any>, sendDwnRpcRequest: (params: {
107
+ export declare function fetchContextKeyRecord(agent: EnboxPlatformAgent, params: FetchContextKeyParams, processRequest: ProcessRequestFn, getSigner: (author: string) => Promise<any>, sendDwnRpcRequest: (params: {
106
108
  targetDid: string;
107
109
  dwnEndpointUrls: string[];
108
110
  message: any;
109
111
  data?: Blob;
110
- }) => Promise<any>): Promise<DerivedPrivateJwk | undefined>;
112
+ }) => Promise<any>, getDwnEndpointUrlsForTarget: (targetDid: string) => Promise<string[]>): Promise<DerivedPrivateJwk | undefined>;
111
113
  export {};
112
114
  //# sourceMappingURL=dwn-key-delivery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dwn-key-delivery.d.ts","sourceRoot":"","sources":["../../src/dwn-key-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAcxB,OAAO,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,iBAAiB,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,6BAA6B,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,YAAY,CAAA;KAAE,CAAC;CACnF,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,wEAAwE;AACxE,KAAK,gBAAgB,GAAG,CAAC,CAAC,SAAS,YAAY,EAC7C,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAC1B,OAAO,CAAC;IAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEzF;;;;;;;;;;G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