@enbox/agent 0.2.2 → 0.3.1
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.
- package/dist/browser.mjs +9 -9
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/agent-did-resolver-cache.js.map +1 -1
- package/dist/esm/anonymous-dwn-api.js +1 -1
- package/dist/esm/bearer-identity.js +1 -1
- package/dist/esm/connect.js +5 -9
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/did-api.js +3 -3
- package/dist/esm/did-api.js.map +1 -1
- package/dist/esm/dwn-api.js +39 -8
- package/dist/esm/dwn-api.js.map +1 -1
- package/dist/esm/dwn-discovery-file.js +244 -0
- package/dist/esm/dwn-discovery-file.js.map +1 -0
- package/dist/esm/dwn-discovery-payload.js +253 -0
- package/dist/esm/dwn-discovery-payload.js.map +1 -0
- package/dist/esm/dwn-encryption.js.map +1 -1
- package/dist/esm/dwn-key-delivery.js.map +1 -1
- package/dist/esm/dwn-record-upgrade.js.map +1 -1
- package/dist/esm/{web5-user-agent.js → enbox-user-agent.js} +12 -7
- package/dist/esm/enbox-user-agent.js.map +1 -0
- package/dist/esm/identity-api.js +3 -3
- package/dist/esm/identity-api.js.map +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/local-dwn.js +150 -26
- package/dist/esm/local-dwn.js.map +1 -1
- package/dist/esm/local-key-manager.js +2 -2
- package/dist/esm/local-key-manager.js.map +1 -1
- package/dist/esm/oidc.js +11 -11
- package/dist/esm/oidc.js.map +1 -1
- package/dist/esm/permissions-api.js.map +1 -1
- package/dist/esm/store-data.js.map +1 -1
- package/dist/esm/sync-api.js +2 -2
- package/dist/esm/sync-api.js.map +1 -1
- package/dist/esm/sync-engine-level.js +2 -2
- package/dist/esm/sync-engine-level.js.map +1 -1
- package/dist/esm/test-harness.js +3 -3
- package/dist/esm/test-harness.js.map +1 -1
- package/dist/esm/utils-internal.js +2 -2
- package/dist/types/agent-did-resolver-cache.d.ts +7 -7
- package/dist/types/agent-did-resolver-cache.d.ts.map +1 -1
- package/dist/types/anonymous-dwn-api.d.ts +3 -3
- package/dist/types/anonymous-dwn-api.d.ts.map +1 -1
- package/dist/types/bearer-identity.d.ts +1 -1
- package/dist/types/connect.d.ts +8 -8
- package/dist/types/connect.d.ts.map +1 -1
- package/dist/types/did-api.d.ts +12 -11
- package/dist/types/did-api.d.ts.map +1 -1
- package/dist/types/dwn-api.d.ts +27 -11
- package/dist/types/dwn-api.d.ts.map +1 -1
- package/dist/types/dwn-discovery-file.d.ts +122 -0
- package/dist/types/dwn-discovery-file.d.ts.map +1 -0
- package/dist/types/dwn-discovery-payload.d.ts +105 -0
- package/dist/types/dwn-discovery-payload.d.ts.map +1 -0
- package/dist/types/dwn-encryption.d.ts +8 -8
- package/dist/types/dwn-encryption.d.ts.map +1 -1
- package/dist/types/dwn-key-delivery.d.ts +5 -5
- package/dist/types/dwn-key-delivery.d.ts.map +1 -1
- package/dist/types/dwn-record-upgrade.d.ts +2 -2
- package/dist/types/dwn-record-upgrade.d.ts.map +1 -1
- package/dist/types/{web5-user-agent.d.ts → enbox-user-agent.d.ts} +17 -13
- package/dist/types/enbox-user-agent.d.ts.map +1 -0
- package/dist/types/identity-api.d.ts +10 -10
- package/dist/types/identity-api.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/local-dwn.d.ts +93 -15
- package/dist/types/local-dwn.d.ts.map +1 -1
- package/dist/types/local-key-manager.d.ts +9 -9
- package/dist/types/local-key-manager.d.ts.map +1 -1
- package/dist/types/oidc.d.ts +23 -19
- package/dist/types/oidc.d.ts.map +1 -1
- package/dist/types/permissions-api.d.ts +4 -4
- package/dist/types/permissions-api.d.ts.map +1 -1
- package/dist/types/store-data.d.ts +3 -3
- package/dist/types/store-data.d.ts.map +1 -1
- package/dist/types/store-did.d.ts +2 -2
- package/dist/types/store-did.d.ts.map +1 -1
- package/dist/types/store-identity.d.ts +2 -2
- package/dist/types/store-identity.d.ts.map +1 -1
- package/dist/types/store-key.d.ts +2 -2
- package/dist/types/store-key.d.ts.map +1 -1
- package/dist/types/sync-api.d.ts +9 -9
- package/dist/types/sync-api.d.ts.map +1 -1
- package/dist/types/sync-engine-level.d.ts +9 -9
- package/dist/types/sync-engine-level.d.ts.map +1 -1
- package/dist/types/sync-messages.d.ts +5 -5
- package/dist/types/sync-messages.d.ts.map +1 -1
- package/dist/types/test-harness.d.ts +4 -4
- package/dist/types/test-harness.d.ts.map +1 -1
- package/dist/types/types/agent.d.ts +24 -19
- package/dist/types/types/agent.d.ts.map +1 -1
- package/dist/types/types/identity.d.ts +1 -1
- package/dist/types/types/key-manager.d.ts +2 -2
- package/dist/types/types/key-manager.d.ts.map +1 -1
- package/dist/types/types/sync.d.ts +2 -2
- package/dist/types/types/sync.d.ts.map +1 -1
- package/dist/types/utils-internal.d.ts +4 -4
- package/dist/types/utils-internal.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/agent-did-resolver-cache.ts +8 -8
- package/src/anonymous-dwn-api.ts +4 -4
- package/src/bearer-identity.ts +1 -1
- package/src/connect.ts +14 -19
- package/src/did-api.ts +13 -11
- package/src/dwn-api.ts +61 -16
- package/src/dwn-discovery-file.ts +305 -0
- package/src/dwn-discovery-payload.ts +308 -0
- package/src/dwn-encryption.ts +8 -8
- package/src/dwn-key-delivery.ts +5 -5
- package/src/dwn-record-upgrade.ts +2 -2
- package/src/{web5-user-agent.ts → enbox-user-agent.ts} +26 -16
- package/src/identity-api.ts +11 -11
- package/src/index.ts +3 -1
- package/src/local-dwn.ts +154 -28
- package/src/local-key-manager.ts +10 -10
- package/src/oidc.ts +40 -30
- package/src/permissions-api.ts +5 -5
- package/src/store-data.ts +7 -7
- package/src/store-did.ts +2 -2
- package/src/store-identity.ts +2 -2
- package/src/store-key.ts +2 -2
- package/src/sync-api.ts +10 -10
- package/src/sync-engine-level.ts +12 -12
- package/src/sync-messages.ts +5 -5
- package/src/test-harness.ts +9 -9
- package/src/types/agent.ts +31 -20
- package/src/types/identity.ts +1 -1
- package/src/types/key-manager.ts +2 -2
- package/src/types/sync.ts +2 -2
- package/src/utils-internal.ts +4 -4
- package/dist/esm/web5-user-agent.js.map +0 -1
- package/dist/types/web5-user-agent.d.ts.map +0 -1
|
@@ -2,11 +2,11 @@ import type { RequireOnly } from '@enbox/common';
|
|
|
2
2
|
import type { AgentDataStore } from './store-data.js';
|
|
3
3
|
import type { AgentKeyManager } from './types/key-manager.js';
|
|
4
4
|
import type { DidMethodCreateOptions } from './did-api.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
6
6
|
import type { IdentityMetadata, PortableIdentity } from './types/identity.js';
|
|
7
7
|
import { BearerIdentity } from './bearer-identity.js';
|
|
8
8
|
export interface IdentityApiParams<TKeyManager extends AgentKeyManager> {
|
|
9
|
-
agent?:
|
|
9
|
+
agent?: EnboxPlatformAgent<TKeyManager>;
|
|
10
10
|
store?: AgentDataStore<IdentityMetadata>;
|
|
11
11
|
}
|
|
12
12
|
export interface IdentityCreateParams<TKeyManager = AgentKeyManager, TMethod extends keyof DidMethodCreateOptions<TKeyManager> = keyof DidMethodCreateOptions<TKeyManager>> {
|
|
@@ -17,7 +17,7 @@ export interface IdentityCreateParams<TKeyManager = AgentKeyManager, TMethod ext
|
|
|
17
17
|
}
|
|
18
18
|
export declare function isPortableIdentity(obj: unknown): obj is PortableIdentity;
|
|
19
19
|
/**
|
|
20
|
-
* This API is used to manage and interact with Identities within the
|
|
20
|
+
* This API is used to manage and interact with Identities within the Enbox Agent framework.
|
|
21
21
|
* An Identity is a DID that is associated with metadata that describes the Identity.
|
|
22
22
|
* Metadata includes A name(label), and whether or not the Identity is connected (delegated to act on the behalf of another DID).
|
|
23
23
|
*
|
|
@@ -28,22 +28,22 @@ export declare function isPortableIdentity(obj: unknown): obj is PortableIdentit
|
|
|
28
28
|
*/
|
|
29
29
|
export declare class AgentIdentityApi<TKeyManager extends AgentKeyManager = AgentKeyManager> {
|
|
30
30
|
/**
|
|
31
|
-
* Holds the instance of a `
|
|
32
|
-
* the `AgentIdentityApi`. This agent is used to interact with other
|
|
31
|
+
* Holds the instance of a `EnboxPlatformAgent` that represents the current execution context for
|
|
32
|
+
* the `AgentIdentityApi`. This agent is used to interact with other Enbox agent components. It's
|
|
33
33
|
* vital to ensure this instance is set to correctly contextualize operations within the broader
|
|
34
|
-
*
|
|
34
|
+
* Enbox Agent framework.
|
|
35
35
|
*/
|
|
36
36
|
private _agent?;
|
|
37
37
|
private _store;
|
|
38
38
|
constructor({ agent, store }?: IdentityApiParams<TKeyManager>);
|
|
39
39
|
/**
|
|
40
|
-
* Retrieves the `
|
|
40
|
+
* Retrieves the `EnboxPlatformAgent` execution context.
|
|
41
41
|
*
|
|
42
|
-
* @returns The `
|
|
42
|
+
* @returns The `EnboxPlatformAgent` instance that represents the current execution context.
|
|
43
43
|
* @throws Will throw an error if the `agent` instance property is undefined.
|
|
44
44
|
*/
|
|
45
|
-
get agent():
|
|
46
|
-
set agent(agent:
|
|
45
|
+
get agent(): EnboxPlatformAgent<TKeyManager>;
|
|
46
|
+
set agent(agent: EnboxPlatformAgent<TKeyManager>);
|
|
47
47
|
get tenant(): string;
|
|
48
48
|
create({ metadata, didMethod, didOptions, store }: IdentityCreateParams<TKeyManager>): Promise<BearerIdentity>;
|
|
49
49
|
export({ didUri }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-api.d.ts","sourceRoot":"","sources":["../../src/identity-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3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AE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC3G;;;;;;;OAOG;IACU,eAAe,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB/F;;;;;OAKG;IACU,iBAAiB,CAAC,EAAE,YAAY,EAAE,GAAC;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;CAYrH"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export * from './bearer-identity.js';
|
|
|
12
12
|
export * from './crypto-api.js';
|
|
13
13
|
export * from './did-api.js';
|
|
14
14
|
export * from './dwn-api.js';
|
|
15
|
+
export * from './dwn-discovery-file.js';
|
|
16
|
+
export * from './dwn-discovery-payload.js';
|
|
15
17
|
export * from './dwn-encryption.js';
|
|
16
18
|
export * from './dwn-key-delivery.js';
|
|
17
19
|
export * from './dwn-record-upgrade.js';
|
|
@@ -32,5 +34,5 @@ export * from './test-harness.js';
|
|
|
32
34
|
export * from './utils.js';
|
|
33
35
|
export * from './connect.js';
|
|
34
36
|
export * from './oidc.js';
|
|
35
|
-
export * from './
|
|
37
|
+
export * from './enbox-user-agent.js';
|
|
36
38
|
//# 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,C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,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,43 +1,121 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Local DWN discovery —
|
|
3
|
-
*
|
|
2
|
+
* Local DWN discovery — discovers a running `@enbox/dwn-server` instance
|
|
3
|
+
* so the agent can route traffic to it.
|
|
4
4
|
*
|
|
5
|
+
* Discovery channels (tried in order):
|
|
6
|
+
* 1. **In-memory cache** — serves a recent positive or negative result.
|
|
7
|
+
* 2. **Discovery file** (`~/.enbox/dwn.json`) — written by `electrobun-dwn`
|
|
8
|
+
* on startup. Fast filesystem read, no network. Available for CLI and
|
|
9
|
+
* native apps; skipped in browsers.
|
|
10
|
+
* 3. **Port probing** (fallback) — sequential HTTP `GET /info` on well-known
|
|
11
|
+
* localhost ports. Works everywhere but is slower.
|
|
12
|
+
*
|
|
13
|
+
* @see https://github.com/enboxorg/enbox/issues/585
|
|
5
14
|
* @module
|
|
6
15
|
*/
|
|
7
|
-
import type {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
import type { EnboxRpc } from '@enbox/dwn-clients';
|
|
17
|
+
import type { DwnDiscoveryFile } from './dwn-discovery-file.js';
|
|
18
|
+
/**
|
|
19
|
+
* Well-known ports the local DWN desktop app may bind to.
|
|
20
|
+
*
|
|
21
|
+
* Per the DWN Transport Spec, clients probe ports `55500` through `55509`
|
|
22
|
+
* (inclusive). Port `3000` is included as a development convenience.
|
|
23
|
+
*
|
|
24
|
+
* @see https://identity.foundation/dwn-transport/#port-probing
|
|
25
|
+
*/
|
|
26
|
+
export declare const localDwnPortCandidates: readonly [3000, 55500, 55501, 55502, 55503, 55504, 55505, 55506, 55507, 55508, 55509];
|
|
27
|
+
/**
|
|
28
|
+
* Hosts probed when discovering a local DWN server.
|
|
29
|
+
*
|
|
30
|
+
* Per the DWN Transport Spec, clients MUST use `127.0.0.1` rather than
|
|
31
|
+
* `localhost` to avoid DNS resolution ambiguity.
|
|
32
|
+
*
|
|
33
|
+
* @see https://identity.foundation/dwn-transport/#port-probing
|
|
34
|
+
*/
|
|
35
|
+
export declare const localDwnHostCandidates: readonly ["127.0.0.1"];
|
|
12
36
|
/**
|
|
13
37
|
* Controls how the agent discovers and routes to a local DWN server.
|
|
14
38
|
*
|
|
39
|
+
* - `'off'` — (default) skip local discovery entirely.
|
|
15
40
|
* - `'prefer'` — probe localhost first; fall back to DID-document endpoints.
|
|
16
41
|
* - `'only'` — require a local server; throw if none is found.
|
|
17
|
-
* - `'off'` — skip local discovery entirely.
|
|
18
42
|
*/
|
|
19
43
|
export type LocalDwnStrategy = 'prefer' | 'only' | 'off';
|
|
20
44
|
/** The `server` field returned by `GET /info` on `@enbox/dwn-server`. */
|
|
21
45
|
export declare const localDwnServerName = "@enbox/dwn-server";
|
|
46
|
+
/** Strips a trailing slash from a URL so endpoint comparisons are consistent. */
|
|
47
|
+
export declare function normalizeBaseUrl(url: string): string;
|
|
22
48
|
/**
|
|
23
|
-
*
|
|
49
|
+
* Discovers a running local DWN server.
|
|
24
50
|
*
|
|
25
51
|
* Results are cached for {@link _cacheTtlMs} milliseconds (default 10 s) to
|
|
26
|
-
* avoid repeated
|
|
52
|
+
* avoid repeated I/O on hot paths such as sync.
|
|
53
|
+
*
|
|
54
|
+
* @example Discovery with file-based channel
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { DwnDiscoveryFile } from './dwn-discovery-file.js';
|
|
57
|
+
*
|
|
58
|
+
* const discoveryFile = new DwnDiscoveryFile();
|
|
59
|
+
* const discovery = new LocalDwnDiscovery(rpcClient, 10_000, discoveryFile);
|
|
60
|
+
* const endpoint = await discovery.getEndpoint();
|
|
61
|
+
* ```
|
|
27
62
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
63
|
+
* @example Browser: inject cached endpoint from `dwn://register` redirect
|
|
64
|
+
* ```ts
|
|
65
|
+
* const discovery = new LocalDwnDiscovery(rpcClient);
|
|
66
|
+
* discovery.setCachedEndpoint('http://127.0.0.1:55557');
|
|
67
|
+
* ```
|
|
30
68
|
*/
|
|
31
69
|
export declare class LocalDwnDiscovery {
|
|
32
70
|
private _rpcClient;
|
|
33
71
|
private _cacheTtlMs;
|
|
72
|
+
private _discoveryFile?;
|
|
34
73
|
private _cachedEndpoint?;
|
|
35
74
|
private _cacheExpiry;
|
|
36
|
-
constructor(_rpcClient:
|
|
75
|
+
constructor(_rpcClient: EnboxRpc, _cacheTtlMs?: number, _discoveryFile?: DwnDiscoveryFile | undefined);
|
|
37
76
|
/**
|
|
38
|
-
* Returns the base URL of a local DWN server, or `undefined` if none
|
|
39
|
-
*
|
|
77
|
+
* Returns the base URL of a local DWN server, or `undefined` if none
|
|
78
|
+
* is discoverable.
|
|
79
|
+
*
|
|
80
|
+
* The discovery order is:
|
|
81
|
+
* 1. In-memory cache (if not expired).
|
|
82
|
+
* 2. `~/.enbox/dwn.json` discovery file (if a {@link DwnDiscoveryFile}
|
|
83
|
+
* was provided). The endpoint from the file is validated via
|
|
84
|
+
* `GET /info` to ensure the server is still running.
|
|
85
|
+
* 3. Sequential port probing on well-known localhost ports (fallback).
|
|
40
86
|
*/
|
|
41
87
|
getEndpoint(): Promise<string | undefined>;
|
|
88
|
+
/**
|
|
89
|
+
* Inject a cached endpoint (e.g. from a `dwn://register` browser redirect
|
|
90
|
+
* or from `localStorage`). The endpoint is validated via `GET /info` before
|
|
91
|
+
* caching.
|
|
92
|
+
*
|
|
93
|
+
* @returns `true` if the endpoint was validated and cached, `false` otherwise.
|
|
94
|
+
*/
|
|
95
|
+
setCachedEndpoint(endpoint: string): Promise<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* Clear the in-memory cache, forcing the next {@link getEndpoint} call
|
|
98
|
+
* to perform a fresh discovery.
|
|
99
|
+
*/
|
|
100
|
+
clearCache(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Try the `~/.enbox/dwn.json` discovery file. Returns the endpoint if
|
|
103
|
+
* the file exists, is valid, and the endpoint passes `GET /info`
|
|
104
|
+
* validation. Returns `undefined` otherwise.
|
|
105
|
+
*/
|
|
106
|
+
private _tryDiscoveryFile;
|
|
107
|
+
/**
|
|
108
|
+
* Sequential HTTP probe on well-known localhost port candidates.
|
|
109
|
+
* Returns the first endpoint whose `GET /info` response identifies
|
|
110
|
+
* as `@enbox/dwn-server`, or `undefined` if none is found.
|
|
111
|
+
*/
|
|
112
|
+
private _probePortCandidates;
|
|
113
|
+
/**
|
|
114
|
+
* Call `GET /info` on the endpoint and check that
|
|
115
|
+
* `serverInfo.server === '@enbox/dwn-server'`.
|
|
116
|
+
*/
|
|
117
|
+
private _validateEndpoint;
|
|
118
|
+
/** Update the in-memory cache entry. */
|
|
119
|
+
private _setCacheEntry;
|
|
42
120
|
}
|
|
43
121
|
//# sourceMappingURL=local-dwn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-dwn.d.ts","sourceRoot":"","sources":["../../src/local-dwn.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"local-dwn.d.ts","sourceRoot":"","sources":["../../src/local-dwn.ts"],"names":[],"mappings":"AA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ams, KmsGetKeyUriParams, KmsGetPublicKeyParams, KmsImportKeyParams, KmsSignParams, KmsUriUnwrapKeyParams, KmsUriWrapKeyParams, KmsVerifyParams, PublicKeyJwk } from '@enbox/crypto';
|
|
2
2
|
import type { AgentDataStore } from './store-data.js';
|
|
3
3
|
import type { AgentKeyManager } from './types/key-manager.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
5
5
|
type SupportedKeyGeneratorAlgorithm = 'Ed25519' | 'secp256k1' | 'ES256K' | 'secp256r1' | 'ES256' | 'X25519' | 'A128GCM' | 'A192GCM' | 'A256GCM' | 'A128KW' | 'A192KW' | 'A256KW';
|
|
6
6
|
/**
|
|
7
7
|
* The `LocalKmsParams` interface specifies the parameters for initializing an instance of
|
|
@@ -11,7 +11,7 @@ type SupportedKeyGeneratorAlgorithm = 'Ed25519' | 'secp256k1' | 'ES256K' | 'secp
|
|
|
11
11
|
* the application exits.
|
|
12
12
|
*/
|
|
13
13
|
export type LocalKmsParams = {
|
|
14
|
-
agent?:
|
|
14
|
+
agent?: EnboxPlatformAgent;
|
|
15
15
|
/**
|
|
16
16
|
* An optional property to specify a custom {@link AgentDataStore} instance for key management. If
|
|
17
17
|
* not provided, {@link LocalKeyManager} uses a default {@link InMemoryKeyStore} instance. This
|
|
@@ -50,10 +50,10 @@ export interface LocalKmsUnwrapKeyParams extends KmsUriUnwrapKeyParams {
|
|
|
50
50
|
}
|
|
51
51
|
export declare class LocalKeyManager implements AgentKeyManager {
|
|
52
52
|
/**
|
|
53
|
-
* Holds the instance of a `
|
|
54
|
-
* the `LocalKeyManager`. This agent is used to interact with other
|
|
53
|
+
* Holds the instance of a `EnboxPlatformAgent` that represents the current execution context for
|
|
54
|
+
* the `LocalKeyManager`. This agent is used to interact with other Enbox agent components. It's
|
|
55
55
|
* vital to ensure this instance is set to correctly contextualize operations within the broader
|
|
56
|
-
*
|
|
56
|
+
* Enbox Agent framework.
|
|
57
57
|
*/
|
|
58
58
|
private _agent?;
|
|
59
59
|
/**
|
|
@@ -74,13 +74,13 @@ export declare class LocalKeyManager implements AgentKeyManager {
|
|
|
74
74
|
private _keyStore;
|
|
75
75
|
constructor({ agent, keyStore }?: LocalKmsParams);
|
|
76
76
|
/**
|
|
77
|
-
* Retrieves the `
|
|
77
|
+
* Retrieves the `EnboxPlatformAgent` execution context.
|
|
78
78
|
*
|
|
79
|
-
* @returns The `
|
|
79
|
+
* @returns The `EnboxPlatformAgent` instance that represents the current execution context.
|
|
80
80
|
* @throws Will throw an error if the `agent` instance property is undefined.
|
|
81
81
|
*/
|
|
82
|
-
get agent():
|
|
83
|
-
set agent(agent:
|
|
82
|
+
get agent(): EnboxPlatformAgent;
|
|
83
|
+
set agent(agent: EnboxPlatformAgent);
|
|
84
84
|
decrypt({ keyUri, ...params }: KmsCipherParams & AesGcmParams): Promise<Uint8Array>;
|
|
85
85
|
digest(_params: KmsDigestParams): Promise<Uint8Array>;
|
|
86
86
|
encrypt({ keyUri, ...params }: KmsCipherParams & AesGcmParams): Promise<Uint8Array>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-key-manager.d.ts","sourceRoot":"","sources":["../../src/local-key-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAMZ,GAAG,EAEH,aAAa,EAEb,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,YAAY,EAKG,MAAM,eAAe,CAAC;AAqBvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"local-key-manager.d.ts","sourceRoot":"","sources":["../../src/local-key-manager.ts"],"names":[],"mappings":"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.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConnectPermissionRequest } from './connect.js';
|
|
2
|
+
import type { EnboxAgent } from './types/agent.js';
|
|
2
3
|
import type { RequireOnly } from '@enbox/common';
|
|
3
|
-
import type { Web5Agent } from './types/agent.js';
|
|
4
4
|
import type { DidDocument, PortableDid } from '@enbox/dids';
|
|
5
5
|
import type { DwnDataEncodedRecordsWriteMessage, DwnPermissionScope } from './types/dwn.js';
|
|
6
6
|
import { type BearerDid } from '@enbox/dids';
|
|
@@ -13,7 +13,7 @@ import { type BearerDid } from '@enbox/dids';
|
|
|
13
13
|
* @see {@link https://www.rfc-editor.org/rfc/rfc9126.html | OAuth 2.0 Pushed Authorization Requests}
|
|
14
14
|
*/
|
|
15
15
|
export type PushedAuthRequest = {
|
|
16
|
-
/** The JWT which contains the {@link
|
|
16
|
+
/** The JWT which contains the {@link EnboxConnectAuthRequest} */
|
|
17
17
|
request: string;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
@@ -96,7 +96,7 @@ export type SIOPv2AuthRequest = {
|
|
|
96
96
|
* An auth request that is compatible with both Web5 Connect and (hopefully, WIP) OIDC SIOPv2
|
|
97
97
|
* The contents of this are inserted into a JWT inside of the {@link PushedAuthRequest}.
|
|
98
98
|
*/
|
|
99
|
-
export type
|
|
99
|
+
export type EnboxConnectAuthRequest = {
|
|
100
100
|
/** The user friendly name of the client/app to be displayed when prompting end-user with permission requests. */
|
|
101
101
|
displayName: string;
|
|
102
102
|
/** PermissionGrants that are to be sent to the provider */
|
|
@@ -127,15 +127,15 @@ export type SIOPv2AuthResponse = {
|
|
|
127
127
|
[key: string]: any;
|
|
128
128
|
};
|
|
129
129
|
/** An auth response that is compatible with both Web5 Connect and (hopefully, WIP) OIDC SIOPv2 */
|
|
130
|
-
export type
|
|
130
|
+
export type EnboxConnectAuthResponse = {
|
|
131
131
|
delegateGrants: DwnDataEncodedRecordsWriteMessage[];
|
|
132
132
|
delegatePortableDid: PortableDid;
|
|
133
133
|
} & SIOPv2AuthResponse;
|
|
134
134
|
/** Represents the different OIDC endpoint types.
|
|
135
135
|
* 1. `pushedAuthorizationRequest`: client sends {@link PushedAuthRequest} receives {@link PushedAuthResponse}
|
|
136
|
-
* 2. `authorize`: provider gets the {@link
|
|
137
|
-
* 3. `callback`: provider sends {@link
|
|
138
|
-
* 4. `token`: client gets {@link
|
|
136
|
+
* 2. `authorize`: provider gets the {@link EnboxConnectAuthRequest} JWT that was stored by the PAR
|
|
137
|
+
* 3. `callback`: provider sends {@link EnboxConnectAuthResponse} to this endpoint
|
|
138
|
+
* 4. `token`: client gets {@link EnboxConnectAuthResponse} from this endpoint
|
|
139
139
|
*/
|
|
140
140
|
type OidcEndpoint = 'pushedAuthorizationRequest' | 'authorize' | 'callback' | 'token';
|
|
141
141
|
/**
|
|
@@ -164,15 +164,15 @@ declare function generateCodeChallenge(): Promise<{
|
|
|
164
164
|
codeChallengeBytes: Uint8Array;
|
|
165
165
|
codeChallengeBase64Url: string;
|
|
166
166
|
}>;
|
|
167
|
-
/** Client creates the {@link
|
|
168
|
-
declare function createAuthRequest(options: RequireOnly<
|
|
167
|
+
/** Client creates the {@link EnboxConnectAuthRequest} */
|
|
168
|
+
declare function createAuthRequest(options: RequireOnly<EnboxConnectAuthRequest, 'client_id' | 'scope' | 'redirect_uri' | 'permissionRequests' | 'displayName'>): Promise<EnboxConnectAuthRequest>;
|
|
169
169
|
/** Encrypts the auth request with the key which will be passed through QR code */
|
|
170
170
|
declare function encryptAuthRequest({ jwt, encryptionKey, }: {
|
|
171
171
|
jwt: string;
|
|
172
172
|
encryptionKey: Uint8Array;
|
|
173
173
|
}): Promise<string>;
|
|
174
174
|
/** Create a response object compatible with Web5 Connect and OIDC SIOPv2 */
|
|
175
|
-
declare function createResponseObject(options: RequireOnly<
|
|
175
|
+
declare function createResponseObject(options: RequireOnly<EnboxConnectAuthResponse, 'iss' | 'sub' | 'aud' | 'delegateGrants' | 'delegatePortableDid'>): Promise<EnboxConnectAuthResponse>;
|
|
176
176
|
/** sign an object and transform it into a jwt using a did */
|
|
177
177
|
declare function signJwt({ did, data, }: {
|
|
178
178
|
did: BearerDid;
|
|
@@ -189,7 +189,7 @@ declare function decryptAuthRequest({ jwe, encryption_key, }: {
|
|
|
189
189
|
}): Promise<string>;
|
|
190
190
|
/**
|
|
191
191
|
* The client uses to decrypt the jwe obtained from the auth server which contains
|
|
192
|
-
* the {@link
|
|
192
|
+
* the {@link EnboxConnectAuthResponse} that was sent by the provider to the auth server.
|
|
193
193
|
*
|
|
194
194
|
* @async
|
|
195
195
|
* @param {BearerDid} clientDid - The did that was initially used by the client for ECDH at connect init.
|
|
@@ -197,7 +197,7 @@ declare function decryptAuthRequest({ jwe, encryption_key, }: {
|
|
|
197
197
|
* @param {string} pin - The pin that was obtained from the user.
|
|
198
198
|
*/
|
|
199
199
|
declare function decryptAuthResponse(clientDid: BearerDid, jwe: string, pin: string): Promise<string>;
|
|
200
|
-
/** Derives a shared ECDH private key in order to encrypt the {@link
|
|
200
|
+
/** Derives a shared ECDH private key in order to encrypt the {@link EnboxConnectAuthResponse} */
|
|
201
201
|
declare function deriveSharedKey(privateKeyDid: BearerDid, publicKeyDid: DidDocument): Promise<Uint8Array>;
|
|
202
202
|
/**
|
|
203
203
|
* Encrypts the auth response jwt. Requires a randomPin is added to the AAD of the
|
|
@@ -213,23 +213,23 @@ declare function encryptAuthResponse({ jwt, encryptionKey, delegateDidKeyId, ran
|
|
|
213
213
|
}): Promise<string>;
|
|
214
214
|
/**
|
|
215
215
|
* Creates the permission grants that assign to the selectedDid the level of
|
|
216
|
-
* permissions that the web app requested in the {@link
|
|
216
|
+
* permissions that the web app requested in the {@link EnboxConnectAuthRequest}
|
|
217
217
|
*/
|
|
218
|
-
declare function createPermissionGrants(selectedDid: string, delegateBearerDid: BearerDid, agent:
|
|
218
|
+
declare function createPermissionGrants(selectedDid: string, delegateBearerDid: BearerDid, agent: EnboxAgent, scopes: DwnPermissionScope[]): Promise<DwnDataEncodedRecordsWriteMessage[]>;
|
|
219
219
|
/**
|
|
220
220
|
* Creates a delegate did which the web app will use as its future indentity.
|
|
221
221
|
* Assigns to that DID the level of permissions that the web app requested in
|
|
222
|
-
* the {@link
|
|
222
|
+
* the {@link EnboxConnectAuthRequest}. Encrypts via ECDH key that the web app
|
|
223
223
|
* will have access to because the web app has the public key which it provided
|
|
224
|
-
* in the {@link
|
|
225
|
-
* {@link
|
|
224
|
+
* in the {@link EnboxConnectAuthRequest}. Then sends the ciphertext of this
|
|
225
|
+
* {@link EnboxConnectAuthResponse} to the callback endpoint. Which the
|
|
226
226
|
* web app will need to retrieve from the token endpoint and decrypt with the pin to access.
|
|
227
227
|
*/
|
|
228
|
-
declare function submitAuthResponse(selectedDid: string, authRequest:
|
|
228
|
+
declare function submitAuthResponse(selectedDid: string, authRequest: EnboxConnectAuthRequest, randomPin: string, agent: EnboxAgent): Promise<void>;
|
|
229
229
|
export declare const Oidc: {
|
|
230
230
|
createAuthRequest: typeof createAuthRequest;
|
|
231
231
|
encryptAuthRequest: typeof encryptAuthRequest;
|
|
232
|
-
getAuthRequest: (request_uri: string, encryption_key: string) => Promise<
|
|
232
|
+
getAuthRequest: (request_uri: string, encryption_key: string) => Promise<EnboxConnectAuthRequest>;
|
|
233
233
|
decryptAuthRequest: typeof decryptAuthRequest;
|
|
234
234
|
createPermissionGrants: typeof createPermissionGrants;
|
|
235
235
|
createResponseObject: typeof createResponseObject;
|
|
@@ -242,5 +242,9 @@ export declare const Oidc: {
|
|
|
242
242
|
generateCodeChallenge: typeof generateCodeChallenge;
|
|
243
243
|
submitAuthResponse: typeof submitAuthResponse;
|
|
244
244
|
};
|
|
245
|
+
/** @deprecated Use {@link EnboxConnectAuthRequest} instead. */
|
|
246
|
+
export type Web5ConnectAuthRequest = EnboxConnectAuthRequest;
|
|
247
|
+
/** @deprecated Use {@link EnboxConnectAuthResponse} instead. */
|
|
248
|
+
export type Web5ConnectAuthResponse = EnboxConnectAuthResponse;
|
|
245
249
|
export {};
|
|
246
250
|
//# sourceMappingURL=oidc.d.ts.map
|
package/dist/types/oidc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidc.d.ts","sourceRoot":"","sources":["../../src/oidc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"oidc.d.ts","sourceRoot":"","sources":["../../src/oidc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,iCAAiC,EAAE,kBAAkB,EAAyB,MAAM,gBAAgB,CAAC;AAKnH,OAAO,EAAE,KAAK,SAAS,EAAU,MAAM,aAAa,CAAC;AAkBrD;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAElB,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IAEd,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAC;IAEtB,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IAErB,uHAAuH;IACvH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;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AS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BlB;AAgBD;;;GAGG;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,CAqD9C;AAiED;;;;;;;;GAQG;AACH,iBAAe,kBAAkB,CAC/B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,uBAAuB,EACpC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,IAAI,CAAC,CA+Ef;AAED,eAAO,MAAM,IAAI;;;kCA3a0B,MAAM,kBAAkB,MAAM,KAAG,OAAO,CAAC,uBAAuB,CAAC;;;;;;;;;;;;CA0b3G,CAAC;AAMF,+DAA+D;AAC/D,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAE7D,gEAAgE;AAChE,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EnboxAgent } from './types/agent.js';
|
|
2
2
|
import type { CreateGrantParams, CreateRequestParams, CreateRevocationParams, FetchPermissionRequestParams, FetchPermissionsParams, GetPermissionParams, IsGrantRevokedParams, PermissionGrantEntry, PermissionRequestEntry, PermissionRevocationEntry, PermissionsApi } from './types/permissions.js';
|
|
3
3
|
import { DwnInterface } from './types/dwn.js';
|
|
4
4
|
export declare class AgentPermissionsApi implements PermissionsApi {
|
|
5
5
|
/** cache for fetching a permission {@link PermissionGrant}, keyed by a specific MessageType and protocol */
|
|
6
6
|
private _cachedPermissions;
|
|
7
7
|
private _agent?;
|
|
8
|
-
get agent():
|
|
9
|
-
set agent(agent:
|
|
8
|
+
get agent(): EnboxAgent;
|
|
9
|
+
set agent(agent: EnboxAgent);
|
|
10
10
|
constructor({ agent }?: {
|
|
11
|
-
agent?:
|
|
11
|
+
agent?: EnboxAgent;
|
|
12
12
|
});
|
|
13
13
|
getPermissionForRequest({ connectedDid, delegateDid, delegate, messageType, protocol, cached }: GetPermissionParams): Promise<PermissionGrantEntry>;
|
|
14
14
|
fetchGrants({ author, target, grantee, grantor, protocol, remote, checkRevoked, }: FetchPermissionsParams): Promise<PermissionGrantEntry[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions-api.d.ts","sourceRoot":"","sources":["../../src/permissions-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"permissions-api.d.ts","sourceRoot":"","sources":["../../src/permissions-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOvS,OAAO,EAAE,YAAY,EAA4C,MAAM,gBAAgB,CAAC;AAExF,qBAAa,mBAAoB,YAAW,cAAc;IAExD,4GAA4G;IAC5G,OAAO,CAAC,kBAAkB,CAA4E;IAEtG,OAAO,CAAC,MAAM,CAAC,CAAa;IAE5B,IAAI,KAAK,IAAI,UAAU,CAKtB;IAED,IAAI,KAAK,CAAC,KAAK,EAAC,UAAU,EAEzB;gBAEW,EAAE,KAAK,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,UAAU,CAAA;KAAO;IAI5C,uBAAuB,CAAC,EAC5B,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,MAAc,EACf,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAiChD,WAAW,CAAC,EAChB,MAAM,EACN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|
+
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
4
4
|
import type { ProtocolDefinition } from '@enbox/dwn-sdk-js';
|
|
5
5
|
export type DataStoreTenantParams = {
|
|
6
|
-
agent:
|
|
6
|
+
agent: EnboxPlatformAgent;
|
|
7
7
|
tenant?: string;
|
|
8
8
|
};
|
|
9
9
|
export type DataStoreListParams = DataStoreTenantParams;
|
|
@@ -91,7 +91,7 @@ export declare class DwnDataStore<TStoreObject extends Record<string, any> = Jwk
|
|
|
91
91
|
*/
|
|
92
92
|
protected isEncryptionActive(tenantDid: string): boolean;
|
|
93
93
|
protected getAllRecords(_params: {
|
|
94
|
-
agent:
|
|
94
|
+
agent: EnboxPlatformAgent;
|
|
95
95
|
tenantDid: string;
|
|
96
96
|
}): Promise<TStoreObject[]>;
|
|
97
97
|
private getRecord;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-data.d.ts","sourceRoot":"","sources":["../../src/store-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAmB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"store-data.d.ts","sourceRoot":"","sources":["../../src/store-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAmB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAyB,MAAM,mBAAmB,CAAC;AAOnF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,MAAM,MAAM,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SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAE,YAAW,cAAc,CAAC,YAAY,CAAC;IACpH,SAAS,CAAC,IAAI,SAAuB;IAErC;;OAEG;IACH,OAAO,CAAC,KAAK,CAAwC;IAExC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IActE,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAOjF,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAcrE,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAuBlI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PortableDid } from '@enbox/dids';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
3
3
|
import type { AgentDataStore, DataStoreDeleteParams, DataStoreGetParams, DataStoreListParams, DataStoreSetParams } from './store-data.js';
|
|
4
4
|
import { DwnDataStore, InMemoryDataStore } from './store-data.js';
|
|
5
5
|
export declare class DwnDidStore extends DwnDataStore<PortableDid> implements AgentDataStore<PortableDid> {
|
|
@@ -19,7 +19,7 @@ export declare class DwnDidStore extends DwnDataStore<PortableDid> implements Ag
|
|
|
19
19
|
list(params: DataStoreListParams): Promise<PortableDid[]>;
|
|
20
20
|
set(params: DataStoreSetParams<PortableDid>): Promise<void>;
|
|
21
21
|
protected getAllRecords({ agent, tenantDid }: {
|
|
22
|
-
agent:
|
|
22
|
+
agent: EnboxPlatformAgent;
|
|
23
23
|
tenantDid: string;
|
|
24
24
|
}): Promise<PortableDid[]>;
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-did.d.ts","sourceRoot":"","sources":["../../src/store-did.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"store-did.d.ts","sourceRoot":"","sources":["../../src/store-did.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAK1I,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAElE,qBAAa,WAAY,SAAQ,YAAY,CAAC,WAAW,CAAE,YAAW,cAAc,CAAC,WAAW,CAAC;IAC/F,SAAS,CAAC,IAAI,SAAiB;IAE/B,SAAS,CAAC,yBAAyB,iDAA8B;IAEjE;;OAEG;IACH,SAAS,CAAC,iBAAiB;;;;;MAKzB;IAEW,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvD,GAAG,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAIjE,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAIzD,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;cAIxD,aAAa,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;QAClD,KAAK,EAAE,kBAAkB,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAqC3B;AAED,qBAAa,gBAAiB,SAAQ,iBAAiB,CAAC,WAAW,CAAE,YAAW,cAAc,CAAC,WAAW,CAAC;IACzG,SAAS,CAAC,IAAI,SAAsB;IAEvB,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvD,GAAG,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAIjE,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAIzD,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGzE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
1
2
|
import type { IdentityMetadata } from './types/identity.js';
|
|
2
|
-
import type { Web5PlatformAgent } from './types/agent.js';
|
|
3
3
|
import type { AgentDataStore, DataStoreDeleteParams, DataStoreGetParams, DataStoreListParams, DataStoreSetParams } from './store-data.js';
|
|
4
4
|
import { DwnDataStore, InMemoryDataStore } from './store-data.js';
|
|
5
5
|
export declare function isIdentityMetadata(obj: unknown): obj is IdentityMetadata;
|
|
@@ -20,7 +20,7 @@ export declare class DwnIdentityStore extends DwnDataStore<IdentityMetadata> imp
|
|
|
20
20
|
set(params: DataStoreSetParams<IdentityMetadata>): Promise<void>;
|
|
21
21
|
list(params: DataStoreListParams): Promise<IdentityMetadata[]>;
|
|
22
22
|
protected getAllRecords({ agent, tenantDid }: {
|
|
23
|
-
agent:
|
|
23
|
+
agent: EnboxPlatformAgent;
|
|
24
24
|
tenantDid: string;
|
|
25
25
|
}): Promise<IdentityMetadata[]>;
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-identity.d.ts","sourceRoot":"","sources":["../../src/store-identity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"store-identity.d.ts","sourceRoot":"","sources":["../../src/store-identity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAK1I,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAElE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,gBAAgB,CAIxE;AAED,qBAAa,gBAAiB,SAAQ,YAAY,CAAC,gBAAgB,CAAE,YAAW,cAAc,CAAC,gBAAgB,CAAC;IAC9G,SAAS,CAAC,IAAI,SAAsB;IAEpC,SAAS,CAAC,yBAAyB,iDAA8B;IAEjE;;OAEG;IACH,SAAS,CAAC,iBAAiB;;;;;MAKzB;IAEW,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvD,GAAG,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAItE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;cAI3D,aAAa,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;QAClD,KAAK,EAAE,kBAAkB,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAqChC;AAED,qBAAa,qBAAsB,SAAQ,iBAAiB,CAAC,gBAAgB,CAAE,YAAW,cAAc,CAAC,gBAAgB,CAAC;IACxH,SAAS,CAAC,IAAI,SAA2B;IAE5B,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvD,GAAG,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAItE,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAI9D,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG9E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Jwk } from '@enbox/crypto';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
3
3
|
import type { AgentDataStore, DataStoreDeleteParams, DataStoreGetParams, DataStoreListParams, DataStoreSetParams } from './store-data.js';
|
|
4
4
|
import { DwnDataStore, InMemoryDataStore } from './store-data.js';
|
|
5
5
|
export declare class DwnKeyStore extends DwnDataStore<Jwk> implements AgentDataStore<Jwk> {
|
|
@@ -19,7 +19,7 @@ export declare class DwnKeyStore extends DwnDataStore<Jwk> implements AgentDataS
|
|
|
19
19
|
set(params: DataStoreSetParams<Jwk>): Promise<void>;
|
|
20
20
|
list(params: DataStoreListParams): Promise<Jwk[]>;
|
|
21
21
|
protected getAllRecords({ agent, tenantDid }: {
|
|
22
|
-
agent:
|
|
22
|
+
agent: EnboxPlatformAgent;
|
|
23
23
|
tenantDid: string;
|
|
24
24
|
}): Promise<Jwk[]>;
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-key.d.ts","sourceRoot":"","sources":["../../src/store-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOzC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