@tinycloud/sdk-services 3.11.0 → 3.12.0-beta.16
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/{BaseService-Ma2MwJAd.d.ts → BaseService-BRDG69KR.d.ts} +1 -1
- package/dist/{BaseService-O0iyuFLk.d.cts → BaseService-CdBkfPGE.d.cts} +1 -1
- package/dist/{IHooksService-4QNODVy6.d.cts → IHooksService-C9p3stsB.d.cts} +1 -1
- package/dist/{IHooksService-CvTpJbQD.d.ts → IHooksService-D6eyZat1.d.ts} +1 -1
- package/dist/{ISQLService-Aly1CBsW.d.ts → ISQLService-B_4KcGA-.d.ts} +1 -1
- package/dist/{ISQLService-BOgWzHLT.d.cts → ISQLService-C6nNpcls.d.cts} +1 -1
- package/dist/context.cjs +4 -0
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.js +4 -0
- package/dist/context.js.map +1 -1
- package/dist/encryption/index.cjs +276 -14
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.d.cts +26 -28
- package/dist/encryption/index.d.ts +26 -28
- package/dist/encryption/index.js +268 -14
- package/dist/encryption/index.js.map +1 -1
- package/dist/encryption/named-keys.cjs +225 -14
- package/dist/encryption/named-keys.cjs.map +1 -1
- package/dist/encryption/named-keys.d.cts +7 -2
- package/dist/encryption/named-keys.d.ts +7 -2
- package/dist/encryption/named-keys.js +225 -14
- package/dist/encryption/named-keys.js.map +1 -1
- package/dist/encryption/resource.cjs.map +1 -1
- package/dist/encryption/resource.js.map +1 -1
- package/dist/feed/index.cjs +4 -0
- package/dist/feed/index.cjs.map +1 -1
- package/dist/feed/index.d.cts +3 -3
- package/dist/feed/index.d.ts +3 -3
- package/dist/feed/index.js +4 -0
- package/dist/feed/index.js.map +1 -1
- package/dist/index.cjs +523 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -12
- package/dist/index.d.ts +14 -12
- package/dist/index.js +513 -29
- package/dist/index.js.map +1 -1
- package/dist/internal/decrypt-transport-response-error.d.cts +1 -1
- package/dist/internal/decrypt-transport-response-error.d.ts +1 -1
- package/dist/kv/index.cjs +48 -11
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.d.cts +5 -5
- package/dist/kv/index.d.ts +5 -5
- package/dist/kv/index.js +48 -11
- package/dist/kv/index.js.map +1 -1
- package/dist/kv/replication/index.cjs +39 -8
- package/dist/kv/replication/index.cjs.map +1 -1
- package/dist/kv/replication/index.d.cts +3 -3
- package/dist/kv/replication/index.d.ts +3 -3
- package/dist/kv/replication/index.js +38 -7
- package/dist/kv/replication/index.js.map +1 -1
- package/dist/{scope-DEgc9f-W.d.cts → scope-DtcbyRKY.d.cts} +1 -1
- package/dist/{scope-BZr0QwxX.d.ts → scope-J20PQP3u.d.ts} +1 -1
- package/dist/sql/index.cjs +36 -0
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +4 -4
- package/dist/sql/index.d.ts +4 -4
- package/dist/sql/index.js +36 -0
- package/dist/sql/index.js.map +1 -1
- package/dist/telemetry/requestLog.cjs +4 -0
- package/dist/telemetry/requestLog.cjs.map +1 -1
- package/dist/telemetry/requestLog.d.cts +1 -1
- package/dist/telemetry/requestLog.d.ts +1 -1
- package/dist/telemetry/requestLog.js +4 -0
- package/dist/telemetry/requestLog.js.map +1 -1
- package/dist/{types-D4XbIfFJ.d.cts → types-DfqNz9Nu.d.cts} +135 -6
- package/dist/{types-CSd0RYir.d.ts → types-DjAP8dve.d.cts} +4 -0
- package/dist/{types-CSd0RYir.d.cts → types-DjAP8dve.d.ts} +4 -0
- package/dist/{types-Bf91gup6.d.ts → types-Nvi_RckJ.d.ts} +135 -6
- package/package.json +4 -1
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import { B as BaseService } from '../BaseService-
|
|
2
|
-
import { c as IService, f as Result } from '../types-
|
|
3
|
-
import { N as NetworkDescriptor, n as EncryptionError, I as InlineEncryptedEnvelope, D as DecryptCapabilityProof, j as DecryptResponseBody, E as EncryptionCrypto, h as DecryptInvocationSigner,
|
|
4
|
-
export { C as CanonicalJson, b as DECRYPT_ACTION, c as DECRYPT_FACT_TYPE, d as DECRYPT_RESULT_TYPE, e as DEFAULT_ENCRYPTION_ALG, f as DEFAULT_KEY_VERSION, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, o as EncryptionErrorInput, J as Json,
|
|
1
|
+
import { B as BaseService } from '../BaseService-CdBkfPGE.cjs';
|
|
2
|
+
import { c as IService, f as Result } from '../types-DjAP8dve.cjs';
|
|
3
|
+
import { N as NetworkDescriptor, n as EncryptionError, I as InlineEncryptedEnvelope, D as DecryptCapabilityProof, j as DecryptResponseBody, E as EncryptionCrypto, h as DecryptInvocationSigner, s as ReceiverKeySigner, r as ReceiverKeyPair, i as DecryptRequestBody, g as DecryptInvocationFact, B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation, Z as KeyWrapContext } from '../types-DfqNz9Nu.cjs';
|
|
4
|
+
export { C as CanonicalJson, _ as ColumnFormat, b as DECRYPT_ACTION, c as DECRYPT_FACT_TYPE, d as DECRYPT_RESULT_TYPE, e as DEFAULT_ENCRYPTION_ALG, f as DEFAULT_KEY_VERSION, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, o as EncryptionErrorInput, J as Json, $ as KEY_WRAP_V2_ALG, a0 as KeyWrapV2Header, a1 as assertKeyWrapAlgorithm, a2 as assertKeyWrapContext, F as base64Decode, G as base64Encode, H as canonicalHashHex, K as canonicalize, a3 as decryptColumn, O as encryptionError, Q as hexDecode, S as hexEncode, a4 as isKeyWrapV2, a5 as openKeyV2, a6 as readKeyWrapV2, a7 as sealKeyV2, W as utf8Decode, X as utf8Encode } from '../types-DfqNz9Nu.cjs';
|
|
5
5
|
export { DecryptTransportResponseError } from '@tinycloud/sdk-services/internal/decrypt-transport-response-error';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Network-descriptor discovery.
|
|
9
|
-
*
|
|
10
|
-
* Resolution order (per architecture):
|
|
11
|
-
*
|
|
12
|
-
* 1. The node's authoritative endpoint
|
|
13
|
-
* `GET /encryption/networks/<networkId>` returns the current
|
|
14
|
-
* descriptor (`state`, `publicEncryptionKey`, `keyVersion`, ...).
|
|
15
|
-
* 2. If the node is unreachable, fall back to the cached discovery
|
|
16
|
-
* record at `.well-known/encryption/network/<name>` inside the
|
|
17
|
-
* owner's public space.
|
|
18
|
-
*
|
|
19
|
-
* The node DB is authoritative on conflict; cached records are
|
|
20
|
-
* advisory only.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
7
|
type DiscoverySource = "node" | "well-known";
|
|
24
8
|
interface DiscoveredNetwork {
|
|
25
9
|
descriptor: NetworkDescriptor;
|
|
@@ -45,8 +29,8 @@ interface DiscoverNetworkInput {
|
|
|
45
29
|
wellKnown?: WellKnownDescriptorFetcher;
|
|
46
30
|
}
|
|
47
31
|
/**
|
|
48
|
-
* Resolve a network descriptor. The node fetcher is preferred
|
|
49
|
-
* well-known
|
|
32
|
+
* Resolve a network descriptor. The node fetcher is preferred. An optional
|
|
33
|
+
* well-known cache cannot override a typed registry, identity, or transport failure.
|
|
50
34
|
*
|
|
51
35
|
* The returned descriptor is sanity-checked: `networkId`, `ownerDid`,
|
|
52
36
|
* and `name` must agree with the URN, and the public key field must
|
|
@@ -85,11 +69,13 @@ declare function ensureNetworkUsableForDecrypt(descriptor: NetworkDescriptor): {
|
|
|
85
69
|
*/
|
|
86
70
|
|
|
87
71
|
interface EncryptToNetworkOptions {
|
|
72
|
+
/** Write TCW2 key wraps. Defaults to the service setting, otherwise false. */
|
|
73
|
+
keyWrapV2?: boolean;
|
|
88
74
|
/** Exact named-key path to bind into the returned envelope. */
|
|
89
75
|
keyPath?: string;
|
|
90
76
|
/** Optional associated authenticated data (bytes). */
|
|
91
77
|
aad?: Uint8Array;
|
|
92
|
-
/** Ciphersuite override
|
|
78
|
+
/** Ciphersuite override; must match the selected key-wrap writer. */
|
|
93
79
|
alg?: string;
|
|
94
80
|
/** Key version override. Defaults to the network's current key version. */
|
|
95
81
|
keyVersion?: number;
|
|
@@ -131,6 +117,10 @@ interface IEncryptionService extends IService {
|
|
|
131
117
|
*
|
|
132
118
|
* The capability proof must root at the network owner DID embedded
|
|
133
119
|
* in the envelope's networkId.
|
|
120
|
+
*
|
|
121
|
+
* Unresponsive decrypt transports use DECRYPTION_DEPENDENCY_UNAVAILABLE.
|
|
122
|
+
* HTTP failure, identity, registry and caller-cancellation classifications
|
|
123
|
+
* remain distinct; a failed request never returns partial plaintext.
|
|
134
124
|
*/
|
|
135
125
|
decryptEnvelope(envelope: InlineEncryptedEnvelope, capabilityProof: DecryptCapabilityProof, options?: DecryptEnvelopeOptions): Promise<Result<Uint8Array, EncryptionError>>;
|
|
136
126
|
}
|
|
@@ -168,11 +158,17 @@ interface DecryptTransport {
|
|
|
168
158
|
}
|
|
169
159
|
|
|
170
160
|
interface EncryptionServiceConfig {
|
|
161
|
+
/** Write TCW2 key wraps. Disabled by default. */
|
|
162
|
+
keyWrapV2?: boolean;
|
|
163
|
+
/** Require TCW2 incoming network-key wraps, not signed receiver responses. Disabled by default. */
|
|
164
|
+
requireKeyWrapV2?: boolean;
|
|
171
165
|
crypto: EncryptionCrypto;
|
|
172
166
|
signer: DecryptInvocationSigner;
|
|
173
167
|
transport: DecryptTransport;
|
|
174
168
|
node?: NodeDescriptorFetcher;
|
|
175
169
|
wellKnown?: WellKnownDescriptorFetcher;
|
|
170
|
+
/** Verified registry destination; overrides descriptor order and caller hints. */
|
|
171
|
+
resolveTargetNode?: (networkId: string) => Promise<string>;
|
|
176
172
|
/** Bound by an owning service graph to prevent cross-session authority use. */
|
|
177
173
|
assertActive?: () => void;
|
|
178
174
|
[key: string]: unknown;
|
|
@@ -281,6 +277,8 @@ interface EncryptToNetworkInput {
|
|
|
281
277
|
keyVersion?: number;
|
|
282
278
|
/** Caller-supplied envelope metadata. */
|
|
283
279
|
metadata?: Record<string, string>;
|
|
280
|
+
/** Write TCW2 key wraps. Disabled by default. */
|
|
281
|
+
keyWrapV2?: boolean;
|
|
284
282
|
}
|
|
285
283
|
interface EncryptToNetworkResult {
|
|
286
284
|
envelope: InlineEncryptedEnvelope;
|
|
@@ -297,7 +295,7 @@ declare function encryptToNetwork(crypto: EncryptionCrypto, input: EncryptToNetw
|
|
|
297
295
|
* Validate an inline envelope shape. Returns an error if the envelope
|
|
298
296
|
* is missing required fields or fails internal hash recomputation.
|
|
299
297
|
*/
|
|
300
|
-
declare function validateEnvelope(crypto: EncryptionCrypto, envelope: unknown): {
|
|
298
|
+
declare function validateEnvelope(crypto: EncryptionCrypto, envelope: unknown, requireKeyWrapV2?: boolean): {
|
|
301
299
|
ok: true;
|
|
302
300
|
data: InlineEncryptedEnvelope;
|
|
303
301
|
} | {
|
|
@@ -453,8 +451,8 @@ declare function buildDecryptInvocation(crypto: EncryptionCrypto, signer: Decryp
|
|
|
453
451
|
* 1. Verify the node signature over the canonical response (excluding
|
|
454
452
|
* the signature field).
|
|
455
453
|
* 2. Recompute every binding hash and reject any mismatch.
|
|
456
|
-
* 3. Confirm
|
|
457
|
-
*
|
|
454
|
+
* 3. Confirm the target, network, and key version echo the request and
|
|
455
|
+
* the returned key-wrap algorithm is supported independently.
|
|
458
456
|
*
|
|
459
457
|
* After verification, the SDK opens `wrappedKey` with the per-request
|
|
460
458
|
* receiver private key and uses the resulting symmetric key to
|
|
@@ -494,6 +492,6 @@ declare function verifyDecryptResponse(input: VerifyDecryptResponseInput): {
|
|
|
494
492
|
* After verification, open the response's `wrappedKey` with the
|
|
495
493
|
* per-request receiver private key and return the symmetric key.
|
|
496
494
|
*/
|
|
497
|
-
declare function openWrappedKey(crypto: EncryptionCrypto, receiverPrivateKey: Uint8Array, response: DecryptResponseBody): Uint8Array;
|
|
495
|
+
declare function openWrappedKey(crypto: EncryptionCrypto, receiverPrivateKey: Uint8Array, response: DecryptResponseBody, expected?: KeyWrapContext): Uint8Array;
|
|
498
496
|
|
|
499
|
-
export { type BuildCanonicalDecryptRequestInput, type BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, type CanonicalDecryptRequest, DecryptCapabilityProof, type DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, type DecryptTransport, type DiscoverNetworkInput, type DiscoveredNetwork, type DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, type EncryptToNetworkInput, type EncryptToNetworkOptions, type EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionService, type EncryptionServiceConfig, type IEncryptionService, InlineEncryptedEnvelope, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, type NodeDescriptorFetcher, type ParsedEncryptionResource, type ParsedNetworkId, type RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, type SignedReceiverKeyInput, type VerifyDecryptResponseInput, type WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalSignedResponse, checkDecryptInvocationInput, decryptEnvelopeWithKey, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, ensureNetworkUsableForDecrypt, generateRandomReceiverKey, isNetworkId, networkDiscoveryKey, openWrappedKey, parseEncryptionResource, parseNetworkId, validateEnvelope, verifyDecryptResponse };
|
|
497
|
+
export { type BuildCanonicalDecryptRequestInput, type BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, type CanonicalDecryptRequest, DecryptCapabilityProof, type DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, type DecryptTransport, type DiscoverNetworkInput, type DiscoveredNetwork, type DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, type EncryptToNetworkInput, type EncryptToNetworkOptions, type EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionService, type EncryptionServiceConfig, type IEncryptionService, InlineEncryptedEnvelope, KeyWrapContext, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, type NodeDescriptorFetcher, type ParsedEncryptionResource, type ParsedNetworkId, type RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, type SignedReceiverKeyInput, type VerifyDecryptResponseInput, type WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalSignedResponse, checkDecryptInvocationInput, decryptEnvelopeWithKey, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, ensureNetworkUsableForDecrypt, generateRandomReceiverKey, isNetworkId, networkDiscoveryKey, openWrappedKey, parseEncryptionResource, parseNetworkId, validateEnvelope, verifyDecryptResponse };
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import { B as BaseService } from '../BaseService-
|
|
2
|
-
import { c as IService, f as Result } from '../types-
|
|
3
|
-
import { N as NetworkDescriptor, n as EncryptionError, I as InlineEncryptedEnvelope, D as DecryptCapabilityProof, j as DecryptResponseBody, E as EncryptionCrypto, h as DecryptInvocationSigner,
|
|
4
|
-
export { C as CanonicalJson, b as DECRYPT_ACTION, c as DECRYPT_FACT_TYPE, d as DECRYPT_RESULT_TYPE, e as DEFAULT_ENCRYPTION_ALG, f as DEFAULT_KEY_VERSION, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, o as EncryptionErrorInput, J as Json,
|
|
1
|
+
import { B as BaseService } from '../BaseService-BRDG69KR.js';
|
|
2
|
+
import { c as IService, f as Result } from '../types-DjAP8dve.js';
|
|
3
|
+
import { N as NetworkDescriptor, n as EncryptionError, I as InlineEncryptedEnvelope, D as DecryptCapabilityProof, j as DecryptResponseBody, E as EncryptionCrypto, h as DecryptInvocationSigner, s as ReceiverKeySigner, r as ReceiverKeyPair, i as DecryptRequestBody, g as DecryptInvocationFact, B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation, Z as KeyWrapContext } from '../types-Nvi_RckJ.js';
|
|
4
|
+
export { C as CanonicalJson, _ as ColumnFormat, b as DECRYPT_ACTION, c as DECRYPT_FACT_TYPE, d as DECRYPT_RESULT_TYPE, e as DEFAULT_ENCRYPTION_ALG, f as DEFAULT_KEY_VERSION, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, o as EncryptionErrorInput, J as Json, $ as KEY_WRAP_V2_ALG, a0 as KeyWrapV2Header, a1 as assertKeyWrapAlgorithm, a2 as assertKeyWrapContext, F as base64Decode, G as base64Encode, H as canonicalHashHex, K as canonicalize, a3 as decryptColumn, O as encryptionError, Q as hexDecode, S as hexEncode, a4 as isKeyWrapV2, a5 as openKeyV2, a6 as readKeyWrapV2, a7 as sealKeyV2, W as utf8Decode, X as utf8Encode } from '../types-Nvi_RckJ.js';
|
|
5
5
|
export { DecryptTransportResponseError } from '@tinycloud/sdk-services/internal/decrypt-transport-response-error';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Network-descriptor discovery.
|
|
9
|
-
*
|
|
10
|
-
* Resolution order (per architecture):
|
|
11
|
-
*
|
|
12
|
-
* 1. The node's authoritative endpoint
|
|
13
|
-
* `GET /encryption/networks/<networkId>` returns the current
|
|
14
|
-
* descriptor (`state`, `publicEncryptionKey`, `keyVersion`, ...).
|
|
15
|
-
* 2. If the node is unreachable, fall back to the cached discovery
|
|
16
|
-
* record at `.well-known/encryption/network/<name>` inside the
|
|
17
|
-
* owner's public space.
|
|
18
|
-
*
|
|
19
|
-
* The node DB is authoritative on conflict; cached records are
|
|
20
|
-
* advisory only.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
7
|
type DiscoverySource = "node" | "well-known";
|
|
24
8
|
interface DiscoveredNetwork {
|
|
25
9
|
descriptor: NetworkDescriptor;
|
|
@@ -45,8 +29,8 @@ interface DiscoverNetworkInput {
|
|
|
45
29
|
wellKnown?: WellKnownDescriptorFetcher;
|
|
46
30
|
}
|
|
47
31
|
/**
|
|
48
|
-
* Resolve a network descriptor. The node fetcher is preferred
|
|
49
|
-
* well-known
|
|
32
|
+
* Resolve a network descriptor. The node fetcher is preferred. An optional
|
|
33
|
+
* well-known cache cannot override a typed registry, identity, or transport failure.
|
|
50
34
|
*
|
|
51
35
|
* The returned descriptor is sanity-checked: `networkId`, `ownerDid`,
|
|
52
36
|
* and `name` must agree with the URN, and the public key field must
|
|
@@ -85,11 +69,13 @@ declare function ensureNetworkUsableForDecrypt(descriptor: NetworkDescriptor): {
|
|
|
85
69
|
*/
|
|
86
70
|
|
|
87
71
|
interface EncryptToNetworkOptions {
|
|
72
|
+
/** Write TCW2 key wraps. Defaults to the service setting, otherwise false. */
|
|
73
|
+
keyWrapV2?: boolean;
|
|
88
74
|
/** Exact named-key path to bind into the returned envelope. */
|
|
89
75
|
keyPath?: string;
|
|
90
76
|
/** Optional associated authenticated data (bytes). */
|
|
91
77
|
aad?: Uint8Array;
|
|
92
|
-
/** Ciphersuite override
|
|
78
|
+
/** Ciphersuite override; must match the selected key-wrap writer. */
|
|
93
79
|
alg?: string;
|
|
94
80
|
/** Key version override. Defaults to the network's current key version. */
|
|
95
81
|
keyVersion?: number;
|
|
@@ -131,6 +117,10 @@ interface IEncryptionService extends IService {
|
|
|
131
117
|
*
|
|
132
118
|
* The capability proof must root at the network owner DID embedded
|
|
133
119
|
* in the envelope's networkId.
|
|
120
|
+
*
|
|
121
|
+
* Unresponsive decrypt transports use DECRYPTION_DEPENDENCY_UNAVAILABLE.
|
|
122
|
+
* HTTP failure, identity, registry and caller-cancellation classifications
|
|
123
|
+
* remain distinct; a failed request never returns partial plaintext.
|
|
134
124
|
*/
|
|
135
125
|
decryptEnvelope(envelope: InlineEncryptedEnvelope, capabilityProof: DecryptCapabilityProof, options?: DecryptEnvelopeOptions): Promise<Result<Uint8Array, EncryptionError>>;
|
|
136
126
|
}
|
|
@@ -168,11 +158,17 @@ interface DecryptTransport {
|
|
|
168
158
|
}
|
|
169
159
|
|
|
170
160
|
interface EncryptionServiceConfig {
|
|
161
|
+
/** Write TCW2 key wraps. Disabled by default. */
|
|
162
|
+
keyWrapV2?: boolean;
|
|
163
|
+
/** Require TCW2 incoming network-key wraps, not signed receiver responses. Disabled by default. */
|
|
164
|
+
requireKeyWrapV2?: boolean;
|
|
171
165
|
crypto: EncryptionCrypto;
|
|
172
166
|
signer: DecryptInvocationSigner;
|
|
173
167
|
transport: DecryptTransport;
|
|
174
168
|
node?: NodeDescriptorFetcher;
|
|
175
169
|
wellKnown?: WellKnownDescriptorFetcher;
|
|
170
|
+
/** Verified registry destination; overrides descriptor order and caller hints. */
|
|
171
|
+
resolveTargetNode?: (networkId: string) => Promise<string>;
|
|
176
172
|
/** Bound by an owning service graph to prevent cross-session authority use. */
|
|
177
173
|
assertActive?: () => void;
|
|
178
174
|
[key: string]: unknown;
|
|
@@ -281,6 +277,8 @@ interface EncryptToNetworkInput {
|
|
|
281
277
|
keyVersion?: number;
|
|
282
278
|
/** Caller-supplied envelope metadata. */
|
|
283
279
|
metadata?: Record<string, string>;
|
|
280
|
+
/** Write TCW2 key wraps. Disabled by default. */
|
|
281
|
+
keyWrapV2?: boolean;
|
|
284
282
|
}
|
|
285
283
|
interface EncryptToNetworkResult {
|
|
286
284
|
envelope: InlineEncryptedEnvelope;
|
|
@@ -297,7 +295,7 @@ declare function encryptToNetwork(crypto: EncryptionCrypto, input: EncryptToNetw
|
|
|
297
295
|
* Validate an inline envelope shape. Returns an error if the envelope
|
|
298
296
|
* is missing required fields or fails internal hash recomputation.
|
|
299
297
|
*/
|
|
300
|
-
declare function validateEnvelope(crypto: EncryptionCrypto, envelope: unknown): {
|
|
298
|
+
declare function validateEnvelope(crypto: EncryptionCrypto, envelope: unknown, requireKeyWrapV2?: boolean): {
|
|
301
299
|
ok: true;
|
|
302
300
|
data: InlineEncryptedEnvelope;
|
|
303
301
|
} | {
|
|
@@ -453,8 +451,8 @@ declare function buildDecryptInvocation(crypto: EncryptionCrypto, signer: Decryp
|
|
|
453
451
|
* 1. Verify the node signature over the canonical response (excluding
|
|
454
452
|
* the signature field).
|
|
455
453
|
* 2. Recompute every binding hash and reject any mismatch.
|
|
456
|
-
* 3. Confirm
|
|
457
|
-
*
|
|
454
|
+
* 3. Confirm the target, network, and key version echo the request and
|
|
455
|
+
* the returned key-wrap algorithm is supported independently.
|
|
458
456
|
*
|
|
459
457
|
* After verification, the SDK opens `wrappedKey` with the per-request
|
|
460
458
|
* receiver private key and uses the resulting symmetric key to
|
|
@@ -494,6 +492,6 @@ declare function verifyDecryptResponse(input: VerifyDecryptResponseInput): {
|
|
|
494
492
|
* After verification, open the response's `wrappedKey` with the
|
|
495
493
|
* per-request receiver private key and return the symmetric key.
|
|
496
494
|
*/
|
|
497
|
-
declare function openWrappedKey(crypto: EncryptionCrypto, receiverPrivateKey: Uint8Array, response: DecryptResponseBody): Uint8Array;
|
|
495
|
+
declare function openWrappedKey(crypto: EncryptionCrypto, receiverPrivateKey: Uint8Array, response: DecryptResponseBody, expected?: KeyWrapContext): Uint8Array;
|
|
498
496
|
|
|
499
|
-
export { type BuildCanonicalDecryptRequestInput, type BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, type CanonicalDecryptRequest, DecryptCapabilityProof, type DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, type DecryptTransport, type DiscoverNetworkInput, type DiscoveredNetwork, type DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, type EncryptToNetworkInput, type EncryptToNetworkOptions, type EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionService, type EncryptionServiceConfig, type IEncryptionService, InlineEncryptedEnvelope, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, type NodeDescriptorFetcher, type ParsedEncryptionResource, type ParsedNetworkId, type RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, type SignedReceiverKeyInput, type VerifyDecryptResponseInput, type WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalSignedResponse, checkDecryptInvocationInput, decryptEnvelopeWithKey, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, ensureNetworkUsableForDecrypt, generateRandomReceiverKey, isNetworkId, networkDiscoveryKey, openWrappedKey, parseEncryptionResource, parseNetworkId, validateEnvelope, verifyDecryptResponse };
|
|
497
|
+
export { type BuildCanonicalDecryptRequestInput, type BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, type CanonicalDecryptRequest, DecryptCapabilityProof, type DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, type DecryptTransport, type DiscoverNetworkInput, type DiscoveredNetwork, type DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, type EncryptToNetworkInput, type EncryptToNetworkOptions, type EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionService, type EncryptionServiceConfig, type IEncryptionService, InlineEncryptedEnvelope, KeyWrapContext, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, type NodeDescriptorFetcher, type ParsedEncryptionResource, type ParsedNetworkId, type RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, type SignedReceiverKeyInput, type VerifyDecryptResponseInput, type WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalSignedResponse, checkDecryptInvocationInput, decryptEnvelopeWithKey, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, ensureNetworkUsableForDecrypt, generateRandomReceiverKey, isNetworkId, networkDiscoveryKey, openWrappedKey, parseEncryptionResource, parseNetworkId, validateEnvelope, verifyDecryptResponse };
|