@tinycloud/node-sdk 3.8.0-beta.11 → 3.8.0-beta.14
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/{WasmKeyProvider-5Ee7fcAw.d.cts → WasmKeyProvider-BKCPRC-c.d.cts} +21 -1
- package/dist/{WasmKeyProvider-5Ee7fcAw.d.ts → WasmKeyProvider-BKCPRC-c.d.ts} +21 -1
- 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 +41 -0
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +3 -3
- package/dist/core.d.ts +3 -3
- package/dist/core.js +41 -0
- 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 +41 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +41 -0
- 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. */
|
|
@@ -106,6 +106,26 @@ declare class FileSessionStorage implements ISessionStorage {
|
|
|
106
106
|
isAvailable(): boolean;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Whether sign-in at `origin` can be granted named-key abilities for the app
|
|
111
|
+
* whose manifest `keys_app_id` (or `app_id`) is `keysAppId`.
|
|
112
|
+
*
|
|
113
|
+
* "Bound" means the key app id equals the reversed host of the origin, or
|
|
114
|
+
* extends it with further dot-separated labels: `tinycloud.chat` binds
|
|
115
|
+
* `chat.tinycloud.tinychat` and `chat.tinycloud.tinychat.worker`. Origins with
|
|
116
|
+
* no registrable host (`localhost`, `tauri.localhost`, IP addresses) or with
|
|
117
|
+
* lookalike hosts (`evil-tinycloud.chat`, `tinycloud.chat.evil.com`) are not
|
|
118
|
+
* bound. `origin` is a URL, an origin string such as `https://tinycloud.chat`,
|
|
119
|
+
* or a bare SIWE domain such as `tinycloud.chat`; the host (including any
|
|
120
|
+
* non-default port, which makes the origin unbound) is what is checked.
|
|
121
|
+
*
|
|
122
|
+
* This is the check `NodeUserAuthorization` applies when it decides whether a
|
|
123
|
+
* manifest's `keys` rows are granted at sign-in. A bound origin still needs a
|
|
124
|
+
* node that lists `encryption-named-keys-v1` in `/info` to actually receive
|
|
125
|
+
* the row.
|
|
126
|
+
*/
|
|
127
|
+
declare function isAppKeyHostBound(keysAppId: string, origin: string | URL): boolean;
|
|
128
|
+
|
|
109
129
|
/**
|
|
110
130
|
* WasmKeyProvider - KeyProvider implementation using WASM session manager.
|
|
111
131
|
*
|
|
@@ -214,4 +234,4 @@ declare class WasmKeyProvider implements KeyProvider {
|
|
|
214
234
|
*/
|
|
215
235
|
declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
|
|
216
236
|
|
|
217
|
-
export { FileSessionStorage as F, MemorySessionStorage as M, WasmKeyProvider as W, type WasmKeyProviderConfig as a, createWasmKeyProvider as c };
|
|
237
|
+
export { FileSessionStorage as F, MemorySessionStorage as M, WasmKeyProvider as W, type WasmKeyProviderConfig as a, createWasmKeyProvider as c, isAppKeyHostBound as i };
|
|
@@ -106,6 +106,26 @@ declare class FileSessionStorage implements ISessionStorage {
|
|
|
106
106
|
isAvailable(): boolean;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Whether sign-in at `origin` can be granted named-key abilities for the app
|
|
111
|
+
* whose manifest `keys_app_id` (or `app_id`) is `keysAppId`.
|
|
112
|
+
*
|
|
113
|
+
* "Bound" means the key app id equals the reversed host of the origin, or
|
|
114
|
+
* extends it with further dot-separated labels: `tinycloud.chat` binds
|
|
115
|
+
* `chat.tinycloud.tinychat` and `chat.tinycloud.tinychat.worker`. Origins with
|
|
116
|
+
* no registrable host (`localhost`, `tauri.localhost`, IP addresses) or with
|
|
117
|
+
* lookalike hosts (`evil-tinycloud.chat`, `tinycloud.chat.evil.com`) are not
|
|
118
|
+
* bound. `origin` is a URL, an origin string such as `https://tinycloud.chat`,
|
|
119
|
+
* or a bare SIWE domain such as `tinycloud.chat`; the host (including any
|
|
120
|
+
* non-default port, which makes the origin unbound) is what is checked.
|
|
121
|
+
*
|
|
122
|
+
* This is the check `NodeUserAuthorization` applies when it decides whether a
|
|
123
|
+
* manifest's `keys` rows are granted at sign-in. A bound origin still needs a
|
|
124
|
+
* node that lists `encryption-named-keys-v1` in `/info` to actually receive
|
|
125
|
+
* the row.
|
|
126
|
+
*/
|
|
127
|
+
declare function isAppKeyHostBound(keysAppId: string, origin: string | URL): boolean;
|
|
128
|
+
|
|
109
129
|
/**
|
|
110
130
|
* WasmKeyProvider - KeyProvider implementation using WASM session manager.
|
|
111
131
|
*
|
|
@@ -214,4 +234,4 @@ declare class WasmKeyProvider implements KeyProvider {
|
|
|
214
234
|
*/
|
|
215
235
|
declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
|
|
216
236
|
|
|
217
|
-
export { FileSessionStorage as F, MemorySessionStorage as M, WasmKeyProvider as W, type WasmKeyProviderConfig as a, createWasmKeyProvider as c };
|
|
237
|
+
export { FileSessionStorage as F, MemorySessionStorage as M, WasmKeyProvider as W, type WasmKeyProviderConfig as a, createWasmKeyProvider as c, isAppKeyHostBound as i };
|
|
@@ -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
|
@@ -111,6 +111,7 @@ __export(core_exports, {
|
|
|
111
111
|
getNodeReplicationLoaders: () => getNodeReplicationLoaders,
|
|
112
112
|
getTinyCloudDebugLogs: () => import_sdk_core13.getTinyCloudDebugLogs,
|
|
113
113
|
installTinyCloudDebugGlobals: () => import_sdk_core13.installTinyCloudDebugGlobals,
|
|
114
|
+
isAppKeyHostBound: () => isAppKeyHostBound,
|
|
114
115
|
isCapabilitySubset: () => import_sdk_core14.isCapabilitySubset,
|
|
115
116
|
isEvmAddress: () => import_sdk_core13.isEvmAddress,
|
|
116
117
|
loadManifest: () => import_sdk_core14.loadManifest,
|
|
@@ -374,6 +375,18 @@ function appKeyHostBinding(domain, appId) {
|
|
|
374
375
|
const reversed = labels.reverse().join(".");
|
|
375
376
|
return appId === reversed || appId.startsWith(`${reversed}.`);
|
|
376
377
|
}
|
|
378
|
+
function isAppKeyHostBound(keysAppId, origin) {
|
|
379
|
+
if (typeof origin === "string" && !origin.includes("://")) {
|
|
380
|
+
return appKeyHostBinding(origin, keysAppId);
|
|
381
|
+
}
|
|
382
|
+
let url;
|
|
383
|
+
try {
|
|
384
|
+
url = typeof origin === "string" ? new URL(origin) : origin;
|
|
385
|
+
} catch {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
return appKeyHostBinding(url.host, keysAppId);
|
|
389
|
+
}
|
|
377
390
|
|
|
378
391
|
// src/replication/authority-sign-in.ts
|
|
379
392
|
var import_sdk_core2 = require("@tinycloud/sdk-core");
|
|
@@ -6518,6 +6531,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6518
6531
|
invoke: graph.invoke,
|
|
6519
6532
|
invokeAny: graph.invokeAny,
|
|
6520
6533
|
signOwnerRevocation: this.signer ? (cid) => this.signOwnerRevocation(cid) : void 0,
|
|
6534
|
+
sessionInvocationSigner: this.sessionInvocationSignerFor(input.serviceSession),
|
|
6521
6535
|
fetch: graph.fetch
|
|
6522
6536
|
});
|
|
6523
6537
|
const keyProvider = new WasmKeyProvider({ sessionManager: input.manager });
|
|
@@ -6733,6 +6747,31 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6733
6747
|
if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
|
|
6734
6748
|
return signBytesWithJwk(bytes, session.jwk);
|
|
6735
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
|
+
}
|
|
6736
6775
|
/** Author a proofless Policy/v3 owner root with the authenticated holder key. */
|
|
6737
6776
|
async createUnifiedOwnerRoot(input) {
|
|
6738
6777
|
const ownerDid = this.credentialHolderDid;
|
|
@@ -7440,6 +7479,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
7440
7479
|
invoke: graph.invoke,
|
|
7441
7480
|
invokeAny: graph.invokeAny,
|
|
7442
7481
|
signOwnerRevocation: this.signer ? (cid) => this.signOwnerRevocation(cid) : void 0,
|
|
7482
|
+
sessionInvocationSigner: this.sessionInvocationSignerFor(serviceSession),
|
|
7443
7483
|
fetch: graph.fetch
|
|
7444
7484
|
});
|
|
7445
7485
|
this._spaceService = new import_sdk_core11.SpaceService({
|
|
@@ -10325,6 +10365,7 @@ var import_sdk_core23 = require("@tinycloud/sdk-core");
|
|
|
10325
10365
|
getNodeReplicationLoaders,
|
|
10326
10366
|
getTinyCloudDebugLogs,
|
|
10327
10367
|
installTinyCloudDebugGlobals,
|
|
10368
|
+
isAppKeyHostBound,
|
|
10328
10369
|
isCapabilitySubset,
|
|
10329
10370
|
isEvmAddress,
|
|
10330
10371
|
loadManifest,
|