@enbox/agent 0.2.2 → 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.
- 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 +3 -3
- 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 +12 -12
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-engine-level.d.ts","sourceRoot":"","sources":["../../src/sync-engine-level.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAgF,MAAM,mBAAmB,CAAC;AAQtI,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,UAAU,EAAE,mBAAmB,EAAY,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"sync-engine-level.d.ts","sourceRoot":"","sources":["../../src/sync-engine-level.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAgF,MAAM,mBAAmB,CAAC;AAQtI,OAAO,KAAK,EAAc,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,UAAU,EAAE,mBAAmB,EAAY,MAAM,iBAAiB,CAAC;AAQzH,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC;CAClD,CAAC;AAuCF,qBAAa,eAAgB,YAAW,UAAU;IAChD;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,CAAqB;IAEpC;;OAEG;IACH,OAAO,CAAC,eAAe,CAAiB;IAExC,OAAO,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permissions.js';
|
|
2
|
-
import type { Web5PlatformAgent } from './types/agent.js';
|
|
3
3
|
import type { GenericMessage, UnionMessageReply } from '@enbox/dwn-sdk-js';
|
|
4
4
|
/** Entry type for fetched messages with optional data stream. */
|
|
5
5
|
export type SyncMessageEntry = {
|
|
@@ -32,7 +32,7 @@ export declare function pullMessages({ did, dwnUrl, delegateDid, protocol, messa
|
|
|
32
32
|
delegateDid?: string;
|
|
33
33
|
protocol?: string;
|
|
34
34
|
messageCids: string[];
|
|
35
|
-
agent:
|
|
35
|
+
agent: EnboxPlatformAgent;
|
|
36
36
|
permissionsApi: PermissionsApi;
|
|
37
37
|
}): Promise<void>;
|
|
38
38
|
/**
|
|
@@ -44,7 +44,7 @@ export declare function fetchRemoteMessages({ did, dwnUrl, delegateDid, protocol
|
|
|
44
44
|
delegateDid?: string;
|
|
45
45
|
protocol?: string;
|
|
46
46
|
messageCids: string[];
|
|
47
|
-
agent:
|
|
47
|
+
agent: EnboxPlatformAgent;
|
|
48
48
|
permissionsApi: PermissionsApi;
|
|
49
49
|
}): Promise<SyncMessageEntry[]>;
|
|
50
50
|
/**
|
|
@@ -59,7 +59,7 @@ export declare function pushMessages({ did, dwnUrl, delegateDid, protocol, messa
|
|
|
59
59
|
delegateDid?: string;
|
|
60
60
|
protocol?: string;
|
|
61
61
|
messageCids: string[];
|
|
62
|
-
agent:
|
|
62
|
+
agent: EnboxPlatformAgent;
|
|
63
63
|
permissionsApi: PermissionsApi;
|
|
64
64
|
}): Promise<void>;
|
|
65
65
|
/**
|
|
@@ -70,7 +70,7 @@ export declare function getLocalMessage({ author, delegateDid, protocol, message
|
|
|
70
70
|
delegateDid?: string;
|
|
71
71
|
protocol?: string;
|
|
72
72
|
messageCid: string;
|
|
73
|
-
agent:
|
|
73
|
+
agent: EnboxPlatformAgent;
|
|
74
74
|
permissionsApi: PermissionsApi;
|
|
75
75
|
}): Promise<SyncMessageEntry | undefined>;
|
|
76
76
|
//# sourceMappingURL=sync-messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-messages.d.ts","sourceRoot":"","sources":["../../src/sync-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sync-messages.d.ts","sourceRoot":"","sources":["../../src/sync-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAqB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAQ9F,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG;IAAE,OAAO,EAAE,cAAc,CAAC;IAAC,UAAU,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC;AAEpG;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAS9E;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAM5E;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;IAC7G,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkChB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,QAA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3
|
import type { DidResolverCache } from '@enbox/dids';
|
|
4
4
|
import type { Dwn } from '@enbox/dwn-sdk-js';
|
|
5
|
+
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
5
6
|
import type { KeyValueStore } from '@enbox/common';
|
|
6
|
-
import type { Web5PlatformAgent } from './types/agent.js';
|
|
7
7
|
import { DataStoreLevel, MessageStoreLevel, ResumableTaskStoreLevel, StateIndexLevel } from '@enbox/dwn-sdk-js';
|
|
8
8
|
import { LocalKeyManager } from './local-key-manager.js';
|
|
9
9
|
import { DwnDidStore } from './store-did.js';
|
|
10
10
|
import { DwnIdentityStore } from './store-identity.js';
|
|
11
11
|
import { DwnKeyStore } from './store-key.js';
|
|
12
12
|
type PlatformAgentTestHarnessParams = {
|
|
13
|
-
agent:
|
|
13
|
+
agent: EnboxPlatformAgent<LocalKeyManager>;
|
|
14
14
|
agentStores: 'dwn' | 'memory';
|
|
15
15
|
didResolverCache: DidResolverCache;
|
|
16
16
|
dwn: Dwn;
|
|
@@ -28,7 +28,7 @@ type PlatformAgentTestHarnessParams = {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
export declare class PlatformAgentTestHarness {
|
|
31
|
-
agent:
|
|
31
|
+
agent: EnboxPlatformAgent<LocalKeyManager>;
|
|
32
32
|
agentStores: 'dwn' | 'memory';
|
|
33
33
|
didResolverCache: DidResolverCache;
|
|
34
34
|
dwn: Dwn;
|
|
@@ -68,7 +68,7 @@ export declare class PlatformAgentTestHarness {
|
|
|
68
68
|
testDwnUrls: string[];
|
|
69
69
|
}): Promise<BearerIdentity>;
|
|
70
70
|
static setup({ agentClass, agentStores, testDataLocation }: {
|
|
71
|
-
agentClass: new (params: any) =>
|
|
71
|
+
agentClass: new (params: any) => EnboxPlatformAgent<LocalKeyManager>;
|
|
72
72
|
agentStores?: 'dwn' | 'memory';
|
|
73
73
|
testDataLocation?: string;
|
|
74
74
|
}): Promise<PlatformAgentTestHarness>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-harness.d.ts","sourceRoot":"","sources":["../../src/test-harness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"test-harness.d.ts","sourceRoot":"","sources":["../../src/test-harness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAwB,iBAAiB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAatI,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAY/D,KAAK,8BAA8B,GAAG;IACpC,KAAK,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAA;IAE1C,WAAW,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC9B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,GAAG,EAA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,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAwB/B,cAAc,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;QACjD,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,GAAG,OAAO,CAAC,cAAc,CAAC;WA8BP,KAAK,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,EAAE;QACvE,UAAU,EAAE,KAAK,MAAM,EAAE,GAAG,KAAK,kBAAkB,CAAC,eAAe,CAAC,CAAA;QACpE,WAAW,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;QAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA+FrC,OAAO,CAAC,MAAM,CAAC,aAAa;IAqC5B,OAAO,CAAC,MAAM,CAAC,eAAe;CAsB/B"}
|
|
@@ -5,14 +5,15 @@ import type { AgentIdentityApi } from '../identity-api.js';
|
|
|
5
5
|
import type { AgentKeyManager } from './key-manager.js';
|
|
6
6
|
import type { AgentPermissionsApi } from '../permissions-api.js';
|
|
7
7
|
import type { AgentSyncApi } from '../sync-api.js';
|
|
8
|
+
import type { EnboxRpc } from '@enbox/dwn-clients';
|
|
8
9
|
import type { IdentityVault } from './identity-vault.js';
|
|
9
|
-
import type {
|
|
10
|
+
import type { LocalKeyManager } from '../local-key-manager.js';
|
|
10
11
|
import type { AgentDidApi, DidInterface, DidRequest, DidResponse } from '../did-api.js';
|
|
11
12
|
import type { DwnInterface, DwnResponse, ProcessDwnRequest, SendDwnRequest } from './dwn.js';
|
|
12
13
|
import type { ProcessVcRequest, SendVcRequest, VcResponse } from './vc.js';
|
|
13
14
|
/**
|
|
14
15
|
* Defines the structure for response status in the context of an Agent's interaction within the
|
|
15
|
-
*
|
|
16
|
+
* Enbox framework.
|
|
16
17
|
*
|
|
17
18
|
* This type is utilized to convey the success or failure of an operation performed by the Agent,
|
|
18
19
|
* providing feedback that can be programmatically interpreted and acted upon.
|
|
@@ -48,18 +49,18 @@ export type ResponseStatus = {
|
|
|
48
49
|
};
|
|
49
50
|
};
|
|
50
51
|
/**
|
|
51
|
-
* Defines the interface for
|
|
52
|
+
* Defines the interface for an Enbox Agent, encapsulating the core functionality all implementations
|
|
52
53
|
* must include.
|
|
53
54
|
*
|
|
54
55
|
* The Agent is responsible for handling decentralized identifier (DID) requests, decentralized web
|
|
55
56
|
* node (DWN) requests, and verifiable credential (VC) requests.
|
|
56
57
|
*
|
|
57
|
-
* The `AgentDid` property represents the
|
|
58
|
+
* The `AgentDid` property represents the Enbox Agent's own DID, while the various process and send
|
|
58
59
|
* methods enable the Agent to handle and initiate requests pertaining to DIDs, DWNs, and VCs.
|
|
59
60
|
*/
|
|
60
|
-
export interface
|
|
61
|
+
export interface EnboxAgent {
|
|
61
62
|
/**
|
|
62
|
-
* The Decentralized Identifier (DID) of this
|
|
63
|
+
* The Decentralized Identifier (DID) of this Enbox Agent.
|
|
63
64
|
*/
|
|
64
65
|
agentDid: BearerDid;
|
|
65
66
|
/**
|
|
@@ -95,23 +96,23 @@ export interface Web5Agent {
|
|
|
95
96
|
sendVcRequest(request: SendVcRequest): Promise<VcResponse>;
|
|
96
97
|
}
|
|
97
98
|
/**
|
|
98
|
-
* Represents
|
|
99
|
-
* {@link
|
|
99
|
+
* Represents an Enbox Platform Agent, an extended and more feature-rich implementation of a
|
|
100
|
+
* {@link EnboxAgent}.
|
|
100
101
|
*
|
|
101
102
|
* This Agent integrates a comprehensive set of APIs and functionalities, including cryptographic
|
|
102
103
|
* operations, DID management, DWN interaction, identity handling, and data synchronization.
|
|
103
104
|
*
|
|
104
|
-
* The platform agent provides a higher-level abstraction over the core
|
|
105
|
-
* facilitating a robust platform for developing
|
|
105
|
+
* The platform agent provides a higher-level abstraction over the core EnboxAgent functionalities,
|
|
106
|
+
* facilitating a robust platform for developing Enbox applications. It includes lifecycle management
|
|
106
107
|
* methods like initialization and startup, alongside a suite of specialized APIs and utilities.
|
|
107
108
|
*
|
|
108
109
|
* @typeParam TKeyManager - The type of Key Manager used to manage cryptographic keys.
|
|
109
110
|
*/
|
|
110
|
-
export interface
|
|
111
|
+
export interface EnboxPlatformAgent<TKeyManager extends AgentKeyManager = AgentKeyManager> extends EnboxAgent {
|
|
111
112
|
/**
|
|
112
113
|
* The cryptography API, essential for performing various cryptographic operations such
|
|
113
114
|
* as encryption, decryption, signing, and verification, ensuring secure data handling and
|
|
114
|
-
* communication within the
|
|
115
|
+
* communication within the Enbox platform.
|
|
115
116
|
*/
|
|
116
117
|
crypto: AgentCryptoApi;
|
|
117
118
|
/**
|
|
@@ -121,12 +122,12 @@ export interface Web5PlatformAgent<TKeyManager extends AgentKeyManager = AgentKe
|
|
|
121
122
|
did: AgentDidApi<TKeyManager>;
|
|
122
123
|
/**
|
|
123
124
|
* The DWN API, enabling the Agent to interact with Decentralized Web Nodes (DWNs) and handle
|
|
124
|
-
* requests from
|
|
125
|
+
* requests from Enbox applications.
|
|
125
126
|
*/
|
|
126
127
|
dwn: AgentDwnApi;
|
|
127
128
|
/**
|
|
128
129
|
* The identity management API, handling identity-related operations and allowing the agent to
|
|
129
|
-
* manage
|
|
130
|
+
* manage Enbox identities, supporting operations like identity creation and update.
|
|
130
131
|
*/
|
|
131
132
|
identity: AgentIdentityApi<TKeyManager>;
|
|
132
133
|
/**
|
|
@@ -139,17 +140,17 @@ export interface Web5PlatformAgent<TKeyManager extends AgentKeyManager = AgentKe
|
|
|
139
140
|
*/
|
|
140
141
|
permissions: AgentPermissionsApi;
|
|
141
142
|
/**
|
|
142
|
-
* The RPC (Remote Procedure Call) client interface, facilitating communication with other
|
|
143
|
-
*
|
|
143
|
+
* The RPC (Remote Procedure Call) client interface, facilitating communication with other Enbox
|
|
144
|
+
* agents and services.
|
|
144
145
|
*/
|
|
145
|
-
rpc:
|
|
146
|
+
rpc: EnboxRpc;
|
|
146
147
|
/**
|
|
147
148
|
* The synchronization API, responsible for managing the consistency and real-time update of the
|
|
148
149
|
* agent's data with the state of the distributed network.
|
|
149
150
|
*/
|
|
150
151
|
sync: AgentSyncApi;
|
|
151
152
|
/**
|
|
152
|
-
* An instance of {@link IdentityVault}, providing secure storage and management of
|
|
153
|
+
* An instance of {@link IdentityVault}, providing secure storage and management of an Enbox Agent's
|
|
153
154
|
* DID and cryptographic keys.
|
|
154
155
|
*/
|
|
155
156
|
vault: IdentityVault;
|
|
@@ -160,7 +161,7 @@ export interface Web5PlatformAgent<TKeyManager extends AgentKeyManager = AgentKe
|
|
|
160
161
|
firstLaunch(): Promise<boolean>;
|
|
161
162
|
/**
|
|
162
163
|
* Initializes the agent with essential parameters (e.g., a passphrase) and prepares it for
|
|
163
|
-
* processing
|
|
164
|
+
* processing requests.
|
|
164
165
|
*/
|
|
165
166
|
initialize(params: unknown): Promise<unknown>;
|
|
166
167
|
/**
|
|
@@ -169,4 +170,8 @@ export interface Web5PlatformAgent<TKeyManager extends AgentKeyManager = AgentKe
|
|
|
169
170
|
*/
|
|
170
171
|
start(params: unknown): Promise<unknown>;
|
|
171
172
|
}
|
|
173
|
+
/** @deprecated Use {@link EnboxAgent} instead. Will be removed in a future version. */
|
|
174
|
+
export type Web5Agent = EnboxAgent;
|
|
175
|
+
/** @deprecated Use {@link EnboxPlatformAgent} instead. Will be removed in a future version. */
|
|
176
|
+
export type Web5PlatformAgent<TKeyManager extends AgentKeyManager = LocalKeyManager> = EnboxPlatformAgent<TKeyManager>;
|
|
172
177
|
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/types/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,e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,MAAM,EAAE,cAAc,CAAC;IAEvB;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9B;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC;IAEjB;;;OAGG;IACH,QAAQ,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAExC;;;OAGG;IACH,UAAU,EAAE,WAAW,CAAC;IAExB;;OAEG;IACH,WAAW,EAAE,mBAAmB,CAAC;IAEjC;;;OAGG;IACH,GAAG,EAAE,QAAQ,CAAC;IAEd;;;OAGG;IACH,IAAI,EAAE,YAAY,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,aAAa,CAAC;IAErB;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhC;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9C;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C;AAMD,uFAAuF;AACvF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AAEnC,+FAA+F;AAC/F,MAAM,MAAM,iBAAiB,CAAC,WAAW,SAAS,eAAe,GAAG,eAAe,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Cipher, Jwk, KeyDeleter, KeyExporter, KeyIdentifier, KeyImporter, KeyManager, KeyWrapper, KmsCipherParams, KmsDeleteKeyParams, KmsExportKeyParams, KmsImportKeyParams, KmsUriUnwrapKeyParams, KmsUriWrapKeyParams, PublicKeyJwk } from '@enbox/crypto';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EnboxPlatformAgent } from './agent.js';
|
|
3
3
|
export interface AgentKeyManager extends KeyManager, Cipher<KmsCipherParams, KmsCipherParams>, KeyImporter<KmsImportKeyParams, KeyIdentifier>, KeyExporter<KmsExportKeyParams, Jwk>, KeyDeleter<KmsDeleteKeyParams>, KeyWrapper<KmsUriWrapKeyParams, KmsUriUnwrapKeyParams> {
|
|
4
|
-
agent:
|
|
4
|
+
agent: EnboxPlatformAgent;
|
|
5
5
|
/**
|
|
6
6
|
* Derives an HD child public key from a stored private key using HKDF-SHA256
|
|
7
7
|
* iteratively through the given derivation path segments.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-manager.d.ts","sourceRoot":"","sources":["../../../src/types/key-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,GAAG,EACH,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"key-manager.d.ts","sourceRoot":"","sources":["../../../src/types/key-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,GAAG,EACH,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,eAAgB,SAAQ,UAAU,EACjD,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC,EACxC,WAAW,CAAC,kBAAkB,EAAE,aAAa,CAAC,EAC9C,WAAW,CAAC,kBAAkB,EAAE,GAAG,CAAC,EACpC,UAAU,CAAC,kBAAkB,CAAC,EAC9B,UAAU,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;IAEtD,KAAK,EAAE,kBAAkB,CAAC;IAE1B;;;;;;;;;OASG;IACH,eAAe,CAAC,MAAM,EAAE;QACtB,MAAM,EAAE,aAAa,CAAC;QACtB,cAAc,EAAE,MAAM,EAAE,CAAC;KAC1B,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAE1B;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,MAAM,EAAE;QACnB,MAAM,EAAE,aAAa,CAAC;QACtB,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,YAAY,EAAE,UAAU,CAAC;QACzB,kBAAkB,EAAE,YAAY,CAAC;KAClC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAExB;;;;;;;;;;;;;;;;;OAiBG;IACH,qBAAqB,CAAC,MAAM,EAAE;QAC5B,MAAM,EAAE,aAAa,CAAC;QACtB,cAAc,EAAE,MAAM,EAAE,CAAC;KAC1B,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EnboxPlatformAgent } from './agent.js';
|
|
2
2
|
/**
|
|
3
3
|
* The SyncEngine is responsible for syncing messages between the agent and the platform.
|
|
4
4
|
*/
|
|
@@ -52,7 +52,7 @@ export interface SyncEngine {
|
|
|
52
52
|
/**
|
|
53
53
|
* The agent that the SyncEngine is attached to.
|
|
54
54
|
*/
|
|
55
|
-
agent:
|
|
55
|
+
agent: EnboxPlatformAgent;
|
|
56
56
|
/**
|
|
57
57
|
* Current connectivity state as observed by the sync engine.
|
|
58
58
|
* Updated when WebSocket subscriptions connect/disconnect or when the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/types/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/types/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY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AMG;IACH,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Jwk, KeyIdentifier, KmsExportKeyParams, KmsGetPublicKeyParams, KmsSignParams } from '@enbox/crypto';
|
|
2
2
|
import { LocalKeyManager } from '@enbox/crypto';
|
|
3
|
-
import type {
|
|
3
|
+
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
4
4
|
/**
|
|
5
|
-
* Internal utility functions used by the
|
|
5
|
+
* Internal utility functions used by the Enbox platform agent that are not intended for public use
|
|
6
6
|
* and are not exported in the public API.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
@@ -36,14 +36,14 @@ export declare class DeterministicKeyGenerator extends LocalKeyManager {
|
|
|
36
36
|
* This approach ensures operations are isolated by DID, supporting multi-tenancy.
|
|
37
37
|
*
|
|
38
38
|
* @param params - The parameters for determining the tenant.
|
|
39
|
-
* @param params.agent - The
|
|
39
|
+
* @param params.agent - The Enbox platform agent instance.
|
|
40
40
|
* @param [params.tenant] - An optional tenant DID. If provided, it takes precedence.
|
|
41
41
|
* @param [params.didUri] - An optional DID URI to use if no tenant DID or agent DID is available.
|
|
42
42
|
* @returns A promise that resolves to the tenant DID.
|
|
43
43
|
* @throws Throws an error if it fails to determine the tenant from the provided inputs.
|
|
44
44
|
*/
|
|
45
45
|
export declare function getDataStoreTenant({ agent, tenant, didUri }: {
|
|
46
|
-
agent:
|
|
46
|
+
agent: EnboxPlatformAgent;
|
|
47
47
|
tenant?: string;
|
|
48
48
|
didUri?: string;
|
|
49
49
|
}): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-internal.d.ts","sourceRoot":"","sources":["../../src/utils-internal.ts"],"names":[],"mappings":"AAAA,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EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAClE,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enbox/agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@scure/bip39": "1.2.2",
|
|
74
|
-
"@enbox/dwn-clients": "0.0
|
|
75
|
-
"@enbox/dwn-sdk-js": "0.1.
|
|
76
|
-
"@enbox/common": "0.0.
|
|
77
|
-
"@enbox/crypto": "0.0.
|
|
78
|
-
"@enbox/dids": "0.0.
|
|
74
|
+
"@enbox/dwn-clients": "0.1.0",
|
|
75
|
+
"@enbox/dwn-sdk-js": "0.1.2",
|
|
76
|
+
"@enbox/common": "0.0.7",
|
|
77
|
+
"@enbox/crypto": "0.0.8",
|
|
78
|
+
"@enbox/dids": "0.0.9",
|
|
79
79
|
"abstract-level": "1.0.4",
|
|
80
80
|
"ed25519-keygen": "0.4.11",
|
|
81
81
|
"level": "8.0.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DidResolutionResult, DidResolverCache, DidResolverCacheLevelParams } from '@enbox/dids';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
4
4
|
|
|
5
5
|
import { DidResolverCacheLevel } from '@enbox/dids';
|
|
6
6
|
import { logger } from '@enbox/common';
|
|
@@ -13,29 +13,29 @@ import { logger } from '@enbox/common';
|
|
|
13
13
|
export class AgentDidResolverCache extends DidResolverCacheLevel implements DidResolverCache {
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Holds the instance of a `
|
|
17
|
-
* the `AgentDidApi`. This agent is used to interact with other
|
|
18
|
-
* to ensure this instance is set to correctly contextualize operations within the broader
|
|
16
|
+
* Holds the instance of a `EnboxPlatformAgent` that represents the current execution context for
|
|
17
|
+
* the `AgentDidApi`. This agent is used to interact with other Enbox agent components. It's vital
|
|
18
|
+
* to ensure this instance is set to correctly contextualize operations within the broader Enbox
|
|
19
19
|
* Agent framework.
|
|
20
20
|
*/
|
|
21
|
-
private _agent?:
|
|
21
|
+
private _agent?: EnboxPlatformAgent;
|
|
22
22
|
|
|
23
23
|
/** A map of DIDs that are currently in-flight. This helps avoid going into an infinite loop */
|
|
24
24
|
private _resolving: Map<string, boolean> = new Map();
|
|
25
25
|
|
|
26
|
-
constructor({ agent, db, location, ttl }: DidResolverCacheLevelParams & { agent?:
|
|
26
|
+
constructor({ agent, db, location, ttl }: DidResolverCacheLevelParams & { agent?: EnboxPlatformAgent }) {
|
|
27
27
|
super ({ db, location, ttl });
|
|
28
28
|
this._agent = agent;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
get agent():
|
|
31
|
+
get agent(): EnboxPlatformAgent {
|
|
32
32
|
if (!this._agent) {
|
|
33
33
|
throw new Error('Agent not initialized');
|
|
34
34
|
}
|
|
35
35
|
return this._agent;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
set agent(agent:
|
|
38
|
+
set agent(agent: EnboxPlatformAgent) {
|
|
39
39
|
this._agent = agent;
|
|
40
40
|
}
|
|
41
41
|
|
package/src/anonymous-dwn-api.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
RecordsSubscribeReply,
|
|
14
14
|
SubscriptionListener,
|
|
15
15
|
} from '@enbox/dwn-sdk-js';
|
|
16
|
-
import type { DwnRpcRequest,
|
|
16
|
+
import type { DwnRpcRequest, EnboxRpc } from '@enbox/dwn-clients';
|
|
17
17
|
|
|
18
18
|
import { ProtocolsQuery, RecordsCount, RecordsQuery, RecordsRead, RecordsSubscribe } from '@enbox/dwn-sdk-js';
|
|
19
19
|
|
|
@@ -26,7 +26,7 @@ export type AnonymousDwnApiParams = {
|
|
|
26
26
|
/** A DID URL dereferencer for resolving target DID service endpoints. */
|
|
27
27
|
didResolver: DidUrlDereferencer;
|
|
28
28
|
/** An RPC client for sending messages to remote DWNs. */
|
|
29
|
-
rpcClient:
|
|
29
|
+
rpcClient: EnboxRpc;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -89,7 +89,7 @@ export type AnonymousProtocolsQueryParams = {
|
|
|
89
89
|
* @example
|
|
90
90
|
* ```ts
|
|
91
91
|
* const resolver = new UniversalResolver({ didResolvers: [DidDht, DidJwk] });
|
|
92
|
-
* const rpcClient = new
|
|
92
|
+
* const rpcClient = new EnboxRpcClient();
|
|
93
93
|
* const anonymousDwn = new AnonymousDwnApi({ didResolver: resolver, rpcClient });
|
|
94
94
|
*
|
|
95
95
|
* const reply = await anonymousDwn.recordsQuery('did:dht:alice...', {
|
|
@@ -99,7 +99,7 @@ export type AnonymousProtocolsQueryParams = {
|
|
|
99
99
|
*/
|
|
100
100
|
export class AnonymousDwnApi {
|
|
101
101
|
private _didResolver: DidUrlDereferencer;
|
|
102
|
-
private _rpcClient:
|
|
102
|
+
private _rpcClient: EnboxRpc;
|
|
103
103
|
|
|
104
104
|
constructor({ didResolver, rpcClient }: AnonymousDwnApiParams) {
|
|
105
105
|
this._didResolver = didResolver;
|
package/src/bearer-identity.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { BearerDid } from '@enbox/dids';
|
|
|
2
2
|
import type { IdentityMetadata, PortableIdentity } from './types/identity.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Represents
|
|
5
|
+
* Represents an Enbox Identity with its DID and metadata.
|
|
6
6
|
*/
|
|
7
7
|
export class BearerIdentity {
|
|
8
8
|
/** {@inheritDoc BearerDid} */
|
package/src/connect.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import type { PushedAuthResponse } from './oidc.js';
|
|
3
|
-
import type { DwnPermissionScope, DwnProtocolDefinition,
|
|
3
|
+
import type { DwnPermissionScope, DwnProtocolDefinition, EnboxConnectAuthResponse } from './index.js';
|
|
4
4
|
|
|
5
5
|
import { CryptoUtils } from '@enbox/crypto';
|
|
6
6
|
import { DidJwk } from '@enbox/dids';
|
|
@@ -21,8 +21,8 @@ async function initClient({
|
|
|
21
21
|
onWalletUriReady,
|
|
22
22
|
validatePin,
|
|
23
23
|
}: WalletConnectOptions): Promise<{
|
|
24
|
-
delegateGrants:
|
|
25
|
-
delegatePortableDid:
|
|
24
|
+
delegateGrants: EnboxConnectAuthResponse['delegateGrants'];
|
|
25
|
+
delegatePortableDid: EnboxConnectAuthResponse['delegatePortableDid'];
|
|
26
26
|
connectedDid: string;
|
|
27
27
|
} | undefined> {
|
|
28
28
|
// ephemeral client did for ECDH, signing, verification
|
|
@@ -93,8 +93,8 @@ async function initClient({
|
|
|
93
93
|
|
|
94
94
|
const parData: PushedAuthResponse = await parResponse.json();
|
|
95
95
|
|
|
96
|
-
// a deeplink to a
|
|
97
|
-
// a route to its
|
|
96
|
+
// a deeplink to a compatible wallet. if the wallet scans this link it should receive
|
|
97
|
+
// a route to its Connect provider flow and the params of where to fetch the auth request.
|
|
98
98
|
logger.log(`Wallet URI: ${walletUri}`);
|
|
99
99
|
const generatedWalletUri = new URL(walletUri);
|
|
100
100
|
generatedWalletUri.searchParams.set('request_uri', parData.request_uri);
|
|
@@ -112,7 +112,7 @@ async function initClient({
|
|
|
112
112
|
tokenParam : request.state,
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
// subscribe to receiving a response from the wallet with default TTL. receive ciphertext of {@link
|
|
115
|
+
// subscribe to receiving a response from the wallet with default TTL. receive ciphertext of {@link EnboxConnectAuthResponse}
|
|
116
116
|
const authResponse = await pollWithTtl(() => fetch(tokenUrl, { signal: AbortSignal.timeout(30_000) }));
|
|
117
117
|
|
|
118
118
|
if (authResponse) {
|
|
@@ -123,7 +123,7 @@ async function initClient({
|
|
|
123
123
|
const jwt = await Oidc.decryptAuthResponse(clientDid, jwe, pin);
|
|
124
124
|
const verifiedAuthResponse = (await Oidc.verifyJwt({
|
|
125
125
|
jwt,
|
|
126
|
-
})) as
|
|
126
|
+
})) as EnboxConnectAuthResponse;
|
|
127
127
|
|
|
128
128
|
return {
|
|
129
129
|
delegateGrants : verifiedAuthResponse.delegateGrants,
|
|
@@ -159,20 +159,20 @@ export type WalletConnectOptions = {
|
|
|
159
159
|
permissionRequests: ConnectPermissionRequest[];
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
* The
|
|
162
|
+
* The Connect API provides a URI to the wallet based on the `walletUri` plus a query params payload valid for 5 minutes.
|
|
163
163
|
* The link can either be used as a deep link on the same device or a QR code for cross device or both.
|
|
164
164
|
* The query params are `{ request_uri: string; encryption_key: string; }`
|
|
165
165
|
* The wallet will use the `request_uri to contact the intermediary server's `authorize` endpoint
|
|
166
|
-
* and pull down the {@link
|
|
166
|
+
* and pull down the {@link EnboxConnectAuthRequest} and use the `encryption_key` to decrypt it.
|
|
167
167
|
*
|
|
168
|
-
* @param uri - The URI returned by the
|
|
168
|
+
* @param uri - The URI returned by the Connect API to be passed to a provider.
|
|
169
169
|
*/
|
|
170
170
|
onWalletUriReady: (uri: string) => void;
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
173
|
* Function that must be provided to submit the pin entered by the user on the client.
|
|
174
|
-
* The pin is used to decrypt the {@link
|
|
175
|
-
* token endpoint by the client inside of
|
|
174
|
+
* The pin is used to decrypt the {@link EnboxConnectAuthResponse} that was retrieved from the
|
|
175
|
+
* token endpoint by the client inside of Connect.
|
|
176
176
|
*
|
|
177
177
|
* @returns A promise that resolves to the PIN as a string.
|
|
178
178
|
*/
|
package/src/did-api.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
DidResolutionResult,
|
|
9
9
|
DidResolverCache,
|
|
10
10
|
DidVerificationMethod,
|
|
11
|
+
DidWebCreateOptions,
|
|
11
12
|
PortableDid,
|
|
12
13
|
} from '@enbox/dids';
|
|
13
14
|
|
|
@@ -15,7 +16,7 @@ import { BearerDid, Did, DidDht, UniversalResolver } from '@enbox/dids';
|
|
|
15
16
|
|
|
16
17
|
import type { AgentDataStore } from './store-data.js';
|
|
17
18
|
import type { AgentKeyManager } from './types/key-manager.js';
|
|
18
|
-
import type {
|
|
19
|
+
import type { EnboxPlatformAgent, ResponseStatus } from './types/agent.js';
|
|
19
20
|
|
|
20
21
|
import { AgentDidResolverCache } from './agent-did-resolver-cache.js';
|
|
21
22
|
import { canonicalize } from '@enbox/crypto';
|
|
@@ -77,12 +78,13 @@ export interface DidCreateParams<
|
|
|
77
78
|
export interface DidMethodCreateOptions<TKeyManager> {
|
|
78
79
|
dht: DidDhtCreateOptions<TKeyManager>;
|
|
79
80
|
jwk: DidJwkCreateOptions<TKeyManager>;
|
|
81
|
+
web: DidWebCreateOptions<TKeyManager>;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
export interface DidApiParams {
|
|
83
85
|
didMethods: DidMethodApi[];
|
|
84
86
|
|
|
85
|
-
agent?:
|
|
87
|
+
agent?: EnboxPlatformAgent;
|
|
86
88
|
|
|
87
89
|
/**
|
|
88
90
|
* An optional `DidResolverCache` instance used for caching resolved DID documents.
|
|
@@ -105,19 +107,19 @@ export function isDidRequest<T extends DidInterface>(
|
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
/**
|
|
108
|
-
* This API is used to manage and interact with DIDs within the
|
|
110
|
+
* This API is used to manage and interact with DIDs within the Enbox Agent framework.
|
|
109
111
|
*
|
|
110
112
|
* If a DWN Data Store is used, the DID information is stored under DID's own tenant by default.
|
|
111
113
|
* If a tenant property is passed, that tenant will be used to store the DID information.
|
|
112
114
|
*/
|
|
113
115
|
export class AgentDidApi<TKeyManager extends AgentKeyManager = AgentKeyManager> extends UniversalResolver {
|
|
114
116
|
/**
|
|
115
|
-
* Holds the instance of a `
|
|
116
|
-
* the `AgentDidApi`. This agent is used to interact with other
|
|
117
|
-
* to ensure this instance is set to correctly contextualize operations within the broader
|
|
117
|
+
* Holds the instance of a `EnboxPlatformAgent` that represents the current execution context for
|
|
118
|
+
* the `AgentDidApi`. This agent is used to interact with other Enbox agent components. It's vital
|
|
119
|
+
* to ensure this instance is set to correctly contextualize operations within the broader Enbox
|
|
118
120
|
* Agent framework.
|
|
119
121
|
*/
|
|
120
|
-
private _agent?:
|
|
122
|
+
private _agent?: EnboxPlatformAgent;
|
|
121
123
|
|
|
122
124
|
private _didMethods: Map<string, DidMethodApi> = new Map();
|
|
123
125
|
|
|
@@ -146,12 +148,12 @@ export class AgentDidApi<TKeyManager extends AgentKeyManager = AgentKeyManager>
|
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
/**
|
|
149
|
-
* Retrieves the `
|
|
151
|
+
* Retrieves the `EnboxPlatformAgent` execution context.
|
|
150
152
|
*
|
|
151
|
-
* @returns The `
|
|
153
|
+
* @returns The `EnboxPlatformAgent` instance that represents the current execution context.
|
|
152
154
|
* @throws Will throw an error if the `agent` instance property is undefined.
|
|
153
155
|
*/
|
|
154
|
-
get agent():
|
|
156
|
+
get agent(): EnboxPlatformAgent {
|
|
155
157
|
if (this._agent === undefined) {
|
|
156
158
|
throw new Error('AgentDidApi: Unable to determine agent execution context.');
|
|
157
159
|
}
|
|
@@ -159,7 +161,7 @@ export class AgentDidApi<TKeyManager extends AgentKeyManager = AgentKeyManager>
|
|
|
159
161
|
return this._agent;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
|
-
set agent(agent:
|
|
164
|
+
set agent(agent: EnboxPlatformAgent) {
|
|
163
165
|
this._agent = agent;
|
|
164
166
|
|
|
165
167
|
// AgentDidResolverCache should set the agent if it is the type of cache being used
|