@enbox/agent 0.3.0 → 0.4.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 (57) hide show
  1. package/dist/browser.mjs +12 -30
  2. package/dist/browser.mjs.map +4 -4
  3. package/dist/esm/connect.js +22 -30
  4. package/dist/esm/connect.js.map +1 -1
  5. package/dist/esm/dwn-api.js +149 -22
  6. package/dist/esm/dwn-api.js.map +1 -1
  7. package/dist/esm/dwn-discovery-file.js +1 -1
  8. package/dist/esm/dwn-discovery-payload.js +20 -21
  9. package/dist/esm/dwn-discovery-payload.js.map +1 -1
  10. package/dist/esm/dwn-key-delivery.js.map +1 -1
  11. package/dist/esm/{oidc.js → enbox-connect-protocol.js} +236 -248
  12. package/dist/esm/enbox-connect-protocol.js.map +1 -0
  13. package/dist/esm/enbox-user-agent.js +18 -5
  14. package/dist/esm/enbox-user-agent.js.map +1 -1
  15. package/dist/esm/index.js +4 -2
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/local-dwn.js +21 -51
  18. package/dist/esm/local-dwn.js.map +1 -1
  19. package/dist/esm/permissions-api.js.map +1 -1
  20. package/dist/esm/store-data.js.map +1 -1
  21. package/dist/esm/sync-engine-level.js +1 -1
  22. package/dist/esm/sync-engine-level.js.map +1 -1
  23. package/dist/esm/sync-messages.js +1 -1
  24. package/dist/esm/sync-messages.js.map +1 -1
  25. package/dist/types/connect.d.ts +15 -19
  26. package/dist/types/connect.d.ts.map +1 -1
  27. package/dist/types/dwn-api.d.ts +46 -6
  28. package/dist/types/dwn-api.d.ts.map +1 -1
  29. package/dist/types/dwn-discovery-file.d.ts +1 -1
  30. package/dist/types/dwn-discovery-payload.d.ts +18 -19
  31. package/dist/types/dwn-discovery-payload.d.ts.map +1 -1
  32. package/dist/types/enbox-connect-protocol.d.ts +220 -0
  33. package/dist/types/enbox-connect-protocol.d.ts.map +1 -0
  34. package/dist/types/enbox-user-agent.d.ts +10 -1
  35. package/dist/types/enbox-user-agent.d.ts.map +1 -1
  36. package/dist/types/index.d.ts +1 -2
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/local-dwn.d.ts +16 -32
  39. package/dist/types/local-dwn.d.ts.map +1 -1
  40. package/package.json +9 -11
  41. package/src/connect.ts +40 -54
  42. package/src/dwn-api.ts +175 -29
  43. package/src/dwn-discovery-file.ts +1 -1
  44. package/src/dwn-discovery-payload.ts +23 -24
  45. package/src/dwn-key-delivery.ts +1 -1
  46. package/src/enbox-connect-protocol.ts +778 -0
  47. package/src/enbox-user-agent.ts +27 -4
  48. package/src/index.ts +4 -2
  49. package/src/local-dwn.ts +22 -53
  50. package/src/permissions-api.ts +3 -3
  51. package/src/store-data.ts +1 -1
  52. package/src/sync-engine-level.ts +1 -1
  53. package/src/sync-messages.ts +1 -1
  54. package/dist/esm/oidc.js.map +0 -1
  55. package/dist/types/oidc.d.ts +0 -250
  56. package/dist/types/oidc.d.ts.map +0 -1
  57. package/src/oidc.ts +0 -864
@@ -1,26 +1,26 @@
1
- import type { DwnPermissionScope, DwnProtocolDefinition, EnboxConnectAuthResponse } from './index.js';
1
+ import type { EnboxConnectResponse } from './enbox-connect-protocol.js';
2
+ import type { DwnPermissionScope, DwnProtocolDefinition } from './index.js';
2
3
  /**
3
4
  * Initiates the wallet connect process. Used when a client wants to obtain
4
5
  * a did from a provider.
5
6
  */
6
7
  declare function initClient({ displayName, connectServerUrl, walletUri, permissionRequests, onWalletUriReady, validatePin, }: WalletConnectOptions): Promise<{
7
- delegateGrants: EnboxConnectAuthResponse['delegateGrants'];
8
- delegatePortableDid: EnboxConnectAuthResponse['delegatePortableDid'];
8
+ delegateGrants: EnboxConnectResponse['delegateGrants'];
9
+ delegatePortableDid: EnboxConnectResponse['delegatePortableDid'];
9
10
  connectedDid: string;
10
11
  } | undefined>;
