@tinycloud/node-sdk 2.4.0-beta.1 → 2.4.0-beta.10
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-Dbzm1kA_.d.cts → core-DiVEwp2P.d.cts} +105 -5
- package/dist/{core-Dbzm1kA_.d.ts → core-DiVEwp2P.d.ts} +105 -5
- package/dist/core.cjs +377 -218
- 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 +205 -44
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +448 -261
- 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 +236 -48
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -17025,133 +17025,135 @@ var require_utils2 = __commonJS({
|
|
|
17025
17025
|
// src/index.ts
|
|
17026
17026
|
var index_exports = {};
|
|
17027
17027
|
__export(index_exports, {
|
|
17028
|
-
ACCOUNT_REGISTRY_PATH: () =>
|
|
17029
|
-
ACCOUNT_REGISTRY_SPACE: () =>
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
|
|
17039
|
-
|
|
17040
|
-
|
|
17041
|
-
|
|
17042
|
-
|
|
17028
|
+
ACCOUNT_REGISTRY_PATH: () => import_sdk_core10.ACCOUNT_REGISTRY_PATH,
|
|
17029
|
+
ACCOUNT_REGISTRY_SPACE: () => import_sdk_core10.ACCOUNT_REGISTRY_SPACE,
|
|
17030
|
+
AccountService: () => import_sdk_core2.AccountService,
|
|
17031
|
+
AutoApproveSpaceCreationHandler: () => import_sdk_core9.AutoApproveSpaceCreationHandler,
|
|
17032
|
+
CapabilityKeyRegistry: () => import_sdk_core18.CapabilityKeyRegistry,
|
|
17033
|
+
CapabilityKeyRegistryErrorCodes: () => import_sdk_core18.CapabilityKeyRegistryErrorCodes,
|
|
17034
|
+
DECRYPT_ACTION: () => import_sdk_core15.DECRYPT_ACTION,
|
|
17035
|
+
DECRYPT_FACT_TYPE: () => import_sdk_core15.DECRYPT_FACT_TYPE,
|
|
17036
|
+
DECRYPT_RESULT_TYPE: () => import_sdk_core15.DECRYPT_RESULT_TYPE,
|
|
17037
|
+
DEFAULT_ENCRYPTION_ALG: () => import_sdk_core15.DEFAULT_ENCRYPTION_ALG,
|
|
17038
|
+
DEFAULT_KEY_VERSION: () => import_sdk_core15.DEFAULT_KEY_VERSION,
|
|
17039
|
+
DEFAULT_MANIFEST_SPACE: () => import_sdk_core10.DEFAULT_MANIFEST_SPACE,
|
|
17040
|
+
DEFAULT_MANIFEST_VERSION: () => import_sdk_core10.DEFAULT_MANIFEST_VERSION,
|
|
17041
|
+
DEFAULT_SIGNED_READ_URL_EXPIRY_MS: () => import_sdk_core11.DEFAULT_SIGNED_READ_URL_EXPIRY_MS,
|
|
17042
|
+
DataVaultService: () => import_sdk_core14.DataVaultService,
|
|
17043
|
+
DatabaseHandle: () => import_sdk_core12.DatabaseHandle,
|
|
17043
17044
|
DelegatedAccess: () => DelegatedAccess,
|
|
17044
|
-
DelegationErrorCodes: () =>
|
|
17045
|
-
DelegationManager: () =>
|
|
17046
|
-
DuckDbAction: () =>
|
|
17047
|
-
DuckDbDatabaseHandle: () =>
|
|
17048
|
-
DuckDbService: () =>
|
|
17049
|
-
ENCRYPTION_NETWORK_URN_PREFIX: () =>
|
|
17050
|
-
ENCRYPTION_SERVICE: () =>
|
|
17051
|
-
ENCRYPTION_SERVICE_SHORT: () =>
|
|
17052
|
-
ENVELOPE_VERSION: () =>
|
|
17053
|
-
EncryptionService: () =>
|
|
17045
|
+
DelegationErrorCodes: () => import_sdk_core17.DelegationErrorCodes,
|
|
17046
|
+
DelegationManager: () => import_sdk_core17.DelegationManager,
|
|
17047
|
+
DuckDbAction: () => import_sdk_core13.DuckDbAction,
|
|
17048
|
+
DuckDbDatabaseHandle: () => import_sdk_core13.DuckDbDatabaseHandle,
|
|
17049
|
+
DuckDbService: () => import_sdk_core13.DuckDbService,
|
|
17050
|
+
ENCRYPTION_NETWORK_URN_PREFIX: () => import_sdk_core15.ENCRYPTION_NETWORK_URN_PREFIX,
|
|
17051
|
+
ENCRYPTION_SERVICE: () => import_sdk_core15.ENCRYPTION_SERVICE,
|
|
17052
|
+
ENCRYPTION_SERVICE_SHORT: () => import_sdk_core15.ENCRYPTION_SERVICE_SHORT,
|
|
17053
|
+
ENVELOPE_VERSION: () => import_sdk_core15.ENVELOPE_VERSION,
|
|
17054
|
+
EncryptionService: () => import_sdk_core15.EncryptionService,
|
|
17054
17055
|
FileSessionStorage: () => FileSessionStorage,
|
|
17055
|
-
HooksService: () =>
|
|
17056
|
-
IdentityParseError: () =>
|
|
17057
|
-
KVService: () =>
|
|
17058
|
-
ManifestValidationError: () =>
|
|
17056
|
+
HooksService: () => import_sdk_core16.HooksService,
|
|
17057
|
+
IdentityParseError: () => import_sdk_core9.IdentityParseError,
|
|
17058
|
+
KVService: () => import_sdk_core11.KVService,
|
|
17059
|
+
ManifestValidationError: () => import_sdk_core10.ManifestValidationError,
|
|
17059
17060
|
MemorySessionStorage: () => MemorySessionStorage,
|
|
17060
|
-
NETWORK_NAME_PATTERN: () =>
|
|
17061
|
-
NetworkIdError: () =>
|
|
17061
|
+
NETWORK_NAME_PATTERN: () => import_sdk_core15.NETWORK_NAME_PATTERN,
|
|
17062
|
+
NetworkIdError: () => import_sdk_core15.NetworkIdError,
|
|
17062
17063
|
NodeUserAuthorization: () => NodeUserAuthorization,
|
|
17063
17064
|
NodeWasmBindings: () => NodeWasmBindings,
|
|
17064
|
-
PermissionNotInManifestError: () =>
|
|
17065
|
-
PrefixedKVService: () =>
|
|
17065
|
+
PermissionNotInManifestError: () => import_sdk_core10.PermissionNotInManifestError,
|
|
17066
|
+
PrefixedKVService: () => import_sdk_core11.PrefixedKVService,
|
|
17066
17067
|
PrivateKeySigner: () => PrivateKeySigner,
|
|
17067
|
-
ProtocolMismatchError: () =>
|
|
17068
|
-
SECRET_NAME_RE: () =>
|
|
17069
|
-
SQLAction: () =>
|
|
17070
|
-
SQLService: () =>
|
|
17071
|
-
SecretsService: () =>
|
|
17072
|
-
ServiceContext: () =>
|
|
17073
|
-
SessionExpiredError: () =>
|
|
17074
|
-
SharingService: () =>
|
|
17075
|
-
SilentNotificationHandler: () =>
|
|
17076
|
-
Space: () =>
|
|
17077
|
-
SpaceErrorCodes: () =>
|
|
17078
|
-
SpaceService: () =>
|
|
17079
|
-
TinyCloud: () =>
|
|
17068
|
+
ProtocolMismatchError: () => import_sdk_core20.ProtocolMismatchError,
|
|
17069
|
+
SECRET_NAME_RE: () => import_sdk_core14.SECRET_NAME_RE,
|
|
17070
|
+
SQLAction: () => import_sdk_core12.SQLAction,
|
|
17071
|
+
SQLService: () => import_sdk_core12.SQLService,
|
|
17072
|
+
SecretsService: () => import_sdk_core14.SecretsService,
|
|
17073
|
+
ServiceContext: () => import_sdk_core21.ServiceContext,
|
|
17074
|
+
SessionExpiredError: () => import_sdk_core10.SessionExpiredError,
|
|
17075
|
+
SharingService: () => import_sdk_core17.SharingService,
|
|
17076
|
+
SilentNotificationHandler: () => import_sdk_core9.SilentNotificationHandler,
|
|
17077
|
+
Space: () => import_sdk_core19.Space,
|
|
17078
|
+
SpaceErrorCodes: () => import_sdk_core19.SpaceErrorCodes,
|
|
17079
|
+
SpaceService: () => import_sdk_core19.SpaceService,
|
|
17080
|
+
TinyCloud: () => import_sdk_core8.TinyCloud,
|
|
17080
17081
|
TinyCloudNode: () => TinyCloudNode,
|
|
17081
|
-
UnsupportedFeatureError: () =>
|
|
17082
|
-
VAULT_PERMISSION_SERVICE: () =>
|
|
17083
|
-
VaultHeaders: () =>
|
|
17084
|
-
VaultPublicSpaceKVActions: () =>
|
|
17085
|
-
VersionCheckError: () =>
|
|
17082
|
+
UnsupportedFeatureError: () => import_sdk_core20.UnsupportedFeatureError,
|
|
17083
|
+
VAULT_PERMISSION_SERVICE: () => import_sdk_core10.VAULT_PERMISSION_SERVICE,
|
|
17084
|
+
VaultHeaders: () => import_sdk_core14.VaultHeaders,
|
|
17085
|
+
VaultPublicSpaceKVActions: () => import_sdk_core14.VaultPublicSpaceKVActions,
|
|
17086
|
+
VersionCheckError: () => import_sdk_core20.VersionCheckError,
|
|
17086
17087
|
WasmKeyProvider: () => WasmKeyProvider,
|
|
17087
|
-
addressStorageKey: () =>
|
|
17088
|
-
buildCanonicalDecryptRequest: () =>
|
|
17089
|
-
buildDecryptAttenuation: () =>
|
|
17090
|
-
buildDecryptFacts: () =>
|
|
17091
|
-
buildDecryptInvocation: () =>
|
|
17092
|
-
buildNetworkId: () =>
|
|
17093
|
-
buildSpaceUri: () =>
|
|
17094
|
-
canonicalHashHex: () =>
|
|
17095
|
-
canonicalSignedResponse: () =>
|
|
17096
|
-
canonicalizeAddress: () =>
|
|
17097
|
-
canonicalizeDid: () =>
|
|
17098
|
-
canonicalizeDidUrl: () =>
|
|
17099
|
-
canonicalizeEncryptionJson: () =>
|
|
17100
|
-
canonicalizeNetworkId: () =>
|
|
17101
|
-
canonicalizeSecretScope: () =>
|
|
17102
|
-
checkDecryptInvocationInput: () =>
|
|
17103
|
-
checkNodeInfo: () =>
|
|
17104
|
-
composeManifestRequest: () =>
|
|
17105
|
-
createCapabilityKeyRegistry: () =>
|
|
17106
|
-
createSharingService: () =>
|
|
17107
|
-
createSpaceService: () =>
|
|
17108
|
-
createVaultCrypto: () =>
|
|
17088
|
+
addressStorageKey: () => import_sdk_core9.addressStorageKey,
|
|
17089
|
+
buildCanonicalDecryptRequest: () => import_sdk_core15.buildCanonicalDecryptRequest,
|
|
17090
|
+
buildDecryptAttenuation: () => import_sdk_core15.buildDecryptAttenuation,
|
|
17091
|
+
buildDecryptFacts: () => import_sdk_core15.buildDecryptFacts,
|
|
17092
|
+
buildDecryptInvocation: () => import_sdk_core15.buildDecryptInvocation,
|
|
17093
|
+
buildNetworkId: () => import_sdk_core15.buildNetworkId,
|
|
17094
|
+
buildSpaceUri: () => import_sdk_core19.buildSpaceUri,
|
|
17095
|
+
canonicalHashHex: () => import_sdk_core15.canonicalHashHex,
|
|
17096
|
+
canonicalSignedResponse: () => import_sdk_core15.canonicalSignedResponse,
|
|
17097
|
+
canonicalizeAddress: () => import_sdk_core9.canonicalizeAddress,
|
|
17098
|
+
canonicalizeDid: () => import_sdk_core9.canonicalizeDid,
|
|
17099
|
+
canonicalizeDidUrl: () => import_sdk_core9.canonicalizeDidUrl,
|
|
17100
|
+
canonicalizeEncryptionJson: () => import_sdk_core15.canonicalizeEncryptionJson,
|
|
17101
|
+
canonicalizeNetworkId: () => import_sdk_core9.canonicalizeNetworkId,
|
|
17102
|
+
canonicalizeSecretScope: () => import_sdk_core14.canonicalizeSecretScope,
|
|
17103
|
+
checkDecryptInvocationInput: () => import_sdk_core15.checkDecryptInvocationInput,
|
|
17104
|
+
checkNodeInfo: () => import_sdk_core20.checkNodeInfo,
|
|
17105
|
+
composeManifestRequest: () => import_sdk_core10.composeManifestRequest,
|
|
17106
|
+
createCapabilityKeyRegistry: () => import_sdk_core18.createCapabilityKeyRegistry,
|
|
17107
|
+
createSharingService: () => import_sdk_core17.createSharingService,
|
|
17108
|
+
createSpaceService: () => import_sdk_core19.createSpaceService,
|
|
17109
|
+
createVaultCrypto: () => import_sdk_core14.createVaultCrypto,
|
|
17109
17110
|
createWasmKeyProvider: () => createWasmKeyProvider,
|
|
17110
|
-
decryptEnvelopeWithKey: () =>
|
|
17111
|
+
decryptEnvelopeWithKey: () => import_sdk_core15.decryptEnvelopeWithKey,
|
|
17111
17112
|
defaultSignStrategy: () => defaultSignStrategy,
|
|
17112
|
-
defaultSpaceCreationHandler: () =>
|
|
17113
|
-
deriveSignedReceiverKey: () =>
|
|
17113
|
+
defaultSpaceCreationHandler: () => import_sdk_core9.defaultSpaceCreationHandler,
|
|
17114
|
+
deriveSignedReceiverKey: () => import_sdk_core15.deriveSignedReceiverKey,
|
|
17114
17115
|
deserializeDelegation: () => deserializeDelegation,
|
|
17115
|
-
didCacheKey: () =>
|
|
17116
|
-
didEquals: () =>
|
|
17117
|
-
discoverNetwork: () =>
|
|
17118
|
-
encryptToNetwork: () =>
|
|
17119
|
-
encryptionBase64Decode: () =>
|
|
17120
|
-
encryptionBase64Encode: () =>
|
|
17121
|
-
encryptionError: () =>
|
|
17122
|
-
encryptionUtf8Decode: () =>
|
|
17123
|
-
encryptionUtf8Encode: () =>
|
|
17124
|
-
ensureNetworkUsableForDecrypt: () =>
|
|
17125
|
-
expandActionShortNames: () =>
|
|
17126
|
-
expandPermissionEntries: () =>
|
|
17127
|
-
expandPermissionEntry: () =>
|
|
17128
|
-
generateRandomReceiverKey: () =>
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
|
|
17133
|
-
|
|
17134
|
-
|
|
17135
|
-
|
|
17136
|
-
|
|
17137
|
-
|
|
17138
|
-
|
|
17139
|
-
|
|
17140
|
-
|
|
17141
|
-
|
|
17142
|
-
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
|
|
17146
|
-
|
|
17147
|
-
|
|
17148
|
-
|
|
17149
|
-
|
|
17150
|
-
|
|
17116
|
+
didCacheKey: () => import_sdk_core9.didCacheKey,
|
|
17117
|
+
didEquals: () => import_sdk_core9.didEquals,
|
|
17118
|
+
discoverNetwork: () => import_sdk_core15.discoverNetwork,
|
|
17119
|
+
encryptToNetwork: () => import_sdk_core15.encryptToNetwork,
|
|
17120
|
+
encryptionBase64Decode: () => import_sdk_core15.encryptionBase64Decode,
|
|
17121
|
+
encryptionBase64Encode: () => import_sdk_core15.encryptionBase64Encode,
|
|
17122
|
+
encryptionError: () => import_sdk_core15.encryptionError,
|
|
17123
|
+
encryptionUtf8Decode: () => import_sdk_core15.encryptionUtf8Decode,
|
|
17124
|
+
encryptionUtf8Encode: () => import_sdk_core15.encryptionUtf8Encode,
|
|
17125
|
+
ensureNetworkUsableForDecrypt: () => import_sdk_core15.ensureNetworkUsableForDecrypt,
|
|
17126
|
+
expandActionShortNames: () => import_sdk_core10.expandActionShortNames,
|
|
17127
|
+
expandPermissionEntries: () => import_sdk_core10.expandPermissionEntries,
|
|
17128
|
+
expandPermissionEntry: () => import_sdk_core10.expandPermissionEntry,
|
|
17129
|
+
generateRandomReceiverKey: () => import_sdk_core15.generateRandomReceiverKey,
|
|
17130
|
+
grantAuthRequest: () => grantAuthRequest,
|
|
17131
|
+
hexDecode: () => import_sdk_core15.hexDecode,
|
|
17132
|
+
hexEncode: () => import_sdk_core15.hexEncode,
|
|
17133
|
+
isCapabilitySubset: () => import_sdk_core10.isCapabilitySubset,
|
|
17134
|
+
isEvmAddress: () => import_sdk_core9.isEvmAddress,
|
|
17135
|
+
isNetworkId: () => import_sdk_core15.isNetworkId,
|
|
17136
|
+
loadManifest: () => import_sdk_core10.loadManifest,
|
|
17137
|
+
makePkhSpaceId: () => import_sdk_core9.makePkhSpaceId,
|
|
17138
|
+
makePublicSpaceId: () => import_sdk_core19.makePublicSpaceId,
|
|
17139
|
+
networkDiscoveryKey: () => import_sdk_core15.networkDiscoveryKey,
|
|
17140
|
+
openWrappedKey: () => import_sdk_core15.openWrappedKey,
|
|
17141
|
+
parseCanonicalNetworkId: () => import_sdk_core9.parseCanonicalNetworkId,
|
|
17142
|
+
parseExpiry: () => import_sdk_core10.parseExpiry,
|
|
17143
|
+
parseNetworkId: () => import_sdk_core15.parseNetworkId,
|
|
17144
|
+
parsePkhDid: () => import_sdk_core9.parsePkhDid,
|
|
17145
|
+
parseSpaceUri: () => import_sdk_core19.parseSpaceUri,
|
|
17146
|
+
pkhDid: () => import_sdk_core9.pkhDid,
|
|
17147
|
+
principalDid: () => import_sdk_core9.principalDid,
|
|
17148
|
+
principalDidEquals: () => import_sdk_core9.principalDidEquals,
|
|
17149
|
+
resolveManifest: () => import_sdk_core10.resolveManifest,
|
|
17150
|
+
resolveSecretListPrefix: () => import_sdk_core14.resolveSecretListPrefix,
|
|
17151
|
+
resolveSecretPath: () => import_sdk_core14.resolveSecretPath,
|
|
17152
|
+
resourceCapabilitiesToSpaceAbilitiesMap: () => import_sdk_core10.resourceCapabilitiesToSpaceAbilitiesMap,
|
|
17151
17153
|
serializeDelegation: () => serializeDelegation,
|
|
17152
|
-
validateEnvelope: () =>
|
|
17153
|
-
validateManifest: () =>
|
|
17154
|
-
verifyDecryptResponse: () =>
|
|
17154
|
+
validateEnvelope: () => import_sdk_core15.validateEnvelope,
|
|
17155
|
+
validateManifest: () => import_sdk_core10.validateManifest,
|
|
17156
|
+
verifyDecryptResponse: () => import_sdk_core15.verifyDecryptResponse
|
|
17155
17157
|
});
|
|
17156
17158
|
module.exports = __toCommonJS(index_exports);
|
|
17157
17159
|
|
|
@@ -17256,7 +17258,7 @@ var PrivateKeySigner = class {
|
|
|
17256
17258
|
};
|
|
17257
17259
|
|
|
17258
17260
|
// src/TinyCloudNode.ts
|
|
17259
|
-
var
|
|
17261
|
+
var import_sdk_core6 = require("@tinycloud/sdk-core");
|
|
17260
17262
|
|
|
17261
17263
|
// src/authorization/NodeUserAuthorization.ts
|
|
17262
17264
|
var import_sdk_core = require("@tinycloud/sdk-core");
|
|
@@ -17336,6 +17338,25 @@ var MemorySessionStorage = class {
|
|
|
17336
17338
|
};
|
|
17337
17339
|
|
|
17338
17340
|
// src/authorization/NodeUserAuthorization.ts
|
|
17341
|
+
var DECRYPT_ACTION = "tinycloud.encryption/decrypt";
|
|
17342
|
+
var NETWORK_CREATE_ACTION = "tinycloud.encryption/network.create";
|
|
17343
|
+
function didPrincipalMatches(actual, expected) {
|
|
17344
|
+
try {
|
|
17345
|
+
return (0, import_sdk_core.principalDidEquals)(actual, expected);
|
|
17346
|
+
} catch {
|
|
17347
|
+
return actual === expected;
|
|
17348
|
+
}
|
|
17349
|
+
}
|
|
17350
|
+
function addRawAbility(rawAbilities, resource, action) {
|
|
17351
|
+
const actions = rawAbilities[resource];
|
|
17352
|
+
if (actions === void 0) {
|
|
17353
|
+
rawAbilities[resource] = [action];
|
|
17354
|
+
return;
|
|
17355
|
+
}
|
|
17356
|
+
if (!actions.includes(action)) {
|
|
17357
|
+
actions.push(action);
|
|
17358
|
+
}
|
|
17359
|
+
}
|
|
17339
17360
|
var NodeUserAuthorization = class {
|
|
17340
17361
|
constructor(config) {
|
|
17341
17362
|
this.extensions = [];
|
|
@@ -17362,6 +17383,7 @@ var NodeUserAuthorization = class {
|
|
|
17362
17383
|
"": [
|
|
17363
17384
|
"tinycloud.sql/read",
|
|
17364
17385
|
"tinycloud.sql/write",
|
|
17386
|
+
"tinycloud.sql/ddl",
|
|
17365
17387
|
"tinycloud.sql/admin",
|
|
17366
17388
|
"tinycloud.sql/export"
|
|
17367
17389
|
]
|
|
@@ -17565,20 +17587,18 @@ var NodeUserAuthorization = class {
|
|
|
17565
17587
|
};
|
|
17566
17588
|
}
|
|
17567
17589
|
const rawAbilities = {};
|
|
17590
|
+
const currentDid = (0, import_sdk_core.pkhDid)(address, chainId);
|
|
17568
17591
|
const spaceResources = request.resources.filter((entry) => {
|
|
17569
17592
|
if (entry.service !== import_sdk_core.ENCRYPTION_PERMISSION_SERVICE) {
|
|
17570
17593
|
return true;
|
|
17571
17594
|
}
|
|
17572
|
-
const
|
|
17573
|
-
|
|
17574
|
-
|
|
17575
|
-
|
|
17576
|
-
const
|
|
17577
|
-
|
|
17578
|
-
|
|
17579
|
-
existing.push(action);
|
|
17580
|
-
seen.add(action);
|
|
17581
|
-
}
|
|
17595
|
+
for (const action of entry.actions) {
|
|
17596
|
+
addRawAbility(rawAbilities, entry.path, action);
|
|
17597
|
+
}
|
|
17598
|
+
if (entry.actions.includes(DECRYPT_ACTION)) {
|
|
17599
|
+
const parsed = (0, import_sdk_core.parseNetworkId)(entry.path);
|
|
17600
|
+
if (didPrincipalMatches(parsed.ownerDid, currentDid)) {
|
|
17601
|
+
addRawAbility(rawAbilities, entry.path, NETWORK_CREATE_ACTION);
|
|
17582
17602
|
}
|
|
17583
17603
|
}
|
|
17584
17604
|
return false;
|
|
@@ -18137,30 +18157,33 @@ var NodeUserAuthorization = class {
|
|
|
18137
18157
|
}
|
|
18138
18158
|
};
|
|
18139
18159
|
|
|
18140
|
-
// src/
|
|
18160
|
+
// src/account/AccountService.ts
|
|
18141
18161
|
var import_sdk_core2 = require("@tinycloud/sdk-core");
|
|
18162
|
+
|
|
18163
|
+
// src/DelegatedAccess.ts
|
|
18164
|
+
var import_sdk_core3 = require("@tinycloud/sdk-core");
|
|
18142
18165
|
var DelegatedAccess = class {
|
|
18143
18166
|
constructor(session, delegation, host, invoke2, telemetry) {
|
|
18144
18167
|
this.session = session;
|
|
18145
18168
|
this._delegation = delegation;
|
|
18146
18169
|
this.host = host;
|
|
18147
|
-
this._serviceContext = new
|
|
18170
|
+
this._serviceContext = new import_sdk_core3.ServiceContext({
|
|
18148
18171
|
invoke: invoke2,
|
|
18149
18172
|
fetch: globalThis.fetch.bind(globalThis),
|
|
18150
18173
|
hosts: [host],
|
|
18151
18174
|
telemetry
|
|
18152
18175
|
});
|
|
18153
18176
|
const prefix = this._delegation.path.replace(/\/$/, "");
|
|
18154
|
-
this._kv = new
|
|
18177
|
+
this._kv = new import_sdk_core3.KVService({ prefix });
|
|
18155
18178
|
this._kv.initialize(this._serviceContext);
|
|
18156
18179
|
this._serviceContext.registerService("kv", this._kv);
|
|
18157
|
-
this._sql = new
|
|
18180
|
+
this._sql = new import_sdk_core3.SQLService({});
|
|
18158
18181
|
this._sql.initialize(this._serviceContext);
|
|
18159
18182
|
this._serviceContext.registerService("sql", this._sql);
|
|
18160
|
-
this._duckdb = new
|
|
18183
|
+
this._duckdb = new import_sdk_core3.DuckDbService({});
|
|
18161
18184
|
this._duckdb.initialize(this._serviceContext);
|
|
18162
18185
|
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
18163
|
-
this._hooks = new
|
|
18186
|
+
this._hooks = new import_sdk_core3.HooksService({});
|
|
18164
18187
|
this._hooks.initialize(this._serviceContext);
|
|
18165
18188
|
this._serviceContext.registerService("hooks", this._hooks);
|
|
18166
18189
|
const serviceSession = {
|
|
@@ -18310,7 +18333,7 @@ function createWasmKeyProvider(sessionManager) {
|
|
|
18310
18333
|
}
|
|
18311
18334
|
|
|
18312
18335
|
// src/delegateToHelpers.ts
|
|
18313
|
-
var
|
|
18336
|
+
var import_sdk_core4 = require("@tinycloud/sdk-core");
|
|
18314
18337
|
function legacyParamsToPermissionEntries(actions, path, spaceIdOverride) {
|
|
18315
18338
|
const byService = /* @__PURE__ */ new Map();
|
|
18316
18339
|
for (const a of actions) {
|
|
@@ -18341,7 +18364,7 @@ function legacyParamsToPermissionEntries(actions, path, spaceIdOverride) {
|
|
|
18341
18364
|
}
|
|
18342
18365
|
return entries;
|
|
18343
18366
|
}
|
|
18344
|
-
var DEFAULT_DELEGATION_EXPIRY_MS =
|
|
18367
|
+
var DEFAULT_DELEGATION_EXPIRY_MS = import_sdk_core4.EXPIRY.SESSION_MS;
|
|
18345
18368
|
function resolveExpiryMs(expiry) {
|
|
18346
18369
|
if (expiry === void 0) {
|
|
18347
18370
|
return DEFAULT_DELEGATION_EXPIRY_MS;
|
|
@@ -18354,10 +18377,10 @@ function resolveExpiryMs(expiry) {
|
|
|
18354
18377
|
}
|
|
18355
18378
|
return expiry;
|
|
18356
18379
|
}
|
|
18357
|
-
return (0,
|
|
18380
|
+
return (0, import_sdk_core4.parseExpiry)(expiry);
|
|
18358
18381
|
}
|
|
18359
18382
|
function extractSiweExpiration(siwe) {
|
|
18360
|
-
const parsed = new
|
|
18383
|
+
const parsed = new import_sdk_core4.SiweMessage(siwe);
|
|
18361
18384
|
if (parsed.expirationTime === void 0 || parsed.expirationTime === null) {
|
|
18362
18385
|
return void 0;
|
|
18363
18386
|
}
|
|
@@ -18371,7 +18394,7 @@ function extractSiweExpiration(siwe) {
|
|
|
18371
18394
|
}
|
|
18372
18395
|
|
|
18373
18396
|
// src/NodeSecretsService.ts
|
|
18374
|
-
var
|
|
18397
|
+
var import_sdk_core5 = require("@tinycloud/sdk-core");
|
|
18375
18398
|
var SECRETS_SPACE = "secrets";
|
|
18376
18399
|
function ok() {
|
|
18377
18400
|
return { ok: true, data: void 0 };
|
|
@@ -18404,7 +18427,7 @@ function secretActionName(action) {
|
|
|
18404
18427
|
}
|
|
18405
18428
|
function secretPermissionEntries(name, options, action, encryptionNetworkId) {
|
|
18406
18429
|
const entries = [];
|
|
18407
|
-
const path = action === "list" ? (0,
|
|
18430
|
+
const path = action === "list" ? (0, import_sdk_core5.resolveSecretListPrefix)(options) : (0, import_sdk_core5.resolveSecretPath)(name, options).permissionPaths.vault;
|
|
18408
18431
|
entries.push({
|
|
18409
18432
|
service: "tinycloud.kv",
|
|
18410
18433
|
space: SECRETS_SPACE,
|
|
@@ -18483,7 +18506,7 @@ var NodeSecretsService = class {
|
|
|
18483
18506
|
);
|
|
18484
18507
|
} catch (error) {
|
|
18485
18508
|
return secretsError(
|
|
18486
|
-
|
|
18509
|
+
import_sdk_core5.ErrorCodes.INVALID_INPUT,
|
|
18487
18510
|
error instanceof Error ? error.message : String(error),
|
|
18488
18511
|
error instanceof Error ? error : void 0
|
|
18489
18512
|
);
|
|
@@ -18493,7 +18516,7 @@ var NodeSecretsService = class {
|
|
|
18493
18516
|
}
|
|
18494
18517
|
if (!this.config.canEscalate()) {
|
|
18495
18518
|
return secretsError(
|
|
18496
|
-
|
|
18519
|
+
import_sdk_core5.ErrorCodes.PERMISSION_DENIED,
|
|
18497
18520
|
`Cannot autosign ${displayActionUrn(action)} for ${target}; TinyCloudNode needs wallet mode with a signer or privateKey.`
|
|
18498
18521
|
);
|
|
18499
18522
|
}
|
|
@@ -18502,7 +18525,7 @@ var NodeSecretsService = class {
|
|
|
18502
18525
|
return this.restoreUnlockAfterEscalation();
|
|
18503
18526
|
} catch (error) {
|
|
18504
18527
|
return secretsError(
|
|
18505
|
-
|
|
18528
|
+
import_sdk_core5.ErrorCodes.PERMISSION_DENIED,
|
|
18506
18529
|
error instanceof Error ? error.message : `Autosign escalation for ${displayActionUrn(action)} on ${target} failed.`,
|
|
18507
18530
|
error instanceof Error ? error : void 0
|
|
18508
18531
|
);
|
|
@@ -18523,10 +18546,10 @@ var NodeSecretsService = class {
|
|
|
18523
18546
|
return false;
|
|
18524
18547
|
}
|
|
18525
18548
|
const manifests = Array.isArray(manifest) ? manifest : [manifest];
|
|
18526
|
-
const requestedEntries = (0,
|
|
18549
|
+
const requestedEntries = (0, import_sdk_core5.expandPermissionEntries)(permissionEntries);
|
|
18527
18550
|
return requestedEntries.every(
|
|
18528
18551
|
(entry) => manifests.some((candidate) => {
|
|
18529
|
-
const resolved = (0,
|
|
18552
|
+
const resolved = (0, import_sdk_core5.resolveManifest)(candidate);
|
|
18530
18553
|
return resolved.resources.some(
|
|
18531
18554
|
(resource) => resource.service === entry.service && resource.space === entry.space && resource.path === entry.path && entry.actions.every((action) => resource.actions.includes(action))
|
|
18532
18555
|
);
|
|
@@ -18538,13 +18561,13 @@ var NodeSecretsService = class {
|
|
|
18538
18561
|
// src/TinyCloudNode.ts
|
|
18539
18562
|
var DEFAULT_HOST = "https://node.tinycloud.xyz";
|
|
18540
18563
|
var DEFAULT_ENCRYPTION_NETWORK_NAME = "default";
|
|
18541
|
-
var
|
|
18542
|
-
var
|
|
18564
|
+
var NETWORK_CREATE_ACTION2 = "tinycloud.encryption/network.create";
|
|
18565
|
+
var DECRYPT_ACTION2 = "tinycloud.encryption/decrypt";
|
|
18543
18566
|
var NETWORK_ADMIN_TYPE = "tinycloud.encryption.network-admin/v1";
|
|
18544
|
-
var DEFAULT_SESSION_EXPIRATION_MS =
|
|
18545
|
-
function
|
|
18567
|
+
var DEFAULT_SESSION_EXPIRATION_MS = import_sdk_core6.EXPIRY.SESSION_MS;
|
|
18568
|
+
function didPrincipalMatches2(actual, expected) {
|
|
18546
18569
|
try {
|
|
18547
|
-
return (0,
|
|
18570
|
+
return (0, import_sdk_core6.principalDidEquals)(actual, expected);
|
|
18548
18571
|
} catch {
|
|
18549
18572
|
return actual === expected;
|
|
18550
18573
|
}
|
|
@@ -18710,12 +18733,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18710
18733
|
throw new Error("Failed to get session key JWK");
|
|
18711
18734
|
}
|
|
18712
18735
|
this.sessionKeyJwk = JSON.parse(jwkStr);
|
|
18713
|
-
this._capabilityRegistry = new
|
|
18736
|
+
this._capabilityRegistry = new import_sdk_core6.CapabilityKeyRegistry();
|
|
18714
18737
|
this._keyProvider = new WasmKeyProvider({
|
|
18715
18738
|
sessionManager: this.sessionManager
|
|
18716
18739
|
});
|
|
18717
|
-
this.notificationHandler = config.notificationHandler ?? new
|
|
18718
|
-
this._sharingService = new
|
|
18740
|
+
this.notificationHandler = config.notificationHandler ?? new import_sdk_core6.SilentNotificationHandler();
|
|
18741
|
+
this._sharingService = new import_sdk_core6.SharingService({
|
|
18719
18742
|
hosts: [this.config.host],
|
|
18720
18743
|
// session: undefined - not needed for receive()
|
|
18721
18744
|
invoke: this.invokeWithRuntimePermissions,
|
|
@@ -18725,8 +18748,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18725
18748
|
// delegationManager: undefined - not needed for receive()
|
|
18726
18749
|
createKVService: (config2) => {
|
|
18727
18750
|
const prefix = config2.pathPrefix?.replace(/\/$/, "");
|
|
18728
|
-
const kvService = new
|
|
18729
|
-
const kvContext = new
|
|
18751
|
+
const kvService = new import_sdk_core6.KVService({ prefix });
|
|
18752
|
+
const kvContext = new import_sdk_core6.ServiceContext({
|
|
18730
18753
|
invoke: config2.invoke,
|
|
18731
18754
|
fetch: config2.fetch ?? globalThis.fetch.bind(globalThis),
|
|
18732
18755
|
hosts: config2.hosts,
|
|
@@ -18786,7 +18809,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18786
18809
|
capabilityRequest: config.capabilityRequest,
|
|
18787
18810
|
includeAccountRegistryPermissions: config.includeAccountRegistryPermissions
|
|
18788
18811
|
});
|
|
18789
|
-
this.tc = new
|
|
18812
|
+
this.tc = new import_sdk_core6.TinyCloud(this.auth, {
|
|
18790
18813
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
18791
18814
|
telemetry: config.telemetry
|
|
18792
18815
|
});
|
|
@@ -18847,7 +18870,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18847
18870
|
*/
|
|
18848
18871
|
get did() {
|
|
18849
18872
|
if (this._address) {
|
|
18850
|
-
return (0,
|
|
18873
|
+
return (0, import_sdk_core6.pkhDid)(this._address, this._chainId);
|
|
18851
18874
|
}
|
|
18852
18875
|
return this.sessionManager.getDID(this.sessionKeyId);
|
|
18853
18876
|
}
|
|
@@ -18881,6 +18904,37 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18881
18904
|
get spaceId() {
|
|
18882
18905
|
return this.auth?.tinyCloudSession?.spaceId;
|
|
18883
18906
|
}
|
|
18907
|
+
/**
|
|
18908
|
+
* Get the account space ID for this wallet identity.
|
|
18909
|
+
* Available after wallet-backed sign-in or a restored session with address metadata.
|
|
18910
|
+
*/
|
|
18911
|
+
get accountSpaceId() {
|
|
18912
|
+
if (!this._address) {
|
|
18913
|
+
return void 0;
|
|
18914
|
+
}
|
|
18915
|
+
return this.wasmBindings.makeSpaceId(this._address, this._chainId, import_sdk_core6.ACCOUNT_REGISTRY_SPACE);
|
|
18916
|
+
}
|
|
18917
|
+
/**
|
|
18918
|
+
* Account-level application and delegation helpers.
|
|
18919
|
+
*/
|
|
18920
|
+
get account() {
|
|
18921
|
+
if (!this._account) {
|
|
18922
|
+
this._account = new import_sdk_core2.AccountService({
|
|
18923
|
+
getDid: () => this.did,
|
|
18924
|
+
getHost: () => this.hosts[0] ?? this.config.host,
|
|
18925
|
+
getPrimarySpaceId: () => this.spaceId,
|
|
18926
|
+
getAccountSpaceId: () => this.accountSpaceId,
|
|
18927
|
+
getSpaces: () => this.spaces,
|
|
18928
|
+
getAccountDb: () => this.accountSpaceId ? this.sqlForSpace(this.accountSpaceId).db("account") : void 0,
|
|
18929
|
+
ensureAccountSpaceHosted: async () => {
|
|
18930
|
+
if (this.accountSpaceId && this.auth) {
|
|
18931
|
+
await this.ensureOwnedSpaceHostedById(this.accountSpaceId);
|
|
18932
|
+
}
|
|
18933
|
+
}
|
|
18934
|
+
});
|
|
18935
|
+
}
|
|
18936
|
+
return this._account;
|
|
18937
|
+
}
|
|
18884
18938
|
/**
|
|
18885
18939
|
* Get the current TinyCloud session.
|
|
18886
18940
|
* Available after signIn().
|
|
@@ -18902,7 +18956,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18902
18956
|
);
|
|
18903
18957
|
}
|
|
18904
18958
|
await this.wasmBindings.ensureInitialized?.();
|
|
18905
|
-
this._address = (0,
|
|
18959
|
+
this._address = (0, import_sdk_core6.canonicalizeAddress)(await this.signer.getAddress());
|
|
18906
18960
|
this._chainId = await this.signer.getChainId();
|
|
18907
18961
|
this._kv = void 0;
|
|
18908
18962
|
this._sql = void 0;
|
|
@@ -18918,10 +18972,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18918
18972
|
await this.tc.signIn(options);
|
|
18919
18973
|
this.syncResolvedHostFromAuth();
|
|
18920
18974
|
this.initializeServices();
|
|
18975
|
+
await this.ensureRequestedEncryptionNetworks();
|
|
18921
18976
|
if (this.config.manifest === void 0 && this.config.capabilityRequest === void 0) {
|
|
18922
|
-
await this.
|
|
18977
|
+
await this.ensureOwnedSpaceHostedById(this.ownedSpaceId("secrets"));
|
|
18923
18978
|
}
|
|
18924
|
-
|
|
18979
|
+
this.scheduleAccountRegistrySync();
|
|
18925
18980
|
this.notificationHandler.success("Successfully signed in");
|
|
18926
18981
|
}
|
|
18927
18982
|
ownedSpaceId(name) {
|
|
@@ -18938,23 +18993,69 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18938
18993
|
if (!this.auth || !this.signer) {
|
|
18939
18994
|
throw new Error("Manifest registry write requires wallet mode");
|
|
18940
18995
|
}
|
|
18941
|
-
const accountSpaceId = this.ownedSpaceId(
|
|
18942
|
-
await this.
|
|
18943
|
-
const
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18996
|
+
const accountSpaceId = this.ownedSpaceId(import_sdk_core6.ACCOUNT_REGISTRY_SPACE);
|
|
18997
|
+
await this.ensureOwnedSpaceHostedById(accountSpaceId);
|
|
18998
|
+
const result = await this.account.applications.register(request.manifests);
|
|
18999
|
+
if (!result.ok) {
|
|
19000
|
+
throw new Error(
|
|
19001
|
+
`Failed to write manifest registry records: ${result.error.message}`
|
|
19002
|
+
);
|
|
19003
|
+
}
|
|
19004
|
+
}
|
|
19005
|
+
scheduleAccountRegistrySync() {
|
|
19006
|
+
void this.withAccountRegistryRetry(async () => {
|
|
19007
|
+
await this.writeManifestRegistryRecords();
|
|
19008
|
+
const spaces = await this.account.spaces.syncAccessible();
|
|
19009
|
+
if (!spaces.ok) {
|
|
19010
|
+
throw new Error(`Failed to sync account spaces: ${spaces.error.message}`);
|
|
19011
|
+
}
|
|
19012
|
+
});
|
|
19013
|
+
}
|
|
19014
|
+
async withAccountRegistryRetry(task) {
|
|
19015
|
+
const delays = [250, 1e3, 3e3];
|
|
19016
|
+
let lastError;
|
|
19017
|
+
for (let attempt = 0; attempt < delays.length; attempt += 1) {
|
|
19018
|
+
try {
|
|
19019
|
+
await task();
|
|
19020
|
+
return;
|
|
19021
|
+
} catch (error) {
|
|
19022
|
+
lastError = error;
|
|
19023
|
+
if (attempt < delays.length - 1) {
|
|
19024
|
+
await new Promise((resolve) => setTimeout(resolve, delays[attempt]));
|
|
19025
|
+
}
|
|
18954
19026
|
}
|
|
18955
19027
|
}
|
|
19028
|
+
console.warn(
|
|
19029
|
+
"TinyCloud account registry sync failed after retries",
|
|
19030
|
+
lastError
|
|
19031
|
+
);
|
|
18956
19032
|
}
|
|
18957
|
-
|
|
19033
|
+
requestedEncryptionNetworkIds() {
|
|
19034
|
+
const request = this.capabilityRequest;
|
|
19035
|
+
if (!request) {
|
|
19036
|
+
return [];
|
|
19037
|
+
}
|
|
19038
|
+
const networkIds = /* @__PURE__ */ new Set();
|
|
19039
|
+
for (const resource of request.resources) {
|
|
19040
|
+
if (resource.service === import_sdk_core6.ENCRYPTION_PERMISSION_SERVICE && resource.path.startsWith("urn:tinycloud:encryption:") && resource.actions.includes(DECRYPT_ACTION2)) {
|
|
19041
|
+
networkIds.add(resource.path);
|
|
19042
|
+
}
|
|
19043
|
+
}
|
|
19044
|
+
return [...networkIds];
|
|
19045
|
+
}
|
|
19046
|
+
async ensureRequestedEncryptionNetworks() {
|
|
19047
|
+
if (!this.signer || !this.auth) {
|
|
19048
|
+
return;
|
|
19049
|
+
}
|
|
19050
|
+
for (const networkId of this.requestedEncryptionNetworkIds()) {
|
|
19051
|
+
const parsed = (0, import_sdk_core6.parseNetworkId)(networkId);
|
|
19052
|
+
if (!didPrincipalMatches2(parsed.ownerDid, this.did)) {
|
|
19053
|
+
continue;
|
|
19054
|
+
}
|
|
19055
|
+
await this.ensureEncryptionNetwork(networkId);
|
|
19056
|
+
}
|
|
19057
|
+
}
|
|
19058
|
+
async ensureOwnedSpaceHostedById(spaceId) {
|
|
18958
19059
|
if (!this.auth) {
|
|
18959
19060
|
throw new Error("Owned space hosting requires wallet mode");
|
|
18960
19061
|
}
|
|
@@ -18966,7 +19067,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18966
19067
|
if (!host) {
|
|
18967
19068
|
throw new Error("Owned space hosting requires a TinyCloud host");
|
|
18968
19069
|
}
|
|
18969
|
-
const activation = await (0,
|
|
19070
|
+
const activation = await (0, import_sdk_core6.activateSessionWithHost)(host, session.delegationHeader);
|
|
18970
19071
|
if (activation.success && !activation.skipped?.includes(spaceId)) {
|
|
18971
19072
|
return;
|
|
18972
19073
|
}
|
|
@@ -18980,7 +19081,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18980
19081
|
throw new Error(`Failed to create owned space: ${spaceId}`);
|
|
18981
19082
|
}
|
|
18982
19083
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
18983
|
-
const retry = await (0,
|
|
19084
|
+
const retry = await (0, import_sdk_core6.activateSessionWithHost)(host, session.delegationHeader);
|
|
18984
19085
|
if (!retry.success || retry.skipped?.includes(spaceId)) {
|
|
18985
19086
|
throw new Error(
|
|
18986
19087
|
`Failed to activate session after creating owned space ${spaceId}: ${retry.error ?? "space was skipped"}`
|
|
@@ -18997,7 +19098,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18997
19098
|
* caller is the root authority of their own owned spaces, so no additional
|
|
18998
19099
|
* delegation is required.
|
|
18999
19100
|
*
|
|
19000
|
-
* Unlike {@link
|
|
19101
|
+
* Unlike {@link ensureOwnedSpaceHostedById}, this always submits the host
|
|
19001
19102
|
* delegation rather than inferring hosting from session activation: a space
|
|
19002
19103
|
* the current session has never referenced is reported neither as
|
|
19003
19104
|
* `activated` nor `skipped`, so activation-based detection would wrongly
|
|
@@ -19022,7 +19123,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19022
19123
|
if (!hosted) {
|
|
19023
19124
|
throw new Error(`Failed to host owned space: ${spaceId}`);
|
|
19024
19125
|
}
|
|
19025
|
-
const activation = await (0,
|
|
19126
|
+
const activation = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
19026
19127
|
host,
|
|
19027
19128
|
this.auth.tinyCloudSession.delegationHeader
|
|
19028
19129
|
);
|
|
@@ -19031,8 +19132,40 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19031
19132
|
`Failed to activate session for owned space ${spaceId}: ${activation.error ?? "space was skipped"}`
|
|
19032
19133
|
);
|
|
19033
19134
|
}
|
|
19135
|
+
void this.account.spaces.register({
|
|
19136
|
+
spaceId,
|
|
19137
|
+
name,
|
|
19138
|
+
ownerDid: this.did,
|
|
19139
|
+
type: "owned",
|
|
19140
|
+
permissions: ["*"],
|
|
19141
|
+
status: "active"
|
|
19142
|
+
}).catch(() => {
|
|
19143
|
+
});
|
|
19034
19144
|
return spaceId;
|
|
19035
19145
|
}
|
|
19146
|
+
/**
|
|
19147
|
+
* Ensure one of this user's owned spaces (e.g. `"secrets"`) is hosted on the
|
|
19148
|
+
* server.
|
|
19149
|
+
*
|
|
19150
|
+
* At sign-in, a full-authority session auto-hosts the owner's `secrets`
|
|
19151
|
+
* space, but a session created with a manifest / capabilityRequest does not.
|
|
19152
|
+
* Such a session can therefore hold valid `tinycloud.kv/*` capabilities for
|
|
19153
|
+
* the owned `secrets` space yet still fail its first scoped
|
|
19154
|
+
* `secrets.put(...)` with `404 Space not found`, because the space was never
|
|
19155
|
+
* registered on the node.
|
|
19156
|
+
*
|
|
19157
|
+
* Calling this resolves `name` to the owner's owned-space URI
|
|
19158
|
+
* (`tinycloud:pkh:eip155:<chain>:<addr>:<name>`) and hosts it via the
|
|
19159
|
+
* host-SIWE delegation flow. The host SIWE is idempotent server-side, so it
|
|
19160
|
+
* is safe to call whether or not the space already exists; do not gate it on
|
|
19161
|
+
* a prior existence check. Must be called after {@link signIn}.
|
|
19162
|
+
*
|
|
19163
|
+
* @param name - The owned space name (e.g. `"secrets"`).
|
|
19164
|
+
* @returns The hosted owned-space URI.
|
|
19165
|
+
*/
|
|
19166
|
+
async ensureOwnedSpaceHosted(name) {
|
|
19167
|
+
return this.hostOwnedSpace(name);
|
|
19168
|
+
}
|
|
19036
19169
|
/**
|
|
19037
19170
|
* Restore a previously established session from stored delegation data.
|
|
19038
19171
|
*
|
|
@@ -19055,30 +19188,30 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19055
19188
|
this._spaceService = void 0;
|
|
19056
19189
|
this._serviceContext = void 0;
|
|
19057
19190
|
this.runtimePermissionGrants = [];
|
|
19058
|
-
const restoredAddress = sessionData.address ? (0,
|
|
19191
|
+
const restoredAddress = sessionData.address ? (0, import_sdk_core6.canonicalizeAddress)(sessionData.address) : void 0;
|
|
19059
19192
|
if (restoredAddress) {
|
|
19060
19193
|
this._address = restoredAddress;
|
|
19061
19194
|
}
|
|
19062
19195
|
if (sessionData.chainId) {
|
|
19063
19196
|
this._chainId = sessionData.chainId;
|
|
19064
19197
|
}
|
|
19065
|
-
this._serviceContext = new
|
|
19198
|
+
this._serviceContext = new import_sdk_core6.ServiceContext({
|
|
19066
19199
|
invoke: this.invokeWithRuntimePermissions,
|
|
19067
19200
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19068
19201
|
fetch: globalThis.fetch.bind(globalThis),
|
|
19069
19202
|
hosts: [this.config.host],
|
|
19070
19203
|
telemetry: this.config.telemetry
|
|
19071
19204
|
});
|
|
19072
|
-
this._kv = new
|
|
19205
|
+
this._kv = new import_sdk_core6.KVService({});
|
|
19073
19206
|
this._kv.initialize(this._serviceContext);
|
|
19074
19207
|
this._serviceContext.registerService("kv", this._kv);
|
|
19075
|
-
this._sql = new
|
|
19208
|
+
this._sql = new import_sdk_core6.SQLService({});
|
|
19076
19209
|
this._sql.initialize(this._serviceContext);
|
|
19077
19210
|
this._serviceContext.registerService("sql", this._sql);
|
|
19078
|
-
this._duckdb = new
|
|
19211
|
+
this._duckdb = new import_sdk_core6.DuckDbService({});
|
|
19079
19212
|
this._duckdb.initialize(this._serviceContext);
|
|
19080
19213
|
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
19081
|
-
this._hooks = new
|
|
19214
|
+
this._hooks = new import_sdk_core6.HooksService({});
|
|
19082
19215
|
this._hooks.initialize(this._serviceContext);
|
|
19083
19216
|
this._serviceContext.registerService("hooks", this._hooks);
|
|
19084
19217
|
const serviceSession = {
|
|
@@ -19177,7 +19310,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19177
19310
|
capabilityRequest: this.config.capabilityRequest,
|
|
19178
19311
|
includeAccountRegistryPermissions: this.config.includeAccountRegistryPermissions
|
|
19179
19312
|
});
|
|
19180
|
-
this.tc = new
|
|
19313
|
+
this.tc = new import_sdk_core6.TinyCloud(this.auth, {
|
|
19181
19314
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19182
19315
|
telemetry: this.config.telemetry
|
|
19183
19316
|
});
|
|
@@ -19222,7 +19355,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19222
19355
|
capabilityRequest: this.config.capabilityRequest,
|
|
19223
19356
|
includeAccountRegistryPermissions: this.config.includeAccountRegistryPermissions
|
|
19224
19357
|
});
|
|
19225
|
-
this.tc = new
|
|
19358
|
+
this.tc = new import_sdk_core6.TinyCloud(this.auth, {
|
|
19226
19359
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19227
19360
|
telemetry: this.config.telemetry
|
|
19228
19361
|
});
|
|
@@ -19238,28 +19371,28 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19238
19371
|
return;
|
|
19239
19372
|
}
|
|
19240
19373
|
this.tc.initializeServices(this.invokeWithRuntimePermissions, [this.config.host]);
|
|
19241
|
-
this._serviceContext = new
|
|
19374
|
+
this._serviceContext = new import_sdk_core6.ServiceContext({
|
|
19242
19375
|
invoke: this.invokeWithRuntimePermissions,
|
|
19243
19376
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19244
19377
|
fetch: globalThis.fetch.bind(globalThis),
|
|
19245
19378
|
hosts: [this.config.host],
|
|
19246
19379
|
telemetry: this.config.telemetry
|
|
19247
19380
|
});
|
|
19248
|
-
this._kv = new
|
|
19381
|
+
this._kv = new import_sdk_core6.KVService({});
|
|
19249
19382
|
this._kv.initialize(this._serviceContext);
|
|
19250
19383
|
this._serviceContext.registerService("kv", this._kv);
|
|
19251
19384
|
const features = this.nodeFeatures;
|
|
19252
19385
|
if (features.length === 0 || features.includes("sql")) {
|
|
19253
|
-
this._sql = new
|
|
19386
|
+
this._sql = new import_sdk_core6.SQLService({});
|
|
19254
19387
|
this._sql.initialize(this._serviceContext);
|
|
19255
19388
|
this._serviceContext.registerService("sql", this._sql);
|
|
19256
19389
|
}
|
|
19257
19390
|
if (features.length === 0 || features.includes("duckdb")) {
|
|
19258
|
-
this._duckdb = new
|
|
19391
|
+
this._duckdb = new import_sdk_core6.DuckDbService({});
|
|
19259
19392
|
this._duckdb.initialize(this._serviceContext);
|
|
19260
19393
|
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
19261
19394
|
}
|
|
19262
|
-
this._hooks = new
|
|
19395
|
+
this._hooks = new import_sdk_core6.HooksService({});
|
|
19263
19396
|
this._hooks.initialize(this._serviceContext);
|
|
19264
19397
|
this._serviceContext.registerService("hooks", this._hooks);
|
|
19265
19398
|
const serviceSession = {
|
|
@@ -19277,9 +19410,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19277
19410
|
this.initializeV2Services(serviceSession);
|
|
19278
19411
|
}
|
|
19279
19412
|
createSpaceScopedKVService(spaceId) {
|
|
19280
|
-
const kvService = new
|
|
19413
|
+
const kvService = new import_sdk_core6.KVService({});
|
|
19281
19414
|
if (this._serviceContext) {
|
|
19282
|
-
const spaceScopedContext = new
|
|
19415
|
+
const spaceScopedContext = new import_sdk_core6.ServiceContext({
|
|
19283
19416
|
invoke: this._serviceContext.invoke,
|
|
19284
19417
|
fetch: this._serviceContext.fetch,
|
|
19285
19418
|
hosts: this._serviceContext.hosts,
|
|
@@ -19344,7 +19477,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19344
19477
|
const shared = wasm.vault_x25519_dh(receiverPrivateKey, peerPublic);
|
|
19345
19478
|
return columnDecrypt(shared, ciphertext);
|
|
19346
19479
|
},
|
|
19347
|
-
verifyNodeSignature: (nodeId, message, signature2) => (0,
|
|
19480
|
+
verifyNodeSignature: (nodeId, message, signature2) => (0, import_sdk_core6.verifyDidKeyEd25519Signature)(nodeId, message, signature2)
|
|
19348
19481
|
};
|
|
19349
19482
|
}
|
|
19350
19483
|
async fetchNodeId() {
|
|
@@ -19415,19 +19548,19 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19415
19548
|
return await response.json();
|
|
19416
19549
|
}
|
|
19417
19550
|
};
|
|
19418
|
-
return new
|
|
19551
|
+
return new import_sdk_core6.EncryptionService({
|
|
19419
19552
|
crypto: crypto2,
|
|
19420
19553
|
signer: {
|
|
19421
19554
|
signDecryptInvocation: async (input) => {
|
|
19422
19555
|
const signed2 = await this.signRawNetworkAuthorization({
|
|
19423
19556
|
targetNode: input.targetNode,
|
|
19424
19557
|
networkId: input.networkId,
|
|
19425
|
-
action:
|
|
19558
|
+
action: DECRYPT_ACTION2,
|
|
19426
19559
|
facts: input.facts
|
|
19427
19560
|
});
|
|
19428
19561
|
return {
|
|
19429
19562
|
...signed2,
|
|
19430
|
-
canonicalBody: (0,
|
|
19563
|
+
canonicalBody: (0, import_sdk_core6.canonicalizeEncryptionJson)(
|
|
19431
19564
|
input.body
|
|
19432
19565
|
)
|
|
19433
19566
|
};
|
|
@@ -19439,14 +19572,14 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19439
19572
|
},
|
|
19440
19573
|
wellKnown: {
|
|
19441
19574
|
fetchWellKnown: async (principal, discoveryKey) => {
|
|
19442
|
-
if (!this._address || !
|
|
19575
|
+
if (!this._address || !didPrincipalMatches2(principal, this.did)) {
|
|
19443
19576
|
return null;
|
|
19444
19577
|
}
|
|
19445
19578
|
if (!this.config.host) {
|
|
19446
19579
|
return null;
|
|
19447
19580
|
}
|
|
19448
|
-
const publicSpaceId = (0,
|
|
19449
|
-
const result = await
|
|
19581
|
+
const publicSpaceId = (0, import_sdk_core6.makePublicSpaceId)(this._address, this._chainId);
|
|
19582
|
+
const result = await import_sdk_core6.TinyCloud.readPublicSpace(this.config.host, publicSpaceId, discoveryKey);
|
|
19450
19583
|
if (!result.ok) {
|
|
19451
19584
|
return null;
|
|
19452
19585
|
}
|
|
@@ -19469,7 +19602,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19469
19602
|
}
|
|
19470
19603
|
createVaultService(spaceId, kv) {
|
|
19471
19604
|
const wasm = this.wasmBindings;
|
|
19472
|
-
const vaultCrypto = (0,
|
|
19605
|
+
const vaultCrypto = (0, import_sdk_core6.createVaultCrypto)({
|
|
19473
19606
|
vault_encrypt: wasm.vault_encrypt,
|
|
19474
19607
|
vault_decrypt: wasm.vault_decrypt,
|
|
19475
19608
|
vault_derive_key: wasm.vault_derive_key,
|
|
@@ -19479,7 +19612,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19479
19612
|
vault_sha256: wasm.vault_sha256
|
|
19480
19613
|
});
|
|
19481
19614
|
const self2 = this;
|
|
19482
|
-
return new
|
|
19615
|
+
return new import_sdk_core6.DataVaultService({
|
|
19483
19616
|
spaceId,
|
|
19484
19617
|
crypto: vaultCrypto,
|
|
19485
19618
|
encryption: {
|
|
@@ -19502,8 +19635,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19502
19635
|
get publicKV() {
|
|
19503
19636
|
return self2._publicKV ?? self2.tc.publicKV;
|
|
19504
19637
|
},
|
|
19505
|
-
readPublicSpace: (host, targetSpaceId, key2) =>
|
|
19506
|
-
makePublicSpaceId:
|
|
19638
|
+
readPublicSpace: (host, targetSpaceId, key2) => import_sdk_core6.TinyCloud.readPublicSpace(host, targetSpaceId, key2),
|
|
19639
|
+
makePublicSpaceId: import_sdk_core6.TinyCloud.makePublicSpaceId,
|
|
19507
19640
|
did: this.did,
|
|
19508
19641
|
address: this._address ?? "",
|
|
19509
19642
|
chainId: this._chainId,
|
|
@@ -19516,7 +19649,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19516
19649
|
* @internal
|
|
19517
19650
|
*/
|
|
19518
19651
|
initializeV2Services(serviceSession) {
|
|
19519
|
-
this._capabilityRegistry = new
|
|
19652
|
+
this._capabilityRegistry = new import_sdk_core6.CapabilityKeyRegistry();
|
|
19520
19653
|
const tcSession = this.auth?.tinyCloudSession;
|
|
19521
19654
|
if (tcSession && this._address) {
|
|
19522
19655
|
const sessionKey = {
|
|
@@ -19590,13 +19723,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19590
19723
|
}
|
|
19591
19724
|
this._capabilityRegistry.registerKey(sessionKey, delegations);
|
|
19592
19725
|
}
|
|
19593
|
-
this._delegationManager = new
|
|
19726
|
+
this._delegationManager = new import_sdk_core6.DelegationManager({
|
|
19594
19727
|
hosts: [this.config.host],
|
|
19595
19728
|
session: serviceSession,
|
|
19596
19729
|
invoke: this.invokeWithRuntimePermissions,
|
|
19597
19730
|
fetch: globalThis.fetch.bind(globalThis)
|
|
19598
19731
|
});
|
|
19599
|
-
this._spaceService = new
|
|
19732
|
+
this._spaceService = new import_sdk_core6.SpaceService({
|
|
19600
19733
|
hosts: [this.config.host],
|
|
19601
19734
|
session: serviceSession,
|
|
19602
19735
|
invoke: this.wasmBindings.invoke,
|
|
@@ -19648,6 +19781,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19648
19781
|
}
|
|
19649
19782
|
};
|
|
19650
19783
|
}
|
|
19784
|
+
},
|
|
19785
|
+
onSpaceRegistered: async (space) => {
|
|
19786
|
+
await this.account.spaces.register(space);
|
|
19651
19787
|
}
|
|
19652
19788
|
});
|
|
19653
19789
|
this._sharingService.updateConfig({
|
|
@@ -19753,7 +19889,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19753
19889
|
...prepared,
|
|
19754
19890
|
signature: signature2
|
|
19755
19891
|
});
|
|
19756
|
-
const activateResult = await (0,
|
|
19892
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
19757
19893
|
host,
|
|
19758
19894
|
delegationSession.delegationHeader
|
|
19759
19895
|
);
|
|
@@ -19763,7 +19899,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19763
19899
|
return {
|
|
19764
19900
|
cid: delegationSession.delegationCid,
|
|
19765
19901
|
delegateDID: params.shareKeyDID,
|
|
19766
|
-
delegatorDID: (0,
|
|
19902
|
+
delegatorDID: (0, import_sdk_core6.pkhDid)(session.address, session.chainId),
|
|
19767
19903
|
spaceId: params.spaceId,
|
|
19768
19904
|
path: params.path,
|
|
19769
19905
|
actions: params.actions,
|
|
@@ -19820,7 +19956,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19820
19956
|
if (!this._sql) {
|
|
19821
19957
|
const features = this.nodeFeatures;
|
|
19822
19958
|
if (features.length > 0 && !features.includes("sql")) {
|
|
19823
|
-
throw new
|
|
19959
|
+
throw new import_sdk_core6.UnsupportedFeatureError("sql", this.config.host, features);
|
|
19824
19960
|
}
|
|
19825
19961
|
throw new Error("Not signed in. Call signIn() first.");
|
|
19826
19962
|
}
|
|
@@ -19844,8 +19980,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19844
19980
|
if (!this._serviceContext || !this._serviceContext.session) {
|
|
19845
19981
|
throw new Error("Not signed in. Call signIn() first.");
|
|
19846
19982
|
}
|
|
19847
|
-
const sql = new
|
|
19848
|
-
const spaceScopedContext = new
|
|
19983
|
+
const sql = new import_sdk_core6.SQLService({});
|
|
19984
|
+
const spaceScopedContext = new import_sdk_core6.ServiceContext({
|
|
19849
19985
|
invoke: this._serviceContext.invoke,
|
|
19850
19986
|
fetch: this._serviceContext.fetch,
|
|
19851
19987
|
hosts: this._serviceContext.hosts,
|
|
@@ -19873,8 +20009,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19873
20009
|
if (!this._serviceContext || !this._serviceContext.session) {
|
|
19874
20010
|
throw new Error("Not signed in. Call signIn() first.");
|
|
19875
20011
|
}
|
|
19876
|
-
const kv = new
|
|
19877
|
-
const spaceScopedContext = new
|
|
20012
|
+
const kv = new import_sdk_core6.KVService({});
|
|
20013
|
+
const spaceScopedContext = new import_sdk_core6.ServiceContext({
|
|
19878
20014
|
invoke: this._serviceContext.invoke,
|
|
19879
20015
|
fetch: this._serviceContext.fetch,
|
|
19880
20016
|
hosts: this._serviceContext.hosts
|
|
@@ -19890,7 +20026,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19890
20026
|
if (!this._duckdb) {
|
|
19891
20027
|
const features = this.nodeFeatures;
|
|
19892
20028
|
if (features.length > 0 && !features.includes("duckdb")) {
|
|
19893
|
-
throw new
|
|
20029
|
+
throw new import_sdk_core6.UnsupportedFeatureError("duckdb", this.config.host, features);
|
|
19894
20030
|
}
|
|
19895
20031
|
throw new Error("Not signed in. Call signIn() first.");
|
|
19896
20032
|
}
|
|
@@ -19942,16 +20078,16 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19942
20078
|
type: NETWORK_ADMIN_TYPE,
|
|
19943
20079
|
targetNode,
|
|
19944
20080
|
networkId,
|
|
19945
|
-
bodyHash: (0,
|
|
20081
|
+
bodyHash: (0, import_sdk_core6.canonicalHashHex)(
|
|
19946
20082
|
crypto2.sha256,
|
|
19947
20083
|
body
|
|
19948
20084
|
),
|
|
19949
|
-
action:
|
|
20085
|
+
action: NETWORK_CREATE_ACTION2
|
|
19950
20086
|
};
|
|
19951
20087
|
const signed2 = await this.signRawNetworkAuthorization({
|
|
19952
20088
|
targetNode,
|
|
19953
20089
|
networkId,
|
|
19954
|
-
action:
|
|
20090
|
+
action: NETWORK_CREATE_ACTION2,
|
|
19955
20091
|
facts
|
|
19956
20092
|
});
|
|
19957
20093
|
const response = await fetch(`${this.config.host}/encryption/networks`, {
|
|
@@ -19960,7 +20096,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19960
20096
|
Authorization: signed2.authorization,
|
|
19961
20097
|
"Content-Type": "application/json"
|
|
19962
20098
|
},
|
|
19963
|
-
body: (0,
|
|
20099
|
+
body: (0, import_sdk_core6.canonicalizeEncryptionJson)(
|
|
19964
20100
|
body
|
|
19965
20101
|
)
|
|
19966
20102
|
});
|
|
@@ -19972,12 +20108,19 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19972
20108
|
const created = await response.json();
|
|
19973
20109
|
return created.descriptor;
|
|
19974
20110
|
}
|
|
19975
|
-
async ensureEncryptionNetwork(
|
|
19976
|
-
const
|
|
20111
|
+
async ensureEncryptionNetwork(nameOrNetworkId = DEFAULT_ENCRYPTION_NETWORK_NAME) {
|
|
20112
|
+
const networkId = nameOrNetworkId.startsWith("urn:tinycloud:encryption:") ? nameOrNetworkId : this.getDefaultEncryptionNetworkId(nameOrNetworkId);
|
|
20113
|
+
const existing = await this.getEncryptionNetwork(networkId);
|
|
19977
20114
|
if (existing) {
|
|
19978
20115
|
return existing;
|
|
19979
20116
|
}
|
|
19980
|
-
|
|
20117
|
+
const parsed = (0, import_sdk_core6.parseNetworkId)(networkId);
|
|
20118
|
+
if (!didPrincipalMatches2(parsed.ownerDid, this.did)) {
|
|
20119
|
+
throw new Error(
|
|
20120
|
+
`Cannot create encryption network ${networkId}: owner ${parsed.ownerDid} does not match signed-in DID ${this.did}`
|
|
20121
|
+
);
|
|
20122
|
+
}
|
|
20123
|
+
return this.createEncryptionNetwork(parsed.name);
|
|
19981
20124
|
}
|
|
19982
20125
|
/**
|
|
19983
20126
|
* App-facing secrets API backed by the `secrets` space vault.
|
|
@@ -20004,7 +20147,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20004
20147
|
throw new Error("Not signed in. Call signIn() first.");
|
|
20005
20148
|
}
|
|
20006
20149
|
if (!this._baseSecrets) {
|
|
20007
|
-
this._baseSecrets = new
|
|
20150
|
+
this._baseSecrets = new import_sdk_core6.SecretsService(() => this.space("secrets").vault);
|
|
20008
20151
|
}
|
|
20009
20152
|
return this._baseSecrets;
|
|
20010
20153
|
}
|
|
@@ -20119,19 +20262,19 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20119
20262
|
async useRuntimeDelegation(delegation) {
|
|
20120
20263
|
const session = this.currentTinyCloudSession();
|
|
20121
20264
|
if (!session) {
|
|
20122
|
-
throw new
|
|
20265
|
+
throw new import_sdk_core6.SessionExpiredError(/* @__PURE__ */ new Date(0));
|
|
20123
20266
|
}
|
|
20124
20267
|
if (delegation.expiry.getTime() <= Date.now()) {
|
|
20125
|
-
throw new
|
|
20268
|
+
throw new import_sdk_core6.SessionExpiredError(delegation.expiry);
|
|
20126
20269
|
}
|
|
20127
20270
|
const expectedDids = [session.verificationMethod, this.sessionDid];
|
|
20128
|
-
if (!expectedDids.some((did) =>
|
|
20271
|
+
if (!expectedDids.some((did) => didPrincipalMatches2(delegation.delegateDID, did))) {
|
|
20129
20272
|
throw new Error(
|
|
20130
20273
|
`Runtime delegation targets ${delegation.delegateDID} but this session key is ${session.verificationMethod}.`
|
|
20131
20274
|
);
|
|
20132
20275
|
}
|
|
20133
20276
|
const targetHost = delegation.host ?? this.config.host;
|
|
20134
|
-
const activateResult = await (0,
|
|
20277
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20135
20278
|
targetHost,
|
|
20136
20279
|
delegation.delegationHeader
|
|
20137
20280
|
);
|
|
@@ -20158,13 +20301,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20158
20301
|
}
|
|
20159
20302
|
const session = this.currentTinyCloudSession();
|
|
20160
20303
|
if (!session) {
|
|
20161
|
-
throw new
|
|
20304
|
+
throw new import_sdk_core6.SessionExpiredError(/* @__PURE__ */ new Date(0));
|
|
20162
20305
|
}
|
|
20163
20306
|
const sessionExpiry = extractSiweExpiration(session.siwe);
|
|
20164
20307
|
if (sessionExpiry !== void 0) {
|
|
20165
20308
|
const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
|
|
20166
20309
|
if (sessionExpiry.getTime() <= Date.now() + marginMs) {
|
|
20167
|
-
throw new
|
|
20310
|
+
throw new import_sdk_core6.SessionExpiredError(sessionExpiry);
|
|
20168
20311
|
}
|
|
20169
20312
|
}
|
|
20170
20313
|
const expanded = this.expandPermissionEntries(permissions);
|
|
@@ -20227,7 +20370,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20227
20370
|
...prepared,
|
|
20228
20371
|
signature: signature2
|
|
20229
20372
|
});
|
|
20230
|
-
const activateResult = await (0,
|
|
20373
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20231
20374
|
this.config.host,
|
|
20232
20375
|
delegatedSession.delegationHeader
|
|
20233
20376
|
);
|
|
@@ -20400,7 +20543,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20400
20543
|
];
|
|
20401
20544
|
const abilities = { kv: { "": kvActions } };
|
|
20402
20545
|
const now = /* @__PURE__ */ new Date();
|
|
20403
|
-
const expiryMs =
|
|
20546
|
+
const expiryMs = import_sdk_core6.EXPIRY.EPHEMERAL_MS;
|
|
20404
20547
|
const expirationTime = new Date(now.getTime() + expiryMs);
|
|
20405
20548
|
const prepared = this.wasmBindings.prepareSession({
|
|
20406
20549
|
abilities,
|
|
@@ -20418,7 +20561,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20418
20561
|
...prepared,
|
|
20419
20562
|
signature: signature2
|
|
20420
20563
|
});
|
|
20421
|
-
const activateResult = await (0,
|
|
20564
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20422
20565
|
this.config.host,
|
|
20423
20566
|
delegationSession.delegationHeader
|
|
20424
20567
|
);
|
|
@@ -20445,8 +20588,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20445
20588
|
}]);
|
|
20446
20589
|
}
|
|
20447
20590
|
if (this._serviceContext) {
|
|
20448
|
-
const publicKV = new
|
|
20449
|
-
const publicContext = new
|
|
20591
|
+
const publicKV = new import_sdk_core6.KVService({ prefix: "" });
|
|
20592
|
+
const publicContext = new import_sdk_core6.ServiceContext({
|
|
20450
20593
|
invoke: this.invokeWithRuntimePermissions,
|
|
20451
20594
|
fetch: this._serviceContext.fetch,
|
|
20452
20595
|
hosts: this._serviceContext.hosts,
|
|
@@ -20573,14 +20716,14 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20573
20716
|
async delegateTo(did, permissions, options) {
|
|
20574
20717
|
const session = this.currentTinyCloudSession();
|
|
20575
20718
|
if (!session) {
|
|
20576
|
-
throw new
|
|
20719
|
+
throw new import_sdk_core6.SessionExpiredError(/* @__PURE__ */ new Date(0));
|
|
20577
20720
|
}
|
|
20578
20721
|
const sessionExpiry = extractSiweExpiration(session.siwe);
|
|
20579
20722
|
if (sessionExpiry !== void 0) {
|
|
20580
20723
|
const now2 = Date.now();
|
|
20581
20724
|
const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
|
|
20582
20725
|
if (sessionExpiry.getTime() <= now2 + marginMs) {
|
|
20583
|
-
throw new
|
|
20726
|
+
throw new import_sdk_core6.SessionExpiredError(sessionExpiry);
|
|
20584
20727
|
}
|
|
20585
20728
|
}
|
|
20586
20729
|
if (!Array.isArray(permissions) || permissions.length === 0) {
|
|
@@ -20609,11 +20752,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20609
20752
|
);
|
|
20610
20753
|
return { delegation: delegation2, prompted: true };
|
|
20611
20754
|
}
|
|
20612
|
-
const granted = (0,
|
|
20755
|
+
const granted = (0, import_sdk_core6.parseRecapCapabilities)(
|
|
20613
20756
|
(siwe) => this.wasmBindings.parseRecapFromSiwe(siwe),
|
|
20614
20757
|
session.siwe
|
|
20615
20758
|
);
|
|
20616
|
-
const { subset, missing } = (0,
|
|
20759
|
+
const { subset, missing } = (0, import_sdk_core6.isCapabilitySubset)(expandedEntries, granted);
|
|
20617
20760
|
if (!subset) {
|
|
20618
20761
|
const runtimeGrant = this.findGrantForOperations(
|
|
20619
20762
|
this.permissionEntriesToOperations(expandedEntries, session)
|
|
@@ -20621,7 +20764,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20621
20764
|
if (runtimeGrant) {
|
|
20622
20765
|
const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
|
|
20623
20766
|
if (runtimeGrant.expiresAt.getTime() <= Date.now() + marginMs) {
|
|
20624
|
-
throw new
|
|
20767
|
+
throw new import_sdk_core6.SessionExpiredError(runtimeGrant.expiresAt);
|
|
20625
20768
|
}
|
|
20626
20769
|
const runtimeExpiration = runtimeGrant.expiresAt < effectiveExpiration ? runtimeGrant.expiresAt : effectiveExpiration;
|
|
20627
20770
|
const delegation2 = await this.createDelegationViaRuntimeGrant(
|
|
@@ -20632,7 +20775,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20632
20775
|
);
|
|
20633
20776
|
return { delegation: delegation2, prompted: false };
|
|
20634
20777
|
}
|
|
20635
|
-
throw new
|
|
20778
|
+
throw new import_sdk_core6.PermissionNotInManifestError(missing, granted);
|
|
20636
20779
|
}
|
|
20637
20780
|
const delegation = await this.createDelegationViaWasmPath(
|
|
20638
20781
|
did,
|
|
@@ -20654,7 +20797,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20654
20797
|
);
|
|
20655
20798
|
}
|
|
20656
20799
|
const target = request.delegationTargets.find(
|
|
20657
|
-
(entry) =>
|
|
20800
|
+
(entry) => didPrincipalMatches2(entry.did, did)
|
|
20658
20801
|
);
|
|
20659
20802
|
if (!target) {
|
|
20660
20803
|
throw new Error(`No manifest delegation target found for DID ${did}`);
|
|
@@ -20714,7 +20857,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20714
20857
|
const spaceId = resolvedSpaces.size === 1 ? [...resolvedSpaces][0] : session.spaceId;
|
|
20715
20858
|
const abilities = {};
|
|
20716
20859
|
for (const entry of entries) {
|
|
20717
|
-
const shortService =
|
|
20860
|
+
const shortService = import_sdk_core6.SERVICE_LONG_TO_SHORT[entry.service];
|
|
20718
20861
|
if (shortService === void 0) {
|
|
20719
20862
|
throw new Error(
|
|
20720
20863
|
`delegateTo: unknown service '${entry.service}' \u2014 no short-form mapping`
|
|
@@ -20754,7 +20897,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20754
20897
|
});
|
|
20755
20898
|
const primary = result.resources[0];
|
|
20756
20899
|
const delegationHeader = { Authorization: result.delegation };
|
|
20757
|
-
const activateResult = await (0,
|
|
20900
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20758
20901
|
this.config.host,
|
|
20759
20902
|
delegationHeader
|
|
20760
20903
|
);
|
|
@@ -20789,7 +20932,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20789
20932
|
const primary = result.resources[0];
|
|
20790
20933
|
const delegationHeader = { Authorization: result.delegation };
|
|
20791
20934
|
const targetHost = grant.delegation.host ?? this.config.host;
|
|
20792
|
-
const activateResult = await (0,
|
|
20935
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20793
20936
|
targetHost,
|
|
20794
20937
|
delegationHeader
|
|
20795
20938
|
);
|
|
@@ -20830,10 +20973,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20830
20973
|
return this.wasmBindings.makeSpaceId(session.address, session.chainId, space);
|
|
20831
20974
|
}
|
|
20832
20975
|
expandPermissionEntries(permissions) {
|
|
20833
|
-
return (0,
|
|
20976
|
+
return (0, import_sdk_core6.expandPermissionEntries)(permissions);
|
|
20834
20977
|
}
|
|
20835
20978
|
shortServiceName(service) {
|
|
20836
|
-
const short =
|
|
20979
|
+
const short = import_sdk_core6.SERVICE_LONG_TO_SHORT[service];
|
|
20837
20980
|
if (short === void 0) {
|
|
20838
20981
|
throw new Error(
|
|
20839
20982
|
`unknown service '${service}' \u2014 no short-form mapping`
|
|
@@ -20859,7 +21002,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20859
21002
|
return abilities;
|
|
20860
21003
|
}
|
|
20861
21004
|
isEncryptionPermissionEntry(entry) {
|
|
20862
|
-
return entry.service ===
|
|
21005
|
+
return entry.service === import_sdk_core6.ENCRYPTION_PERMISSION_SERVICE && entry.path.startsWith("urn:tinycloud:encryption:");
|
|
20863
21006
|
}
|
|
20864
21007
|
permissionsToRawAbilities(entries) {
|
|
20865
21008
|
const rawAbilities = {};
|
|
@@ -20892,11 +21035,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20892
21035
|
}
|
|
20893
21036
|
sessionCoversPermissionEntries(session, entries) {
|
|
20894
21037
|
try {
|
|
20895
|
-
const granted = (0,
|
|
21038
|
+
const granted = (0, import_sdk_core6.parseRecapCapabilities)(
|
|
20896
21039
|
(siwe) => this.wasmBindings.parseRecapFromSiwe(siwe),
|
|
20897
21040
|
session.siwe
|
|
20898
21041
|
);
|
|
20899
|
-
return (0,
|
|
21042
|
+
return (0, import_sdk_core6.isCapabilitySubset)(entries, granted).subset;
|
|
20900
21043
|
} catch {
|
|
20901
21044
|
return false;
|
|
20902
21045
|
}
|
|
@@ -21104,7 +21247,23 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21104
21247
|
if (granted.resource !== void 0 || requested.resource !== void 0) {
|
|
21105
21248
|
return granted.resource !== void 0 && requested.resource !== void 0 && granted.resource === requested.resource && this.pathContains(granted.path, requested.path);
|
|
21106
21249
|
}
|
|
21107
|
-
return granted.spaceId !== void 0 && requested.spaceId !== void 0 && granted.spaceId
|
|
21250
|
+
return granted.spaceId !== void 0 && requested.spaceId !== void 0 && this.spaceIdsEqual(granted.spaceId, requested.spaceId) && this.pathContains(granted.path, requested.path);
|
|
21251
|
+
}
|
|
21252
|
+
// Space IDs are `tinycloud:pkh:eip155:<chain>:<0xADDR>:<name>`. The embedded
|
|
21253
|
+
// EIP-155 address is case-insensitive, but the CLI canonicalizes it to
|
|
21254
|
+
// lowercase when building a space URI while stored runtime delegations keep
|
|
21255
|
+
// the EIP-55 checksummed form — so a byte-for-byte compare spuriously rejects
|
|
21256
|
+
// an otherwise-valid grant. Lowercase ONLY the `eip155:<chain>:0x<addr>`
|
|
21257
|
+
// segment and leave everything else (crucially the case-sensitive space NAME)
|
|
21258
|
+
// byte-exact. Mirrors the CLI's `normalizeSpaceForCompare` (OPENKEY_SCOPE_MISMATCH fix).
|
|
21259
|
+
spaceIdsEqual(a, b) {
|
|
21260
|
+
return this.normalizeSpaceAddress(a) === this.normalizeSpaceAddress(b);
|
|
21261
|
+
}
|
|
21262
|
+
normalizeSpaceAddress(space) {
|
|
21263
|
+
return space.replace(
|
|
21264
|
+
/(eip155:\d+:)(0x[0-9a-fA-F]{40})/,
|
|
21265
|
+
(_match, prefix, addr) => prefix + addr.toLowerCase()
|
|
21266
|
+
);
|
|
21108
21267
|
}
|
|
21109
21268
|
actionContains(grantedAction, requestedAction) {
|
|
21110
21269
|
if (grantedAction === requestedAction) {
|
|
@@ -21211,7 +21370,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21211
21370
|
if (resolvedDelegateDID.endsWith(".eth") && this.config.ensResolver) {
|
|
21212
21371
|
const address = await this.config.ensResolver.resolveAddress(resolvedDelegateDID);
|
|
21213
21372
|
if (!address) throw new Error(`Could not resolve ENS name: ${resolvedDelegateDID}`);
|
|
21214
|
-
resolvedDelegateDID = (0,
|
|
21373
|
+
resolvedDelegateDID = (0, import_sdk_core6.pkhDid)(address, 1);
|
|
21215
21374
|
}
|
|
21216
21375
|
const entries = legacyParamsToPermissionEntries(
|
|
21217
21376
|
params.actions,
|
|
@@ -21226,7 +21385,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21226
21385
|
);
|
|
21227
21386
|
return result.delegation;
|
|
21228
21387
|
} catch (err) {
|
|
21229
|
-
if (err instanceof
|
|
21388
|
+
if (err instanceof import_sdk_core6.PermissionNotInManifestError) {
|
|
21230
21389
|
} else {
|
|
21231
21390
|
throw err;
|
|
21232
21391
|
}
|
|
@@ -21283,7 +21442,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21283
21442
|
...prepared,
|
|
21284
21443
|
signature: signature2
|
|
21285
21444
|
});
|
|
21286
|
-
const activateResult = await (0,
|
|
21445
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
21287
21446
|
this.config.host,
|
|
21288
21447
|
delegationSession.delegationHeader
|
|
21289
21448
|
);
|
|
@@ -21305,7 +21464,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21305
21464
|
};
|
|
21306
21465
|
const hasKvActions = params.actions.some((a) => a.startsWith("tinycloud.kv/"));
|
|
21307
21466
|
if (hasKvActions && params.includePublicSpace !== false) {
|
|
21308
|
-
const publicSpaceId = (0,
|
|
21467
|
+
const publicSpaceId = (0, import_sdk_core6.makePublicSpaceId)(
|
|
21309
21468
|
this.wasmBindings.ensureEip55(session.address),
|
|
21310
21469
|
session.chainId
|
|
21311
21470
|
);
|
|
@@ -21328,7 +21487,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21328
21487
|
...publicPrepared,
|
|
21329
21488
|
signature: publicSignature
|
|
21330
21489
|
});
|
|
21331
|
-
const publicActivateResult = await (0,
|
|
21490
|
+
const publicActivateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
21332
21491
|
this.config.host,
|
|
21333
21492
|
publicSession.delegationHeader
|
|
21334
21493
|
);
|
|
@@ -21368,7 +21527,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21368
21527
|
const targetHost = delegation.host ?? this.config.host;
|
|
21369
21528
|
if (this.isSessionOnly) {
|
|
21370
21529
|
const myDid = this.did;
|
|
21371
|
-
if (!
|
|
21530
|
+
if (!didPrincipalMatches2(delegation.delegateDID, myDid)) {
|
|
21372
21531
|
throw new Error(
|
|
21373
21532
|
`Delegation targets ${delegation.delegateDID} but this user's DID is ${myDid}. The delegation must target this user's DID.`
|
|
21374
21533
|
);
|
|
@@ -21433,7 +21592,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21433
21592
|
...prepared,
|
|
21434
21593
|
signature: signature2
|
|
21435
21594
|
});
|
|
21436
|
-
const activateResult = await (0,
|
|
21595
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
21437
21596
|
targetHost,
|
|
21438
21597
|
invokerSession.delegationHeader
|
|
21439
21598
|
);
|
|
@@ -21539,7 +21698,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21539
21698
|
...prepared,
|
|
21540
21699
|
signature: signature2
|
|
21541
21700
|
});
|
|
21542
|
-
const activateResult = await (0,
|
|
21701
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
21543
21702
|
targetHost,
|
|
21544
21703
|
subDelegationSession.delegationHeader
|
|
21545
21704
|
);
|
|
@@ -21581,11 +21740,11 @@ TinyCloudNode.registerNodeDefaults({
|
|
|
21581
21740
|
});
|
|
21582
21741
|
|
|
21583
21742
|
// src/index.ts
|
|
21584
|
-
var import_sdk_core7 = require("@tinycloud/sdk-core");
|
|
21585
21743
|
var import_sdk_core8 = require("@tinycloud/sdk-core");
|
|
21744
|
+
var import_sdk_core9 = require("@tinycloud/sdk-core");
|
|
21586
21745
|
|
|
21587
21746
|
// src/storage/FileSessionStorage.ts
|
|
21588
|
-
var
|
|
21747
|
+
var import_sdk_core7 = require("@tinycloud/sdk-core");
|
|
21589
21748
|
var import_fs = require("fs");
|
|
21590
21749
|
var import_path = require("path");
|
|
21591
21750
|
var FileSessionStorage = class {
|
|
@@ -21640,7 +21799,7 @@ var FileSessionStorage = class {
|
|
|
21640
21799
|
try {
|
|
21641
21800
|
const data = (0, import_fs.readFileSync)(filePath, "utf-8");
|
|
21642
21801
|
const parsed = JSON.parse(data);
|
|
21643
|
-
const validation = (0,
|
|
21802
|
+
const validation = (0, import_sdk_core7.validatePersistedSessionData)(parsed);
|
|
21644
21803
|
if (!validation.ok) {
|
|
21645
21804
|
console.warn(`Invalid session data for ${address}:`, validation.error.message);
|
|
21646
21805
|
(0, import_fs.unlinkSync)(filePath);
|
|
@@ -21705,9 +21864,35 @@ var FileSessionStorage = class {
|
|
|
21705
21864
|
};
|
|
21706
21865
|
|
|
21707
21866
|
// src/index.ts
|
|
21708
|
-
var
|
|
21867
|
+
var import_sdk_core10 = require("@tinycloud/sdk-core");
|
|
21709
21868
|
|
|
21710
21869
|
// src/delegation.ts
|
|
21870
|
+
async function grantAuthRequest(authority, request, options) {
|
|
21871
|
+
if (request.kind !== "tinycloud.auth.request") {
|
|
21872
|
+
throw new Error(
|
|
21873
|
+
`grantAuthRequest expects a tinycloud.auth.request artifact, got "${request.kind}".`
|
|
21874
|
+
);
|
|
21875
|
+
}
|
|
21876
|
+
if (!Array.isArray(request.requested) || request.requested.length === 0) {
|
|
21877
|
+
throw new Error("grantAuthRequest request has no requested capabilities.");
|
|
21878
|
+
}
|
|
21879
|
+
const expiry = options?.expiry ?? request.requestedExpiry;
|
|
21880
|
+
const result = await authority.delegateTo(
|
|
21881
|
+
request.sessionDid,
|
|
21882
|
+
request.requested,
|
|
21883
|
+
expiry !== void 0 ? { expiry } : void 0
|
|
21884
|
+
);
|
|
21885
|
+
return {
|
|
21886
|
+
kind: "tinycloud.auth.delegation",
|
|
21887
|
+
version: 1,
|
|
21888
|
+
requestId: request.requestId,
|
|
21889
|
+
delegationCid: result.delegation.cid,
|
|
21890
|
+
delegation: result.delegation,
|
|
21891
|
+
permissions: request.requested,
|
|
21892
|
+
expiry: result.delegation.expiry.toISOString(),
|
|
21893
|
+
prompted: result.prompted
|
|
21894
|
+
};
|
|
21895
|
+
}
|
|
21711
21896
|
function serializeDelegation(delegation) {
|
|
21712
21897
|
return JSON.stringify({
|
|
21713
21898
|
...delegation,
|
|
@@ -21724,7 +21909,6 @@ function deserializeDelegation(data) {
|
|
|
21724
21909
|
}
|
|
21725
21910
|
|
|
21726
21911
|
// src/index.ts
|
|
21727
|
-
var import_sdk_core10 = require("@tinycloud/sdk-core");
|
|
21728
21912
|
var import_sdk_core11 = require("@tinycloud/sdk-core");
|
|
21729
21913
|
var import_sdk_core12 = require("@tinycloud/sdk-core");
|
|
21730
21914
|
var import_sdk_core13 = require("@tinycloud/sdk-core");
|
|
@@ -21735,10 +21919,12 @@ var import_sdk_core17 = require("@tinycloud/sdk-core");
|
|
|
21735
21919
|
var import_sdk_core18 = require("@tinycloud/sdk-core");
|
|
21736
21920
|
var import_sdk_core19 = require("@tinycloud/sdk-core");
|
|
21737
21921
|
var import_sdk_core20 = require("@tinycloud/sdk-core");
|
|
21922
|
+
var import_sdk_core21 = require("@tinycloud/sdk-core");
|
|
21738
21923
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21739
21924
|
0 && (module.exports = {
|
|
21740
21925
|
ACCOUNT_REGISTRY_PATH,
|
|
21741
21926
|
ACCOUNT_REGISTRY_SPACE,
|
|
21927
|
+
AccountService,
|
|
21742
21928
|
AutoApproveSpaceCreationHandler,
|
|
21743
21929
|
CapabilityKeyRegistry,
|
|
21744
21930
|
CapabilityKeyRegistryErrorCodes,
|
|
@@ -21838,6 +22024,7 @@ var import_sdk_core20 = require("@tinycloud/sdk-core");
|
|
|
21838
22024
|
expandPermissionEntries,
|
|
21839
22025
|
expandPermissionEntry,
|
|
21840
22026
|
generateRandomReceiverKey,
|
|
22027
|
+
grantAuthRequest,
|
|
21841
22028
|
hexDecode,
|
|
21842
22029
|
hexEncode,
|
|
21843
22030
|
isCapabilitySubset,
|