@tinycloud/node-sdk 3.7.0-beta.4 → 3.8.0-beta.0
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-Cw00iiSP.d.ts → TinyCloudNode-BtKzLDJX.d.ts} +10 -0
- package/dist/{TinyCloudNode-DD7qjyLU.d.cts → TinyCloudNode-ggmlnSfI.d.cts} +10 -0
- package/dist/{authority-Ck5hZdBn.d.cts → authority-_SYAE-uV.d.cts} +1 -1
- package/dist/{authority-DXR6887E.d.ts → authority-sJ6buHMj.d.ts} +1 -1
- package/dist/core.cjs +20 -0
- 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 +20 -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 +20 -0
- 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 +20 -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 +4 -4
|
@@ -276,6 +276,8 @@ interface NodeUserAuthorizationConfig {
|
|
|
276
276
|
* scheduling never reach this layer.
|
|
277
277
|
*/
|
|
278
278
|
replication?: Pick<ReplicationOptions, "enabled" | "prefixes" | "allowSecrets">;
|
|
279
|
+
/** Extra top-level resource URIs and their abilities added to the sign-in ReCap (e.g. named-key prefixes). */
|
|
280
|
+
additionalRawAbilities?: Record<string, string[]>;
|
|
279
281
|
/**
|
|
280
282
|
* Mints the replica session stamp on each fresh sign-in (TC-858 §4). Returns
|
|
281
283
|
* `undefined` when replication is off, so the persisted session carries no stamp.
|
|
@@ -348,6 +350,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
348
350
|
private readonly localNodeIdentityStore?;
|
|
349
351
|
private readonly enablePublicSpace;
|
|
350
352
|
private readonly replication?;
|
|
353
|
+
private readonly additionalRawAbilities?;
|
|
351
354
|
private readonly establishReplicaStamp?;
|
|
352
355
|
private readonly nonce?;
|
|
353
356
|
private readonly siweConfig?;
|
|
@@ -558,7 +561,9 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
558
561
|
*/
|
|
559
562
|
replicationSignInEntries(): PermissionEntry[];
|
|
560
563
|
private defaultEncryptionNetworkId;
|
|
564
|
+
/** Sign-in capabilities plus the caller's additional top-level resource abilities. */
|
|
561
565
|
private resolveSignInCapabilities;
|
|
566
|
+
private resolveBaseSignInCapabilities;
|
|
562
567
|
/**
|
|
563
568
|
* Build SIWE overrides from the top-level nonce and siweConfig.
|
|
564
569
|
* - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
|
|
@@ -1090,6 +1095,8 @@ interface TinyCloudNodeConfig {
|
|
|
1090
1095
|
* the same cross-process profile lock as SQLite and pending writes. Browser storage uses
|
|
1091
1096
|
* its mandatory origin Web Lock instead. Missing guards gate the replica, not the session.
|
|
1092
1097
|
*/
|
|
1098
|
+
/** Extra top-level resource URIs and their abilities added to the sign-in ReCap (e.g. named-key prefixes). */
|
|
1099
|
+
additionalRawAbilities?: Record<string, string[]>;
|
|
1093
1100
|
replication?: ReplicationOptions & {
|
|
1094
1101
|
storage: KVReplicaStorage;
|
|
1095
1102
|
mode?: "background" | "foreground";
|
|
@@ -1393,6 +1400,9 @@ declare class TinyCloudNode {
|
|
|
1393
1400
|
reason?: string;
|
|
1394
1401
|
warnings?: BootstrapWarning[];
|
|
1395
1402
|
};
|
|
1403
|
+
private _freshEncryptionNetworkCreated;
|
|
1404
|
+
/** Whether the last sign-in's fresh account bootstrap created its encryption network. */
|
|
1405
|
+
get freshEncryptionNetworkCreated(): boolean;
|
|
1396
1406
|
/**
|
|
1397
1407
|
* Turns every service's storage rejections into one `storage.full` event,
|
|
1398
1408
|
* and remembers whose storage is full so sign-in and listing skip their
|
|
@@ -276,6 +276,8 @@ interface NodeUserAuthorizationConfig {
|
|
|
276
276
|
* scheduling never reach this layer.
|
|
277
277
|
*/
|
|
278
278
|
replication?: Pick<ReplicationOptions, "enabled" | "prefixes" | "allowSecrets">;
|
|
279
|
+
/** Extra top-level resource URIs and their abilities added to the sign-in ReCap (e.g. named-key prefixes). */
|
|
280
|
+
additionalRawAbilities?: Record<string, string[]>;
|
|
279
281
|
/**
|
|
280
282
|
* Mints the replica session stamp on each fresh sign-in (TC-858 §4). Returns
|
|
281
283
|
* `undefined` when replication is off, so the persisted session carries no stamp.
|
|
@@ -348,6 +350,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
348
350
|
private readonly localNodeIdentityStore?;
|
|
349
351
|
private readonly enablePublicSpace;
|
|
350
352
|
private readonly replication?;
|
|
353
|
+
private readonly additionalRawAbilities?;
|
|
351
354
|
private readonly establishReplicaStamp?;
|
|
352
355
|
private readonly nonce?;
|
|
353
356
|
private readonly siweConfig?;
|
|
@@ -558,7 +561,9 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
558
561
|
*/
|
|
559
562
|
replicationSignInEntries(): PermissionEntry[];
|
|
560
563
|
private defaultEncryptionNetworkId;
|
|
564
|
+
/** Sign-in capabilities plus the caller's additional top-level resource abilities. */
|
|
561
565
|
private resolveSignInCapabilities;
|
|
566
|
+
private resolveBaseSignInCapabilities;
|
|
562
567
|
/**
|
|
563
568
|
* Build SIWE overrides from the top-level nonce and siweConfig.
|
|
564
569
|
* - Top-level `nonce` is seeded first so `siweConfig.nonce` wins if both are set.
|
|
@@ -1090,6 +1095,8 @@ interface TinyCloudNodeConfig {
|
|
|
1090
1095
|
* the same cross-process profile lock as SQLite and pending writes. Browser storage uses
|
|
1091
1096
|
* its mandatory origin Web Lock instead. Missing guards gate the replica, not the session.
|
|
1092
1097
|
*/
|
|
1098
|
+
/** Extra top-level resource URIs and their abilities added to the sign-in ReCap (e.g. named-key prefixes). */
|
|
1099
|
+
additionalRawAbilities?: Record<string, string[]>;
|
|
1093
1100
|
replication?: ReplicationOptions & {
|
|
1094
1101
|
storage: KVReplicaStorage;
|
|
1095
1102
|
mode?: "background" | "foreground";
|
|
@@ -1393,6 +1400,9 @@ declare class TinyCloudNode {
|
|
|
1393
1400
|
reason?: string;
|
|
1394
1401
|
warnings?: BootstrapWarning[];
|
|
1395
1402
|
};
|
|
1403
|
+
private _freshEncryptionNetworkCreated;
|
|
1404
|
+
/** Whether the last sign-in's fresh account bootstrap created its encryption network. */
|
|
1405
|
+
get freshEncryptionNetworkCreated(): boolean;
|
|
1396
1406
|
/**
|
|
1397
1407
|
* Turns every service's storage rejections into one `storage.full` event,
|
|
1398
1408
|
* and remembers whose storage is full so sign-in and listing skip their
|
|
@@ -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 { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
|
|
4
|
-
import { T as TinyCloudNode } from './TinyCloudNode-
|
|
4
|
+
import { T as TinyCloudNode } from './TinyCloudNode-ggmlnSfI.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 & {
|
|
@@ -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 { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
|
|
4
|
-
import { T as TinyCloudNode } from './TinyCloudNode-
|
|
4
|
+
import { T as TinyCloudNode } from './TinyCloudNode-BtKzLDJX.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 & {
|
package/dist/core.cjs
CHANGED
|
@@ -547,6 +547,7 @@ var NodeUserAuthorization = class {
|
|
|
547
547
|
this.includeAccountRegistryPermissions = config.includeAccountRegistryPermissions ?? true;
|
|
548
548
|
this.replication = config.replication?.enabled === true ? config.replication : void 0;
|
|
549
549
|
this.establishReplicaStamp = config.establishReplicaStamp;
|
|
550
|
+
this.additionalRawAbilities = config.additionalRawAbilities;
|
|
550
551
|
this._manifest = config.manifest;
|
|
551
552
|
this._capabilityRequest = config.capabilityRequest;
|
|
552
553
|
this.sessionManager = config.sessionManager ?? this.wasm.createSessionManager();
|
|
@@ -977,7 +978,18 @@ var NodeUserAuthorization = class {
|
|
|
977
978
|
defaultEncryptionNetworkId(address, chainId) {
|
|
978
979
|
return `urn:tinycloud:encryption:${(0, import_sdk_core5.pkhDid)(address, chainId)}:default`;
|
|
979
980
|
}
|
|
981
|
+
/** Sign-in capabilities plus the caller's additional top-level resource abilities. */
|
|
980
982
|
resolveSignInCapabilities(address, chainId) {
|
|
983
|
+
const base = this.resolveBaseSignInCapabilities(address, chainId);
|
|
984
|
+
const extra = this.additionalRawAbilities;
|
|
985
|
+
if (extra === void 0 || Object.keys(extra).length === 0) return base;
|
|
986
|
+
const rawAbilities = { ...base.rawAbilities ?? {} };
|
|
987
|
+
for (const [resource, actions] of Object.entries(extra)) {
|
|
988
|
+
for (const action of actions) addRawAbility(rawAbilities, resource, action);
|
|
989
|
+
}
|
|
990
|
+
return { ...base, rawAbilities };
|
|
991
|
+
}
|
|
992
|
+
resolveBaseSignInCapabilities(address, chainId) {
|
|
981
993
|
const request = this.getCapabilityRequest();
|
|
982
994
|
if (request === void 0) {
|
|
983
995
|
const defaultNetworkId = this.defaultEncryptionNetworkId(address, chainId);
|
|
@@ -3849,6 +3861,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3849
3861
|
this._bootstrapStatus = {
|
|
3850
3862
|
skipped: false
|
|
3851
3863
|
};
|
|
3864
|
+
this._freshEncryptionNetworkCreated = false;
|
|
3852
3865
|
/**
|
|
3853
3866
|
* Turns every service's storage rejections into one `storage.full` event,
|
|
3854
3867
|
* and remembers whose storage is full so sign-in and listing skip their
|
|
@@ -4012,6 +4025,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4012
4025
|
get bootstrapStatus() {
|
|
4013
4026
|
return this._bootstrapStatus;
|
|
4014
4027
|
}
|
|
4028
|
+
/** Whether the last sign-in's fresh account bootstrap created its encryption network. */
|
|
4029
|
+
get freshEncryptionNetworkCreated() {
|
|
4030
|
+
return this._freshEncryptionNetworkCreated;
|
|
4031
|
+
}
|
|
4015
4032
|
/**
|
|
4016
4033
|
* Subscribe to `storage.full`. It fires on the first write any service had
|
|
4017
4034
|
* rejected because the owner's TinyCloud storage is full
|
|
@@ -4214,6 +4231,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4214
4231
|
signStrategy: config.signStrategy ?? { type: "auto-sign" },
|
|
4215
4232
|
wasmBindings: this.wasmBindings,
|
|
4216
4233
|
...config.replication?.enabled === true ? { establishReplicaStamp: this.establishReplicaStamp } : {},
|
|
4234
|
+
...config.additionalRawAbilities === void 0 ? {} : { additionalRawAbilities: config.additionalRawAbilities },
|
|
4217
4235
|
sessionManager: this.sessionManager,
|
|
4218
4236
|
sessionStorage: config.sessionStorage ?? new MemorySessionStorage(),
|
|
4219
4237
|
domain: this.siweDomain,
|
|
@@ -4779,6 +4797,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4779
4797
|
async bootstrapAccountIfNeeded() {
|
|
4780
4798
|
this._bootstrapSkipped = false;
|
|
4781
4799
|
this._bootstrapStatus = { skipped: false };
|
|
4800
|
+
this._freshEncryptionNetworkCreated = false;
|
|
4782
4801
|
if (this.config.autoBootstrapAccount === false) {
|
|
4783
4802
|
this._bootstrapStatus = { skipped: true, reason: "auto-bootstrap-disabled" };
|
|
4784
4803
|
return false;
|
|
@@ -5068,6 +5087,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
5068
5087
|
}
|
|
5069
5088
|
if (step.kind === "encryption-network-create") {
|
|
5070
5089
|
await this.ensureEncryptionNetwork(step.networkId, { assumeMissing: mode === "fresh" });
|
|
5090
|
+
if (mode === "fresh") this._freshEncryptionNetworkCreated = true;
|
|
5071
5091
|
}
|
|
5072
5092
|
if (step.kind === "secret-records-schema") {
|
|
5073
5093
|
const db = this.sqlForSpace(step.spaceId).db(step.database);
|