11
12
  /**
12
- * Initiates the wallet connect process. Used when a client wants to obtain
13
- * a did from a provider.
13
+ * Options for initiating a wallet connect flow (remote, relay-mediated).
14
14
  */
15
15
  export type WalletConnectOptions = {
16
- /** The user friendly name of the client/app to be displayed when prompting end-user with permission requests. */
16
+ /** The user-friendly name of the app, displayed in the wallet consent UI. */
17
17
  displayName: string;
18
- /** The URL of the intermediary server which relays messages between the client and provider. */
18
+ /** The URL of the connect server which relays messages between the app and wallet. */
19
19
  connectServerUrl: string;
20
20
  /**
21
- * The URI of the Provider (wallet).The `onWalletUriReady` will take this wallet
22
- * uri and add a payload to it which will be used to obtain and decrypt from the `request_uri`.
23
- * @example `web5://` or `http://localhost:3000/`.
21
+ * The URI of the wallet app. Query params (`request_uri`, `encryption_key`)
22
+ * are appended and passed to `onWalletUriReady`.
23
+ * @example `enbox://connect` or `http://localhost:3000/`
24
24
  */
25
25
  walletUri: string;
26
26
  /**
@@ -30,19 +30,15 @@ export type WalletConnectOptions = {
30
30
  */
31
31
  permissionRequests: ConnectPermissionRequest[];
32
32
  /**
33
- * The Connect API provides a URI to the wallet based on the `walletUri` plus a query params payload valid for 5 minutes.
34
- * The link can either be used as a deep link on the same device or a QR code for cross device or both.
35
- * The query params are `{ request_uri: string; encryption_key: string; }`
36
- * The wallet will use the `request_uri to contact the intermediary server's `authorize` endpoint
37
- * and pull down the {@link EnboxConnectAuthRequest} and use the `encryption_key` to decrypt it.
33
+ * Called with the wallet URI including query params (`request_uri`, `encryption_key`).
34
+ * The app should render this as a QR code or use it as a deep link.
38
35
  *
39
- * @param uri - The URI returned by the Connect API to be passed to a provider.
36
+ * @param uri - The wallet URI with connect payload.
40
37
  */
41
38
  onWalletUriReady: (uri: string) => void;
42
39
  /**
43
- * Function that must be provided to submit the pin entered by the user on the client.
44
- * The pin is used to decrypt the {@link EnboxConnectAuthResponse} that was retrieved from the
45
- * token endpoint by the client inside of Connect.
40
+ * Called to collect the PIN from the user. The PIN is used as AAD
41
+ * when decrypting the connect response from the relay.
46
42
  *
47
43
  * @returns A promise that resolves to the PIN as a string.
48
44
  */
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sour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C,0EAA0E;IAC1E,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;CACxC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,GAAG,WAAW,CAAC;AAE3F;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,+DAA+D;IAC/D,UAAU,EAAE,qBAAqB,CAAC;IAElC,uDAAuD;IACvD,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,iBAAS,kCAAkC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,yBAAyB,GAAG,wBAAwB,CAsE5H;AAED,eAAO,MAAM,aAAa;;;CAAqD,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { DerivedPrivateJwk, DwnConfig, EncryptionKeyDeriver, ProtocolDefinition } from '@enbox/dwn-sdk-js';
1
+ import type { DerivedPrivateJwk, DwnConfig, EncryptionKeyDeriver, GenericMessage, ProtocolDefinition } from '@enbox/dwn-sdk-js';
2
2
  import type { PublicKeyJwk } from '@enbox/crypto';
3
3
  import { Dwn } from '@enbox/dwn-sdk-js';
4
4
  import type { EnboxPlatformAgent } from './types/agent.js';
@@ -8,9 +8,14 @@ import { DwnInterface } from './types/dwn.js';
8
8
  export { isDwnMessage, isDwnRequest, isMessagesPermissionScope, isRecordPermissionScope, isRecordsType } from './dwn-type-guards.js';
9
9
  type DwnApiParams = {
10
10
  agent?: EnboxPlatformAgent;
11
- dwn: Dwn;
12
11
  localDwnStrategy?: LocalDwnStrategy;
13
- };
12
+ } & ({
13
+ dwn: Dwn;
14
+ localDwnEndpoint?: never;
15
+ } | {
16
+ dwn?: never;
17
+ localDwnEndpoint: string;
18
+ });
14
19
  interface DwnApiCreateDwnParams extends Partial<DwnConfig> {
15
20
  dataPath?: string;
16
21
  }
