@tinycloud/node-sdk 3.8.0-beta.13 → 3.8.0-beta.15
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/{TinyCloudNode-BVDUdEcf.d.cts → TinyCloudNode-DLuN31i0.d.cts} +6 -0
- package/dist/{TinyCloudNode-jMK_2Uj8.d.ts → TinyCloudNode-DfuhkGz7.d.ts} +6 -0
- package/dist/{authority-i22vHbbp.d.ts → authority-BHLahKNJ.d.ts} +1 -1
- package/dist/{authority-DJ-PE4Xo.d.cts → authority-Bgbd8NGB.d.cts} +1 -1
- package/dist/core.cjs +40 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +45 -3
- package/dist/core.js.map +1 -1
- package/dist/encryption-keys.d.cts +1 -1
- package/dist/encryption-keys.d.ts +1 -1
- package/dist/index.cjs +40 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +45 -3
- package/dist/index.js.map +1 -1
- package/dist/replication/authority.d.cts +2 -2
- package/dist/replication/authority.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1985,6 +1985,12 @@ declare class TinyCloudNode {
|
|
|
1985
1985
|
invokeAny(entries: Parameters<InvokeAnyFunction$1>[1], facts?: Parameters<InvokeAnyFunction$1>[2]): ReturnType<InvokeAnyFunction$1>;
|
|
1986
1986
|
/** Sign protocol bytes with the established in-memory session key. */
|
|
1987
1987
|
signSessionBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
1988
|
+
/**
|
|
1989
|
+
* Signs proofless invocations with `session`'s own did:key, for the node's
|
|
1990
|
+
* issued-delegation list and revocation by the delegator. The audience is
|
|
1991
|
+
* this Node's DID; each invocation lives 60 seconds.
|
|
1992
|
+
*/
|
|
1993
|
+
private sessionInvocationSignerFor;
|
|
1988
1994
|
/** Author a proofless Policy/v3 owner root with the authenticated holder key. */
|
|
1989
1995
|
createUnifiedOwnerRoot(input: UnifiedOwnerRootInput): Promise<UnifiedOwnerRootReceipt>;
|
|
1990
1996
|
/** Apply only an already-enabled signing policy to the exact credential request. */
|
|
@@ -1985,6 +1985,12 @@ declare class TinyCloudNode {
|
|
|
1985
1985
|
invokeAny(entries: Parameters<InvokeAnyFunction$1>[1], facts?: Parameters<InvokeAnyFunction$1>[2]): ReturnType<InvokeAnyFunction$1>;
|
|
1986
1986
|
/** Sign protocol bytes with the established in-memory session key. */
|
|
1987
1987
|
signSessionBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
1988
|
+
/**
|
|
1989
|
+
* Signs proofless invocations with `session`'s own did:key, for the node's
|
|
1990
|
+
* issued-delegation list and revocation by the delegator. The audience is
|
|
1991
|
+
* this Node's DID; each invocation lives 60 seconds.
|
|
1992
|
+
*/
|
|
1993
|
+
private sessionInvocationSignerFor;
|
|
1988
1994
|
/** Author a proofless Policy/v3 owner root with the authenticated holder key. */
|
|
1989
1995
|
createUnifiedOwnerRoot(input: UnifiedOwnerRootInput): Promise<UnifiedOwnerRootReceipt>;
|
|
1990
1996
|
/** Apply only an already-enabled signing policy to the exact credential request. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
|
|
2
2
|
import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
|
|
3
3
|
import { ReplicaLocalEraseOutcome, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaPurgeFailedEvent, ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
|
|
4
|
-
import { T as TinyCloudNode } from './TinyCloudNode-
|
|
4
|
+
import { T as TinyCloudNode } from './TinyCloudNode-DfuhkGz7.js';
|
|
5
5
|
|
|
6
6
|
/** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
|
|
7
7
|
declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
|
|
2
2
|
import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
|
|
3
3
|
import { ReplicaLocalEraseOutcome, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaPurgeFailedEvent, ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
|
|
4
|
-
import { T as TinyCloudNode } from './TinyCloudNode-
|
|
4
|
+
import { T as TinyCloudNode } from './TinyCloudNode-DLuN31i0.cjs';
|
|
5
5
|
|
|
6
6
|
/** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
|
|
7
7
|
declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
|
package/dist/core.cjs
CHANGED
|
@@ -6531,6 +6531,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6531
6531
|
invoke: graph.invoke,
|
|
6532
6532
|
invokeAny: graph.invokeAny,
|
|
6533
6533
|
signOwnerRevocation: this.signer ? (cid) => this.signOwnerRevocation(cid) : void 0,
|
|
6534
|
+
sessionInvocationSigner: this.sessionInvocationSignerFor(input.serviceSession),
|
|
6534
6535
|
fetch: graph.fetch
|
|
6535
6536
|
});
|
|
6536
6537
|
const keyProvider = new WasmKeyProvider({ sessionManager: input.manager });
|
|
@@ -6746,6 +6747,31 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6746
6747
|
if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
|
|
6747
6748
|
return signBytesWithJwk(bytes, session.jwk);
|
|
6748
6749
|
}
|
|
6750
|
+
/**
|
|
6751
|
+
* Signs proofless invocations with `session`'s own did:key, for the node's
|
|
6752
|
+
* issued-delegation list and revocation by the delegator. The audience is
|
|
6753
|
+
* this Node's DID; each invocation lives 60 seconds.
|
|
6754
|
+
*/
|
|
6755
|
+
sessionInvocationSignerFor(session) {
|
|
6756
|
+
return {
|
|
6757
|
+
did: () => session.verificationMethod.split("#", 1)[0],
|
|
6758
|
+
sign: async (attenuation) => {
|
|
6759
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
6760
|
+
const invocation = await (0, import_sdk_core11.signCompactUcanAuthorization)({
|
|
6761
|
+
issuerDid: session.verificationMethod.split("#", 1)[0],
|
|
6762
|
+
audienceDid: await this.fetchNodeId(),
|
|
6763
|
+
attenuation,
|
|
6764
|
+
facts: [{}],
|
|
6765
|
+
proofs: [],
|
|
6766
|
+
notBefore: now,
|
|
6767
|
+
expiresAt: now + 60,
|
|
6768
|
+
nonce: `urn:uuid:${crypto.randomUUID()}`,
|
|
6769
|
+
sign: (bytes) => signBytesWithJwk(bytes, session.jwk)
|
|
6770
|
+
});
|
|
6771
|
+
return invocation.authorization;
|
|
6772
|
+
}
|
|
6773
|
+
};
|
|
6774
|
+
}
|
|
6749
6775
|
/** Author a proofless Policy/v3 owner root with the authenticated holder key. */
|
|
6750
6776
|
async createUnifiedOwnerRoot(input) {
|
|
6751
6777
|
const ownerDid = this.credentialHolderDid;
|
|
@@ -7453,6 +7479,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
7453
7479
|
invoke: graph.invoke,
|
|
7454
7480
|
invokeAny: graph.invokeAny,
|
|
7455
7481
|
signOwnerRevocation: this.signer ? (cid) => this.signOwnerRevocation(cid) : void 0,
|
|
7482
|
+
sessionInvocationSigner: this.sessionInvocationSignerFor(serviceSession),
|
|
7456
7483
|
fetch: graph.fetch
|
|
7457
7484
|
});
|
|
7458
7485
|
this._spaceService = new import_sdk_core11.SpaceService({
|
|
@@ -8869,7 +8896,19 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8869
8896
|
"delegateTo requires a non-empty permissions array"
|
|
8870
8897
|
);
|
|
8871
8898
|
}
|
|
8872
|
-
const expandedEntries =
|
|
8899
|
+
const expandedEntries = (0, import_sdk_core11.expandDelegationPermissionEntries)(permissions);
|
|
8900
|
+
const namedKeyEntries = expandedEntries.filter((entry) => entry.service === import_sdk_core11.ENCRYPTION_PERMISSION_SERVICE && entry.path.includes("/"));
|
|
8901
|
+
if (namedKeyEntries.length > 0) {
|
|
8902
|
+
if (expandedEntries.some((entry) => entry.service === import_sdk_core11.ENCRYPTION_PERMISSION_SERVICE && !entry.path.includes("/"))) {
|
|
8903
|
+
throw new import_sdk_core11.ManifestValidationError("named-key delegation cannot include bare-network permissions");
|
|
8904
|
+
}
|
|
8905
|
+
if (options?.forceWalletSign) {
|
|
8906
|
+
throw new import_sdk_core11.ManifestValidationError("named-key delegation requires a signed session grant");
|
|
8907
|
+
}
|
|
8908
|
+
const granted = this.projectSignedRecapCapabilities(session.siwe);
|
|
8909
|
+
const { subset, missing } = this.signedCapabilitySubset(namedKeyEntries, granted);
|
|
8910
|
+
if (!subset) throw new import_sdk_core11.PermissionNotInManifestError(missing, granted);
|
|
8911
|
+
}
|
|
8873
8912
|
const now = /* @__PURE__ */ new Date();
|
|
8874
8913
|
const expiryMs = resolveExpiryMs(options?.expiry);
|
|
8875
8914
|
const expirationTime = new Date(now.getTime() + expiryMs);
|