@tinycloud/node-sdk 2.4.0-beta.5 → 2.4.0-beta.7
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/{core-BSQqoLAd.d.cts → core-iwTdsebf.d.cts} +13 -1
- package/dist/{core-BSQqoLAd.d.ts → core-iwTdsebf.d.ts} +13 -1
- package/dist/core.cjs +262 -193
- 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 +80 -12
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +305 -236
- 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 +80 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/core.cjs
CHANGED
|
@@ -30,94 +30,95 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/core.ts
|
|
31
31
|
var core_exports = {};
|
|
32
32
|
__export(core_exports, {
|
|
33
|
-
ACCOUNT_REGISTRY_PATH: () =>
|
|
34
|
-
ACCOUNT_REGISTRY_SPACE: () =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
ACCOUNT_REGISTRY_PATH: () => import_sdk_core10.ACCOUNT_REGISTRY_PATH,
|
|
34
|
+
ACCOUNT_REGISTRY_SPACE: () => import_sdk_core10.ACCOUNT_REGISTRY_SPACE,
|
|
35
|
+
AccountService: () => import_sdk_core3.AccountService,
|
|
36
|
+
AutoApproveSpaceCreationHandler: () => import_sdk_core9.AutoApproveSpaceCreationHandler,
|
|
37
|
+
CapabilityKeyRegistry: () => import_sdk_core16.CapabilityKeyRegistry,
|
|
38
|
+
CapabilityKeyRegistryErrorCodes: () => import_sdk_core16.CapabilityKeyRegistryErrorCodes,
|
|
39
|
+
DEFAULT_MANIFEST_SPACE: () => import_sdk_core10.DEFAULT_MANIFEST_SPACE,
|
|
40
|
+
DEFAULT_MANIFEST_VERSION: () => import_sdk_core10.DEFAULT_MANIFEST_VERSION,
|
|
41
|
+
DEFAULT_SIGNED_READ_URL_EXPIRY_MS: () => import_sdk_core11.DEFAULT_SIGNED_READ_URL_EXPIRY_MS,
|
|
42
|
+
DataVaultService: () => import_sdk_core14.DataVaultService,
|
|
43
|
+
DatabaseHandle: () => import_sdk_core12.DatabaseHandle,
|
|
43
44
|
DelegatedAccess: () => DelegatedAccess,
|
|
44
|
-
DelegationErrorCodes: () =>
|
|
45
|
-
DelegationManager: () =>
|
|
46
|
-
DuckDbAction: () =>
|
|
47
|
-
DuckDbDatabaseHandle: () =>
|
|
48
|
-
DuckDbService: () =>
|
|
45
|
+
DelegationErrorCodes: () => import_sdk_core15.DelegationErrorCodes,
|
|
46
|
+
DelegationManager: () => import_sdk_core15.DelegationManager,
|
|
47
|
+
DuckDbAction: () => import_sdk_core13.DuckDbAction,
|
|
48
|
+
DuckDbDatabaseHandle: () => import_sdk_core13.DuckDbDatabaseHandle,
|
|
49
|
+
DuckDbService: () => import_sdk_core13.DuckDbService,
|
|
49
50
|
FileSessionStorage: () => FileSessionStorage,
|
|
50
|
-
IdentityParseError: () =>
|
|
51
|
-
KVService: () =>
|
|
52
|
-
ManifestValidationError: () =>
|
|
51
|
+
IdentityParseError: () => import_sdk_core9.IdentityParseError,
|
|
52
|
+
KVService: () => import_sdk_core11.KVService,
|
|
53
|
+
ManifestValidationError: () => import_sdk_core10.ManifestValidationError,
|
|
53
54
|
MemorySessionStorage: () => MemorySessionStorage,
|
|
54
55
|
NodeUserAuthorization: () => NodeUserAuthorization,
|
|
55
|
-
PermissionNotInManifestError: () =>
|
|
56
|
-
PrefixedKVService: () =>
|
|
57
|
-
ProtocolMismatchError: () =>
|
|
58
|
-
SECRET_NAME_RE: () =>
|
|
59
|
-
SQLAction: () =>
|
|
60
|
-
SQLService: () =>
|
|
61
|
-
SecretsService: () =>
|
|
62
|
-
ServiceContext: () =>
|
|
63
|
-
SessionExpiredError: () =>
|
|
64
|
-
SharingService: () =>
|
|
65
|
-
SilentNotificationHandler: () =>
|
|
66
|
-
Space: () =>
|
|
67
|
-
SpaceErrorCodes: () =>
|
|
68
|
-
SpaceService: () =>
|
|
69
|
-
TinyCloud: () =>
|
|
56
|
+
PermissionNotInManifestError: () => import_sdk_core10.PermissionNotInManifestError,
|
|
57
|
+
PrefixedKVService: () => import_sdk_core11.PrefixedKVService,
|
|
58
|
+
ProtocolMismatchError: () => import_sdk_core18.ProtocolMismatchError,
|
|
59
|
+
SECRET_NAME_RE: () => import_sdk_core14.SECRET_NAME_RE,
|
|
60
|
+
SQLAction: () => import_sdk_core12.SQLAction,
|
|
61
|
+
SQLService: () => import_sdk_core12.SQLService,
|
|
62
|
+
SecretsService: () => import_sdk_core14.SecretsService,
|
|
63
|
+
ServiceContext: () => import_sdk_core19.ServiceContext,
|
|
64
|
+
SessionExpiredError: () => import_sdk_core10.SessionExpiredError,
|
|
65
|
+
SharingService: () => import_sdk_core15.SharingService,
|
|
66
|
+
SilentNotificationHandler: () => import_sdk_core9.SilentNotificationHandler,
|
|
67
|
+
Space: () => import_sdk_core17.Space,
|
|
68
|
+
SpaceErrorCodes: () => import_sdk_core17.SpaceErrorCodes,
|
|
69
|
+
SpaceService: () => import_sdk_core17.SpaceService,
|
|
70
|
+
TinyCloud: () => import_sdk_core8.TinyCloud,
|
|
70
71
|
TinyCloudNode: () => TinyCloudNode,
|
|
71
|
-
UnsupportedFeatureError: () =>
|
|
72
|
-
VAULT_PERMISSION_SERVICE: () =>
|
|
73
|
-
VaultHeaders: () =>
|
|
74
|
-
VaultPublicSpaceKVActions: () =>
|
|
75
|
-
VersionCheckError: () =>
|
|
72
|
+
UnsupportedFeatureError: () => import_sdk_core18.UnsupportedFeatureError,
|
|
73
|
+
VAULT_PERMISSION_SERVICE: () => import_sdk_core10.VAULT_PERMISSION_SERVICE,
|
|
74
|
+
VaultHeaders: () => import_sdk_core14.VaultHeaders,
|
|
75
|
+
VaultPublicSpaceKVActions: () => import_sdk_core14.VaultPublicSpaceKVActions,
|
|
76
|
+
VersionCheckError: () => import_sdk_core18.VersionCheckError,
|
|
76
77
|
WasmKeyProvider: () => WasmKeyProvider,
|
|
77
|
-
addressStorageKey: () =>
|
|
78
|
-
buildSpaceUri: () =>
|
|
79
|
-
canonicalizeAddress: () =>
|
|
80
|
-
canonicalizeDid: () =>
|
|
81
|
-
canonicalizeDidUrl: () =>
|
|
82
|
-
canonicalizeNetworkId: () =>
|
|
83
|
-
canonicalizeSecretScope: () =>
|
|
84
|
-
checkNodeInfo: () =>
|
|
85
|
-
composeManifestRequest: () =>
|
|
86
|
-
createCapabilityKeyRegistry: () =>
|
|
87
|
-
createSharingService: () =>
|
|
88
|
-
createSpaceService: () =>
|
|
89
|
-
createVaultCrypto: () =>
|
|
78
|
+
addressStorageKey: () => import_sdk_core9.addressStorageKey,
|
|
79
|
+
buildSpaceUri: () => import_sdk_core17.buildSpaceUri,
|
|
80
|
+
canonicalizeAddress: () => import_sdk_core9.canonicalizeAddress,
|
|
81
|
+
canonicalizeDid: () => import_sdk_core9.canonicalizeDid,
|
|
82
|
+
canonicalizeDidUrl: () => import_sdk_core9.canonicalizeDidUrl,
|
|
83
|
+
canonicalizeNetworkId: () => import_sdk_core9.canonicalizeNetworkId,
|
|
84
|
+
canonicalizeSecretScope: () => import_sdk_core14.canonicalizeSecretScope,
|
|
85
|
+
checkNodeInfo: () => import_sdk_core18.checkNodeInfo,
|
|
86
|
+
composeManifestRequest: () => import_sdk_core10.composeManifestRequest,
|
|
87
|
+
createCapabilityKeyRegistry: () => import_sdk_core16.createCapabilityKeyRegistry,
|
|
88
|
+
createSharingService: () => import_sdk_core15.createSharingService,
|
|
89
|
+
createSpaceService: () => import_sdk_core17.createSpaceService,
|
|
90
|
+
createVaultCrypto: () => import_sdk_core14.createVaultCrypto,
|
|
90
91
|
createWasmKeyProvider: () => createWasmKeyProvider,
|
|
91
92
|
defaultSignStrategy: () => defaultSignStrategy,
|
|
92
|
-
defaultSpaceCreationHandler: () =>
|
|
93
|
+
defaultSpaceCreationHandler: () => import_sdk_core9.defaultSpaceCreationHandler,
|
|
93
94
|
deserializeDelegation: () => deserializeDelegation,
|
|
94
|
-
didCacheKey: () =>
|
|
95
|
-
didEquals: () =>
|
|
96
|
-
expandActionShortNames: () =>
|
|
97
|
-
expandPermissionEntries: () =>
|
|
98
|
-
expandPermissionEntry: () =>
|
|
99
|
-
isCapabilitySubset: () =>
|
|
100
|
-
isEvmAddress: () =>
|
|
101
|
-
loadManifest: () =>
|
|
102
|
-
makePkhSpaceId: () =>
|
|
103
|
-
makePublicSpaceId: () =>
|
|
104
|
-
parseCanonicalNetworkId: () =>
|
|
105
|
-
parseExpiry: () =>
|
|
106
|
-
parsePkhDid: () =>
|
|
107
|
-
parseSpaceUri: () =>
|
|
108
|
-
pkhDid: () =>
|
|
109
|
-
principalDid: () =>
|
|
110
|
-
principalDidEquals: () =>
|
|
111
|
-
resolveManifest: () =>
|
|
112
|
-
resolveSecretListPrefix: () =>
|
|
113
|
-
resolveSecretPath: () =>
|
|
114
|
-
resourceCapabilitiesToSpaceAbilitiesMap: () =>
|
|
95
|
+
didCacheKey: () => import_sdk_core9.didCacheKey,
|
|
96
|
+
didEquals: () => import_sdk_core9.didEquals,
|
|
97
|
+
expandActionShortNames: () => import_sdk_core10.expandActionShortNames,
|
|
98
|
+
expandPermissionEntries: () => import_sdk_core10.expandPermissionEntries,
|
|
99
|
+
expandPermissionEntry: () => import_sdk_core10.expandPermissionEntry,
|
|
100
|
+
isCapabilitySubset: () => import_sdk_core10.isCapabilitySubset,
|
|
101
|
+
isEvmAddress: () => import_sdk_core9.isEvmAddress,
|
|
102
|
+
loadManifest: () => import_sdk_core10.loadManifest,
|
|
103
|
+
makePkhSpaceId: () => import_sdk_core9.makePkhSpaceId,
|
|
104
|
+
makePublicSpaceId: () => import_sdk_core17.makePublicSpaceId,
|
|
105
|
+
parseCanonicalNetworkId: () => import_sdk_core9.parseCanonicalNetworkId,
|
|
106
|
+
parseExpiry: () => import_sdk_core10.parseExpiry,
|
|
107
|
+
parsePkhDid: () => import_sdk_core9.parsePkhDid,
|
|
108
|
+
parseSpaceUri: () => import_sdk_core17.parseSpaceUri,
|
|
109
|
+
pkhDid: () => import_sdk_core9.pkhDid,
|
|
110
|
+
principalDid: () => import_sdk_core9.principalDid,
|
|
111
|
+
principalDidEquals: () => import_sdk_core9.principalDidEquals,
|
|
112
|
+
resolveManifest: () => import_sdk_core10.resolveManifest,
|
|
113
|
+
resolveSecretListPrefix: () => import_sdk_core14.resolveSecretListPrefix,
|
|
114
|
+
resolveSecretPath: () => import_sdk_core14.resolveSecretPath,
|
|
115
|
+
resourceCapabilitiesToSpaceAbilitiesMap: () => import_sdk_core10.resourceCapabilitiesToSpaceAbilitiesMap,
|
|
115
116
|
serializeDelegation: () => serializeDelegation,
|
|
116
|
-
validateManifest: () =>
|
|
117
|
+
validateManifest: () => import_sdk_core10.validateManifest
|
|
117
118
|
});
|
|
118
119
|
module.exports = __toCommonJS(core_exports);
|
|
119
|
-
var import_sdk_core7 = require("@tinycloud/sdk-core");
|
|
120
120
|
var import_sdk_core8 = require("@tinycloud/sdk-core");
|
|
121
|
+
var import_sdk_core9 = require("@tinycloud/sdk-core");
|
|
121
122
|
|
|
122
123
|
// src/storage/MemorySessionStorage.ts
|
|
123
124
|
var MemorySessionStorage = class {
|
|
@@ -1136,32 +1137,35 @@ var NodeUserAuthorization = class {
|
|
|
1136
1137
|
};
|
|
1137
1138
|
|
|
1138
1139
|
// src/TinyCloudNode.ts
|
|
1139
|
-
var
|
|
1140
|
+
var import_sdk_core7 = require("@tinycloud/sdk-core");
|
|
1140
1141
|
|
|
1141
|
-
// src/
|
|
1142
|
+
// src/account/AccountService.ts
|
|
1142
1143
|
var import_sdk_core3 = require("@tinycloud/sdk-core");
|
|
1144
|
+
|
|
1145
|
+
// src/DelegatedAccess.ts
|
|
1146
|
+
var import_sdk_core4 = require("@tinycloud/sdk-core");
|
|
1143
1147
|
var DelegatedAccess = class {
|
|
1144
1148
|
constructor(session, delegation, host, invoke, telemetry) {
|
|
1145
1149
|
this.session = session;
|
|
1146
1150
|
this._delegation = delegation;
|
|
1147
1151
|
this.host = host;
|
|
1148
|
-
this._serviceContext = new
|
|
1152
|
+
this._serviceContext = new import_sdk_core4.ServiceContext({
|
|
1149
1153
|
invoke,
|
|
1150
1154
|
fetch: globalThis.fetch.bind(globalThis),
|
|
1151
1155
|
hosts: [host],
|
|
1152
1156
|
telemetry
|
|
1153
1157
|
});
|
|
1154
1158
|
const prefix = this._delegation.path.replace(/\/$/, "");
|
|
1155
|
-
this._kv = new
|
|
1159
|
+
this._kv = new import_sdk_core4.KVService({ prefix });
|
|
1156
1160
|
this._kv.initialize(this._serviceContext);
|
|
1157
1161
|
this._serviceContext.registerService("kv", this._kv);
|
|
1158
|
-
this._sql = new
|
|
1162
|
+
this._sql = new import_sdk_core4.SQLService({});
|
|
1159
1163
|
this._sql.initialize(this._serviceContext);
|
|
1160
1164
|
this._serviceContext.registerService("sql", this._sql);
|
|
1161
|
-
this._duckdb = new
|
|
1165
|
+
this._duckdb = new import_sdk_core4.DuckDbService({});
|
|
1162
1166
|
this._duckdb.initialize(this._serviceContext);
|
|
1163
1167
|
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
1164
|
-
this._hooks = new
|
|
1168
|
+
this._hooks = new import_sdk_core4.HooksService({});
|
|
1165
1169
|
this._hooks.initialize(this._serviceContext);
|
|
1166
1170
|
this._serviceContext.registerService("hooks", this._hooks);
|
|
1167
1171
|
const serviceSession = {
|
|
@@ -1311,7 +1315,7 @@ function createWasmKeyProvider(sessionManager) {
|
|
|
1311
1315
|
}
|
|
1312
1316
|
|
|
1313
1317
|
// src/delegateToHelpers.ts
|
|
1314
|
-
var
|
|
1318
|
+
var import_sdk_core5 = require("@tinycloud/sdk-core");
|
|
1315
1319
|
function legacyParamsToPermissionEntries(actions, path, spaceIdOverride) {
|
|
1316
1320
|
const byService = /* @__PURE__ */ new Map();
|
|
1317
1321
|
for (const a of actions) {
|
|
@@ -1342,7 +1346,7 @@ function legacyParamsToPermissionEntries(actions, path, spaceIdOverride) {
|
|
|
1342
1346
|
}
|
|
1343
1347
|
return entries;
|
|
1344
1348
|
}
|
|
1345
|
-
var DEFAULT_DELEGATION_EXPIRY_MS =
|
|
1349
|
+
var DEFAULT_DELEGATION_EXPIRY_MS = import_sdk_core5.EXPIRY.SESSION_MS;
|
|
1346
1350
|
function resolveExpiryMs(expiry) {
|
|
1347
1351
|
if (expiry === void 0) {
|
|
1348
1352
|
return DEFAULT_DELEGATION_EXPIRY_MS;
|
|
@@ -1355,10 +1359,10 @@ function resolveExpiryMs(expiry) {
|
|
|
1355
1359
|
}
|
|
1356
1360
|
return expiry;
|
|
1357
1361
|
}
|
|
1358
|
-
return (0,
|
|
1362
|
+
return (0, import_sdk_core5.parseExpiry)(expiry);
|
|
1359
1363
|
}
|
|
1360
1364
|
function extractSiweExpiration(siwe) {
|
|
1361
|
-
const parsed = new
|
|
1365
|
+
const parsed = new import_sdk_core5.SiweMessage(siwe);
|
|
1362
1366
|
if (parsed.expirationTime === void 0 || parsed.expirationTime === null) {
|
|
1363
1367
|
return void 0;
|
|
1364
1368
|
}
|
|
@@ -1372,7 +1376,7 @@ function extractSiweExpiration(siwe) {
|
|
|
1372
1376
|
}
|
|
1373
1377
|
|
|
1374
1378
|
// src/NodeSecretsService.ts
|
|
1375
|
-
var
|
|
1379
|
+
var import_sdk_core6 = require("@tinycloud/sdk-core");
|
|
1376
1380
|
var SECRETS_SPACE = "secrets";
|
|
1377
1381
|
function ok() {
|
|
1378
1382
|
return { ok: true, data: void 0 };
|
|
@@ -1405,7 +1409,7 @@ function secretActionName(action) {
|
|
|
1405
1409
|
}
|
|
1406
1410
|
function secretPermissionEntries(name, options, action, encryptionNetworkId) {
|
|
1407
1411
|
const entries = [];
|
|
1408
|
-
const path = action === "list" ? (0,
|
|
1412
|
+
const path = action === "list" ? (0, import_sdk_core6.resolveSecretListPrefix)(options) : (0, import_sdk_core6.resolveSecretPath)(name, options).permissionPaths.vault;
|
|
1409
1413
|
entries.push({
|
|
1410
1414
|
service: "tinycloud.kv",
|
|
1411
1415
|
space: SECRETS_SPACE,
|
|
@@ -1484,7 +1488,7 @@ var NodeSecretsService = class {
|
|
|
1484
1488
|
);
|
|
1485
1489
|
} catch (error) {
|
|
1486
1490
|
return secretsError(
|
|
1487
|
-
|
|
1491
|
+
import_sdk_core6.ErrorCodes.INVALID_INPUT,
|
|
1488
1492
|
error instanceof Error ? error.message : String(error),
|
|
1489
1493
|
error instanceof Error ? error : void 0
|
|
1490
1494
|
);
|
|
@@ -1494,7 +1498,7 @@ var NodeSecretsService = class {
|
|
|
1494
1498
|
}
|
|
1495
1499
|
if (!this.config.canEscalate()) {
|
|
1496
1500
|
return secretsError(
|
|
1497
|
-
|
|
1501
|
+
import_sdk_core6.ErrorCodes.PERMISSION_DENIED,
|
|
1498
1502
|
`Cannot autosign ${displayActionUrn(action)} for ${target}; TinyCloudNode needs wallet mode with a signer or privateKey.`
|
|
1499
1503
|
);
|
|
1500
1504
|
}
|
|
@@ -1503,7 +1507,7 @@ var NodeSecretsService = class {
|
|
|
1503
1507
|
return this.restoreUnlockAfterEscalation();
|
|
1504
1508
|
} catch (error) {
|
|
1505
1509
|
return secretsError(
|
|
1506
|
-
|
|
1510
|
+
import_sdk_core6.ErrorCodes.PERMISSION_DENIED,
|
|
1507
1511
|
error instanceof Error ? error.message : `Autosign escalation for ${displayActionUrn(action)} on ${target} failed.`,
|
|
1508
1512
|
error instanceof Error ? error : void 0
|
|
1509
1513
|
);
|
|
@@ -1524,10 +1528,10 @@ var NodeSecretsService = class {
|
|
|
1524
1528
|
return false;
|
|
1525
1529
|
}
|
|
1526
1530
|
const manifests = Array.isArray(manifest) ? manifest : [manifest];
|
|
1527
|
-
const requestedEntries = (0,
|
|
1531
|
+
const requestedEntries = (0, import_sdk_core6.expandPermissionEntries)(permissionEntries);
|
|
1528
1532
|
return requestedEntries.every(
|
|
1529
1533
|
(entry) => manifests.some((candidate) => {
|
|
1530
|
-
const resolved = (0,
|
|
1534
|
+
const resolved = (0, import_sdk_core6.resolveManifest)(candidate);
|
|
1531
1535
|
return resolved.resources.some(
|
|
1532
1536
|
(resource) => resource.service === entry.service && resource.space === entry.space && resource.path === entry.path && entry.actions.every((action) => resource.actions.includes(action))
|
|
1533
1537
|
);
|
|
@@ -1542,10 +1546,10 @@ var DEFAULT_ENCRYPTION_NETWORK_NAME = "default";
|
|
|
1542
1546
|
var NETWORK_CREATE_ACTION2 = "tinycloud.encryption/network.create";
|
|
1543
1547
|
var DECRYPT_ACTION2 = "tinycloud.encryption/decrypt";
|
|
1544
1548
|
var NETWORK_ADMIN_TYPE = "tinycloud.encryption.network-admin/v1";
|
|
1545
|
-
var DEFAULT_SESSION_EXPIRATION_MS =
|
|
1549
|
+
var DEFAULT_SESSION_EXPIRATION_MS = import_sdk_core7.EXPIRY.SESSION_MS;
|
|
1546
1550
|
function didPrincipalMatches2(actual, expected) {
|
|
1547
1551
|
try {
|
|
1548
|
-
return (0,
|
|
1552
|
+
return (0, import_sdk_core7.principalDidEquals)(actual, expected);
|
|
1549
1553
|
} catch {
|
|
1550
1554
|
return actual === expected;
|
|
1551
1555
|
}
|
|
@@ -1711,12 +1715,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1711
1715
|
throw new Error("Failed to get session key JWK");
|
|
1712
1716
|
}
|
|
1713
1717
|
this.sessionKeyJwk = JSON.parse(jwkStr);
|
|
1714
|
-
this._capabilityRegistry = new
|
|
1718
|
+
this._capabilityRegistry = new import_sdk_core7.CapabilityKeyRegistry();
|
|
1715
1719
|
this._keyProvider = new WasmKeyProvider({
|
|
1716
1720
|
sessionManager: this.sessionManager
|
|
1717
1721
|
});
|
|
1718
|
-
this.notificationHandler = config.notificationHandler ?? new
|
|
1719
|
-
this._sharingService = new
|
|
1722
|
+
this.notificationHandler = config.notificationHandler ?? new import_sdk_core7.SilentNotificationHandler();
|
|
1723
|
+
this._sharingService = new import_sdk_core7.SharingService({
|
|
1720
1724
|
hosts: [this.config.host],
|
|
1721
1725
|
// session: undefined - not needed for receive()
|
|
1722
1726
|
invoke: this.invokeWithRuntimePermissions,
|
|
@@ -1726,8 +1730,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1726
1730
|
// delegationManager: undefined - not needed for receive()
|
|
1727
1731
|
createKVService: (config2) => {
|
|
1728
1732
|
const prefix = config2.pathPrefix?.replace(/\/$/, "");
|
|
1729
|
-
const kvService = new
|
|
1730
|
-
const kvContext = new
|
|
1733
|
+
const kvService = new import_sdk_core7.KVService({ prefix });
|
|
1734
|
+
const kvContext = new import_sdk_core7.ServiceContext({
|
|
1731
1735
|
invoke: config2.invoke,
|
|
1732
1736
|
fetch: config2.fetch ?? globalThis.fetch.bind(globalThis),
|
|
1733
1737
|
hosts: config2.hosts,
|
|
@@ -1787,7 +1791,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1787
1791
|
capabilityRequest: config.capabilityRequest,
|
|
1788
1792
|
includeAccountRegistryPermissions: config.includeAccountRegistryPermissions
|
|
1789
1793
|
});
|
|
1790
|
-
this.tc = new
|
|
1794
|
+
this.tc = new import_sdk_core7.TinyCloud(this.auth, {
|
|
1791
1795
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
1792
1796
|
telemetry: config.telemetry
|
|
1793
1797
|
});
|
|
@@ -1848,7 +1852,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1848
1852
|
*/
|
|
1849
1853
|
get did() {
|
|
1850
1854
|
if (this._address) {
|
|
1851
|
-
return (0,
|
|
1855
|
+
return (0, import_sdk_core7.pkhDid)(this._address, this._chainId);
|
|
1852
1856
|
}
|
|
1853
1857
|
return this.sessionManager.getDID(this.sessionKeyId);
|
|
1854
1858
|
}
|
|
@@ -1882,6 +1886,37 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1882
1886
|
get spaceId() {
|
|
1883
1887
|
return this.auth?.tinyCloudSession?.spaceId;
|
|
1884
1888
|
}
|
|
1889
|
+
/**
|
|
1890
|
+
* Get the account space ID for this wallet identity.
|
|
1891
|
+
* Available after wallet-backed sign-in or a restored session with address metadata.
|
|
1892
|
+
*/
|
|
1893
|
+
get accountSpaceId() {
|
|
1894
|
+
if (!this._address) {
|
|
1895
|
+
return void 0;
|
|
1896
|
+
}
|
|
1897
|
+
return this.wasmBindings.makeSpaceId(this._address, this._chainId, import_sdk_core7.ACCOUNT_REGISTRY_SPACE);
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Account-level application and delegation helpers.
|
|
1901
|
+
*/
|
|
1902
|
+
get account() {
|
|
1903
|
+
if (!this._account) {
|
|
1904
|
+
this._account = new import_sdk_core3.AccountService({
|
|
1905
|
+
getDid: () => this.did,
|
|
1906
|
+
getHost: () => this.hosts[0] ?? this.config.host,
|
|
1907
|
+
getPrimarySpaceId: () => this.spaceId,
|
|
1908
|
+
getAccountSpaceId: () => this.accountSpaceId,
|
|
1909
|
+
getSpaces: () => this.spaces,
|
|
1910
|
+
getAccountDb: () => this.accountSpaceId ? this.sqlForSpace(this.accountSpaceId).db("account") : void 0,
|
|
1911
|
+
ensureAccountSpaceHosted: async () => {
|
|
1912
|
+
if (this.accountSpaceId && this.auth) {
|
|
1913
|
+
await this.ensureOwnedSpaceHosted(this.accountSpaceId);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
return this._account;
|
|
1919
|
+
}
|
|
1885
1920
|
/**
|
|
1886
1921
|
* Get the current TinyCloud session.
|
|
1887
1922
|
* Available after signIn().
|
|
@@ -1903,7 +1938,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1903
1938
|
);
|
|
1904
1939
|
}
|
|
1905
1940
|
await this.wasmBindings.ensureInitialized?.();
|
|
1906
|
-
this._address = (0,
|
|
1941
|
+
this._address = (0, import_sdk_core7.canonicalizeAddress)(await this.signer.getAddress());
|
|
1907
1942
|
this._chainId = await this.signer.getChainId();
|
|
1908
1943
|
this._kv = void 0;
|
|
1909
1944
|
this._sql = void 0;
|
|
@@ -1923,7 +1958,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1923
1958
|
if (this.config.manifest === void 0 && this.config.capabilityRequest === void 0) {
|
|
1924
1959
|
await this.ensureOwnedSpaceHosted(this.ownedSpaceId("secrets"));
|
|
1925
1960
|
}
|
|
1926
|
-
|
|
1961
|
+
this.scheduleAccountRegistrySync();
|
|
1927
1962
|
this.notificationHandler.success("Successfully signed in");
|
|
1928
1963
|
}
|
|
1929
1964
|
ownedSpaceId(name) {
|
|
@@ -1940,21 +1975,42 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1940
1975
|
if (!this.auth || !this.signer) {
|
|
1941
1976
|
throw new Error("Manifest registry write requires wallet mode");
|
|
1942
1977
|
}
|
|
1943
|
-
const accountSpaceId = this.ownedSpaceId(
|
|
1978
|
+
const accountSpaceId = this.ownedSpaceId(import_sdk_core7.ACCOUNT_REGISTRY_SPACE);
|
|
1944
1979
|
await this.ensureOwnedSpaceHosted(accountSpaceId);
|
|
1945
|
-
const
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1980
|
+
const result = await this.account.applications.register(request.manifests);
|
|
1981
|
+
if (!result.ok) {
|
|
1982
|
+
throw new Error(
|
|
1983
|
+
`Failed to write manifest registry records: ${result.error.message}`
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
scheduleAccountRegistrySync() {
|
|
1988
|
+
void this.withAccountRegistryRetry(async () => {
|
|
1989
|
+
await this.writeManifestRegistryRecords();
|
|
1990
|
+
const spaces = await this.account.spaces.syncAccessible();
|
|
1991
|
+
if (!spaces.ok) {
|
|
1992
|
+
throw new Error(`Failed to sync account spaces: ${spaces.error.message}`);
|
|
1993
|
+
}
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
async withAccountRegistryRetry(task) {
|
|
1997
|
+
const delays = [250, 1e3, 3e3];
|
|
1998
|
+
let lastError;
|
|
1999
|
+
for (let attempt = 0; attempt < delays.length; attempt += 1) {
|
|
2000
|
+
try {
|
|
2001
|
+
await task();
|
|
2002
|
+
return;
|
|
2003
|
+
} catch (error) {
|
|
2004
|
+
lastError = error;
|
|
2005
|
+
if (attempt < delays.length - 1) {
|
|
2006
|
+
await new Promise((resolve) => setTimeout(resolve, delays[attempt]));
|
|
2007
|
+
}
|
|
1956
2008
|
}
|
|
1957
2009
|
}
|
|
2010
|
+
console.warn(
|
|
2011
|
+
"TinyCloud account registry sync failed after retries",
|
|
2012
|
+
lastError
|
|
2013
|
+
);
|
|
1958
2014
|
}
|
|
1959
2015
|
requestedEncryptionNetworkIds() {
|
|
1960
2016
|
const request = this.capabilityRequest;
|
|
@@ -1963,7 +2019,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1963
2019
|
}
|
|
1964
2020
|
const networkIds = /* @__PURE__ */ new Set();
|
|
1965
2021
|
for (const resource of request.resources) {
|
|
1966
|
-
if (resource.service ===
|
|
2022
|
+
if (resource.service === import_sdk_core7.ENCRYPTION_PERMISSION_SERVICE && resource.path.startsWith("urn:tinycloud:encryption:") && resource.actions.includes(DECRYPT_ACTION2)) {
|
|
1967
2023
|
networkIds.add(resource.path);
|
|
1968
2024
|
}
|
|
1969
2025
|
}
|
|
@@ -1974,7 +2030,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1974
2030
|
return;
|
|
1975
2031
|
}
|
|
1976
2032
|
for (const networkId of this.requestedEncryptionNetworkIds()) {
|
|
1977
|
-
const parsed = (0,
|
|
2033
|
+
const parsed = (0, import_sdk_core7.parseNetworkId)(networkId);
|
|
1978
2034
|
if (!didPrincipalMatches2(parsed.ownerDid, this.did)) {
|
|
1979
2035
|
continue;
|
|
1980
2036
|
}
|
|
@@ -1993,7 +2049,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1993
2049
|
if (!host) {
|
|
1994
2050
|
throw new Error("Owned space hosting requires a TinyCloud host");
|
|
1995
2051
|
}
|
|
1996
|
-
const activation = await (0,
|
|
2052
|
+
const activation = await (0, import_sdk_core7.activateSessionWithHost)(host, session.delegationHeader);
|
|
1997
2053
|
if (activation.success && !activation.skipped?.includes(spaceId)) {
|
|
1998
2054
|
return;
|
|
1999
2055
|
}
|
|
@@ -2007,7 +2063,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2007
2063
|
throw new Error(`Failed to create owned space: ${spaceId}`);
|
|
2008
2064
|
}
|
|
2009
2065
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
2010
|
-
const retry = await (0,
|
|
2066
|
+
const retry = await (0, import_sdk_core7.activateSessionWithHost)(host, session.delegationHeader);
|
|
2011
2067
|
if (!retry.success || retry.skipped?.includes(spaceId)) {
|
|
2012
2068
|
throw new Error(
|
|
2013
2069
|
`Failed to activate session after creating owned space ${spaceId}: ${retry.error ?? "space was skipped"}`
|
|
@@ -2049,7 +2105,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2049
2105
|
if (!hosted) {
|
|
2050
2106
|
throw new Error(`Failed to host owned space: ${spaceId}`);
|
|
2051
2107
|
}
|
|
2052
|
-
const activation = await (0,
|
|
2108
|
+
const activation = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
2053
2109
|
host,
|
|
2054
2110
|
this.auth.tinyCloudSession.delegationHeader
|
|
2055
2111
|
);
|
|
@@ -2058,6 +2114,15 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2058
2114
|
`Failed to activate session for owned space ${spaceId}: ${activation.error ?? "space was skipped"}`
|
|
2059
2115
|
);
|
|
2060
2116
|
}
|
|
2117
|
+
void this.account.spaces.register({
|
|
2118
|
+
spaceId,
|
|
2119
|
+
name,
|
|
2120
|
+
ownerDid: this.did,
|
|
2121
|
+
type: "owned",
|
|
2122
|
+
permissions: ["*"],
|
|
2123
|
+
status: "active"
|
|
2124
|
+
}).catch(() => {
|
|
2125
|
+
});
|
|
2061
2126
|
return spaceId;
|
|
2062
2127
|
}
|
|
2063
2128
|
/**
|
|
@@ -2082,30 +2147,30 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2082
2147
|
this._spaceService = void 0;
|
|
2083
2148
|
this._serviceContext = void 0;
|
|
2084
2149
|
this.runtimePermissionGrants = [];
|
|
2085
|
-
const restoredAddress = sessionData.address ? (0,
|
|
2150
|
+
const restoredAddress = sessionData.address ? (0, import_sdk_core7.canonicalizeAddress)(sessionData.address) : void 0;
|
|
2086
2151
|
if (restoredAddress) {
|
|
2087
2152
|
this._address = restoredAddress;
|
|
2088
2153
|
}
|
|
2089
2154
|
if (sessionData.chainId) {
|
|
2090
2155
|
this._chainId = sessionData.chainId;
|
|
2091
2156
|
}
|
|
2092
|
-
this._serviceContext = new
|
|
2157
|
+
this._serviceContext = new import_sdk_core7.ServiceContext({
|
|
2093
2158
|
invoke: this.invokeWithRuntimePermissions,
|
|
2094
2159
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
2095
2160
|
fetch: globalThis.fetch.bind(globalThis),
|
|
2096
2161
|
hosts: [this.config.host],
|
|
2097
2162
|
telemetry: this.config.telemetry
|
|
2098
2163
|
});
|
|
2099
|
-
this._kv = new
|
|
2164
|
+
this._kv = new import_sdk_core7.KVService({});
|
|
2100
2165
|
this._kv.initialize(this._serviceContext);
|
|
2101
2166
|
this._serviceContext.registerService("kv", this._kv);
|
|
2102
|
-
this._sql = new
|
|
2167
|
+
this._sql = new import_sdk_core7.SQLService({});
|
|
2103
2168
|
this._sql.initialize(this._serviceContext);
|
|
2104
2169
|
this._serviceContext.registerService("sql", this._sql);
|
|
2105
|
-
this._duckdb = new
|
|
2170
|
+
this._duckdb = new import_sdk_core7.DuckDbService({});
|
|
2106
2171
|
this._duckdb.initialize(this._serviceContext);
|
|
2107
2172
|
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
2108
|
-
this._hooks = new
|
|
2173
|
+
this._hooks = new import_sdk_core7.HooksService({});
|
|
2109
2174
|
this._hooks.initialize(this._serviceContext);
|
|
2110
2175
|
this._serviceContext.registerService("hooks", this._hooks);
|
|
2111
2176
|
const serviceSession = {
|
|
@@ -2204,7 +2269,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2204
2269
|
capabilityRequest: this.config.capabilityRequest,
|
|
2205
2270
|
includeAccountRegistryPermissions: this.config.includeAccountRegistryPermissions
|
|
2206
2271
|
});
|
|
2207
|
-
this.tc = new
|
|
2272
|
+
this.tc = new import_sdk_core7.TinyCloud(this.auth, {
|
|
2208
2273
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
2209
2274
|
telemetry: this.config.telemetry
|
|
2210
2275
|
});
|
|
@@ -2249,7 +2314,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2249
2314
|
capabilityRequest: this.config.capabilityRequest,
|
|
2250
2315
|
includeAccountRegistryPermissions: this.config.includeAccountRegistryPermissions
|
|
2251
2316
|
});
|
|
2252
|
-
this.tc = new
|
|
2317
|
+
this.tc = new import_sdk_core7.TinyCloud(this.auth, {
|
|
2253
2318
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
2254
2319
|
telemetry: this.config.telemetry
|
|
2255
2320
|
});
|
|
@@ -2265,28 +2330,28 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2265
2330
|
return;
|
|
2266
2331
|
}
|
|
2267
2332
|
this.tc.initializeServices(this.invokeWithRuntimePermissions, [this.config.host]);
|
|
2268
|
-
this._serviceContext = new
|
|
2333
|
+
this._serviceContext = new import_sdk_core7.ServiceContext({
|
|
2269
2334
|
invoke: this.invokeWithRuntimePermissions,
|
|
2270
2335
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
2271
2336
|
fetch: globalThis.fetch.bind(globalThis),
|
|
2272
2337
|
hosts: [this.config.host],
|
|
2273
2338
|
telemetry: this.config.telemetry
|
|
2274
2339
|
});
|
|
2275
|
-
this._kv = new
|
|
2340
|
+
this._kv = new import_sdk_core7.KVService({});
|
|
2276
2341
|
this._kv.initialize(this._serviceContext);
|
|
2277
2342
|
this._serviceContext.registerService("kv", this._kv);
|
|
2278
2343
|
const features = this.nodeFeatures;
|
|
2279
2344
|
if (features.length === 0 || features.includes("sql")) {
|
|
2280
|
-
this._sql = new
|
|
2345
|
+
this._sql = new import_sdk_core7.SQLService({});
|
|
2281
2346
|
this._sql.initialize(this._serviceContext);
|
|
2282
2347
|
this._serviceContext.registerService("sql", this._sql);
|
|
2283
2348
|
}
|
|
2284
2349
|
if (features.length === 0 || features.includes("duckdb")) {
|
|
2285
|
-
this._duckdb = new
|
|
2350
|
+
this._duckdb = new import_sdk_core7.DuckDbService({});
|
|
2286
2351
|
this._duckdb.initialize(this._serviceContext);
|
|
2287
2352
|
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
2288
2353
|
}
|
|
2289
|
-
this._hooks = new
|
|
2354
|
+
this._hooks = new import_sdk_core7.HooksService({});
|
|
2290
2355
|
this._hooks.initialize(this._serviceContext);
|
|
2291
2356
|
this._serviceContext.registerService("hooks", this._hooks);
|
|
2292
2357
|
const serviceSession = {
|
|
@@ -2304,9 +2369,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2304
2369
|
this.initializeV2Services(serviceSession);
|
|
2305
2370
|
}
|
|
2306
2371
|
createSpaceScopedKVService(spaceId) {
|
|
2307
|
-
const kvService = new
|
|
2372
|
+
const kvService = new import_sdk_core7.KVService({});
|
|
2308
2373
|
if (this._serviceContext) {
|
|
2309
|
-
const spaceScopedContext = new
|
|
2374
|
+
const spaceScopedContext = new import_sdk_core7.ServiceContext({
|
|
2310
2375
|
invoke: this._serviceContext.invoke,
|
|
2311
2376
|
fetch: this._serviceContext.fetch,
|
|
2312
2377
|
hosts: this._serviceContext.hosts,
|
|
@@ -2371,7 +2436,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2371
2436
|
const shared = wasm.vault_x25519_dh(receiverPrivateKey, peerPublic);
|
|
2372
2437
|
return columnDecrypt(shared, ciphertext);
|
|
2373
2438
|
},
|
|
2374
|
-
verifyNodeSignature: (nodeId, message, signature) => (0,
|
|
2439
|
+
verifyNodeSignature: (nodeId, message, signature) => (0, import_sdk_core7.verifyDidKeyEd25519Signature)(nodeId, message, signature)
|
|
2375
2440
|
};
|
|
2376
2441
|
}
|
|
2377
2442
|
async fetchNodeId() {
|
|
@@ -2442,7 +2507,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2442
2507
|
return await response.json();
|
|
2443
2508
|
}
|
|
2444
2509
|
};
|
|
2445
|
-
return new
|
|
2510
|
+
return new import_sdk_core7.EncryptionService({
|
|
2446
2511
|
crypto,
|
|
2447
2512
|
signer: {
|
|
2448
2513
|
signDecryptInvocation: async (input) => {
|
|
@@ -2454,7 +2519,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2454
2519
|
});
|
|
2455
2520
|
return {
|
|
2456
2521
|
...signed,
|
|
2457
|
-
canonicalBody: (0,
|
|
2522
|
+
canonicalBody: (0, import_sdk_core7.canonicalizeEncryptionJson)(
|
|
2458
2523
|
input.body
|
|
2459
2524
|
)
|
|
2460
2525
|
};
|
|
@@ -2472,8 +2537,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2472
2537
|
if (!this.config.host) {
|
|
2473
2538
|
return null;
|
|
2474
2539
|
}
|
|
2475
|
-
const publicSpaceId = (0,
|
|
2476
|
-
const result = await
|
|
2540
|
+
const publicSpaceId = (0, import_sdk_core7.makePublicSpaceId)(this._address, this._chainId);
|
|
2541
|
+
const result = await import_sdk_core7.TinyCloud.readPublicSpace(this.config.host, publicSpaceId, discoveryKey);
|
|
2477
2542
|
if (!result.ok) {
|
|
2478
2543
|
return null;
|
|
2479
2544
|
}
|
|
@@ -2496,7 +2561,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2496
2561
|
}
|
|
2497
2562
|
createVaultService(spaceId, kv) {
|
|
2498
2563
|
const wasm = this.wasmBindings;
|
|
2499
|
-
const vaultCrypto = (0,
|
|
2564
|
+
const vaultCrypto = (0, import_sdk_core7.createVaultCrypto)({
|
|
2500
2565
|
vault_encrypt: wasm.vault_encrypt,
|
|
2501
2566
|
vault_decrypt: wasm.vault_decrypt,
|
|
2502
2567
|
vault_derive_key: wasm.vault_derive_key,
|
|
@@ -2506,7 +2571,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2506
2571
|
vault_sha256: wasm.vault_sha256
|
|
2507
2572
|
});
|
|
2508
2573
|
const self = this;
|
|
2509
|
-
return new
|
|
2574
|
+
return new import_sdk_core7.DataVaultService({
|
|
2510
2575
|
spaceId,
|
|
2511
2576
|
crypto: vaultCrypto,
|
|
2512
2577
|
encryption: {
|
|
@@ -2529,8 +2594,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2529
2594
|
get publicKV() {
|
|
2530
2595
|
return self._publicKV ?? self.tc.publicKV;
|
|
2531
2596
|
},
|
|
2532
|
-
readPublicSpace: (host, targetSpaceId, key) =>
|
|
2533
|
-
makePublicSpaceId:
|
|
2597
|
+
readPublicSpace: (host, targetSpaceId, key) => import_sdk_core7.TinyCloud.readPublicSpace(host, targetSpaceId, key),
|
|
2598
|
+
makePublicSpaceId: import_sdk_core7.TinyCloud.makePublicSpaceId,
|
|
2534
2599
|
did: this.did,
|
|
2535
2600
|
address: this._address ?? "",
|
|
2536
2601
|
chainId: this._chainId,
|
|
@@ -2543,7 +2608,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2543
2608
|
* @internal
|
|
2544
2609
|
*/
|
|
2545
2610
|
initializeV2Services(serviceSession) {
|
|
2546
|
-
this._capabilityRegistry = new
|
|
2611
|
+
this._capabilityRegistry = new import_sdk_core7.CapabilityKeyRegistry();
|
|
2547
2612
|
const tcSession = this.auth?.tinyCloudSession;
|
|
2548
2613
|
if (tcSession && this._address) {
|
|
2549
2614
|
const sessionKey = {
|
|
@@ -2617,13 +2682,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2617
2682
|
}
|
|
2618
2683
|
this._capabilityRegistry.registerKey(sessionKey, delegations);
|
|
2619
2684
|
}
|
|
2620
|
-
this._delegationManager = new
|
|
2685
|
+
this._delegationManager = new import_sdk_core7.DelegationManager({
|
|
2621
2686
|
hosts: [this.config.host],
|
|
2622
2687
|
session: serviceSession,
|
|
2623
2688
|
invoke: this.invokeWithRuntimePermissions,
|
|
2624
2689
|
fetch: globalThis.fetch.bind(globalThis)
|
|
2625
2690
|
});
|
|
2626
|
-
this._spaceService = new
|
|
2691
|
+
this._spaceService = new import_sdk_core7.SpaceService({
|
|
2627
2692
|
hosts: [this.config.host],
|
|
2628
2693
|
session: serviceSession,
|
|
2629
2694
|
invoke: this.wasmBindings.invoke,
|
|
@@ -2675,6 +2740,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2675
2740
|
}
|
|
2676
2741
|
};
|
|
2677
2742
|
}
|
|
2743
|
+
},
|
|
2744
|
+
onSpaceRegistered: async (space) => {
|
|
2745
|
+
await this.account.spaces.register(space);
|
|
2678
2746
|
}
|
|
2679
2747
|
});
|
|
2680
2748
|
this._sharingService.updateConfig({
|
|
@@ -2780,7 +2848,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2780
2848
|
...prepared,
|
|
2781
2849
|
signature
|
|
2782
2850
|
});
|
|
2783
|
-
const activateResult = await (0,
|
|
2851
|
+
const activateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
2784
2852
|
host,
|
|
2785
2853
|
delegationSession.delegationHeader
|
|
2786
2854
|
);
|
|
@@ -2790,7 +2858,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2790
2858
|
return {
|
|
2791
2859
|
cid: delegationSession.delegationCid,
|
|
2792
2860
|
delegateDID: params.shareKeyDID,
|
|
2793
|
-
delegatorDID: (0,
|
|
2861
|
+
delegatorDID: (0, import_sdk_core7.pkhDid)(session.address, session.chainId),
|
|
2794
2862
|
spaceId: params.spaceId,
|
|
2795
2863
|
path: params.path,
|
|
2796
2864
|
actions: params.actions,
|
|
@@ -2847,7 +2915,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2847
2915
|
if (!this._sql) {
|
|
2848
2916
|
const features = this.nodeFeatures;
|
|
2849
2917
|
if (features.length > 0 && !features.includes("sql")) {
|
|
2850
|
-
throw new
|
|
2918
|
+
throw new import_sdk_core7.UnsupportedFeatureError("sql", this.config.host, features);
|
|
2851
2919
|
}
|
|
2852
2920
|
throw new Error("Not signed in. Call signIn() first.");
|
|
2853
2921
|
}
|
|
@@ -2871,8 +2939,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2871
2939
|
if (!this._serviceContext || !this._serviceContext.session) {
|
|
2872
2940
|
throw new Error("Not signed in. Call signIn() first.");
|
|
2873
2941
|
}
|
|
2874
|
-
const sql = new
|
|
2875
|
-
const spaceScopedContext = new
|
|
2942
|
+
const sql = new import_sdk_core7.SQLService({});
|
|
2943
|
+
const spaceScopedContext = new import_sdk_core7.ServiceContext({
|
|
2876
2944
|
invoke: this._serviceContext.invoke,
|
|
2877
2945
|
fetch: this._serviceContext.fetch,
|
|
2878
2946
|
hosts: this._serviceContext.hosts,
|
|
@@ -2900,8 +2968,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2900
2968
|
if (!this._serviceContext || !this._serviceContext.session) {
|
|
2901
2969
|
throw new Error("Not signed in. Call signIn() first.");
|
|
2902
2970
|
}
|
|
2903
|
-
const kv = new
|
|
2904
|
-
const spaceScopedContext = new
|
|
2971
|
+
const kv = new import_sdk_core7.KVService({});
|
|
2972
|
+
const spaceScopedContext = new import_sdk_core7.ServiceContext({
|
|
2905
2973
|
invoke: this._serviceContext.invoke,
|
|
2906
2974
|
fetch: this._serviceContext.fetch,
|
|
2907
2975
|
hosts: this._serviceContext.hosts
|
|
@@ -2917,7 +2985,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2917
2985
|
if (!this._duckdb) {
|
|
2918
2986
|
const features = this.nodeFeatures;
|
|
2919
2987
|
if (features.length > 0 && !features.includes("duckdb")) {
|
|
2920
|
-
throw new
|
|
2988
|
+
throw new import_sdk_core7.UnsupportedFeatureError("duckdb", this.config.host, features);
|
|
2921
2989
|
}
|
|
2922
2990
|
throw new Error("Not signed in. Call signIn() first.");
|
|
2923
2991
|
}
|
|
@@ -2969,7 +3037,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2969
3037
|
type: NETWORK_ADMIN_TYPE,
|
|
2970
3038
|
targetNode,
|
|
2971
3039
|
networkId,
|
|
2972
|
-
bodyHash: (0,
|
|
3040
|
+
bodyHash: (0, import_sdk_core7.canonicalHashHex)(
|
|
2973
3041
|
crypto.sha256,
|
|
2974
3042
|
body
|
|
2975
3043
|
),
|
|
@@ -2987,7 +3055,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2987
3055
|
Authorization: signed.authorization,
|
|
2988
3056
|
"Content-Type": "application/json"
|
|
2989
3057
|
},
|
|
2990
|
-
body: (0,
|
|
3058
|
+
body: (0, import_sdk_core7.canonicalizeEncryptionJson)(
|
|
2991
3059
|
body
|
|
2992
3060
|
)
|
|
2993
3061
|
});
|
|
@@ -3005,7 +3073,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3005
3073
|
if (existing) {
|
|
3006
3074
|
return existing;
|
|
3007
3075
|
}
|
|
3008
|
-
const parsed = (0,
|
|
3076
|
+
const parsed = (0, import_sdk_core7.parseNetworkId)(networkId);
|
|
3009
3077
|
if (!didPrincipalMatches2(parsed.ownerDid, this.did)) {
|
|
3010
3078
|
throw new Error(
|
|
3011
3079
|
`Cannot create encryption network ${networkId}: owner ${parsed.ownerDid} does not match signed-in DID ${this.did}`
|
|
@@ -3038,7 +3106,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3038
3106
|
throw new Error("Not signed in. Call signIn() first.");
|
|
3039
3107
|
}
|
|
3040
3108
|
if (!this._baseSecrets) {
|
|
3041
|
-
this._baseSecrets = new
|
|
3109
|
+
this._baseSecrets = new import_sdk_core7.SecretsService(() => this.space("secrets").vault);
|
|
3042
3110
|
}
|
|
3043
3111
|
return this._baseSecrets;
|
|
3044
3112
|
}
|
|
@@ -3153,10 +3221,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3153
3221
|
async useRuntimeDelegation(delegation) {
|
|
3154
3222
|
const session = this.currentTinyCloudSession();
|
|
3155
3223
|
if (!session) {
|
|
3156
|
-
throw new
|
|
3224
|
+
throw new import_sdk_core7.SessionExpiredError(/* @__PURE__ */ new Date(0));
|
|
3157
3225
|
}
|
|
3158
3226
|
if (delegation.expiry.getTime() <= Date.now()) {
|
|
3159
|
-
throw new
|
|
3227
|
+
throw new import_sdk_core7.SessionExpiredError(delegation.expiry);
|
|
3160
3228
|
}
|
|
3161
3229
|
const expectedDids = [session.verificationMethod, this.sessionDid];
|
|
3162
3230
|
if (!expectedDids.some((did) => didPrincipalMatches2(delegation.delegateDID, did))) {
|
|
@@ -3165,7 +3233,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3165
3233
|
);
|
|
3166
3234
|
}
|
|
3167
3235
|
const targetHost = delegation.host ?? this.config.host;
|
|
3168
|
-
const activateResult = await (0,
|
|
3236
|
+
const activateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
3169
3237
|
targetHost,
|
|
3170
3238
|
delegation.delegationHeader
|
|
3171
3239
|
);
|
|
@@ -3192,13 +3260,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3192
3260
|
}
|
|
3193
3261
|
const session = this.currentTinyCloudSession();
|
|
3194
3262
|
if (!session) {
|
|
3195
|
-
throw new
|
|
3263
|
+
throw new import_sdk_core7.SessionExpiredError(/* @__PURE__ */ new Date(0));
|
|
3196
3264
|
}
|
|
3197
3265
|
const sessionExpiry = extractSiweExpiration(session.siwe);
|
|
3198
3266
|
if (sessionExpiry !== void 0) {
|
|
3199
3267
|
const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
|
|
3200
3268
|
if (sessionExpiry.getTime() <= Date.now() + marginMs) {
|
|
3201
|
-
throw new
|
|
3269
|
+
throw new import_sdk_core7.SessionExpiredError(sessionExpiry);
|
|
3202
3270
|
}
|
|
3203
3271
|
}
|
|
3204
3272
|
const expanded = this.expandPermissionEntries(permissions);
|
|
@@ -3261,7 +3329,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3261
3329
|
...prepared,
|
|
3262
3330
|
signature
|
|
3263
3331
|
});
|
|
3264
|
-
const activateResult = await (0,
|
|
3332
|
+
const activateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
3265
3333
|
this.config.host,
|
|
3266
3334
|
delegatedSession.delegationHeader
|
|
3267
3335
|
);
|
|
@@ -3434,7 +3502,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3434
3502
|
];
|
|
3435
3503
|
const abilities = { kv: { "": kvActions } };
|
|
3436
3504
|
const now = /* @__PURE__ */ new Date();
|
|
3437
|
-
const expiryMs =
|
|
3505
|
+
const expiryMs = import_sdk_core7.EXPIRY.EPHEMERAL_MS;
|
|
3438
3506
|
const expirationTime = new Date(now.getTime() + expiryMs);
|
|
3439
3507
|
const prepared = this.wasmBindings.prepareSession({
|
|
3440
3508
|
abilities,
|
|
@@ -3452,7 +3520,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3452
3520
|
...prepared,
|
|
3453
3521
|
signature
|
|
3454
3522
|
});
|
|
3455
|
-
const activateResult = await (0,
|
|
3523
|
+
const activateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
3456
3524
|
this.config.host,
|
|
3457
3525
|
delegationSession.delegationHeader
|
|
3458
3526
|
);
|
|
@@ -3479,8 +3547,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3479
3547
|
}]);
|
|
3480
3548
|
}
|
|
3481
3549
|
if (this._serviceContext) {
|
|
3482
|
-
const publicKV = new
|
|
3483
|
-
const publicContext = new
|
|
3550
|
+
const publicKV = new import_sdk_core7.KVService({ prefix: "" });
|
|
3551
|
+
const publicContext = new import_sdk_core7.ServiceContext({
|
|
3484
3552
|
invoke: this.invokeWithRuntimePermissions,
|
|
3485
3553
|
fetch: this._serviceContext.fetch,
|
|
3486
3554
|
hosts: this._serviceContext.hosts,
|
|
@@ -3607,14 +3675,14 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3607
3675
|
async delegateTo(did, permissions, options) {
|
|
3608
3676
|
const session = this.currentTinyCloudSession();
|
|
3609
3677
|
if (!session) {
|
|
3610
|
-
throw new
|
|
3678
|
+
throw new import_sdk_core7.SessionExpiredError(/* @__PURE__ */ new Date(0));
|
|
3611
3679
|
}
|
|
3612
3680
|
const sessionExpiry = extractSiweExpiration(session.siwe);
|
|
3613
3681
|
if (sessionExpiry !== void 0) {
|
|
3614
3682
|
const now2 = Date.now();
|
|
3615
3683
|
const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
|
|
3616
3684
|
if (sessionExpiry.getTime() <= now2 + marginMs) {
|
|
3617
|
-
throw new
|
|
3685
|
+
throw new import_sdk_core7.SessionExpiredError(sessionExpiry);
|
|
3618
3686
|
}
|
|
3619
3687
|
}
|
|
3620
3688
|
if (!Array.isArray(permissions) || permissions.length === 0) {
|
|
@@ -3643,11 +3711,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3643
3711
|
);
|
|
3644
3712
|
return { delegation: delegation2, prompted: true };
|
|
3645
3713
|
}
|
|
3646
|
-
const granted = (0,
|
|
3714
|
+
const granted = (0, import_sdk_core7.parseRecapCapabilities)(
|
|
3647
3715
|
(siwe) => this.wasmBindings.parseRecapFromSiwe(siwe),
|
|
3648
3716
|
session.siwe
|
|
3649
3717
|
);
|
|
3650
|
-
const { subset, missing } = (0,
|
|
3718
|
+
const { subset, missing } = (0, import_sdk_core7.isCapabilitySubset)(expandedEntries, granted);
|
|
3651
3719
|
if (!subset) {
|
|
3652
3720
|
const runtimeGrant = this.findGrantForOperations(
|
|
3653
3721
|
this.permissionEntriesToOperations(expandedEntries, session)
|
|
@@ -3655,7 +3723,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3655
3723
|
if (runtimeGrant) {
|
|
3656
3724
|
const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
|
|
3657
3725
|
if (runtimeGrant.expiresAt.getTime() <= Date.now() + marginMs) {
|
|
3658
|
-
throw new
|
|
3726
|
+
throw new import_sdk_core7.SessionExpiredError(runtimeGrant.expiresAt);
|
|
3659
3727
|
}
|
|
3660
3728
|
const runtimeExpiration = runtimeGrant.expiresAt < effectiveExpiration ? runtimeGrant.expiresAt : effectiveExpiration;
|
|
3661
3729
|
const delegation2 = await this.createDelegationViaRuntimeGrant(
|
|
@@ -3666,7 +3734,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3666
3734
|
);
|
|
3667
3735
|
return { delegation: delegation2, prompted: false };
|
|
3668
3736
|
}
|
|
3669
|
-
throw new
|
|
3737
|
+
throw new import_sdk_core7.PermissionNotInManifestError(missing, granted);
|
|
3670
3738
|
}
|
|
3671
3739
|
const delegation = await this.createDelegationViaWasmPath(
|
|
3672
3740
|
did,
|
|
@@ -3748,7 +3816,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3748
3816
|
const spaceId = resolvedSpaces.size === 1 ? [...resolvedSpaces][0] : session.spaceId;
|
|
3749
3817
|
const abilities = {};
|
|
3750
3818
|
for (const entry of entries) {
|
|
3751
|
-
const shortService =
|
|
3819
|
+
const shortService = import_sdk_core7.SERVICE_LONG_TO_SHORT[entry.service];
|
|
3752
3820
|
if (shortService === void 0) {
|
|
3753
3821
|
throw new Error(
|
|
3754
3822
|
`delegateTo: unknown service '${entry.service}' \u2014 no short-form mapping`
|
|
@@ -3788,7 +3856,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3788
3856
|
});
|
|
3789
3857
|
const primary = result.resources[0];
|
|
3790
3858
|
const delegationHeader = { Authorization: result.delegation };
|
|
3791
|
-
const activateResult = await (0,
|
|
3859
|
+
const activateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
3792
3860
|
this.config.host,
|
|
3793
3861
|
delegationHeader
|
|
3794
3862
|
);
|
|
@@ -3823,7 +3891,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3823
3891
|
const primary = result.resources[0];
|
|
3824
3892
|
const delegationHeader = { Authorization: result.delegation };
|
|
3825
3893
|
const targetHost = grant.delegation.host ?? this.config.host;
|
|
3826
|
-
const activateResult = await (0,
|
|
3894
|
+
const activateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
3827
3895
|
targetHost,
|
|
3828
3896
|
delegationHeader
|
|
3829
3897
|
);
|
|
@@ -3864,10 +3932,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3864
3932
|
return this.wasmBindings.makeSpaceId(session.address, session.chainId, space);
|
|
3865
3933
|
}
|
|
3866
3934
|
expandPermissionEntries(permissions) {
|
|
3867
|
-
return (0,
|
|
3935
|
+
return (0, import_sdk_core7.expandPermissionEntries)(permissions);
|
|
3868
3936
|
}
|
|
3869
3937
|
shortServiceName(service) {
|
|
3870
|
-
const short =
|
|
3938
|
+
const short = import_sdk_core7.SERVICE_LONG_TO_SHORT[service];
|
|
3871
3939
|
if (short === void 0) {
|
|
3872
3940
|
throw new Error(
|
|
3873
3941
|
`unknown service '${service}' \u2014 no short-form mapping`
|
|
@@ -3893,7 +3961,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3893
3961
|
return abilities;
|
|
3894
3962
|
}
|
|
3895
3963
|
isEncryptionPermissionEntry(entry) {
|
|
3896
|
-
return entry.service ===
|
|
3964
|
+
return entry.service === import_sdk_core7.ENCRYPTION_PERMISSION_SERVICE && entry.path.startsWith("urn:tinycloud:encryption:");
|
|
3897
3965
|
}
|
|
3898
3966
|
permissionsToRawAbilities(entries) {
|
|
3899
3967
|
const rawAbilities = {};
|
|
@@ -3926,11 +3994,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3926
3994
|
}
|
|
3927
3995
|
sessionCoversPermissionEntries(session, entries) {
|
|
3928
3996
|
try {
|
|
3929
|
-
const granted = (0,
|
|
3997
|
+
const granted = (0, import_sdk_core7.parseRecapCapabilities)(
|
|
3930
3998
|
(siwe) => this.wasmBindings.parseRecapFromSiwe(siwe),
|
|
3931
3999
|
session.siwe
|
|
3932
4000
|
);
|
|
3933
|
-
return (0,
|
|
4001
|
+
return (0, import_sdk_core7.isCapabilitySubset)(entries, granted).subset;
|
|
3934
4002
|
} catch {
|
|
3935
4003
|
return false;
|
|
3936
4004
|
}
|
|
@@ -4261,7 +4329,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4261
4329
|
if (resolvedDelegateDID.endsWith(".eth") && this.config.ensResolver) {
|
|
4262
4330
|
const address = await this.config.ensResolver.resolveAddress(resolvedDelegateDID);
|
|
4263
4331
|
if (!address) throw new Error(`Could not resolve ENS name: ${resolvedDelegateDID}`);
|
|
4264
|
-
resolvedDelegateDID = (0,
|
|
4332
|
+
resolvedDelegateDID = (0, import_sdk_core7.pkhDid)(address, 1);
|
|
4265
4333
|
}
|
|
4266
4334
|
const entries = legacyParamsToPermissionEntries(
|
|
4267
4335
|
params.actions,
|
|
@@ -4276,7 +4344,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4276
4344
|
);
|
|
4277
4345
|
return result.delegation;
|
|
4278
4346
|
} catch (err) {
|
|
4279
|
-
if (err instanceof
|
|
4347
|
+
if (err instanceof import_sdk_core7.PermissionNotInManifestError) {
|
|
4280
4348
|
} else {
|
|
4281
4349
|
throw err;
|
|
4282
4350
|
}
|
|
@@ -4333,7 +4401,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4333
4401
|
...prepared,
|
|
4334
4402
|
signature
|
|
4335
4403
|
});
|
|
4336
|
-
const activateResult = await (0,
|
|
4404
|
+
const activateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
4337
4405
|
this.config.host,
|
|
4338
4406
|
delegationSession.delegationHeader
|
|
4339
4407
|
);
|
|
@@ -4355,7 +4423,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4355
4423
|
};
|
|
4356
4424
|
const hasKvActions = params.actions.some((a) => a.startsWith("tinycloud.kv/"));
|
|
4357
4425
|
if (hasKvActions && params.includePublicSpace !== false) {
|
|
4358
|
-
const publicSpaceId = (0,
|
|
4426
|
+
const publicSpaceId = (0, import_sdk_core7.makePublicSpaceId)(
|
|
4359
4427
|
this.wasmBindings.ensureEip55(session.address),
|
|
4360
4428
|
session.chainId
|
|
4361
4429
|
);
|
|
@@ -4378,7 +4446,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4378
4446
|
...publicPrepared,
|
|
4379
4447
|
signature: publicSignature
|
|
4380
4448
|
});
|
|
4381
|
-
const publicActivateResult = await (0,
|
|
4449
|
+
const publicActivateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
4382
4450
|
this.config.host,
|
|
4383
4451
|
publicSession.delegationHeader
|
|
4384
4452
|
);
|
|
@@ -4483,7 +4551,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4483
4551
|
...prepared,
|
|
4484
4552
|
signature
|
|
4485
4553
|
});
|
|
4486
|
-
const activateResult = await (0,
|
|
4554
|
+
const activateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
4487
4555
|
targetHost,
|
|
4488
4556
|
invokerSession.delegationHeader
|
|
4489
4557
|
);
|
|
@@ -4589,7 +4657,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4589
4657
|
...prepared,
|
|
4590
4658
|
signature
|
|
4591
4659
|
});
|
|
4592
|
-
const activateResult = await (0,
|
|
4660
|
+
const activateResult = await (0, import_sdk_core7.activateSessionWithHost)(
|
|
4593
4661
|
targetHost,
|
|
4594
4662
|
subDelegationSession.delegationHeader
|
|
4595
4663
|
);
|
|
@@ -4625,7 +4693,7 @@ _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS = 6e4;
|
|
|
4625
4693
|
var TinyCloudNode = _TinyCloudNode;
|
|
4626
4694
|
|
|
4627
4695
|
// src/core.ts
|
|
4628
|
-
var
|
|
4696
|
+
var import_sdk_core10 = require("@tinycloud/sdk-core");
|
|
4629
4697
|
|
|
4630
4698
|
// src/delegation.ts
|
|
4631
4699
|
function serializeDelegation(delegation) {
|
|
@@ -4644,7 +4712,6 @@ function deserializeDelegation(data) {
|
|
|
4644
4712
|
}
|
|
4645
4713
|
|
|
4646
4714
|
// src/core.ts
|
|
4647
|
-
var import_sdk_core10 = require("@tinycloud/sdk-core");
|
|
4648
4715
|
var import_sdk_core11 = require("@tinycloud/sdk-core");
|
|
4649
4716
|
var import_sdk_core12 = require("@tinycloud/sdk-core");
|
|
4650
4717
|
var import_sdk_core13 = require("@tinycloud/sdk-core");
|
|
@@ -4653,10 +4720,12 @@ var import_sdk_core15 = require("@tinycloud/sdk-core");
|
|
|
4653
4720
|
var import_sdk_core16 = require("@tinycloud/sdk-core");
|
|
4654
4721
|
var import_sdk_core17 = require("@tinycloud/sdk-core");
|
|
4655
4722
|
var import_sdk_core18 = require("@tinycloud/sdk-core");
|
|
4723
|
+
var import_sdk_core19 = require("@tinycloud/sdk-core");
|
|
4656
4724
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4657
4725
|
0 && (module.exports = {
|
|
4658
4726
|
ACCOUNT_REGISTRY_PATH,
|
|
4659
4727
|
ACCOUNT_REGISTRY_SPACE,
|
|
4728
|
+
AccountService,
|
|
4660
4729
|
AutoApproveSpaceCreationHandler,
|
|
4661
4730
|
CapabilityKeyRegistry,
|
|
4662
4731
|
CapabilityKeyRegistryErrorCodes,
|