@@ -24,8 +29,16 @@ export declare class AgentDwnApi {
24
29
  private _agent?;
25
30
  /**
26
31
  * The DWN instance to use for this API.
32
+ * `undefined` in remote mode — all operations route through RPC to
33
+ * the local DWN server endpoint.
34
+ */
35
+ private _dwn?;
36
+ /**
37
+ * The local DWN server endpoint for remote mode.
38
+ * When set, `_dwn` is `undefined` and `processRequest()` routes
39
+ * through `sendDwnRpcRequest()`.
27
40
  */
28
- private _dwn;
41
+ private _localDwnEndpoint?;
29
42
  /**
30
43
  * Protocol definition cache — TTL 30 minutes. Protocols rarely change.
31
44
  * Keyed by `${tenantDid}~${protocolUri}`.
@@ -51,7 +64,12 @@ export declare class AgentDwnApi {
51
64
  private _localDwnStrategy;
52
65
  /** Lazy-initialized local DWN discovery instance. */
53
66
  private _localDwnDiscovery?;
54
- constructor({ agent, dwn, localDwnStrategy }: DwnApiParams);
67
+ constructor(params: DwnApiParams);
68
+ /**
69
+ * Whether the API is operating in remote mode (no in-process DWN).
70
+ * In remote mode, all DWN operations are routed through RPC.
71
+ */
72
+ get isRemoteMode(): boolean;
55
73
  /**
56
74
  * Retrieves the `EnboxPlatformAgent` execution context.
57
75
  *
@@ -63,7 +81,7 @@ export declare class AgentDwnApi {
63
81
  get localDwnStrategy(): LocalDwnStrategy;
64
82
  setLocalDwnStrategy(strategy: LocalDwnStrategy): void;
65
83
  /**
66
- * Inject a cached local DWN endpoint (e.g. from a `dwn://register`
84
+ * Inject a cached local DWN endpoint (e.g. from a `dwn://connect`
67
85
  * browser redirect or from persisted storage). The endpoint is validated
68
86
  * via `GET /info` before being accepted.
69
87
  *
@@ -110,6 +128,28 @@ export declare class AgentDwnApi {
110
128
  get node(): Dwn;
111
129
  static createDwn({ dataPath, dataStore, didResolver, stateIndex, eventLog, messageStore, tenantGate, resumableTaskStore }: DwnApiCreateDwnParams): Promise<Dwn>;
112
130
  processRequest<T extends DwnInterface>(request: ProcessDwnRequest<T>): Promise<DwnResponse<T>>;
131
+ /**
132
+ * Process a pre-constructed DWN message against the local DWN (in-process
133
+ * or remote server). Used by the sync engine to store messages that were
134
+ * already fetched from a remote DWN.
135
+ *
136
+ * Unlike {@link processRequest}, this method does NOT construct a new
137
+ * message — it takes an already-signed `GenericMessage` and routes it
138
+ * to the appropriate backend.
139
+ *
140
+ * @param tenant - The DID of the DWN tenant (target).
141
+ * @param message - The pre-constructed DWN message.
142
+ * @param options - Optional data stream and subscription handler.
143
+ * @returns The reply from processing the message.
144
+ */
145
+ processRawMessage(tenant: string, message: GenericMessage, options?: {
146
+ dataStream?: ReadableStream<Uint8Array>;
147
+ }): Promise<{
148
+ status: {
149
+ code: number;
150
+ detail: string;
151
+ };
152
+ }>;
113
153
  sendRequest<T extends DwnInterface>(request: SendDwnRequest<T>): Promise<DwnResponse<T>>;
114
154
  /**
115
155
  * Post-write key delivery: after a successful encrypted `RecordsWrite`,
@@ -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,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAMV,WAAW,EAGX,iBAAiB,EACjB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAKxB,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,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,GAAG,EAAE,GAAG,CAAC;IAC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AAM,EAAE;QACnC,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,GAAG,CAAC,MAAM,CAAC;IAIf;;;;;;;OAOG;YACW,qBAAqB;IAqBnC;;;OAGG;YACW,6BAA6B;IAU3C;;;;;;;;;;;OAWG;YACW,uBAAuB;IAarC;;;OAGG;YACW,iBAAiB;YAWjB,aAAa;IAuD3B;;;OAGG;IACH,OAAO,CAAC,kCAAkC,CAGvC;IAEH;;;;;OAKG;IACU,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxE;;;;;;OAMG;IACU,qBAAqB,CAAC,MAAM,EAAE;QACzC,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,iBAAiB,CAAC;QAClC,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;QACxB,6BAA6B,CAAC,EAAE;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,YAAY,CAAA;SAAE,CAAC;KACnF,GAAG,OAAO,CAAC,MAAM,CAAC;IASnB;;;OAGG;YACW,yBAAyB;IAYvC;;;;;;OAMG;IACU,qBAAqB,CAAC,MAAM,EAAE;QACzC,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;CAS3C"}
@@ -64,7 +64,7 @@ export declare const DISCOVERY_FILENAME = "dwn.json";
64
64
  * Reads, writes, and validates the `~/.enbox/dwn.json` discovery file.
65
65
  *
66
66
  * This is the **file-based discovery channel** for CLI and native apps.
67
- * It is complementary to the `dwn://register` browser redirect flow.
67
+ * It is complementary to the `dwn://connect` browser redirect flow.
68
68
  *
69
69
  * @example Reading the discovery file
70
70
  * ```ts
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Shared types and utilities for the `dwn://register` discovery protocol.
2
+ * Shared types and utilities for the `dwn://connect` discovery protocol.
3
3
  *
4
4
  * The payload is the JSON data exchanged between the local DWN server
5
- * (electrobun-dwn) and the requesting app during the `dwn://register`
5
+ * (electrobun-dwn) and the requesting app during the `dwn://connect`
6
6
  * redirect flow. It is encoded as base64url and placed in the URL
7
7
  * fragment (`#`) of the callback URL.
8
8
  *
@@ -10,11 +10,10 @@
10
10
  * consumed from any environment (Bun, browser, Electrobun) without
11
11
  * triggering transitive dependency resolution issues.
12
12
  *
13
- * @see https://github.com/enboxorg/enbox/issues/586
14
13
  * @module
15
14
  */
16
15
  /**
17
- * The JSON payload delivered via the URL fragment in a `dwn://register`
16
+ * The JSON payload delivered via the URL fragment in a `dwn://connect`
18
17
  * callback redirect.
19
18
  *
20
19
  * Intentionally minimal — everything beyond the endpoint (version,
@@ -25,22 +24,22 @@ export type DwnDiscoveryPayload = {
25
24
  endpoint: string;
26
25
  };
27
26
  /**
28
- * Parsed result from a `dwn://register` URL.
27
+ * Parsed result from a `dwn://connect` URL.
29
28
  */
30
- export type DwnRegisterUrlParams = {
29
+ export type DwnConnectUrlParams = {
31
30
  /** The callback URL to redirect to with the discovery payload. */
32
31
  callback: string;
33
32
  };
34
33
  /** The URL scheme for DWN discovery protocol handlers. */
35
34
  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";
35
+ /** The `dwn://connect` path that triggers the discovery handshake. */
36
+ export declare const DWN_CONNECT_PATH = "connect";
38
37
  /**
39
- * Build a `dwn://register?callback=<url>` URL that, when opened by the OS,
38
+ * Build a `dwn://connect?callback=<url>` URL that, when opened by the OS,
40
39
  * triggers electrobun-dwn (or another `dwn://` scheme handler) to redirect
41
40
  * back to `callbackUrl` with the local DWN endpoint in the URL fragment.
42
41
  *
43
- * This is the **trigger** side of the `dwn://register` browser flow.
42
+ * This is the **trigger** side of the `dwn://connect` browser flow.
44
43
  * The web app opens this URL (e.g. via `window.open()` or `location.href`),
45
44
  * the OS routes it to the registered handler, and the handler redirects
46
45
  * back with the discovery payload.
@@ -48,16 +47,16 @@ export declare const DWN_REGISTER_PATH = "register";
48
47
  * @param callbackUrl - The URL to redirect back to after discovery.
49
48
  * This should be the current page (or a dedicated callback page) that
50
49
  * will read the payload from `window.location.hash`.
51
- * @returns The `dwn://register?callback=<encoded-url>` URL string.
50
+ * @returns The `dwn://connect?callback=<encoded-url>` URL string.
52
51
  *
53
52
  * @example
54
53
  * ```ts
55
- * const registerUrl = buildDwnRegisterUrl('https://myapp.com/callback');
56
- * // => 'dwn://register?callback=https%3A%2F%2Fmyapp.com%2Fcallback'
54
+ * const registerUrl = buildDwnConnectUrl('https://myapp.com/callback');
55
+ * // => 'dwn://connect?callback=https%3A%2F%2Fmyapp.com%2Fcallback'
57
56
  * window.open(registerUrl);
58
57
  * ```
59
58
  */
60
- export declare function buildDwnRegisterUrl(callbackUrl: string): string;
59
+ export declare function buildDwnConnectUrl(callbackUrl: string): string;
61
60
  /**
62
61
  * Encode a {@link DwnDiscoveryPayload} as a base64url string suitable
63
62
  * for use in a URL fragment.
@@ -74,18 +73,18 @@ export declare function encodeDwnDiscoveryPayload(payload: DwnDiscoveryPayload):
74
73
  */
75
74
  export declare function decodeDwnDiscoveryPayload(encoded: string): DwnDiscoveryPayload | undefined;
76
75
  /**
77
- * Parse a `dwn://register?callback=<url>` URL into its components.
76
+ * Parse a `dwn://connect?callback=<url>` URL into its components.
78
77
  *
79
- * @param url - The full `dwn://register?callback=...` URL.
78
+ * @param url - The full `dwn://connect?callback=...` URL.
80
79
  * @returns The parsed parameters, or `undefined` if the URL is not a
81
- * valid `dwn://register` URL or is missing the `callback` parameter.
80
+ * valid `dwn://connect` URL or is missing the `callback` parameter.
82
81
  */
83
- export declare function parseDwnRegisterUrl(url: string): DwnRegisterUrlParams | undefined;
82
+ export declare function parseDwnConnectUrl(url: string): DwnConnectUrlParams | undefined;
84
83
  /**
85
84
  * Build the full callback redirect URL with the discovery payload
86
85
  * encoded in the URL fragment.
87
86
  *
88
- * @param callbackUrl - The callback URL from the `dwn://register` request.
87
+ * @param callbackUrl - The callback URL from the `dwn://connect` request.
89
88
  * @param payload - The discovery payload to encode in the fragment.
90
89
  * @returns The full redirect URL (e.g. `https://notes.sh/dwn#eyJ...`).
91
90
  */
@@ -1 +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,wB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 @@
1
+ /**
2
+ * Enbox Connect Protocol
3
+ *
4
+ * A capability delegation protocol for DWN access. Enables apps to request
5
+ * scoped permission grants from a wallet (provider), receiving a delegate DID
6
+ * with the granted permissions.
7
+ *
8
+ * Two transport modes:
9
+ * - Local (`dwn://connect`): same-device, direct HTTP against the local DWN
10
+ * - Remote (`enbox://connect`): cross-device, relay-mediated with QR/deep link
11
+ *
12
+ * The protocol uses JWTs for signing, JWE (XChaCha20-Poly1305) for encryption,
13
+ * and ECDH (Ed25519 → X25519 + HKDF) for key agreement.
14
+ */
15
+ import type { ConnectPermissionRequest } from './connect.js';
16
+ import type { EnboxAgent } from './types/agent.js';
17
+ import type { RequireOnly } from '@enbox/common';
18
+ import type { DidDocument, PortableDid } from '@enbox/dids';
19
+ import type { DwnDataEncodedRecordsWriteMessage, DwnPermissionScope } from './types/dwn.js';
20
+ import { type BearerDid } from '@enbox/dids';
21
+ /**
22
+ * Pushed to the connect server so the wallet can retrieve it later.
23
+ * The request is encrypted (JWE) before being pushed.
24
+ *
25
+ * Inspired by RFC 9126 (Pushed Authorization Requests).
26
+ */
27
+ export type ConnectPushedRequest = {
28
+ /** The encrypted JWE containing the signed {@link EnboxConnectRequest} JWT. */
29
+ request: string;
30
+ };
31
+ /**
32
+ * Returned by the connect server after a {@link ConnectPushedRequest}.
33
+ * Contains a URI the wallet uses to fetch the encrypted request,
34
+ * and the TTL before it expires.
35
+ */
36
+ export type ConnectPushedResponse = {
37
+ /** URI where the wallet can fetch the encrypted auth request. */
38
+ request_uri: string;
39
+ /** Seconds until the request expires. */
40
+ expires_in: number;
41
+ };
42
+ /**
43
+ * A connect request from an app to a wallet, asking for DWN permissions.
44
+ *
45
+ * The app creates this, signs it as a JWT, encrypts it as a JWE, and pushes
46
+ * it to the connect server. The wallet retrieves, decrypts, verifies, and
47
+ * displays it in a consent UI.
48
+ */
49
+ export type EnboxConnectRequest = {
50
+ /** Ephemeral DID (did:jwk) used for ECDH key agreement and request signing. */
51
+ clientDid: string;
52
+ /** Human-readable name of the requesting application, shown in the consent UI. */
53
+ appName: string;
54
+ /** DWN protocols and permission scopes being requested. */
55
+ permissionRequests: ConnectPermissionRequest[];
56
+ /** Anti-replay nonce (random base64url). */
57
+ nonce: string;
58
+ /** State correlator for matching request to response (random base64url). */
59
+ state: string;
60
+ /** URL where the wallet should POST the encrypted response. */
61
+ callbackUrl: string;
62
+ /** Response mode — always `direct_post` (wallet POSTs response to callbackUrl). */
63
+ responseMode: 'direct_post';
64
+ /** Supported DID methods for the connected identity. */
65
+ supportedDidMethods: string[];
66
+ };
67
+ /**
68
+ * A connect response from a wallet, granting DWN permissions.
69
+ *
70
+ * The wallet creates this after user consent, signs it as a JWT with the
71
+ * delegate DID, encrypts it via ECDH, and POSTs it to the connect server.
72
+ * The app retrieves, decrypts (using ECDH + optional PIN), and verifies it.
73
+ */
74
+ export type EnboxConnectResponse = {
75
+ /** The wallet owner's real DID that authorised the delegation. */
76
+ providerDid: string;
77
+ /** The newly created delegate DID identifier. */
78
+ delegateDid: string;
79
+ /** Audience — must match the `clientDid` from the request. */
80
+ aud: string;
81
+ /** Issued-at timestamp (Unix seconds). */
82
+ iat: number;
83
+ /** Expiration timestamp (Unix seconds). */
84
+ exp: number;
85
+ /** Echo of the request nonce. */
86
+ nonce?: string;
87
+ /** DWN permission grant messages (serialised RecordsWrite with encoded data). */
88
+ delegateGrants: DwnDataEncodedRecordsWriteMessage[];
89
+ /** The delegate DID's full portable form, including private keys. */
90
+ delegatePortableDid: PortableDid;
91
+ };
92
+ /** The connect server endpoint types. */
93
+ export type ConnectEndpoint = 'pushedAuthorizationRequest' | 'authorize' | 'callback' | 'token';
94
+ /** @deprecated Use {@link EnboxConnectRequest} instead. */
95
+ export type EnboxConnectAuthRequest = EnboxConnectRequest;
96
+ /** @deprecated Use {@link EnboxConnectResponse} instead. */
97
+ export type EnboxConnectAuthResponse = EnboxConnectResponse;
98
+ /** @deprecated Use {@link ConnectPushedRequest} instead. */
99
+ export type PushedAuthRequest = ConnectPushedRequest;
100
+ /** @deprecated Use {@link ConnectPushedResponse} instead. */
101
+ export type PushedAuthResponse = ConnectPushedResponse;
102
+ /**
103
+ * Builds the URL for a connect server endpoint.
104
+ *
105
+ * @param options.baseURL - The connect server base URL (e.g. `http://localhost:3000/connect/`)
106
+ * @param options.endpoint - The endpoint type
107
+ * @param options.authParam - Required for `authorize` endpoint (the request ID)
108
+ * @param options.tokenParam - Required for `token` endpoint (the state value)
109
+ */
110
+ declare function buildConnectUrl({ baseURL, endpoint, authParam, tokenParam, }: {
111
+ baseURL: string;
112
+ endpoint: ConnectEndpoint;
113
+ authParam?: string;
114
+ tokenParam?: string;
115
+ }): string;
116
+ /** Signs an object as a JWT using an Ed25519 DID key. */
117
+ declare function signJwt({ did, data, }: {
118
+ did: BearerDid;
119
+ data: Record<string, unknown>;
120
+ }): Promise<string>;
121
+ /** Verifies a JWT signature using the DID in the `kid` header. Returns the parsed payload. */
122
+ declare function verifyJwt({ jwt }: {
123
+ jwt: string;
124
+ }): Promise<Record<string, unknown>>;
125
+ /** Encrypts the connect request JWT with a symmetric key (shared via QR code or deep link). */
126
+ declare function encryptRequest({ jwt, encryptionKey, }: {
127
+ jwt: string;
128
+ encryptionKey: Uint8Array;
129
+ }): Promise<string>;
130
+ /** Decrypts an encrypted connect request JWE using the symmetric key from the QR/deep link. */
131
+ declare function decryptRequest({ jwe, encryptionKey, }: {
132
+ jwe: string;
133
+ encryptionKey: string;
134
+ }): Promise<string>;
135
+ /** Derives a shared ECDH key for encrypting/decrypting the connect response. */
136
+ declare function deriveSharedKey(privateKeyDid: BearerDid, publicKeyDid: DidDocument): Promise<Uint8Array>;
137
+ /**
138
+ * Encrypts the connect response JWT.
139
+ *
140
+ * For remote (relay-mediated) flows, `pin` is required — it is added to the
141
+ * AAD to prevent MITM attacks via the untrusted relay.
142
+ *
143
+ * For local (same-device) flows, `pin` may be omitted — the ECDH encryption
144
+ * alone is sufficient when there is no untrusted intermediary.
145
+ */
146
+ declare function encryptResponse({ jwt, encryptionKey, delegateDidKeyId, pin, }: {
147
+ jwt: string;
148
+ encryptionKey: Uint8Array;
149
+ delegateDidKeyId: string;
150
+ pin?: string;
151
+ }): Promise<string>;
152
+ /**
153
+ * Decrypts the connect response JWE using ECDH + optional PIN.
154
+ *
155
+ * @param clientDid - The ephemeral DID used at connect initiation (for ECDH).
156
+ * @param jwe - The encrypted response JWE.
157
+ * @param pin - The PIN entered by the user (required for remote flows, omit for local).
158
+ */
159
+ declare function decryptResponse(clientDid: BearerDid, jwe: string, pin?: string): Promise<string>;
160
+ /** Creates an {@link EnboxConnectRequest}. */
161
+ declare function createConnectRequest(options: RequireOnly<EnboxConnectRequest, 'clientDid' | 'callbackUrl' | 'permissionRequests' | 'appName'>): Promise<EnboxConnectRequest>;
162
+ /**
163
+ * Fetches an encrypted connect request from the authorize endpoint
164
+ * and decrypts it using the encryption key from the QR/deep link.
165
+ */
166
+ declare function getConnectRequest(requestUri: string, encryptionKey: string): Promise<EnboxConnectRequest>;
167
+ /** Creates an {@link EnboxConnectResponse} with timestamps. */
168
+ declare function createConnectResponse(options: RequireOnly<EnboxConnectResponse, 'providerDid' | 'delegateDid' | 'aud' | 'delegateGrants' | 'delegatePortableDid'>): Promise<EnboxConnectResponse>;
169
+ /**
170
+ * Creates permission grants that assign the requested scopes to a delegate DID.
171
+ */
172
+ declare function createPermissionGrants(selectedDid: string, delegateBearerDid: BearerDid, agent: EnboxAgent, scopes: DwnPermissionScope[]): Promise<DwnDataEncodedRecordsWriteMessage[]>;
173
+ /**
174
+ * Executes the full wallet-side (provider) flow:
175
+ * 1. Creates a delegate DID
176
+ * 2. Installs requested protocols
177
+ * 3. Creates permission grants
178
+ * 4. Builds, signs, and encrypts the response
179
+ * 5. POSTs the encrypted response to the callback URL
180
+ *
181
+ * @param selectedDid - The provider's DID that is granting access.
182
+ * @param connectRequest - The decoded connect request from the app.
183
+ * @param pin - The PIN for response encryption AAD (required for remote flows).
184
+ * @param agent - The agent instance for DWN operations.
185
+ */
186
+ declare function submitConnectResponse(selectedDid: string, connectRequest: EnboxConnectRequest, pin: string | undefined, agent: EnboxAgent): Promise<void>;
187
+ export declare const EnboxConnectProtocol: {
188
+ buildConnectUrl: typeof buildConnectUrl;
189
+ signJwt: typeof signJwt;
190
+ verifyJwt: typeof verifyJwt;
191
+ encryptRequest: typeof encryptRequest;
192
+ decryptRequest: typeof decryptRequest;
193
+ encryptResponse: typeof encryptResponse;
194
+ decryptResponse: typeof decryptResponse;
195
+ deriveSharedKey: typeof deriveSharedKey;
196
+ createConnectRequest: typeof createConnectRequest;
197
+ getConnectRequest: typeof getConnectRequest;
198
+ createConnectResponse: typeof createConnectResponse;
199
+ createPermissionGrants: typeof createPermissionGrants;
200
+ submitConnectResponse: typeof submitConnectResponse;
201
+ };
202
+ /** @deprecated Use {@link EnboxConnectProtocol} instead. */
203
+ export declare const Oidc: {
204
+ createAuthRequest: typeof createConnectRequest;
205
+ encryptAuthRequest: typeof encryptRequest;
206
+ getAuthRequest: typeof getConnectRequest;
207
+ decryptAuthRequest: typeof decryptRequest;
208
+ createPermissionGrants: typeof createPermissionGrants;
209
+ createResponseObject: typeof createConnectResponse;
210
+ encryptAuthResponse: typeof encryptResponse;
211
+ decryptAuthResponse: typeof decryptResponse;
212
+ deriveSharedKey: typeof deriveSharedKey;
213
+ signJwt: typeof signJwt;
214
+ verifyJwt: typeof verifyJwt;
215
+ buildOidcUrl: typeof buildConnectUrl;
216
+ generateCodeChallenge: never;
217
+ submitAuthResponse: typeof submitConnectResponse;
218
+ };
219
+ export {};
220
+ //# sourceMappingURL=enbox-connect-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enbox-connect-protocol.d.ts","sourceRoot":"","sources":["../../src/enbox-connect-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE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AAG,aAAa,GAAG,KAAK,GAAG,gBAAgB,GAAG,qBAAqB,CACjF,GACA,OAAO,CAAC,oBAAoB,CAAC,CAQ/B;AAeD;;GAEG;AACH,iBAAe,sBAAsB,CACnC,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,SAAS,EAC5B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,kBAAkB,EAAE,GAC3B,OAAO,CAAC,iCAAiC,EAAE,CAAC,CA4C9C;AAiED;;;;;;;;;;;;GAYG;AACH,iBAAe,qBAAqB,CAClC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,mBAAmB,EACnC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,IAAI,CAAC,CAyEf;AAMD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;CAchC,CAAC;AAMF,4DAA4D;AAC5D,eAAO,MAAM,IAAI;;;;;;;;;;;;;2BAasB,KAAK;;CAE3C,CAAC"}
@@ -75,6 +75,15 @@ export type AgentParams<TKeyManager extends AgentKeyManager = LocalKeyManager> =
75
75
  };
76
76
  export type CreateUserAgentParams = Partial<AgentParams> & {
77
77
  localDwnStrategy?: LocalDwnStrategy;
78
+ /**
79
+ * When set, the agent operates in "remote mode": no in-process DWN is
80
+ * created. All `processRequest()` calls are routed through RPC to
81
+ * this endpoint instead.
82
+ *
83
+ * Typically set by `AuthManager.create()` after standalone discovery
84
+ * determines that a local DWN server is running.
85
+ */
86
+ localDwnEndpoint?: string;
78
87
  };
79
88
  export declare class EnboxUserAgent<TKeyManager extends AgentKeyManager = LocalKeyManager> implements EnboxPlatformAgent<TKeyManager> {
80
89
  crypto: AgentCryptoApi;
@@ -93,7 +102,7 @@ export declare class EnboxUserAgent<TKeyManager extends AgentKeyManager = LocalK
93
102
  /**
94
103
  * If any of the required agent components are not provided, instantiate default implementations.
95
104
  */
96
- static create({ dataPath, localDwnStrategy, agentDid, agentVault, cryptoApi, didApi, dwnApi, identityApi, keyManager, permissionsApi, rpcClient, syncApi }?: CreateUserAgentParams): Promise<EnboxUserAgent>;
105
+ static create({ dataPath, localDwnStrategy, localDwnEndpoint, agentDid, agentVault, cryptoApi, didApi, dwnApi, identityApi, keyManager, permissionsApi, rpcClient, syncApi }?: CreateUserAgentParams): Promise<EnboxUserAgent>;
97
106
  firstLaunch(): Promise<boolean>;
98
107
  /**
99
108
  * Initializes the User Agent with a password, and optionally a recovery phrase.
@@ -1 +1 @@
1
- {"version":3,"file":"enbox-user-agent.d.ts","sourceRoot":"","sources":["../../src/enbox-user-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AA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OrG,iBAAiB,CAAC,CAAC,SAAS,YAAY,EAC5C,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAIb,iBAAiB,CAAC,CAAC,SAAS,YAAY,EACnD,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC5B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAIb,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAIjE,cAAc,CAAC,CAAC,SAAS,YAAY,EAChD,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAIb,cAAc,CAAC,CAAC,SAAS,YAAY,EAChD,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAIb,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;IAI3D,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CASvE;AAMD,2FAA2F;AAC3F,eAAO,MAAM,aAAa,uBAAiB,CAAC;AAE5C,2FAA2F;AAC3F,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC"}
@@ -16,7 +16,6 @@ export * from './dwn-discovery-file.js';
16
16
  export * from './dwn-discovery-payload.js';
17
17
  export * from './dwn-encryption.js';
18
18
  export * from './dwn-key-delivery.js';
19
- export * from './dwn-record-upgrade.js';
20
19
  export * from './dwn-type-guards.js';
21
20
  export * from './protocol-utils.js';
22
21
  export * from './hd-identity-vault.js';
@@ -33,6 +32,6 @@ export * from './sync-engine-level.js';
33
32
  export * from './test-harness.js';
34
33
  export * from './utils.js';
35
34
  export * from './connect.js';
36
- export * from './oidc.js';
35
+ export * from './enbox-connect-protocol.js';
37
36
  export * from './enbox-user-agent.js';
38
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,kBAAkB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,eAAe,CAAC;AAEnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,kBAAkB,CAAC;AACtC,cAAc,gBAAgB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