@enbox/dwn-sdk-js 0.4.4 → 0.4.6
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 +15 -15
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/generated/precompiled-validators.js +5406 -2391
- package/dist/esm/generated/precompiled-validators.js.map +1 -1
- package/dist/esm/json-schemas/definitions.json +18 -0
- package/dist/esm/src/core/constants.js +3 -3
- package/dist/esm/src/core/constants.js.map +1 -1
- package/dist/esm/src/core/dwn-error.js +29 -1
- package/dist/esm/src/core/dwn-error.js.map +1 -1
- package/dist/esm/src/core/messages-grant-authorization.js +20 -0
- package/dist/esm/src/core/messages-grant-authorization.js.map +1 -1
- package/dist/esm/src/core/protocol-authorization-validation.js +80 -3
- package/dist/esm/src/core/protocol-authorization-validation.js.map +1 -1
- package/dist/esm/src/core/recording-validation-state-reader.js +5 -0
- package/dist/esm/src/core/recording-validation-state-reader.js.map +1 -1
- package/dist/esm/src/core/replication-apply.js +163 -7
- package/dist/esm/src/core/replication-apply.js.map +1 -1
- package/dist/esm/src/core/validation-state-reader.js +20 -0
- package/dist/esm/src/core/validation-state-reader.js.map +1 -1
- package/dist/esm/src/dwn.js +19 -2
- package/dist/esm/src/dwn.js.map +1 -1
- package/dist/esm/src/handlers/messages-query.js +3 -5
- package/dist/esm/src/handlers/messages-query.js.map +1 -1
- package/dist/esm/src/handlers/protocols-configure.js +10 -4
- package/dist/esm/src/handlers/protocols-configure.js.map +1 -1
- package/dist/esm/src/handlers/records-write.js +1 -1
- package/dist/esm/src/handlers/records-write.js.map +1 -1
- package/dist/esm/src/index.js +2 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/interfaces/protocols-configure.js +23 -10
- package/dist/esm/src/interfaces/protocols-configure.js.map +1 -1
- package/dist/esm/src/interfaces/records-write-signing.js +2 -8
- package/dist/esm/src/interfaces/records-write-signing.js.map +1 -1
- package/dist/esm/src/interfaces/records-write.js +43 -65
- package/dist/esm/src/interfaces/records-write.js.map +1 -1
- package/dist/esm/src/protocols/encryption.js +411 -0
- package/dist/esm/src/protocols/encryption.js.map +1 -0
- package/dist/esm/src/protocols/permission-grant.js +0 -5
- package/dist/esm/src/protocols/permission-grant.js.map +1 -1
- package/dist/esm/src/types/message-types.js.map +1 -1
- package/dist/esm/src/types/permission-types.js.map +1 -1
- package/dist/esm/src/types/protocols-types.js.map +1 -1
- package/dist/esm/src/utils/encryption.js +156 -188
- package/dist/esm/src/utils/encryption.js.map +1 -1
- package/dist/esm/src/utils/hd-key.js +0 -1
- package/dist/esm/src/utils/hd-key.js.map +1 -1
- package/dist/esm/src/utils/permission-scope.js +9 -6
- package/dist/esm/src/utils/permission-scope.js.map +1 -1
- package/dist/esm/src/utils/protocols.js +12 -9
- package/dist/esm/src/utils/protocols.js.map +1 -1
- package/dist/esm/src/utils/records.js +54 -56
- package/dist/esm/src/utils/records.js.map +1 -1
- package/dist/esm/src/utils/replication.js +27 -4
- package/dist/esm/src/utils/replication.js.map +1 -1
- package/dist/esm/tests/core/replication-apply.spec.js +141 -1
- package/dist/esm/tests/core/replication-apply.spec.js.map +1 -1
- package/dist/esm/tests/core/replication-replay-property.spec.js +1 -0
- package/dist/esm/tests/core/replication-replay-property.spec.js.map +1 -1
- package/dist/esm/tests/core/validation-read-closure.spec.js +111 -0
- package/dist/esm/tests/core/validation-read-closure.spec.js.map +1 -1
- package/dist/esm/tests/core/validation-state-reader.spec.js +89 -0
- package/dist/esm/tests/core/validation-state-reader.spec.js.map +1 -1
- package/dist/esm/tests/features/protocol-composition.spec.js +30 -31
- package/dist/esm/tests/features/protocol-composition.spec.js.map +1 -1
- package/dist/esm/tests/fuzz/encryption.fuzz.spec.js +29 -121
- package/dist/esm/tests/fuzz/encryption.fuzz.spec.js.map +1 -1
- package/dist/esm/tests/handlers/messages-query.spec.js +71 -3
- package/dist/esm/tests/handlers/messages-query.spec.js.map +1 -1
- package/dist/esm/tests/handlers/messages-read.spec.js +2 -2
- package/dist/esm/tests/handlers/messages-read.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-read.spec.js +9 -135
- package/dist/esm/tests/handlers/records-read.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-write.spec.js +279 -19
- package/dist/esm/tests/handlers/records-write.spec.js.map +1 -1
- package/dist/esm/tests/interfaces/protocols-configure.spec.js +17 -22
- package/dist/esm/tests/interfaces/protocols-configure.spec.js.map +1 -1
- package/dist/esm/tests/interfaces/records-write.spec.js +170 -150
- package/dist/esm/tests/interfaces/records-write.spec.js.map +1 -1
- package/dist/esm/tests/protocols/encryption.spec.js +914 -0
- package/dist/esm/tests/protocols/encryption.spec.js.map +1 -0
- package/dist/esm/tests/scenarios/end-to-end-tests.spec.js +100 -100
- package/dist/esm/tests/scenarios/end-to-end-tests.spec.js.map +1 -1
- package/dist/esm/tests/store/message-store-level.spec.js +20 -2
- package/dist/esm/tests/store/message-store-level.spec.js.map +1 -1
- package/dist/esm/tests/utils/encryption-callbacks.spec.js +88 -125
- package/dist/esm/tests/utils/encryption-callbacks.spec.js.map +1 -1
- package/dist/esm/tests/utils/encryption.spec.js +121 -271
- package/dist/esm/tests/utils/encryption.spec.js.map +1 -1
- package/dist/esm/tests/utils/permission-scope.spec.js +5 -1
- package/dist/esm/tests/utils/permission-scope.spec.js.map +1 -1
- package/dist/esm/tests/utils/records.spec.js +15 -5
- package/dist/esm/tests/utils/records.spec.js.map +1 -1
- package/dist/esm/tests/utils/test-data-generator.js +7 -44
- package/dist/esm/tests/utils/test-data-generator.js.map +1 -1
- package/dist/esm/tests/validation/json-schemas/encryption/audience-key.spec.js +40 -0
- package/dist/esm/tests/validation/json-schemas/encryption/audience-key.spec.js.map +1 -0
- package/dist/esm/tests/validation/json-schemas/encryption/grant-key.spec.js +72 -0
- package/dist/esm/tests/validation/json-schemas/encryption/grant-key.spec.js.map +1 -0
- package/dist/types/generated/precompiled-validators.d.ts +140 -92
- package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
- package/dist/types/src/core/constants.d.ts +2 -2
- package/dist/types/src/core/constants.d.ts.map +1 -1
- package/dist/types/src/core/core-protocol.d.ts +1 -1
- package/dist/types/src/core/core-protocol.d.ts.map +1 -1
- package/dist/types/src/core/dwn-error.d.ts +29 -1
- package/dist/types/src/core/dwn-error.d.ts.map +1 -1
- package/dist/types/src/core/messages-grant-authorization.d.ts +2 -0
- package/dist/types/src/core/messages-grant-authorization.d.ts.map +1 -1
- package/dist/types/src/core/protocol-authorization-validation.d.ts +2 -2
- package/dist/types/src/core/protocol-authorization-validation.d.ts.map +1 -1
- package/dist/types/src/core/recording-validation-state-reader.d.ts +9 -0
- package/dist/types/src/core/recording-validation-state-reader.d.ts.map +1 -1
- package/dist/types/src/core/replication-apply.d.ts +4 -3
- package/dist/types/src/core/replication-apply.d.ts.map +1 -1
- package/dist/types/src/core/validation-state-reader.d.ts +9 -0
- package/dist/types/src/core/validation-state-reader.d.ts.map +1 -1
- package/dist/types/src/dwn.d.ts +1 -0
- package/dist/types/src/dwn.d.ts.map +1 -1
- package/dist/types/src/handlers/messages-query.d.ts.map +1 -1
- package/dist/types/src/handlers/protocols-configure.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +6 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/interfaces/protocols-configure.d.ts +1 -1
- package/dist/types/src/interfaces/protocols-configure.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-write-signing.d.ts +4 -8
- package/dist/types/src/interfaces/records-write-signing.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-write.d.ts +10 -26
- package/dist/types/src/interfaces/records-write.d.ts.map +1 -1
- package/dist/types/src/protocols/encryption.d.ts +43 -0
- package/dist/types/src/protocols/encryption.d.ts.map +1 -0
- package/dist/types/src/protocols/permission-grant.d.ts +0 -7
- package/dist/types/src/protocols/permission-grant.d.ts.map +1 -1
- package/dist/types/src/types/encryption-types.d.ts +5 -38
- package/dist/types/src/types/encryption-types.d.ts.map +1 -1
- package/dist/types/src/types/message-types.d.ts +0 -13
- package/dist/types/src/types/message-types.d.ts.map +1 -1
- package/dist/types/src/types/permission-types.d.ts +0 -9
- package/dist/types/src/types/permission-types.d.ts.map +1 -1
- package/dist/types/src/types/protocols-types.d.ts +9 -14
- package/dist/types/src/types/protocols-types.d.ts.map +1 -1
- package/dist/types/src/types/records-types.d.ts +3 -3
- package/dist/types/src/types/records-types.d.ts.map +1 -1
- package/dist/types/src/types/validation-state-reader.d.ts +12 -0
- package/dist/types/src/types/validation-state-reader.d.ts.map +1 -1
- package/dist/types/src/utils/encryption.d.ts +61 -145
- package/dist/types/src/utils/encryption.d.ts.map +1 -1
- package/dist/types/src/utils/hd-key.d.ts +1 -1
- package/dist/types/src/utils/hd-key.d.ts.map +1 -1
- package/dist/types/src/utils/permission-scope.d.ts +4 -3
- package/dist/types/src/utils/permission-scope.d.ts.map +1 -1
- package/dist/types/src/utils/protocols.d.ts +3 -5
- package/dist/types/src/utils/protocols.d.ts.map +1 -1
- package/dist/types/src/utils/records.d.ts +5 -13
- package/dist/types/src/utils/records.d.ts.map +1 -1
- package/dist/types/src/utils/replication.d.ts +3 -0
- package/dist/types/src/utils/replication.d.ts.map +1 -1
- package/dist/types/tests/features/protocol-composition.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/messages-query.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-read.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-write.spec.d.ts.map +1 -1
- package/dist/types/tests/protocols/encryption.spec.d.ts +2 -0
- package/dist/types/tests/protocols/encryption.spec.d.ts.map +1 -0
- package/dist/types/tests/scenarios/end-to-end-tests.spec.d.ts.map +1 -1
- package/dist/types/tests/utils/test-data-generator.d.ts +0 -5
- package/dist/types/tests/utils/test-data-generator.d.ts.map +1 -1
- package/dist/types/tests/validation/json-schemas/encryption/audience-key.spec.d.ts +2 -0
- package/dist/types/tests/validation/json-schemas/encryption/audience-key.spec.d.ts.map +1 -0
- package/dist/types/tests/validation/json-schemas/encryption/grant-key.spec.d.ts +2 -0
- package/dist/types/tests/validation/json-schemas/encryption/grant-key.spec.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/core/constants.ts +3 -3
- package/src/core/core-protocol.ts +1 -1
- package/src/core/dwn-error.ts +29 -1
- package/src/core/messages-grant-authorization.ts +27 -0
- package/src/core/protocol-authorization-validation.ts +145 -6
- package/src/core/recording-validation-state-reader.ts +13 -0
- package/src/core/replication-apply.ts +222 -8
- package/src/core/validation-state-reader.ts +30 -0
- package/src/dwn.ts +24 -2
- package/src/handlers/messages-query.ts +6 -5
- package/src/handlers/protocols-configure.ts +19 -3
- package/src/handlers/records-write.ts +1 -1
- package/src/index.ts +15 -5
- package/src/interfaces/protocols-configure.ts +39 -12
- package/src/interfaces/records-write-signing.ts +5 -12
- package/src/interfaces/records-write.ts +75 -92
- package/src/protocols/encryption.ts +649 -0
- package/src/protocols/permission-grant.ts +0 -6
- package/src/types/encryption-types.ts +9 -38
- package/src/types/message-types.ts +0 -13
- package/src/types/permission-types.ts +0 -10
- package/src/types/protocols-types.ts +9 -16
- package/src/types/records-types.ts +3 -3
- package/src/types/validation-state-reader.ts +13 -0
- package/src/utils/encryption.ts +258 -280
- package/src/utils/hd-key.ts +1 -1
- package/src/utils/permission-scope.ts +10 -6
- package/src/utils/protocols.ts +16 -15
- package/src/utils/records.ts +86 -71
- package/src/utils/replication.ts +30 -4
- package/dist/esm/tests/vectors/protocol-definitions/chat.json +0 -70
|
@@ -1,53 +1,24 @@
|
|
|
1
|
-
import type { JweKeyUnwrapPayload } from '../utils/encryption.js';
|
|
2
1
|
import type { KeyDerivationScheme } from '../utils/hd-key.js';
|
|
2
|
+
import type { KeyUnwrapPayload } from '../utils/encryption.js';
|
|
3
3
|
import type { PublicKeyJwk } from './jose-types.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* The implementor performs HKDF key derivation and public key computation
|
|
8
|
-
* internally — the private key never leaves the implementation boundary.
|
|
9
|
-
*
|
|
10
|
-
* Analogous to `MessageSigner` for signing operations.
|
|
11
|
-
*/
|
|
5
|
+
export type KeyDecrypterDerivationScheme = KeyDerivationScheme | 'roleAudience';
|
|
6
|
+
|
|
12
7
|
export interface EncryptionKeyDeriver {
|
|
13
|
-
/** Fully qualified key ID (e.g. did:example:alice#enc) */
|
|
14
8
|
rootKeyId: string;
|
|
15
|
-
/** The derivation scheme (e.g. KeyDerivationScheme.ProtocolPath) */
|
|
16
9
|
derivationScheme: KeyDerivationScheme;
|
|
17
|
-
|
|
18
|
-
* Derives an HD child public key for the given full derivation path.
|
|
19
|
-
* The private key material stays within the implementor's boundary.
|
|
20
|
-
*
|
|
21
|
-
* @param fullDerivationPath - The complete HKDF path segments
|
|
22
|
-
* (e.g. ['protocolPath', 'https://chat.example', 'thread', 'message'])
|
|
23
|
-
* @returns The derived child public key as a JWK
|
|
24
|
-
*/
|
|
10
|
+
|
|
25
11
|
derivePublicKey(fullDerivationPath: string[]): Promise<PublicKeyJwk>;
|
|
26
12
|
}
|
|
27
13
|
|
|
28
|
-
/**
|
|
29
|
-
* A callback interface for decrypting JWE-wrapped Content Encryption Keys (CEKs).
|
|
30
|
-
* The implementor performs HKDF key derivation, ECDH-ES key agreement, and AES Key Unwrap
|
|
31
|
-
* internally — the private key never leaves the implementation boundary.
|
|
32
|
-
*
|
|
33
|
-
* Analogous to `MessageSigner` for signing operations.
|
|
34
|
-
*/
|
|
35
14
|
export interface KeyDecrypter {
|
|
36
|
-
/** Fully qualified key ID (e.g. did:example:alice#enc) */
|
|
37
15
|
rootKeyId: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* leaf decryption key via HKDF through the given derivation path, then
|
|
43
|
-
* performing ECDH-ES key agreement and AES-256 Key Unwrap.
|
|
44
|
-
*
|
|
45
|
-
* @param fullDerivationPath - The complete HKDF path to derive the leaf key
|
|
46
|
-
* @param jweKeyUnwrapPayload - The wrapped CEK and ephemeral public key from the JWE recipient
|
|
47
|
-
* @returns The unwrapped CEK bytes (typically 32 bytes for AES-256)
|
|
48
|
-
*/
|
|
16
|
+
derivationScheme: KeyDecrypterDerivationScheme;
|
|
17
|
+
|
|
18
|
+
derivePublicKey(fullDerivationPath: string[]): Promise<PublicKeyJwk>;
|
|
19
|
+
|
|
49
20
|
decrypt(
|
|
50
21
|
fullDerivationPath: string[],
|
|
51
|
-
|
|
22
|
+
keyUnwrapPayload: KeyUnwrapPayload,
|
|
52
23
|
): Promise<Uint8Array>;
|
|
53
24
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { GeneralJws } from './jws-types.js';
|
|
2
2
|
import type { ProgressToken } from './subscriptions.js';
|
|
3
|
-
import type { PublicKeyJwk } from './jose-types.js';
|
|
4
3
|
import type { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
|
|
5
4
|
import type { PaginationCursor, SortDirection } from './query-types.js';
|
|
6
5
|
|
|
@@ -44,18 +43,6 @@ export type AuthorizationModel = {
|
|
|
44
43
|
*/
|
|
45
44
|
ownerDelegatedGrant?: DelegatedGrantRecordsWriteMessage;
|
|
46
45
|
|
|
47
|
-
/**
|
|
48
|
-
* The author's ProtocolPath-derived public key for the key-delivery protocol's
|
|
49
|
-
* `contextKey` path. Included by external authors on cross-DWN encrypted
|
|
50
|
-
* protocol records so the DWN owner can encrypt a context key back to them
|
|
51
|
-
* without needing to query the author's DWN.
|
|
52
|
-
*/
|
|
53
|
-
authorKeyDeliveryPublicKey?: {
|
|
54
|
-
/** Fully-qualified verification method ID (e.g. `did:example:bob#enc`). */
|
|
55
|
-
rootKeyId: string;
|
|
56
|
-
/** The author's ProtocolPath-derived public key in JWK format. */
|
|
57
|
-
publicKeyJwk: PublicKeyJwk;
|
|
58
|
-
};
|
|
59
46
|
};
|
|
60
47
|
|
|
61
48
|
export type DelegatedGrantRecordsWriteMessage = {
|
|
@@ -109,16 +109,6 @@ export type PermissionGrantData = {
|
|
|
109
109
|
|
|
110
110
|
conditions?: PermissionConditions;
|
|
111
111
|
|
|
112
|
-
/**
|
|
113
|
-
* Optional delegate key-delivery metadata for cross-device context key delivery.
|
|
114
|
-
* Contains the pre-derived ProtocolPath leaf public key that the owner uses
|
|
115
|
-
* to encrypt contextKey records addressed to the delegate.
|
|
116
|
-
*/
|
|
117
|
-
delegateKeyDelivery?: {
|
|
118
|
-
rootKeyId: string;
|
|
119
|
-
publicKeyJwk: Record<string, any>;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
112
|
/** Optional metadata for the connect session that created this grant. */
|
|
123
113
|
connectSession?: ConnectSessionMetadata;
|
|
124
114
|
};
|
|
@@ -12,6 +12,7 @@ export type ProtocolsConfigureDescriptor = {
|
|
|
12
12
|
|
|
13
13
|
export type ProtocolDefinition = {
|
|
14
14
|
protocol: string;
|
|
15
|
+
$keyAgreement?: ProtocolKeyAgreement;
|
|
15
16
|
/**
|
|
16
17
|
* Denotes if this Protocol Definition can be returned by unauthenticated or unauthorized `ProtocolsQuery`.
|
|
17
18
|
*/
|
|
@@ -132,18 +133,9 @@ export type ProtocolActionRule = {
|
|
|
132
133
|
can: (ProtocolAction | `${ProtocolAction}` | (string & {}))[];
|
|
133
134
|
};
|
|
134
135
|
/**
|
|
135
|
-
*
|
|
136
|
+
* Public key used for protocol-path content encryption.
|
|
136
137
|
*/
|
|
137
|
-
export type
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* The ID of the root key that derives the public key at this protocol path for encrypting the symmetric key used for data encryption.
|
|
141
|
-
*/
|
|
142
|
-
rootKeyId: string;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Public key for encrypting the symmetric key used for data encryption.
|
|
146
|
-
*/
|
|
138
|
+
export type ProtocolKeyAgreement = {
|
|
147
139
|
publicKeyJwk: PublicKeyJwk;
|
|
148
140
|
};
|
|
149
141
|
|
|
@@ -224,6 +216,7 @@ export type ProtocolTagSchema = {
|
|
|
224
216
|
exclusiveMaximum?: number;
|
|
225
217
|
minLength?: number;
|
|
226
218
|
maxLength?: number;
|
|
219
|
+
pattern?: string;
|
|
227
220
|
minItems?: number;
|
|
228
221
|
maxItems?: number;
|
|
229
222
|
uniqueItems?: boolean;
|
|
@@ -234,13 +227,13 @@ export type ProtocolTagSchema = {
|
|
|
234
227
|
/**
|
|
235
228
|
* Union of all value types that can appear as properties of a `ProtocolRuleSet`.
|
|
236
229
|
* This includes:
|
|
237
|
-
* - `$`-prefixed directive values (`$
|
|
230
|
+
* - `$`-prefixed directive values (`$keyAgreement`, `$actions`, `$role`, `$ref`, `$size`, `$tags`, `$delivery`)
|
|
238
231
|
* - Child `ProtocolRuleSet` entries (non-`$` keys)
|
|
239
232
|
*/
|
|
240
233
|
type ProtocolRuleSetValue =
|
|
241
234
|
| ProtocolRuleSet
|
|
242
235
|
| ProtocolActionRule[]
|
|
243
|
-
|
|
|
236
|
+
| ProtocolKeyAgreement
|
|
244
237
|
| ProtocolTagsDefinition
|
|
245
238
|
| ProtocolSizeDefinition
|
|
246
239
|
| ProtocolRecordLimitDefinition
|
|
@@ -251,9 +244,9 @@ type ProtocolRuleSetValue =
|
|
|
251
244
|
|
|
252
245
|
export type ProtocolRuleSet = {
|
|
253
246
|
/**
|
|
254
|
-
*
|
|
247
|
+
* Key agreement setting for records at this protocol path.
|
|
255
248
|
*/
|
|
256
|
-
$
|
|
249
|
+
$keyAgreement?: ProtocolKeyAgreement;
|
|
257
250
|
$actions?: ProtocolActionRule[];
|
|
258
251
|
|
|
259
252
|
/**
|
|
@@ -268,7 +261,7 @@ export type ProtocolRuleSet = {
|
|
|
268
261
|
* and `typePath` is the protocol path of the type in the external protocol's structure.
|
|
269
262
|
*
|
|
270
263
|
* A `$ref` node is a pure attachment point — it must NOT have `$actions`, `$role`, `$size`,
|
|
271
|
-
* `$tags`, or `$
|
|
264
|
+
* `$tags`, or `$keyAgreement`. Authorization for the referenced type is governed by its own
|
|
272
265
|
* protocol. Only children defined under the `$ref` node get `$actions` from the composing protocol.
|
|
273
266
|
*
|
|
274
267
|
* Example:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { DwnEncryption } from '../utils/encryption.js';
|
|
1
2
|
import type { GeneralJws } from './jws-types.js';
|
|
2
|
-
import type { JweEncryption } from '../utils/encryption.js';
|
|
3
3
|
import type { AuthorizationModel, GenericMessage, GenericMessageReply, GenericSignaturePayload, MessageSubscription, Pagination } from './message-types.js';
|
|
4
4
|
import type { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
|
|
5
5
|
import type { PaginationCursor, RangeCriterion, RangeFilter, StartsWithFilter } from './query-types.js';
|
|
@@ -60,7 +60,7 @@ export type InternalRecordsWriteMessage = GenericMessage & {
|
|
|
60
60
|
contextId?: string;
|
|
61
61
|
descriptor: RecordsWriteDescriptor;
|
|
62
62
|
attestation?: GeneralJws;
|
|
63
|
-
encryption?:
|
|
63
|
+
encryption?: DwnEncryption;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
export type RecordsWriteMessage = {
|
|
@@ -69,7 +69,7 @@ export type RecordsWriteMessage = {
|
|
|
69
69
|
contextId: string;
|
|
70
70
|
descriptor: RecordsWriteDescriptor;
|
|
71
71
|
attestation?: GeneralJws;
|
|
72
|
-
encryption?:
|
|
72
|
+
encryption?: DwnEncryption;
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -78,6 +78,19 @@ export interface ValidationStateReader {
|
|
|
78
78
|
contextIdPrefix?: string;
|
|
79
79
|
}): Promise<RecordsWriteMessage[]>;
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Queries accepted audience epoch records in the Encryption Protocol.
|
|
83
|
+
* The optional `keyId` narrows the lookup to one published audience key.
|
|
84
|
+
*/
|
|
85
|
+
queryAudienceEpochs(input: {
|
|
86
|
+
tenant: string;
|
|
87
|
+
protocol: string;
|
|
88
|
+
contextId: string;
|
|
89
|
+
role: string;
|
|
90
|
+
epoch: number;
|
|
91
|
+
keyId?: string;
|
|
92
|
+
}): Promise<RecordsWriteMessage[]>;
|
|
93
|
+
|
|
81
94
|
/**
|
|
82
95
|
* Fetches the permission grant with the given record ID, with its scope parsed from grant data.
|
|
83
96
|
* @throws {DwnError} with `GrantAuthorizationGrantMissing` when the grant does not exist.
|