@enbox/agent 0.5.15 → 0.6.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 +11 -11
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/dwn-api.js +433 -33
- package/dist/esm/dwn-api.js.map +1 -1
- package/dist/esm/dwn-encryption.js +131 -12
- package/dist/esm/dwn-encryption.js.map +1 -1
- package/dist/esm/dwn-key-delivery.js +64 -47
- package/dist/esm/dwn-key-delivery.js.map +1 -1
- package/dist/esm/enbox-connect-protocol.js +400 -3
- package/dist/esm/enbox-connect-protocol.js.map +1 -1
- package/dist/esm/permissions-api.js +11 -1
- package/dist/esm/permissions-api.js.map +1 -1
- package/dist/esm/sync-closure-resolver.js +8 -1
- package/dist/esm/sync-closure-resolver.js.map +1 -1
- package/dist/esm/sync-engine-level.js +407 -6
- package/dist/esm/sync-engine-level.js.map +1 -1
- package/dist/esm/sync-messages.js +10 -3
- package/dist/esm/sync-messages.js.map +1 -1
- package/dist/types/dwn-api.d.ts +159 -0
- package/dist/types/dwn-api.d.ts.map +1 -1
- package/dist/types/dwn-encryption.d.ts +39 -2
- package/dist/types/dwn-encryption.d.ts.map +1 -1
- package/dist/types/dwn-key-delivery.d.ts +1 -9
- package/dist/types/dwn-key-delivery.d.ts.map +1 -1
- package/dist/types/enbox-connect-protocol.d.ts +166 -1
- package/dist/types/enbox-connect-protocol.d.ts.map +1 -1
- package/dist/types/permissions-api.d.ts.map +1 -1
- package/dist/types/sync-closure-resolver.d.ts.map +1 -1
- package/dist/types/sync-engine-level.d.ts +45 -1
- package/dist/types/sync-engine-level.d.ts.map +1 -1
- package/dist/types/sync-messages.d.ts +2 -2
- package/dist/types/sync-messages.d.ts.map +1 -1
- package/dist/types/types/permissions.d.ts +9 -0
- package/dist/types/types/permissions.d.ts.map +1 -1
- package/dist/types/types/sync.d.ts +70 -2
- package/dist/types/types/sync.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/dwn-api.ts +494 -38
- package/src/dwn-encryption.ts +160 -11
- package/src/dwn-key-delivery.ts +73 -61
- package/src/enbox-connect-protocol.ts +575 -6
- package/src/permissions-api.ts +13 -1
- package/src/sync-closure-resolver.ts +7 -1
- package/src/sync-engine-level.ts +368 -4
- package/src/sync-messages.ts +14 -5
- package/src/types/permissions.ts +9 -0
- package/src/types/sync.ts +86 -2
|
@@ -97,11 +97,35 @@ export declare function getKeyDecrypter(agent: EnboxPlatformAgent, didUri: strin
|
|
|
97
97
|
* @param contextKey - The derived private key for the context
|
|
98
98
|
*/
|
|
99
99
|
export declare function buildContextKeyDecrypter(contextKey: DerivedPrivateJwk): KeyDecrypter;
|
|
100
|
+
/** Cache entry shape for scope-aware delegate decryption keys. */
|
|
101
|
+
export type DelegateDecryptionKeyEntry = {
|
|
102
|
+
protocol: string;
|
|
103
|
+
scope: {
|
|
104
|
+
kind: 'protocol';
|
|
105
|
+
} | {
|
|
106
|
+
kind: 'protocolPath';
|
|
107
|
+
protocolPath: string;
|
|
108
|
+
match: 'exact';
|
|
109
|
+
};
|
|
110
|
+
derivedPrivateKey: DerivedPrivateJwk;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Builds a KeyDecrypter for an exact-path delegate key that enforces the
|
|
114
|
+
* record's full derivation path matches the key's path exactly — siblings
|
|
115
|
+
* and descendants are NOT accessible.
|
|
116
|
+
*/
|
|
117
|
+
export declare function buildExactProtocolPathDecrypter(key: DerivedPrivateJwk): KeyDecrypter;
|
|
100
118
|
/**
|
|
101
119
|
* Resolves the appropriate KeyDecrypter for a record's encryption scheme.
|
|
102
120
|
* Handles both single-party (ProtocolPath) and multi-party (ProtocolContext).
|
|
103
121
|
*
|
|
122
|
+
* For ProtocolPath records:
|
|
123
|
+
* - Owner: derives key directly from KMS
|
|
124
|
+
* - Delegate with protocol-wide key: uses ancestor-prefix derivation
|
|
125
|
+
* - Delegate with exact-path key: enforces exact path match
|
|
126
|
+
*
|
|
104
127
|
* For ProtocolContext records:
|
|
128
|
+
* - Delegate: uses delivered context key from the connect flow
|
|
105
129
|
* - Context creator: derives key directly from KMS
|
|
106
130
|
* - Participant: fetches contextKey via key-delivery protocol, caches it
|
|
107
131
|
*
|
|
@@ -111,6 +135,8 @@ export declare function buildContextKeyDecrypter(contextKey: DerivedPrivateJwk):
|
|
|
111
135
|
* @param targetDid - The target DID (DWN owner), if known
|
|
112
136
|
* @param contextDerivedKeyCache - Cache for context-derived private keys
|
|
113
137
|
* @param fetchContextKeyRecordFn - Function to fetch context key records from key-delivery protocol
|
|
138
|
+
* @param delegateDecryptionKeyCache - Cache for scope-aware delegate decryption keys
|
|
139
|
+
* @param granteeDid - The delegate DID (if this is a delegated request)
|
|
114
140
|
*/
|
|
115
141
|
export declare function resolveKeyDecrypter(agent: EnboxPlatformAgent, authorDid: string, recordsWrite: RecordsWriteMessage, targetDid: string | undefined, contextDerivedKeyCache: {
|
|
116
142
|
get(key: string): DerivedPrivateJwk | undefined;
|
|
@@ -120,7 +146,12 @@ export declare function resolveKeyDecrypter(agent: EnboxPlatformAgent, authorDid
|
|
|
120
146
|
requesterDid: string;
|
|
121
147
|
sourceProtocol: string;
|
|
122
148
|
sourceContextId: string;
|
|
123
|
-
}) => Promise<DerivedPrivateJwk | undefined
|
|
149
|
+
}) => Promise<DerivedPrivateJwk | undefined>, delegateDecryptionKeyCache?: {
|
|
150
|
+
get(key: string): DelegateDecryptionKeyEntry[] | undefined;
|
|
151
|
+
}, granteeDid?: string, delegateContextKeyCache?: {
|
|
152
|
+
get(key: string): DerivedPrivateJwk | undefined;
|
|
153
|
+
set(key: string, value: DerivedPrivateJwk): void;
|
|
154
|
+
}): Promise<KeyDecrypter>;
|
|
124
155
|
/**
|
|
125
156
|
* Post-processes a DWN reply, auto-decrypting data if encryption is enabled.
|
|
126
157
|
* Delegates to the SDK's Records.decrypt() with the appropriate KeyDecrypter —
|
|
@@ -131,6 +162,7 @@ export declare function resolveKeyDecrypter(agent: EnboxPlatformAgent, authorDid
|
|
|
131
162
|
* @param agent - The platform agent
|
|
132
163
|
* @param contextDerivedKeyCache - Cache for context-derived private keys
|
|
133
164
|
* @param fetchContextKeyRecordFn - Function to fetch context key records
|
|
165
|
+
* @param delegateDecryptionKeyCache - Cache for scope-aware delegate decryption keys
|
|
134
166
|
*/
|
|
135
167
|
export declare function maybeDecryptReply<T extends DwnInterface>(request: ProcessDwnRequest<T> | SendDwnRequest<T>, reply: DwnMessageReply[T], agent: EnboxPlatformAgent, contextDerivedKeyCache: {
|
|
136
168
|
get(key: string): DerivedPrivateJwk | undefined;
|
|
@@ -140,5 +172,10 @@ export declare function maybeDecryptReply<T extends DwnInterface>(request: Proce
|
|
|
140
172
|
requesterDid: string;
|
|
141
173
|
sourceProtocol: string;
|
|
142
174
|
sourceContextId: string;
|
|
143
|
-
}) => Promise<DerivedPrivateJwk | undefined
|
|
175
|
+
}) => Promise<DerivedPrivateJwk | undefined>, delegateDecryptionKeyCache?: {
|
|
176
|
+
get(key: string): DelegateDecryptionKeyEntry[] | undefined;
|
|
177
|
+
}, delegateContextKeyCache?: {
|
|
178
|
+
get(key: string): DerivedPrivateJwk | undefined;
|
|
179
|
+
set(key: string, value: DerivedPrivateJwk): void;
|
|
180
|
+
}): Promise<void>;
|
|
144
181
|
//# sourceMappingURL=dwn-encryption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dwn-encryption.d.ts","sourceRoot":"","sources":["../../src/dwn-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,YAAY,EAGZ,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"dwn-encryption.d.ts","sourceRoot":"","sources":["../../src/dwn-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,YAAY,EAGZ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GAAG,iBAAiB,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,EAC7H,uBAAuB,EAAE,CAAC,MAAM,EAAE;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,KAAK,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAC5C,0BAA0B,CAAC,EAAE;IAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,0BAA0B,EAAE,GAAG,SAAS,CAAA;CAAE,EAC3F,uBAAuB,CAAC,EAAE;IAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,GAC9H,OAAO,CAAC,IAAI,CAAC,CA+Df"}
|
|
@@ -99,16 +99,8 @@ export declare function eagerSendContextKeyRecord(agent: EnboxPlatformAgent, ten
|
|
|
99
99
|
* @param agent - The platform agent
|
|
100
100
|
* @param params - The fetch parameters
|
|
101
101
|
* @param processRequest - The agent's processRequest method (bound)
|
|
102
|
-
* @param getSigner - Function to get a signer for a DID
|
|
103
|
-
* @param sendDwnRpcRequest - Function to send a DWN RPC request
|
|
104
|
-
* @param getDwnEndpointUrlsForTarget - Function to resolve DWN endpoint URLs (with local discovery)
|
|
105
102
|
* @returns The decrypted `DerivedPrivateJwk`, or `undefined` if no matching record found
|
|
106
103
|
*/
|
|
107
|
-
export declare function fetchContextKeyRecord(
|
|
108
|
-
targetDid: string;
|
|
109
|
-
dwnEndpointUrls: string[];
|
|
110
|
-
message: any;
|
|
111
|
-
data?: Blob;
|
|
112
|
-
}) => Promise<any>, getDwnEndpointUrlsForTarget: (targetDid: string) => Promise<string[]>): Promise<DerivedPrivateJwk | undefined>;
|
|
104
|
+
export declare function fetchContextKeyRecord(_agent: EnboxPlatformAgent, params: FetchContextKeyParams, processRequest: ProcessRequestFn): Promise<DerivedPrivateJwk | undefined>;
|
|
113
105
|
export {};
|
|
114
106
|
//# sourceMappingURL=dwn-key-delivery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dwn-key-delivery.d.ts","sourceRoot":"","sources":["../../src/dwn-key-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,
|
|
1
|
+
{"version":3,"file":"dwn-key-delivery.d.ts","sourceRoot":"","sources":["../../src/dwn-key-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAUxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK9C;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,iBAAiB,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,6BAA6B,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,YAAY,CAAA;KAAE,CAAC;CACnF,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE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F,OAAO,CAAC,MAAM,CAAC,CAkFjB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,EACxD,aAAa,EAAE,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC,EACpI,iBAAiB,EAAE,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EACxH,2BAA2B,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAuDD;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,qBAAqB,EAC7B,cAAc,EAAE,gBAAgB,GAC/B,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CA2DxC"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* The protocol uses JWTs for signing, JWE (XChaCha20-Poly1305) for encryption,
|
|
13
13
|
* and ECDH (Ed25519 → X25519 + HKDF) for key agreement.
|
|
14
14
|
*/
|
|
15
|
+
import type { DerivedPrivateJwk } from '@enbox/dwn-sdk-js';
|
|
15
16
|
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
16
17
|
import type { RequireOnly } from '@enbox/common';
|
|
17
18
|
import type { DidDocument, PortableDid } from '@enbox/dids';
|
|
@@ -28,6 +29,72 @@ export type ConnectPermissionRequest = {
|
|
|
28
29
|
/** The scope of the permissions being requested for the given protocol */
|
|
29
30
|
permissionScopes: DwnPermissionScope[];
|
|
30
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* A scope-aware decryption key delivered to delegates during the connect flow.
|
|
34
|
+
*
|
|
35
|
+
* Two scope kinds:
|
|
36
|
+
*
|
|
37
|
+
* - **`protocol`** — protocol-wide key at depth `[ProtocolPath, protocolUri]`.
|
|
38
|
+
* Can derive leaf keys for any type path within the protocol.
|
|
39
|
+
* Issued when the grant covers the entire protocol (no `protocolPath`).
|
|
40
|
+
*
|
|
41
|
+
* - **`protocolPath`** — exact-path key at depth
|
|
42
|
+
* `[ProtocolPath, protocolUri, ...pathSegments]`.
|
|
43
|
+
* Can only decrypt records at that exact path — not siblings or descendants.
|
|
44
|
+
* Issued when the grant is narrowed to a specific `protocolPath`.
|
|
45
|
+
*
|
|
46
|
+
* Common conditions (both kinds):
|
|
47
|
+
* 1. The protocol has `encryptionRequired: true` types (single-party only)
|
|
48
|
+
* 2. The delegate has at least one read-like scope (Read/Query/Subscribe)
|
|
49
|
+
* 3. The protocol does NOT use multi-party / role-based access patterns
|
|
50
|
+
*
|
|
51
|
+
* Out of scope (fail closed):
|
|
52
|
+
* - `contextId`-scoped encrypted delegate reads
|
|
53
|
+
* - multi-party / ProtocolContext encrypted delegate reads
|
|
54
|
+
*/
|
|
55
|
+
export type DelegateDecryptionKey = {
|
|
56
|
+
/** The protocol URI this key is scoped to. */
|
|
57
|
+
protocol: string;
|
|
58
|
+
/** Protocol-wide decryption scope. */
|
|
59
|
+
scope: {
|
|
60
|
+
kind: 'protocol';
|
|
61
|
+
};
|
|
62
|
+
/** The derived private key material for ProtocolPath decryption. */
|
|
63
|
+
derivedPrivateKey: DerivedPrivateJwk;
|
|
64
|
+
} | {
|
|
65
|
+
/** The protocol URI this key is scoped to. */
|
|
66
|
+
protocol: string;
|
|
67
|
+
/** Exact-path decryption scope — siblings and descendants are NOT accessible. */
|
|
68
|
+
scope: {
|
|
69
|
+
kind: 'protocolPath';
|
|
70
|
+
protocolPath: string;
|
|
71
|
+
match: 'exact';
|
|
72
|
+
};
|
|
73
|
+
/** The derived private key material for ProtocolPath decryption. */
|
|
74
|
+
derivedPrivateKey: DerivedPrivateJwk;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* A context-scoped decryption key for a multi-party encrypted protocol.
|
|
78
|
+
*
|
|
79
|
+
* Delivered to delegates during the connect flow so they can decrypt
|
|
80
|
+
* ProtocolContext-encrypted records without the owner's root X25519 key.
|
|
81
|
+
*
|
|
82
|
+
* Each key is scoped to one rootContextId — it unlocks all records within
|
|
83
|
+
* that context domain but cannot access other contexts in the protocol.
|
|
84
|
+
*
|
|
85
|
+
* Delivered only when:
|
|
86
|
+
* 1. The protocol has multi-party access patterns (detected by `isMultiPartyContext`)
|
|
87
|
+
* 2. The delegate has a protocol-wide read-like scope (no protocolPath/contextId)
|
|
88
|
+
* 3. The protocol has `encryptionRequired: true` types
|
|
89
|
+
*/
|
|
90
|
+
export type DelegateContextKey = {
|
|
91
|
+
/** The protocol URI this key belongs to. */
|
|
92
|
+
protocol: string;
|
|
93
|
+
/** The root context ID this key unlocks. */
|
|
94
|
+
contextId: string;
|
|
95
|
+
/** The derived private key at `[ProtocolContext, rootContextId]`. */
|
|
96
|
+
derivedPrivateKey: DerivedPrivateJwk;
|
|
97
|
+
};
|
|
31
98
|
import { type BearerDid } from '@enbox/dids';
|
|
32
99
|
/**
|
|
33
100
|
* Pushed to the connect server so the wallet can retrieve it later.
|
|
@@ -99,6 +166,40 @@ export type EnboxConnectResponse = {
|
|
|
99
166
|
delegateGrants: DwnDataEncodedRecordsWriteMessage[];
|
|
100
167
|
/** The delegate DID's full portable form, including private keys. */
|
|
101
168
|
delegatePortableDid: PortableDid;
|
|
169
|
+
/**
|
|
170
|
+
* Scope-aware decryption keys for encrypted protocols.
|
|
171
|
+
*
|
|
172
|
+
* Derived only for read-like permission scopes (Read/Query/Subscribe) on
|
|
173
|
+
* protocols with `encryptionRequired: true` types. Write-only delegates
|
|
174
|
+
* receive no decryption keys.
|
|
175
|
+
*/
|
|
176
|
+
delegateDecryptionKeys?: DelegateDecryptionKey[];
|
|
177
|
+
/**
|
|
178
|
+
* Context-scoped decryption keys for multi-party encrypted protocols.
|
|
179
|
+
*
|
|
180
|
+
* Derived at connect time for each existing rootContextId in multi-party
|
|
181
|
+
* protocols where the delegate has a protocol-wide read-like scope.
|
|
182
|
+
* Each key is scoped to `[ProtocolContext, rootContextId]` and can decrypt
|
|
183
|
+
* all records within that context domain.
|
|
184
|
+
*
|
|
185
|
+
* Contexts created after connect are delivered automatically by
|
|
186
|
+
* `postWriteKeyDelivery()` when the owner creates a new multi-party root
|
|
187
|
+
* record on the same agent instance (same-process delivery).
|
|
188
|
+
* Cross-device delivery is a documented follow-up.
|
|
189
|
+
*/
|
|
190
|
+
delegateContextKeys?: DelegateContextKey[];
|
|
191
|
+
/**
|
|
192
|
+
* Protocol URIs that have multi-party encrypted access patterns.
|
|
193
|
+
*
|
|
194
|
+
* Delivered even when no contexts exist yet (cold-start), so the
|
|
195
|
+
* delegate's agent can register for future context key delivery.
|
|
196
|
+
*/
|
|
197
|
+
delegateMultiPartyProtocols?: string[];
|
|
198
|
+
/** Per-grant revocation mappings for session-bound self-revocation on disconnect. */
|
|
199
|
+
sessionRevocations?: {
|
|
200
|
+
grantId: string;
|
|
201
|
+
revocationGrantId: string;
|
|
202
|
+
}[];
|
|
102
203
|
};
|
|
103
204
|
/** The connect server endpoint types. */
|
|
104
205
|
export type ConnectEndpoint = 'pushedAuthorizationRequest' | 'authorize' | 'callback' | 'token';
|
|
@@ -172,7 +273,68 @@ declare function createConnectResponse(options: RequireOnly<EnboxConnectResponse
|
|
|
172
273
|
/**
|
|
173
274
|
* Creates permission grants that assign the requested scopes to a delegate DID.
|
|
174
275
|
*/
|
|
175
|
-
declare function createPermissionGrants(selectedDid: string, delegateBearerDid: BearerDid, agent: EnboxPlatformAgent, scopes: DwnPermissionScope[]
|
|
276
|
+
declare function createPermissionGrants(selectedDid: string, delegateBearerDid: BearerDid, agent: EnboxPlatformAgent, scopes: DwnPermissionScope[], delegateKeyDeliveryData?: {
|
|
277
|
+
rootKeyId: string;
|
|
278
|
+
publicKeyJwk: Record<string, any>;
|
|
279
|
+
}): Promise<DwnDataEncodedRecordsWriteMessage[]>;
|
|
280
|
+
/**
|
|
281
|
+
* Derives the minimal set of decryption keys implied by read-like permission
|
|
282
|
+
* scopes for a single-party encrypted protocol.
|
|
283
|
+
*
|
|
284
|
+
* Rules:
|
|
285
|
+
* - Only Records.Read / Records.Query / Records.Subscribe scopes contribute.
|
|
286
|
+
* - Write / Delete / Count scopes produce no decryption keys.
|
|
287
|
+
* - If any unrestricted (no `protocolPath`) read scope exists, one
|
|
288
|
+
* protocol-wide key is emitted and narrower keys are dropped.
|
|
289
|
+
* - Otherwise one exact-path key is emitted per unique `protocolPath`.
|
|
290
|
+
* - Scopes with `contextId` cause a fail-closed error.
|
|
291
|
+
* - Multi-party protocols cause a fail-closed error.
|
|
292
|
+
*
|
|
293
|
+
* @param agent - The platform agent (must hold the owner's KMS keys)
|
|
294
|
+
* @param ownerDid - The DID of the protocol owner
|
|
295
|
+
* @param protocolUri - The protocol URI
|
|
296
|
+
* @param scopes - The permission scopes for this protocol
|
|
297
|
+
* @param protocolDefinition - The protocol definition (for multi-party detection)
|
|
298
|
+
* @returns An array of `DelegateDecryptionKey` (may be empty)
|
|
299
|
+
*/
|
|
300
|
+
declare function deriveScopedDecryptionKeys(agent: EnboxPlatformAgent, ownerDid: string, protocolUri: string, scopes: DwnPermissionScope[], protocolDefinition: DwnProtocolDefinition): Promise<DelegateDecryptionKey[]>;
|
|
301
|
+
/**
|
|
302
|
+
* Detects whether a protocol definition has any root-level type whose subtree
|
|
303
|
+
* triggers multi-party semantics. Delegates to the canonical
|
|
304
|
+
* `isMultiPartyContext()` from `protocol-utils.ts` which checks:
|
|
305
|
+
*
|
|
306
|
+
* - `$role: true` descendants in the subtree
|
|
307
|
+
* - Relational `who`/`of` `$actions` rules that grant `read` access
|
|
308
|
+
*
|
|
309
|
+
* These patterns cause the DWN agent to use ProtocolContext encryption at
|
|
310
|
+
* write time, which is not supported in delegate sessions yet.
|
|
311
|
+
*/
|
|
312
|
+
/**
|
|
313
|
+
* Classifies root-level types in a protocol definition into multi-party
|
|
314
|
+
* and single-party buckets. Used to detect mixed protocols that cannot
|
|
315
|
+
* be safely modeled with a single key type.
|
|
316
|
+
*/
|
|
317
|
+
declare function classifyProtocolRoots(definition: DwnProtocolDefinition): {
|
|
318
|
+
multiParty: string[];
|
|
319
|
+
singleParty: string[];
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Derives per-context decryption keys for a delegate's access to a multi-party
|
|
323
|
+
* encrypted protocol. Queries the owner's DWN for all root-level records
|
|
324
|
+
* (thread roots, etc.) and derives a `[ProtocolContext, rootContextId]` key
|
|
325
|
+
* for each.
|
|
326
|
+
*
|
|
327
|
+
* Validates scopes first — only protocol-wide read-like scopes are accepted.
|
|
328
|
+
* `protocolPath`-scoped and `contextId`-scoped reads throw (not yet supported).
|
|
329
|
+
* Write-only scopes return empty (no decryption keys needed).
|
|
330
|
+
*
|
|
331
|
+
* @param agent - The platform agent (must hold the owner's KMS keys)
|
|
332
|
+
* @param ownerDid - The DID of the protocol owner
|
|
333
|
+
* @param protocolDefinition - The protocol definition
|
|
334
|
+
* @param scopes - The permission scopes for this protocol
|
|
335
|
+
* @returns An array of `DelegateContextKey` (may be empty)
|
|
336
|
+
*/
|
|
337
|
+
declare function deriveContextKeysForDelegate(agent: EnboxPlatformAgent, ownerDid: string, protocolDefinition: DwnProtocolDefinition, scopes: DwnPermissionScope[]): Promise<DelegateContextKey[]>;
|
|
176
338
|
/**
|
|
177
339
|
* Executes the full wallet-side (provider) flow:
|
|
178
340
|
* 1. Creates a delegate DID
|
|
@@ -201,6 +363,9 @@ export declare const EnboxConnectProtocol: {
|
|
|
201
363
|
createConnectResponse: typeof createConnectResponse;
|
|
202
364
|
createPermissionGrants: typeof createPermissionGrants;
|
|
203
365
|
submitConnectResponse: typeof submitConnectResponse;
|
|
366
|
+
deriveScopedDecryptionKeys: typeof deriveScopedDecryptionKeys;
|
|
367
|
+
deriveContextKeysForDelegate: typeof deriveContextKeysForDelegate;
|
|
368
|
+
classifyProtocolRoots: typeof classifyProtocolRoots;
|
|
204
369
|
};
|
|
205
370
|
export {};
|
|
206
371
|
//# sourceMappingURL=enbox-connect-protocol.d.ts.map
|
|
@@ -1 +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,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"enbox-connect-protocol.d.ts","sourceRoot":"","sources":["../../src/enbox-connect-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,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,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEnH;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,kBAAkB,EAAE,qBAAqB,CAAC;IAE1C,0EAA0E;IAC1E,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsB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pB,EACD,MAAM,EAAE,oBAAoB,EAAE,EAC9B,SAAS,GAAE,OAAe,GACzB,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IA6B5C,OAAO,CAAC,MAAM,CAAC,mBAAmB;IA+DlC,OAAO,CAAC,MAAM,CAAC,2BAA2B;CAG3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-closure-resolver.d.ts","sourceRoot":"","sources":["../../src/sync-closure-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAEV,wBAAwB,EACxB,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"sync-closure-resolver.d.ts","sourceRoot":"","sources":["../../src/sync-closure-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAEV,wBAAwB,EACxB,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA+ZtE;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,aAAa,CAAC,CA8FxB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,cAAc,EAAE,EAC1B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,EAAE,CAAC,CAU1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AbstractLevel } from 'abstract-level';
|
|
2
2
|
import type { GenericMessage } from '@enbox/dwn-sdk-js';
|
|
3
|
+
import type { DeadLetterCategory, DeadLetterEntry, StartSyncParams, SyncConnectivityState, SyncEngine, SyncEventListener, SyncHealthSummary, SyncIdentityOptions } from './types/sync.js';
|
|
3
4
|
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
4
|
-
import type { StartSyncParams, SyncConnectivityState, SyncEngine, SyncEventListener, SyncIdentityOptions } from './types/sync.js';
|
|
5
5
|
export type SyncEngineLevelParams = {
|
|
6
6
|
agent?: EnboxPlatformAgent;
|
|
7
7
|
dataPath?: string;
|
|
@@ -89,9 +89,18 @@ export declare class SyncEngineLevel implements SyncEngine {
|
|
|
89
89
|
private static readonly MAX_CONSECUTIVE_FAILURES;
|
|
90
90
|
/** Backoff multiplier for consecutive failures (caps at 4x the configured interval). */
|
|
91
91
|
private static readonly MAX_BACKOFF_MULTIPLIER;
|
|
92
|
+
/**
|
|
93
|
+
* Bound browser event handlers so they can be added and removed.
|
|
94
|
+
* Set in `startBrowserConnectivityListeners`, cleared in `stopBrowserConnectivityListeners`.
|
|
95
|
+
*/
|
|
96
|
+
private _onOnline?;
|
|
97
|
+
private _onOffline?;
|
|
98
|
+
private _onVisibilityChange?;
|
|
92
99
|
constructor({ agent, dataPath, db }: SyncEngineLevelParams);
|
|
93
100
|
/** Lazy accessor for the replication ledger. */
|
|
94
101
|
private get ledger();
|
|
102
|
+
/** LevelDB sublevel for permanently failed messages (dead letters). */
|
|
103
|
+
private get _deadLetters();
|
|
95
104
|
/**
|
|
96
105
|
* Retrieves the `EnboxPlatformAgent` execution context.
|
|
97
106
|
*
|
|
@@ -202,6 +211,15 @@ export declare class SyncEngineLevel implements SyncEngine {
|
|
|
202
211
|
/**
|
|
203
212
|
* Tears down all live subscriptions and push listeners.
|
|
204
213
|
*/
|
|
214
|
+
/**
|
|
215
|
+
* Registers browser `online`, `offline`, and `visibilitychange` event
|
|
216
|
+
* listeners to detect connectivity changes that WebSocket `close` events
|
|
217
|
+
* miss (NAT timeout, network switch, sleep/wake). Safe to call in Node —
|
|
218
|
+
* the guards skip registration when browser APIs are unavailable.
|
|
219
|
+
*/
|
|
220
|
+
private startBrowserConnectivityListeners;
|
|
221
|
+
/** Removes browser connectivity listeners if they were registered. */
|
|
222
|
+
private stopBrowserConnectivityListeners;
|
|
205
223
|
private teardownLiveSync;
|
|
206
224
|
/**
|
|
207
225
|
* Opens a MessagesSubscribe WebSocket subscription to a remote DWN.
|
|
@@ -383,6 +401,32 @@ export declare class SyncEngineLevel implements SyncEngine {
|
|
|
383
401
|
static topologicalSort<T extends {
|
|
384
402
|
message: GenericMessage;
|
|
385
403
|
}>(messages: T[]): T[];
|
|
404
|
+
/**
|
|
405
|
+
* Clear dead letter entries scoped to a specific sync link. Matches on
|
|
406
|
+
* (tenantDid, remoteEndpoint, protocol) so that repairing protocol A
|
|
407
|
+
* does not erase still-valid failures for protocol B on the same remote.
|
|
408
|
+
* When `protocol` is undefined (full-tenant link), clears entries that
|
|
409
|
+
* also have no protocol.
|
|
410
|
+
*/
|
|
411
|
+
private clearDeadLettersForLink;
|
|
412
|
+
/**
|
|
413
|
+
* Build a compound dead letter key. Different remotes can fail the same CID
|
|
414
|
+
* for different reasons, so the key includes the remote endpoint.
|
|
415
|
+
*/
|
|
416
|
+
private static deadLetterKey;
|
|
417
|
+
recordDeadLetter(params: {
|
|
418
|
+
messageCid: string;
|
|
419
|
+
tenantDid: string;
|
|
420
|
+
remoteEndpoint?: string;
|
|
421
|
+
protocol?: string;
|
|
422
|
+
category: DeadLetterCategory;
|
|
423
|
+
errorCode?: string;
|
|
424
|
+
errorDetail: string;
|
|
425
|
+
}): Promise<void>;
|
|
426
|
+
getFailedMessages(tenantDid?: string): Promise<DeadLetterEntry[]>;
|
|
427
|
+
clearFailedMessage(messageCid: string, remoteEndpoint?: string): Promise<boolean>;
|
|
428
|
+
clearAllFailedMessages(tenantDid?: string): Promise<void>;
|
|
429
|
+
getSyncHealth(): Promise<SyncHealthSummary>;
|
|
386
430
|
/**
|
|
387
431
|
* Returns the list of sync targets: (did, dwnUrl, delegateDid?, protocol?) tuples.
|
|
388
432
|
*/
|
|
@@ -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;AAGpD,OAAO,KAAK,EAAE,cAAc,EAAkI,MAAM,mBAAmB,CAAC;AASxL,OAAO,KAAK,
|
|
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;AAGpD,OAAO,KAAK,EAAE,cAAc,EAAkI,MAAM,mBAAmB,CAAC;AASxL,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAoC,eAAe,EAAE,qBAAqB,EAAE,UAAU,EAAa,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAuB,MAAM,iBAAiB,CAAC;AAC5P,OAAO,KAAK,EAAc,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAevE,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;AAmIF,qBAAa,eAAgB,YAAW,UAAU;IAChD;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,CAAqB;IAEpC;;OAEG;IACH,OAAO,CAAC,eAAe,CAAiB;IAExC,OAAO,CAAC,GAAG,CAA8C;IACzD,OAAO,CAAC,eAAe,CAAC,CAAiC;IACzD,OAAO,CAAC,SAAS,CAAS;IAE1B;;;;OAIG;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CAAC;IA+BjF,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBzD,aAAa,IAAI,OAAO,CAAC,iBAAiB,CAAC;IA4BxD;;OAEG;YACW,cAAc;IAsC5B;;;OAGG;YACW,wBAAwB;CAcvC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { GenericMessage, MessagesSyncDiffEntry, UnionMessageReply } from '@enbox/dwn-sdk-js';
|
|
1
2
|
import type { EnboxPlatformAgent } from './types/agent.js';
|
|
2
3
|
import type { PermissionsApi } from './types/permissions.js';
|
|
3
4
|
import type { PushResult } from './types/sync.js';
|
|
4
|
-
import type { GenericMessage, MessagesSyncDiffEntry, UnionMessageReply } from '@enbox/dwn-sdk-js';
|
|
5
5
|
/** Entry type for fetched messages with optional data stream and retry buffer. */
|
|
6
6
|
export type SyncMessageEntry = {
|
|
7
7
|
message: GenericMessage;
|
|
@@ -48,7 +48,7 @@ export declare function pullMessages({ did, dwnUrl, delegateDid, protocol, messa
|
|
|
48
48
|
prefetched?: MessagesSyncDiffEntry[];
|
|
49
49
|
agent: EnboxPlatformAgent;
|
|
50
50
|
permissionsApi: PermissionsApi;
|
|
51
|
-
}): Promise<
|
|
51
|
+
}): Promise<string[]>;
|
|
52
52
|
/**
|
|
53
53
|
* Fetches messages from a remote DWN by their CIDs using MessagesRead.
|
|
54
54
|
*/
|
|
@@ -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,cAAc,EAAqB,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAErH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;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AAM,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,gBAAgB,EAAE,CAAC,CAoE9B;AAED;;;;;;;;;GASG;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,UAAU,CAAC,CA2DtB;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;IAC1G,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAmCxC"}
|
|
@@ -41,6 +41,11 @@ export type CreateGrantParams = {
|
|
|
41
41
|
grantedTo: string;
|
|
42
42
|
scope: DwnPermissionScope;
|
|
43
43
|
delegated?: boolean;
|
|
44
|
+
/** Delegate key-delivery metadata for cross-device context key delivery. */
|
|
45
|
+
delegateKeyDelivery?: {
|
|
46
|
+
rootKeyId: string;
|
|
47
|
+
publicKeyJwk: Record<string, any>;
|
|
48
|
+
};
|
|
44
49
|
};
|
|
45
50
|
export type CreateRequestParams = {
|
|
46
51
|
store?: boolean;
|
|
@@ -54,6 +59,10 @@ export type CreateRevocationParams = {
|
|
|
54
59
|
author: string;
|
|
55
60
|
grant: DwnPermissionGrant;
|
|
56
61
|
description?: string;
|
|
62
|
+
/** For delegated revocation: the delegate DID that signs the revocation. */
|
|
63
|
+
granteeDid?: string;
|
|
64
|
+
/** For delegated revocation: the grant ID that authorizes the revocation write. */
|
|
65
|
+
permissionGrantId?: string;
|
|
57
66
|
};
|
|
58
67
|
export type GetPermissionParams = {
|
|
59
68
|
connectedDid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/types/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9I,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;I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