@tinycloud/sdk-services 3.8.0-beta.16 → 3.8.0-beta.9
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/encryption/index.cjs +7 -80
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.d.cts +9 -21
- package/dist/encryption/index.d.ts +9 -21
- package/dist/encryption/index.js +7 -79
- package/dist/encryption/index.js.map +1 -1
- package/dist/encryption/named-keys.cjs.map +1 -1
- package/dist/encryption/named-keys.d.cts +1 -1
- package/dist/encryption/named-keys.d.ts +1 -1
- 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/index.cjs +7 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -79
- package/dist/index.js.map +1 -1
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.js.map +1 -1
- package/dist/{types-DZBExWAf.d.ts → types-BGRzS1ob.d.ts} +1 -6
- package/dist/{types-CBKrdtP8.d.cts → types-B_rbS4XE.d.cts} +1 -6
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -10,10 +10,10 @@ export { IPrefixedKVService, KVService, PrefixedKVService } from './kv/index.cjs
|
|
|
10
10
|
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, av as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, aw as KVAction, ax as KVActionType, ay as KVBatchPutItem, az as KVBatchPutOptions, aA as KVBatchPutResponse, aB as KVBatchReadResponse, aC as KVChange, aD as KVChangesAuthority, aE as KVChangesOptions, aF as KVChangesResponse, aG as KVCreateSignedReadUrlOptions, aH as KVDeleteOptions, aI as KVGetOptions, aJ as KVHeadOptions, aK as KVListOptions, b as KVListPage, aL as KVListResponse, aM as KVPutOptions, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aN as KVResponse, aO as KVResponseHeaders, aP as KVServiceConfig, aQ as KVSignedReadUrlResponse, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as ReplicaLocalEraseOutcome, a3 as ReplicaPageAdmission, a4 as ReplicaPartitionEraser, a5 as ReplicaPartitionIndexEntry, a6 as ReplicaPeerCommit, a7 as ReplicaPrivateGateHash, a8 as ReplicaPurgeError, a9 as ReplicaPurgeFailedEvent, aa as ReplicaPurgeIntent, ab as ReplicaPurgeLocalCopyResult, ac as ReplicaPurgeTrigger, ad as ReplicaQuotaLedger, ae as ReplicaQuotaSpec, af as ReplicaSessionStamp, ag as ReplicaStampedReply, ah as ReplicaState, ai as ReplicaStatusEntry, aj as ReplicationAuthority, ak as ReplicationControl, al as ReplicationEvent, R as ReplicationIdentity, am as ReplicationOptions, an as ReplicationPurgeReport, ao as ReplicationReason, ap as ReplicationScheduler, aq as ResolvedReplicationOptions, ar as SaltedHash, as as canonicalReplicationIdentity, at as replicationIdentityKey, au as requiresSecretsOptIn } from './scope-Dv3IAXMr.cjs';
|
|
11
11
|
export { ClampConsentAnchor, ConsentDeadlineMs, EffectiveGrantExpiry, EffectiveGrantExpiryInput, MintRemainingMs, NeedsSilentRenewal, ReplicaConsentAnchor, ReplicaConsentSource, ReplicaGrantPolicy } from './kv/replication/grantPolicyTypes.cjs';
|
|
12
12
|
export { BatchOptions, BatchResponse, DatabaseHandle, ExecuteOptions, ExecuteResponse, IDatabaseHandle, ISQLMigrations, ISQLService, QueryOptions, QueryResponse, SQLAction, SQLActionType, SQLMigrations, SQLService, SQLServiceConfig, SqlMigration, SqlMigrationApplyOptions, SqlMigrationApplyResponse, SqlStatement, SqlValue } from './sql/index.cjs';
|
|
13
|
-
import { D as DecryptCapabilityProof } from './types-
|
|
14
|
-
export { B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation, 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, g as DecryptInvocationFact, h as DecryptInvocationSigner, i as DecryptRequestBody, j as DecryptResponseBody, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, E as EncryptionCrypto, n as EncryptionError, o as EncryptionErrorInput, I as InlineEncryptedEnvelope, J as Json, N as NetworkDescriptor, R as ReceiverKeyPair, p as ReceiverKeySigner, q as base64Decode, r as base64Encode, s as canonicalHashHex, t as canonicalizeEncryptionJson, u as encryptionError, v as hexDecode, w as hexEncode, x as utf8Decode, y as utf8Encode } from './types-
|
|
13
|
+
import { D as DecryptCapabilityProof } from './types-B_rbS4XE.cjs';
|
|
14
|
+
export { B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation, 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, g as DecryptInvocationFact, h as DecryptInvocationSigner, i as DecryptRequestBody, j as DecryptResponseBody, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, E as EncryptionCrypto, n as EncryptionError, o as EncryptionErrorInput, I as InlineEncryptedEnvelope, J as Json, N as NetworkDescriptor, R as ReceiverKeyPair, p as ReceiverKeySigner, q as base64Decode, r as base64Encode, s as canonicalHashHex, t as canonicalizeEncryptionJson, u as encryptionError, v as hexDecode, w as hexEncode, x as utf8Decode, y as utf8Encode } from './types-B_rbS4XE.cjs';
|
|
15
15
|
import { IEncryptionService } from './encryption/index.cjs';
|
|
16
|
-
export { BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, CanonicalDecryptRequest, DecryptEnvelopeOptions, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionService, EncryptionServiceConfig, NETWORK_NAME_PATTERN, NetworkIdError, NodeDescriptorFetcher,
|
|
16
|
+
export { BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, CanonicalDecryptRequest, DecryptEnvelopeOptions, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionService, EncryptionServiceConfig, NETWORK_NAME_PATTERN, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, RandomReceiverKeyInput, SignedReceiverKeyInput, VerifyDecryptResponseInput, WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalSignedResponse, checkDecryptInvocationInput, decryptEnvelopeWithKey, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, ensureNetworkUsableForDecrypt, generateRandomReceiverKey, isNetworkId, networkDiscoveryKey, openWrappedKey, parseNetworkId, validateEnvelope, verifyDecryptResponse } from './encryption/index.cjs';
|
|
17
17
|
export { DecryptTransportResponseError } from '@tinycloud/sdk-services/internal/decrypt-transport-response-error';
|
|
18
18
|
export { kvPrefixCovers } from './kv/replication/prefix.cjs';
|
|
19
19
|
import './kv/replication/contractConstants.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export { IPrefixedKVService, KVService, PrefixedKVService } from './kv/index.js'
|
|
|
10
10
|
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, av as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, aw as KVAction, ax as KVActionType, ay as KVBatchPutItem, az as KVBatchPutOptions, aA as KVBatchPutResponse, aB as KVBatchReadResponse, aC as KVChange, aD as KVChangesAuthority, aE as KVChangesOptions, aF as KVChangesResponse, aG as KVCreateSignedReadUrlOptions, aH as KVDeleteOptions, aI as KVGetOptions, aJ as KVHeadOptions, aK as KVListOptions, b as KVListPage, aL as KVListResponse, aM as KVPutOptions, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aN as KVResponse, aO as KVResponseHeaders, aP as KVServiceConfig, aQ as KVSignedReadUrlResponse, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as ReplicaLocalEraseOutcome, a3 as ReplicaPageAdmission, a4 as ReplicaPartitionEraser, a5 as ReplicaPartitionIndexEntry, a6 as ReplicaPeerCommit, a7 as ReplicaPrivateGateHash, a8 as ReplicaPurgeError, a9 as ReplicaPurgeFailedEvent, aa as ReplicaPurgeIntent, ab as ReplicaPurgeLocalCopyResult, ac as ReplicaPurgeTrigger, ad as ReplicaQuotaLedger, ae as ReplicaQuotaSpec, af as ReplicaSessionStamp, ag as ReplicaStampedReply, ah as ReplicaState, ai as ReplicaStatusEntry, aj as ReplicationAuthority, ak as ReplicationControl, al as ReplicationEvent, R as ReplicationIdentity, am as ReplicationOptions, an as ReplicationPurgeReport, ao as ReplicationReason, ap as ReplicationScheduler, aq as ResolvedReplicationOptions, ar as SaltedHash, as as canonicalReplicationIdentity, at as replicationIdentityKey, au as requiresSecretsOptIn } from './scope-1-8skVDk.js';
|
|
11
11
|
export { ClampConsentAnchor, ConsentDeadlineMs, EffectiveGrantExpiry, EffectiveGrantExpiryInput, MintRemainingMs, NeedsSilentRenewal, ReplicaConsentAnchor, ReplicaConsentSource, ReplicaGrantPolicy } from './kv/replication/grantPolicyTypes.js';
|
|
12
12
|
export { BatchOptions, BatchResponse, DatabaseHandle, ExecuteOptions, ExecuteResponse, IDatabaseHandle, ISQLMigrations, ISQLService, QueryOptions, QueryResponse, SQLAction, SQLActionType, SQLMigrations, SQLService, SQLServiceConfig, SqlMigration, SqlMigrationApplyOptions, SqlMigrationApplyResponse, SqlStatement, SqlValue } from './sql/index.js';
|
|
13
|
-
import { D as DecryptCapabilityProof } from './types-
|
|
14
|
-
export { B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation, 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, g as DecryptInvocationFact, h as DecryptInvocationSigner, i as DecryptRequestBody, j as DecryptResponseBody, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, E as EncryptionCrypto, n as EncryptionError, o as EncryptionErrorInput, I as InlineEncryptedEnvelope, J as Json, N as NetworkDescriptor, R as ReceiverKeyPair, p as ReceiverKeySigner, q as base64Decode, r as base64Encode, s as canonicalHashHex, t as canonicalizeEncryptionJson, u as encryptionError, v as hexDecode, w as hexEncode, x as utf8Decode, y as utf8Encode } from './types-
|
|
13
|
+
import { D as DecryptCapabilityProof } from './types-BGRzS1ob.js';
|
|
14
|
+
export { B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation, 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, g as DecryptInvocationFact, h as DecryptInvocationSigner, i as DecryptRequestBody, j as DecryptResponseBody, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, E as EncryptionCrypto, n as EncryptionError, o as EncryptionErrorInput, I as InlineEncryptedEnvelope, J as Json, N as NetworkDescriptor, R as ReceiverKeyPair, p as ReceiverKeySigner, q as base64Decode, r as base64Encode, s as canonicalHashHex, t as canonicalizeEncryptionJson, u as encryptionError, v as hexDecode, w as hexEncode, x as utf8Decode, y as utf8Encode } from './types-BGRzS1ob.js';
|
|
15
15
|
import { IEncryptionService } from './encryption/index.js';
|
|
16
|
-
export { BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, CanonicalDecryptRequest, DecryptEnvelopeOptions, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionService, EncryptionServiceConfig, NETWORK_NAME_PATTERN, NetworkIdError, NodeDescriptorFetcher,
|
|
16
|
+
export { BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, CanonicalDecryptRequest, DecryptEnvelopeOptions, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionService, EncryptionServiceConfig, NETWORK_NAME_PATTERN, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, RandomReceiverKeyInput, SignedReceiverKeyInput, VerifyDecryptResponseInput, WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalSignedResponse, checkDecryptInvocationInput, decryptEnvelopeWithKey, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, ensureNetworkUsableForDecrypt, generateRandomReceiverKey, isNetworkId, networkDiscoveryKey, openWrappedKey, parseNetworkId, validateEnvelope, verifyDecryptResponse } from './encryption/index.js';
|
|
17
17
|
export { DecryptTransportResponseError } from '@tinycloud/sdk-services/internal/decrypt-transport-response-error';
|
|
18
18
|
export { kvPrefixCovers } from './kv/replication/prefix.js';
|
|
19
19
|
import './kv/replication/contractConstants.js';
|
package/dist/index.js
CHANGED
|
@@ -713,26 +713,6 @@ function parseNetworkId(networkId) {
|
|
|
713
713
|
}
|
|
714
714
|
return { networkId, ownerDid, name };
|
|
715
715
|
}
|
|
716
|
-
function parseEncryptionResource(resource) {
|
|
717
|
-
const networkSeparator = resource.lastIndexOf(":");
|
|
718
|
-
const nameAndPath = resource.slice(networkSeparator + 1);
|
|
719
|
-
const pathSeparator = nameAndPath.indexOf("/");
|
|
720
|
-
const name = pathSeparator === -1 ? nameAndPath : nameAndPath.slice(0, pathSeparator);
|
|
721
|
-
const networkId = pathSeparator === -1 ? resource : `${resource.slice(0, networkSeparator + 1)}${name}`;
|
|
722
|
-
const parsed = parseNetworkId(networkId);
|
|
723
|
-
if (pathSeparator === -1) return parsed;
|
|
724
|
-
const keyPath = nameAndPath.slice(pathSeparator + 1);
|
|
725
|
-
const segments = keyPath.split("/");
|
|
726
|
-
const prefix = keyPath.endsWith("/");
|
|
727
|
-
if (keyPath.length === 0 || /[\u0000-\u001f\u007f\\]/.test(keyPath) || segments.some(
|
|
728
|
-
(segment, index) => segment === "." || segment === ".." || segment.length === 0 && !(prefix && index === segments.length - 1)
|
|
729
|
-
)) {
|
|
730
|
-
throw new NetworkIdError(
|
|
731
|
-
`encryption resource has an invalid keyPath (got ${JSON.stringify(resource)})`
|
|
732
|
-
);
|
|
733
|
-
}
|
|
734
|
-
return { ...parsed, keyPath };
|
|
735
|
-
}
|
|
736
716
|
function buildNetworkId(ownerDid, name) {
|
|
737
717
|
if (typeof ownerDid !== "string" || !ownerDid.startsWith("did:")) {
|
|
738
718
|
throw new NetworkIdError("ownerDid must be a DID");
|
|
@@ -7830,12 +7810,7 @@ function ensureNetworkUsableForDecrypt(descriptor) {
|
|
|
7830
7810
|
|
|
7831
7811
|
// src/encryption/envelope.ts
|
|
7832
7812
|
function encryptToNetwork(crypto2, input) {
|
|
7833
|
-
|
|
7834
|
-
input.keyPath === void 0 ? input.networkId : `${input.networkId}/${input.keyPath}`
|
|
7835
|
-
);
|
|
7836
|
-
if (parsedResource.keyPath !== input.keyPath || input.keyPath?.endsWith("/")) {
|
|
7837
|
-
throw new NetworkIdError("keyPath must name an exact encryption key");
|
|
7838
|
-
}
|
|
7813
|
+
parseNetworkId(input.networkId);
|
|
7839
7814
|
const alg = input.alg ?? DEFAULT_ENCRYPTION_ALG;
|
|
7840
7815
|
const keyVersion = input.keyVersion ?? DEFAULT_KEY_VERSION;
|
|
7841
7816
|
const symmetricKey = crypto2.randomBytes(32);
|
|
@@ -7849,7 +7824,6 @@ function encryptToNetwork(crypto2, input) {
|
|
|
7849
7824
|
const envelope = {
|
|
7850
7825
|
v: ENVELOPE_VERSION,
|
|
7851
7826
|
networkId: input.networkId,
|
|
7852
|
-
...input.keyPath !== void 0 ? { keyPath: input.keyPath } : {},
|
|
7853
7827
|
alg,
|
|
7854
7828
|
keyVersion,
|
|
7855
7829
|
encryptedSymmetricKey,
|
|
@@ -7881,24 +7855,13 @@ function validateEnvelope(crypto2, envelope) {
|
|
|
7881
7855
|
};
|
|
7882
7856
|
}
|
|
7883
7857
|
try {
|
|
7884
|
-
|
|
7885
|
-
throw new Error("networkId must identify the network root");
|
|
7886
|
-
}
|
|
7887
|
-
if (e.keyPath !== void 0) {
|
|
7888
|
-
if (typeof e.keyPath !== "string") {
|
|
7889
|
-
throw new Error("keyPath must be a string");
|
|
7890
|
-
}
|
|
7891
|
-
const parsed = parseEncryptionResource(`${e.networkId}/${e.keyPath}`);
|
|
7892
|
-
if (parsed.keyPath !== e.keyPath || e.keyPath.endsWith("/")) {
|
|
7893
|
-
throw new Error("keyPath must name an exact encryption key");
|
|
7894
|
-
}
|
|
7895
|
-
}
|
|
7858
|
+
parseNetworkId(e.networkId);
|
|
7896
7859
|
} catch (err3) {
|
|
7897
7860
|
return {
|
|
7898
7861
|
ok: false,
|
|
7899
7862
|
error: encryptionError({
|
|
7900
7863
|
code: "INVALID_ENVELOPE",
|
|
7901
|
-
message: `envelope
|
|
7864
|
+
message: `envelope.networkId is malformed: ${err3 instanceof Error ? err3.message : String(err3)}`
|
|
7902
7865
|
})
|
|
7903
7866
|
};
|
|
7904
7867
|
}
|
|
@@ -7971,7 +7934,6 @@ function buildDecryptFacts(input) {
|
|
|
7971
7934
|
type: DECRYPT_FACT_TYPE,
|
|
7972
7935
|
targetNode: input.body.targetNode,
|
|
7973
7936
|
networkId: input.body.networkId,
|
|
7974
|
-
...input.body.keyPath !== void 0 ? { keyPath: input.body.keyPath } : {},
|
|
7975
7937
|
bodyHash,
|
|
7976
7938
|
encryptedSymmetricKeyHash: input.encryptedSymmetricKeyHash,
|
|
7977
7939
|
receiverPublicKeyHash,
|
|
@@ -7979,14 +7941,10 @@ function buildDecryptFacts(input) {
|
|
|
7979
7941
|
keyVersion: input.body.keyVersion
|
|
7980
7942
|
};
|
|
7981
7943
|
}
|
|
7982
|
-
function buildDecryptAttenuation(networkId
|
|
7983
|
-
|
|
7984
|
-
const parsed = parseEncryptionResource(resource);
|
|
7985
|
-
if (parsed.networkId !== networkId || parsed.keyPath !== keyPath || keyPath?.endsWith("/")) {
|
|
7986
|
-
throw new NetworkIdError("keyPath must name an exact encryption key");
|
|
7987
|
-
}
|
|
7944
|
+
function buildDecryptAttenuation(networkId) {
|
|
7945
|
+
parseNetworkId(networkId);
|
|
7988
7946
|
return {
|
|
7989
|
-
[
|
|
7947
|
+
[networkId]: {
|
|
7990
7948
|
[DECRYPT_ACTION]: {}
|
|
7991
7949
|
}
|
|
7992
7950
|
};
|
|
@@ -8046,15 +8004,6 @@ function checkDecryptInvocationInput(crypto2, input) {
|
|
|
8046
8004
|
})
|
|
8047
8005
|
};
|
|
8048
8006
|
}
|
|
8049
|
-
if (input.facts.keyPath !== input.body.keyPath) {
|
|
8050
|
-
return {
|
|
8051
|
-
ok: false,
|
|
8052
|
-
error: encryptionError({
|
|
8053
|
-
code: "INVALID_INPUT",
|
|
8054
|
-
message: "facts.keyPath must equal body.keyPath"
|
|
8055
|
-
})
|
|
8056
|
-
};
|
|
8057
|
-
}
|
|
8058
8007
|
if (input.facts.alg !== input.body.alg) {
|
|
8059
8008
|
return {
|
|
8060
8009
|
ok: false,
|
|
@@ -8092,9 +8041,7 @@ function checkDecryptInvocationInput(crypto2, input) {
|
|
|
8092
8041
|
};
|
|
8093
8042
|
}
|
|
8094
8043
|
try {
|
|
8095
|
-
|
|
8096
|
-
throw new NetworkIdError("networkId must identify the network root");
|
|
8097
|
-
}
|
|
8044
|
+
parseNetworkId(input.networkId);
|
|
8098
8045
|
} catch (err3) {
|
|
8099
8046
|
return {
|
|
8100
8047
|
ok: false,
|
|
@@ -8104,22 +8051,6 @@ function checkDecryptInvocationInput(crypto2, input) {
|
|
|
8104
8051
|
})
|
|
8105
8052
|
};
|
|
8106
8053
|
}
|
|
8107
|
-
try {
|
|
8108
|
-
const resource = parseEncryptionResource(
|
|
8109
|
-
input.body.keyPath === void 0 ? input.body.networkId : `${input.body.networkId}/${input.body.keyPath}`
|
|
8110
|
-
);
|
|
8111
|
-
if (resource.keyPath !== input.body.keyPath || input.body.keyPath?.endsWith("/")) {
|
|
8112
|
-
throw new NetworkIdError("keyPath must name an exact encryption key");
|
|
8113
|
-
}
|
|
8114
|
-
} catch (err3) {
|
|
8115
|
-
return {
|
|
8116
|
-
ok: false,
|
|
8117
|
-
error: encryptionError({
|
|
8118
|
-
code: "INVALID_INPUT",
|
|
8119
|
-
message: err3 instanceof Error ? err3.message : String(err3)
|
|
8120
|
-
})
|
|
8121
|
-
};
|
|
8122
|
-
}
|
|
8123
8054
|
const canonicalBody = canonicalize(
|
|
8124
8055
|
input.body
|
|
8125
8056
|
);
|
|
@@ -8360,7 +8291,6 @@ var EncryptionService = class extends BaseService {
|
|
|
8360
8291
|
// that spelling in the envelope so a later response can be compared
|
|
8361
8292
|
// byte-for-byte (notably for checksummed did:pkh principals).
|
|
8362
8293
|
networkId: descriptor.networkId,
|
|
8363
|
-
...options?.keyPath !== void 0 ? { keyPath: options.keyPath } : {},
|
|
8364
8294
|
networkPublicKey,
|
|
8365
8295
|
plaintext,
|
|
8366
8296
|
...options?.aad !== void 0 ? { aad: options.aad } : {},
|
|
@@ -8420,7 +8350,6 @@ var EncryptionService = class extends BaseService {
|
|
|
8420
8350
|
type: DECRYPT_FACT_TYPE,
|
|
8421
8351
|
targetNode,
|
|
8422
8352
|
networkId: envelope.networkId,
|
|
8423
|
-
...envelope.keyPath !== void 0 ? { keyPath: envelope.keyPath } : {},
|
|
8424
8353
|
alg: envelope.alg,
|
|
8425
8354
|
keyVersion: envelope.keyVersion,
|
|
8426
8355
|
encryptedSymmetricKey: envelope.encryptedSymmetricKey,
|
|
@@ -8636,7 +8565,6 @@ export {
|
|
|
8636
8565
|
openWrappedKey,
|
|
8637
8566
|
parseAuthError,
|
|
8638
8567
|
parseCapabilityResource,
|
|
8639
|
-
parseEncryptionResource,
|
|
8640
8568
|
parseNetworkId,
|
|
8641
8569
|
parsePermissionHint,
|
|
8642
8570
|
parsePermissionHintFromErrorText,
|