@tinycloud/node-sdk 2.4.0-beta.5 → 2.4.0-beta.6
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-zT0sxgtZ.d.cts} +11 -1
- package/dist/{core-BSQqoLAd.d.ts → core-zT0sxgtZ.d.ts} +11 -1
- package/dist/core.cjs +217 -181
- 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 +35 -0
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +260 -224
- 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 +35 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -17025,134 +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: () =>
|
|
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,
|
|
17129
17130
|
grantAuthRequest: () => grantAuthRequest,
|
|
17130
|
-
hexDecode: () =>
|
|
17131
|
-
hexEncode: () =>
|
|
17132
|
-
isCapabilitySubset: () =>
|
|
17133
|
-
isEvmAddress: () =>
|
|
17134
|
-
isNetworkId: () =>
|
|
17135
|
-
loadManifest: () =>
|
|
17136
|
-
makePkhSpaceId: () =>
|
|
17137
|
-
makePublicSpaceId: () =>
|
|
17138
|
-
networkDiscoveryKey: () =>
|
|
17139
|
-
openWrappedKey: () =>
|
|
17140
|
-
parseCanonicalNetworkId: () =>
|
|
17141
|
-
parseExpiry: () =>
|
|
17142
|
-
parseNetworkId: () =>
|
|
17143
|
-
parsePkhDid: () =>
|
|
17144
|
-
parseSpaceUri: () =>
|
|
17145
|
-
pkhDid: () =>
|
|
17146
|
-
principalDid: () =>
|
|
17147
|
-
principalDidEquals: () =>
|
|
17148
|
-
resolveManifest: () =>
|
|
17149
|
-
resolveSecretListPrefix: () =>
|
|
17150
|
-
resolveSecretPath: () =>
|
|
17151
|
-
resourceCapabilitiesToSpaceAbilitiesMap: () =>
|
|
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,
|
|
17152
17153
|
serializeDelegation: () => serializeDelegation,
|
|
17153
|
-
validateEnvelope: () =>
|
|
17154
|
-
validateManifest: () =>
|
|
17155
|
-
verifyDecryptResponse: () =>
|
|
17154
|
+
validateEnvelope: () => import_sdk_core15.validateEnvelope,
|
|
17155
|
+
validateManifest: () => import_sdk_core10.validateManifest,
|
|
17156
|
+
verifyDecryptResponse: () => import_sdk_core15.verifyDecryptResponse
|
|
17156
17157
|
});
|
|
17157
17158
|
module.exports = __toCommonJS(index_exports);
|
|
17158
17159
|
|
|
@@ -17257,7 +17258,7 @@ var PrivateKeySigner = class {
|
|
|
17257
17258
|
};
|
|
17258
17259
|
|
|
17259
17260
|
// src/TinyCloudNode.ts
|
|
17260
|
-
var
|
|
17261
|
+
var import_sdk_core6 = require("@tinycloud/sdk-core");
|
|
17261
17262
|
|
|
17262
17263
|
// src/authorization/NodeUserAuthorization.ts
|
|
17263
17264
|
var import_sdk_core = require("@tinycloud/sdk-core");
|
|
@@ -18155,30 +18156,33 @@ var NodeUserAuthorization = class {
|
|
|
18155
18156
|
}
|
|
18156
18157
|
};
|
|
18157
18158
|
|
|
18158
|
-
// src/
|
|
18159
|
+
// src/account/AccountService.ts
|
|
18159
18160
|
var import_sdk_core2 = require("@tinycloud/sdk-core");
|
|
18161
|
+
|
|
18162
|
+
// src/DelegatedAccess.ts
|
|
18163
|
+
var import_sdk_core3 = require("@tinycloud/sdk-core");
|
|
18160
18164
|
var DelegatedAccess = class {
|
|
18161
18165
|
constructor(session, delegation, host, invoke2, telemetry) {
|
|
18162
18166
|
this.session = session;
|
|
18163
18167
|
this._delegation = delegation;
|
|
18164
18168
|
this.host = host;
|
|
18165
|
-
this._serviceContext = new
|
|
18169
|
+
this._serviceContext = new import_sdk_core3.ServiceContext({
|
|
18166
18170
|
invoke: invoke2,
|
|
18167
18171
|
fetch: globalThis.fetch.bind(globalThis),
|
|
18168
18172
|
hosts: [host],
|
|
18169
18173
|
telemetry
|
|
18170
18174
|
});
|
|
18171
18175
|
const prefix = this._delegation.path.replace(/\/$/, "");
|
|
18172
|
-
this._kv = new
|
|
18176
|
+
this._kv = new import_sdk_core3.KVService({ prefix });
|
|
18173
18177
|
this._kv.initialize(this._serviceContext);
|
|
18174
18178
|
this._serviceContext.registerService("kv", this._kv);
|
|
18175
|
-
this._sql = new
|
|
18179
|
+
this._sql = new import_sdk_core3.SQLService({});
|
|
18176
18180
|
this._sql.initialize(this._serviceContext);
|
|
18177
18181
|
this._serviceContext.registerService("sql", this._sql);
|
|
18178
|
-
this._duckdb = new
|
|
18182
|
+
this._duckdb = new import_sdk_core3.DuckDbService({});
|
|
18179
18183
|
this._duckdb.initialize(this._serviceContext);
|
|
18180
18184
|
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
18181
|
-
this._hooks = new
|
|
18185
|
+
this._hooks = new import_sdk_core3.HooksService({});
|
|
18182
18186
|
this._hooks.initialize(this._serviceContext);
|
|
18183
18187
|
this._serviceContext.registerService("hooks", this._hooks);
|
|
18184
18188
|
const serviceSession = {
|
|
@@ -18328,7 +18332,7 @@ function createWasmKeyProvider(sessionManager) {
|
|
|
18328
18332
|
}
|
|
18329
18333
|
|
|
18330
18334
|
// src/delegateToHelpers.ts
|
|
18331
|
-
var
|
|
18335
|
+
var import_sdk_core4 = require("@tinycloud/sdk-core");
|
|
18332
18336
|
function legacyParamsToPermissionEntries(actions, path, spaceIdOverride) {
|
|
18333
18337
|
const byService = /* @__PURE__ */ new Map();
|
|
18334
18338
|
for (const a of actions) {
|
|
@@ -18359,7 +18363,7 @@ function legacyParamsToPermissionEntries(actions, path, spaceIdOverride) {
|
|
|
18359
18363
|
}
|
|
18360
18364
|
return entries;
|
|
18361
18365
|
}
|
|
18362
|
-
var DEFAULT_DELEGATION_EXPIRY_MS =
|
|
18366
|
+
var DEFAULT_DELEGATION_EXPIRY_MS = import_sdk_core4.EXPIRY.SESSION_MS;
|
|
18363
18367
|
function resolveExpiryMs(expiry) {
|
|
18364
18368
|
if (expiry === void 0) {
|
|
18365
18369
|
return DEFAULT_DELEGATION_EXPIRY_MS;
|
|
@@ -18372,10 +18376,10 @@ function resolveExpiryMs(expiry) {
|
|
|
18372
18376
|
}
|
|
18373
18377
|
return expiry;
|
|
18374
18378
|
}
|
|
18375
|
-
return (0,
|
|
18379
|
+
return (0, import_sdk_core4.parseExpiry)(expiry);
|
|
18376
18380
|
}
|
|
18377
18381
|
function extractSiweExpiration(siwe) {
|
|
18378
|
-
const parsed = new
|
|
18382
|
+
const parsed = new import_sdk_core4.SiweMessage(siwe);
|
|
18379
18383
|
if (parsed.expirationTime === void 0 || parsed.expirationTime === null) {
|
|
18380
18384
|
return void 0;
|
|
18381
18385
|
}
|
|
@@ -18389,7 +18393,7 @@ function extractSiweExpiration(siwe) {
|
|
|
18389
18393
|
}
|
|
18390
18394
|
|
|
18391
18395
|
// src/NodeSecretsService.ts
|
|
18392
|
-
var
|
|
18396
|
+
var import_sdk_core5 = require("@tinycloud/sdk-core");
|
|
18393
18397
|
var SECRETS_SPACE = "secrets";
|
|
18394
18398
|
function ok() {
|
|
18395
18399
|
return { ok: true, data: void 0 };
|
|
@@ -18422,7 +18426,7 @@ function secretActionName(action) {
|
|
|
18422
18426
|
}
|
|
18423
18427
|
function secretPermissionEntries(name, options, action, encryptionNetworkId) {
|
|
18424
18428
|
const entries = [];
|
|
18425
|
-
const path = action === "list" ? (0,
|
|
18429
|
+
const path = action === "list" ? (0, import_sdk_core5.resolveSecretListPrefix)(options) : (0, import_sdk_core5.resolveSecretPath)(name, options).permissionPaths.vault;
|
|
18426
18430
|
entries.push({
|
|
18427
18431
|
service: "tinycloud.kv",
|
|
18428
18432
|
space: SECRETS_SPACE,
|
|
@@ -18501,7 +18505,7 @@ var NodeSecretsService = class {
|
|
|
18501
18505
|
);
|
|
18502
18506
|
} catch (error) {
|
|
18503
18507
|
return secretsError(
|
|
18504
|
-
|
|
18508
|
+
import_sdk_core5.ErrorCodes.INVALID_INPUT,
|
|
18505
18509
|
error instanceof Error ? error.message : String(error),
|
|
18506
18510
|
error instanceof Error ? error : void 0
|
|
18507
18511
|
);
|
|
@@ -18511,7 +18515,7 @@ var NodeSecretsService = class {
|
|
|
18511
18515
|
}
|
|
18512
18516
|
if (!this.config.canEscalate()) {
|
|
18513
18517
|
return secretsError(
|
|
18514
|
-
|
|
18518
|
+
import_sdk_core5.ErrorCodes.PERMISSION_DENIED,
|
|
18515
18519
|
`Cannot autosign ${displayActionUrn(action)} for ${target}; TinyCloudNode needs wallet mode with a signer or privateKey.`
|
|
18516
18520
|
);
|
|
18517
18521
|
}
|
|
@@ -18520,7 +18524,7 @@ var NodeSecretsService = class {
|
|
|
18520
18524
|
return this.restoreUnlockAfterEscalation();
|
|
18521
18525
|
} catch (error) {
|
|
18522
18526
|
return secretsError(
|
|
18523
|
-
|
|
18527
|
+
import_sdk_core5.ErrorCodes.PERMISSION_DENIED,
|
|
18524
18528
|
error instanceof Error ? error.message : `Autosign escalation for ${displayActionUrn(action)} on ${target} failed.`,
|
|
18525
18529
|
error instanceof Error ? error : void 0
|
|
18526
18530
|
);
|
|
@@ -18541,10 +18545,10 @@ var NodeSecretsService = class {
|
|
|
18541
18545
|
return false;
|
|
18542
18546
|
}
|
|
18543
18547
|
const manifests = Array.isArray(manifest) ? manifest : [manifest];
|
|
18544
|
-
const requestedEntries = (0,
|
|
18548
|
+
const requestedEntries = (0, import_sdk_core5.expandPermissionEntries)(permissionEntries);
|
|
18545
18549
|
return requestedEntries.every(
|
|
18546
18550
|
(entry) => manifests.some((candidate) => {
|
|
18547
|
-
const resolved = (0,
|
|
18551
|
+
const resolved = (0, import_sdk_core5.resolveManifest)(candidate);
|
|
18548
18552
|
return resolved.resources.some(
|
|
18549
18553
|
(resource) => resource.service === entry.service && resource.space === entry.space && resource.path === entry.path && entry.actions.every((action) => resource.actions.includes(action))
|
|
18550
18554
|
);
|
|
@@ -18559,10 +18563,10 @@ var DEFAULT_ENCRYPTION_NETWORK_NAME = "default";
|
|
|
18559
18563
|
var NETWORK_CREATE_ACTION2 = "tinycloud.encryption/network.create";
|
|
18560
18564
|
var DECRYPT_ACTION2 = "tinycloud.encryption/decrypt";
|
|
18561
18565
|
var NETWORK_ADMIN_TYPE = "tinycloud.encryption.network-admin/v1";
|
|
18562
|
-
var DEFAULT_SESSION_EXPIRATION_MS =
|
|
18566
|
+
var DEFAULT_SESSION_EXPIRATION_MS = import_sdk_core6.EXPIRY.SESSION_MS;
|
|
18563
18567
|
function didPrincipalMatches2(actual, expected) {
|
|
18564
18568
|
try {
|
|
18565
|
-
return (0,
|
|
18569
|
+
return (0, import_sdk_core6.principalDidEquals)(actual, expected);
|
|
18566
18570
|
} catch {
|
|
18567
18571
|
return actual === expected;
|
|
18568
18572
|
}
|
|
@@ -18728,12 +18732,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18728
18732
|
throw new Error("Failed to get session key JWK");
|
|
18729
18733
|
}
|
|
18730
18734
|
this.sessionKeyJwk = JSON.parse(jwkStr);
|
|
18731
|
-
this._capabilityRegistry = new
|
|
18735
|
+
this._capabilityRegistry = new import_sdk_core6.CapabilityKeyRegistry();
|
|
18732
18736
|
this._keyProvider = new WasmKeyProvider({
|
|
18733
18737
|
sessionManager: this.sessionManager
|
|
18734
18738
|
});
|
|
18735
|
-
this.notificationHandler = config.notificationHandler ?? new
|
|
18736
|
-
this._sharingService = new
|
|
18739
|
+
this.notificationHandler = config.notificationHandler ?? new import_sdk_core6.SilentNotificationHandler();
|
|
18740
|
+
this._sharingService = new import_sdk_core6.SharingService({
|
|
18737
18741
|
hosts: [this.config.host],
|
|
18738
18742
|
// session: undefined - not needed for receive()
|
|
18739
18743
|
invoke: this.invokeWithRuntimePermissions,
|
|
@@ -18743,8 +18747,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18743
18747
|
// delegationManager: undefined - not needed for receive()
|
|
18744
18748
|
createKVService: (config2) => {
|
|
18745
18749
|
const prefix = config2.pathPrefix?.replace(/\/$/, "");
|
|
18746
|
-
const kvService = new
|
|
18747
|
-
const kvContext = new
|
|
18750
|
+
const kvService = new import_sdk_core6.KVService({ prefix });
|
|
18751
|
+
const kvContext = new import_sdk_core6.ServiceContext({
|
|
18748
18752
|
invoke: config2.invoke,
|
|
18749
18753
|
fetch: config2.fetch ?? globalThis.fetch.bind(globalThis),
|
|
18750
18754
|
hosts: config2.hosts,
|
|
@@ -18804,7 +18808,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18804
18808
|
capabilityRequest: config.capabilityRequest,
|
|
18805
18809
|
includeAccountRegistryPermissions: config.includeAccountRegistryPermissions
|
|
18806
18810
|
});
|
|
18807
|
-
this.tc = new
|
|
18811
|
+
this.tc = new import_sdk_core6.TinyCloud(this.auth, {
|
|
18808
18812
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
18809
18813
|
telemetry: config.telemetry
|
|
18810
18814
|
});
|
|
@@ -18865,7 +18869,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18865
18869
|
*/
|
|
18866
18870
|
get did() {
|
|
18867
18871
|
if (this._address) {
|
|
18868
|
-
return (0,
|
|
18872
|
+
return (0, import_sdk_core6.pkhDid)(this._address, this._chainId);
|
|
18869
18873
|
}
|
|
18870
18874
|
return this.sessionManager.getDID(this.sessionKeyId);
|
|
18871
18875
|
}
|
|
@@ -18899,6 +18903,37 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18899
18903
|
get spaceId() {
|
|
18900
18904
|
return this.auth?.tinyCloudSession?.spaceId;
|
|
18901
18905
|
}
|
|
18906
|
+
/**
|
|
18907
|
+
* Get the account space ID for this wallet identity.
|
|
18908
|
+
* Available after wallet-backed sign-in or a restored session with address metadata.
|
|
18909
|
+
*/
|
|
18910
|
+
get accountSpaceId() {
|
|
18911
|
+
if (!this._address) {
|
|
18912
|
+
return void 0;
|
|
18913
|
+
}
|
|
18914
|
+
return this.wasmBindings.makeSpaceId(this._address, this._chainId, import_sdk_core6.ACCOUNT_REGISTRY_SPACE);
|
|
18915
|
+
}
|
|
18916
|
+
/**
|
|
18917
|
+
* Account-level application and delegation helpers.
|
|
18918
|
+
*/
|
|
18919
|
+
get account() {
|
|
18920
|
+
if (!this._account) {
|
|
18921
|
+
this._account = new import_sdk_core2.AccountService({
|
|
18922
|
+
getDid: () => this.did,
|
|
18923
|
+
getHost: () => this.hosts[0] ?? this.config.host,
|
|
18924
|
+
getPrimarySpaceId: () => this.spaceId,
|
|
18925
|
+
getAccountSpaceId: () => this.accountSpaceId,
|
|
18926
|
+
getSpaces: () => this.spaces,
|
|
18927
|
+
getAccountDb: () => this.accountSpaceId ? this.sqlForSpace(this.accountSpaceId).db("account") : void 0,
|
|
18928
|
+
ensureAccountSpaceHosted: async () => {
|
|
18929
|
+
if (this.accountSpaceId && this.auth) {
|
|
18930
|
+
await this.ensureOwnedSpaceHosted(this.accountSpaceId);
|
|
18931
|
+
}
|
|
18932
|
+
}
|
|
18933
|
+
});
|
|
18934
|
+
}
|
|
18935
|
+
return this._account;
|
|
18936
|
+
}
|
|
18902
18937
|
/**
|
|
18903
18938
|
* Get the current TinyCloud session.
|
|
18904
18939
|
* Available after signIn().
|
|
@@ -18920,7 +18955,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18920
18955
|
);
|
|
18921
18956
|
}
|
|
18922
18957
|
await this.wasmBindings.ensureInitialized?.();
|
|
18923
|
-
this._address = (0,
|
|
18958
|
+
this._address = (0, import_sdk_core6.canonicalizeAddress)(await this.signer.getAddress());
|
|
18924
18959
|
this._chainId = await this.signer.getChainId();
|
|
18925
18960
|
this._kv = void 0;
|
|
18926
18961
|
this._sql = void 0;
|
|
@@ -18957,7 +18992,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18957
18992
|
if (!this.auth || !this.signer) {
|
|
18958
18993
|
throw new Error("Manifest registry write requires wallet mode");
|
|
18959
18994
|
}
|
|
18960
|
-
const accountSpaceId = this.ownedSpaceId(
|
|
18995
|
+
const accountSpaceId = this.ownedSpaceId(import_sdk_core6.ACCOUNT_REGISTRY_SPACE);
|
|
18961
18996
|
await this.ensureOwnedSpaceHosted(accountSpaceId);
|
|
18962
18997
|
const accountKV = this.spaces.get(accountSpaceId).kv;
|
|
18963
18998
|
for (const record of request.registryRecords) {
|
|
@@ -18980,7 +19015,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18980
19015
|
}
|
|
18981
19016
|
const networkIds = /* @__PURE__ */ new Set();
|
|
18982
19017
|
for (const resource of request.resources) {
|
|
18983
|
-
if (resource.service ===
|
|
19018
|
+
if (resource.service === import_sdk_core6.ENCRYPTION_PERMISSION_SERVICE && resource.path.startsWith("urn:tinycloud:encryption:") && resource.actions.includes(DECRYPT_ACTION2)) {
|
|
18984
19019
|
networkIds.add(resource.path);
|
|
18985
19020
|
}
|
|
18986
19021
|
}
|
|
@@ -18991,7 +19026,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18991
19026
|
return;
|
|
18992
19027
|
}
|
|
18993
19028
|
for (const networkId of this.requestedEncryptionNetworkIds()) {
|
|
18994
|
-
const parsed = (0,
|
|
19029
|
+
const parsed = (0, import_sdk_core6.parseNetworkId)(networkId);
|
|
18995
19030
|
if (!didPrincipalMatches2(parsed.ownerDid, this.did)) {
|
|
18996
19031
|
continue;
|
|
18997
19032
|
}
|
|
@@ -19010,7 +19045,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19010
19045
|
if (!host) {
|
|
19011
19046
|
throw new Error("Owned space hosting requires a TinyCloud host");
|
|
19012
19047
|
}
|
|
19013
|
-
const activation = await (0,
|
|
19048
|
+
const activation = await (0, import_sdk_core6.activateSessionWithHost)(host, session.delegationHeader);
|
|
19014
19049
|
if (activation.success && !activation.skipped?.includes(spaceId)) {
|
|
19015
19050
|
return;
|
|
19016
19051
|
}
|
|
@@ -19024,7 +19059,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19024
19059
|
throw new Error(`Failed to create owned space: ${spaceId}`);
|
|
19025
19060
|
}
|
|
19026
19061
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
19027
|
-
const retry = await (0,
|
|
19062
|
+
const retry = await (0, import_sdk_core6.activateSessionWithHost)(host, session.delegationHeader);
|
|
19028
19063
|
if (!retry.success || retry.skipped?.includes(spaceId)) {
|
|
19029
19064
|
throw new Error(
|
|
19030
19065
|
`Failed to activate session after creating owned space ${spaceId}: ${retry.error ?? "space was skipped"}`
|
|
@@ -19066,7 +19101,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19066
19101
|
if (!hosted) {
|
|
19067
19102
|
throw new Error(`Failed to host owned space: ${spaceId}`);
|
|
19068
19103
|
}
|
|
19069
|
-
const activation = await (0,
|
|
19104
|
+
const activation = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
19070
19105
|
host,
|
|
19071
19106
|
this.auth.tinyCloudSession.delegationHeader
|
|
19072
19107
|
);
|
|
@@ -19099,30 +19134,30 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19099
19134
|
this._spaceService = void 0;
|
|
19100
19135
|
this._serviceContext = void 0;
|
|
19101
19136
|
this.runtimePermissionGrants = [];
|
|
19102
|
-
const restoredAddress = sessionData.address ? (0,
|
|
19137
|
+
const restoredAddress = sessionData.address ? (0, import_sdk_core6.canonicalizeAddress)(sessionData.address) : void 0;
|
|
19103
19138
|
if (restoredAddress) {
|
|
19104
19139
|
this._address = restoredAddress;
|
|
19105
19140
|
}
|
|
19106
19141
|
if (sessionData.chainId) {
|
|
19107
19142
|
this._chainId = sessionData.chainId;
|
|
19108
19143
|
}
|
|
19109
|
-
this._serviceContext = new
|
|
19144
|
+
this._serviceContext = new import_sdk_core6.ServiceContext({
|
|
19110
19145
|
invoke: this.invokeWithRuntimePermissions,
|
|
19111
19146
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19112
19147
|
fetch: globalThis.fetch.bind(globalThis),
|
|
19113
19148
|
hosts: [this.config.host],
|
|
19114
19149
|
telemetry: this.config.telemetry
|
|
19115
19150
|
});
|
|
19116
|
-
this._kv = new
|
|
19151
|
+
this._kv = new import_sdk_core6.KVService({});
|
|
19117
19152
|
this._kv.initialize(this._serviceContext);
|
|
19118
19153
|
this._serviceContext.registerService("kv", this._kv);
|
|
19119
|
-
this._sql = new
|
|
19154
|
+
this._sql = new import_sdk_core6.SQLService({});
|
|
19120
19155
|
this._sql.initialize(this._serviceContext);
|
|
19121
19156
|
this._serviceContext.registerService("sql", this._sql);
|
|
19122
|
-
this._duckdb = new
|
|
19157
|
+
this._duckdb = new import_sdk_core6.DuckDbService({});
|
|
19123
19158
|
this._duckdb.initialize(this._serviceContext);
|
|
19124
19159
|
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
19125
|
-
this._hooks = new
|
|
19160
|
+
this._hooks = new import_sdk_core6.HooksService({});
|
|
19126
19161
|
this._hooks.initialize(this._serviceContext);
|
|
19127
19162
|
this._serviceContext.registerService("hooks", this._hooks);
|
|
19128
19163
|
const serviceSession = {
|
|
@@ -19221,7 +19256,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19221
19256
|
capabilityRequest: this.config.capabilityRequest,
|
|
19222
19257
|
includeAccountRegistryPermissions: this.config.includeAccountRegistryPermissions
|
|
19223
19258
|
});
|
|
19224
|
-
this.tc = new
|
|
19259
|
+
this.tc = new import_sdk_core6.TinyCloud(this.auth, {
|
|
19225
19260
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19226
19261
|
telemetry: this.config.telemetry
|
|
19227
19262
|
});
|
|
@@ -19266,7 +19301,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19266
19301
|
capabilityRequest: this.config.capabilityRequest,
|
|
19267
19302
|
includeAccountRegistryPermissions: this.config.includeAccountRegistryPermissions
|
|
19268
19303
|
});
|
|
19269
|
-
this.tc = new
|
|
19304
|
+
this.tc = new import_sdk_core6.TinyCloud(this.auth, {
|
|
19270
19305
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19271
19306
|
telemetry: this.config.telemetry
|
|
19272
19307
|
});
|
|
@@ -19282,28 +19317,28 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19282
19317
|
return;
|
|
19283
19318
|
}
|
|
19284
19319
|
this.tc.initializeServices(this.invokeWithRuntimePermissions, [this.config.host]);
|
|
19285
|
-
this._serviceContext = new
|
|
19320
|
+
this._serviceContext = new import_sdk_core6.ServiceContext({
|
|
19286
19321
|
invoke: this.invokeWithRuntimePermissions,
|
|
19287
19322
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19288
19323
|
fetch: globalThis.fetch.bind(globalThis),
|
|
19289
19324
|
hosts: [this.config.host],
|
|
19290
19325
|
telemetry: this.config.telemetry
|
|
19291
19326
|
});
|
|
19292
|
-
this._kv = new
|
|
19327
|
+
this._kv = new import_sdk_core6.KVService({});
|
|
19293
19328
|
this._kv.initialize(this._serviceContext);
|
|
19294
19329
|
this._serviceContext.registerService("kv", this._kv);
|
|
19295
19330
|
const features = this.nodeFeatures;
|
|
19296
19331
|
if (features.length === 0 || features.includes("sql")) {
|
|
19297
|
-
this._sql = new
|
|
19332
|
+
this._sql = new import_sdk_core6.SQLService({});
|
|
19298
19333
|
this._sql.initialize(this._serviceContext);
|
|
19299
19334
|
this._serviceContext.registerService("sql", this._sql);
|
|
19300
19335
|
}
|
|
19301
19336
|
if (features.length === 0 || features.includes("duckdb")) {
|
|
19302
|
-
this._duckdb = new
|
|
19337
|
+
this._duckdb = new import_sdk_core6.DuckDbService({});
|
|
19303
19338
|
this._duckdb.initialize(this._serviceContext);
|
|
19304
19339
|
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
19305
19340
|
}
|
|
19306
|
-
this._hooks = new
|
|
19341
|
+
this._hooks = new import_sdk_core6.HooksService({});
|
|
19307
19342
|
this._hooks.initialize(this._serviceContext);
|
|
19308
19343
|
this._serviceContext.registerService("hooks", this._hooks);
|
|
19309
19344
|
const serviceSession = {
|
|
@@ -19321,9 +19356,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19321
19356
|
this.initializeV2Services(serviceSession);
|
|
19322
19357
|
}
|
|
19323
19358
|
createSpaceScopedKVService(spaceId) {
|
|
19324
|
-
const kvService = new
|
|
19359
|
+
const kvService = new import_sdk_core6.KVService({});
|
|
19325
19360
|
if (this._serviceContext) {
|
|
19326
|
-
const spaceScopedContext = new
|
|
19361
|
+
const spaceScopedContext = new import_sdk_core6.ServiceContext({
|
|
19327
19362
|
invoke: this._serviceContext.invoke,
|
|
19328
19363
|
fetch: this._serviceContext.fetch,
|
|
19329
19364
|
hosts: this._serviceContext.hosts,
|
|
@@ -19388,7 +19423,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19388
19423
|
const shared = wasm.vault_x25519_dh(receiverPrivateKey, peerPublic);
|
|
19389
19424
|
return columnDecrypt(shared, ciphertext);
|
|
19390
19425
|
},
|
|
19391
|
-
verifyNodeSignature: (nodeId, message, signature2) => (0,
|
|
19426
|
+
verifyNodeSignature: (nodeId, message, signature2) => (0, import_sdk_core6.verifyDidKeyEd25519Signature)(nodeId, message, signature2)
|
|
19392
19427
|
};
|
|
19393
19428
|
}
|
|
19394
19429
|
async fetchNodeId() {
|
|
@@ -19459,7 +19494,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19459
19494
|
return await response.json();
|
|
19460
19495
|
}
|
|
19461
19496
|
};
|
|
19462
|
-
return new
|
|
19497
|
+
return new import_sdk_core6.EncryptionService({
|
|
19463
19498
|
crypto: crypto2,
|
|
19464
19499
|
signer: {
|
|
19465
19500
|
signDecryptInvocation: async (input) => {
|
|
@@ -19471,7 +19506,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19471
19506
|
});
|
|
19472
19507
|
return {
|
|
19473
19508
|
...signed2,
|
|
19474
|
-
canonicalBody: (0,
|
|
19509
|
+
canonicalBody: (0, import_sdk_core6.canonicalizeEncryptionJson)(
|
|
19475
19510
|
input.body
|
|
19476
19511
|
)
|
|
19477
19512
|
};
|
|
@@ -19489,8 +19524,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19489
19524
|
if (!this.config.host) {
|
|
19490
19525
|
return null;
|
|
19491
19526
|
}
|
|
19492
|
-
const publicSpaceId = (0,
|
|
19493
|
-
const result = await
|
|
19527
|
+
const publicSpaceId = (0, import_sdk_core6.makePublicSpaceId)(this._address, this._chainId);
|
|
19528
|
+
const result = await import_sdk_core6.TinyCloud.readPublicSpace(this.config.host, publicSpaceId, discoveryKey);
|
|
19494
19529
|
if (!result.ok) {
|
|
19495
19530
|
return null;
|
|
19496
19531
|
}
|
|
@@ -19513,7 +19548,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19513
19548
|
}
|
|
19514
19549
|
createVaultService(spaceId, kv) {
|
|
19515
19550
|
const wasm = this.wasmBindings;
|
|
19516
|
-
const vaultCrypto = (0,
|
|
19551
|
+
const vaultCrypto = (0, import_sdk_core6.createVaultCrypto)({
|
|
19517
19552
|
vault_encrypt: wasm.vault_encrypt,
|
|
19518
19553
|
vault_decrypt: wasm.vault_decrypt,
|
|
19519
19554
|
vault_derive_key: wasm.vault_derive_key,
|
|
@@ -19523,7 +19558,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19523
19558
|
vault_sha256: wasm.vault_sha256
|
|
19524
19559
|
});
|
|
19525
19560
|
const self2 = this;
|
|
19526
|
-
return new
|
|
19561
|
+
return new import_sdk_core6.DataVaultService({
|
|
19527
19562
|
spaceId,
|
|
19528
19563
|
crypto: vaultCrypto,
|
|
19529
19564
|
encryption: {
|
|
@@ -19546,8 +19581,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19546
19581
|
get publicKV() {
|
|
19547
19582
|
return self2._publicKV ?? self2.tc.publicKV;
|
|
19548
19583
|
},
|
|
19549
|
-
readPublicSpace: (host, targetSpaceId, key2) =>
|
|
19550
|
-
makePublicSpaceId:
|
|
19584
|
+
readPublicSpace: (host, targetSpaceId, key2) => import_sdk_core6.TinyCloud.readPublicSpace(host, targetSpaceId, key2),
|
|
19585
|
+
makePublicSpaceId: import_sdk_core6.TinyCloud.makePublicSpaceId,
|
|
19551
19586
|
did: this.did,
|
|
19552
19587
|
address: this._address ?? "",
|
|
19553
19588
|
chainId: this._chainId,
|
|
@@ -19560,7 +19595,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19560
19595
|
* @internal
|
|
19561
19596
|
*/
|
|
19562
19597
|
initializeV2Services(serviceSession) {
|
|
19563
|
-
this._capabilityRegistry = new
|
|
19598
|
+
this._capabilityRegistry = new import_sdk_core6.CapabilityKeyRegistry();
|
|
19564
19599
|
const tcSession = this.auth?.tinyCloudSession;
|
|
19565
19600
|
if (tcSession && this._address) {
|
|
19566
19601
|
const sessionKey = {
|
|
@@ -19634,13 +19669,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19634
19669
|
}
|
|
19635
19670
|
this._capabilityRegistry.registerKey(sessionKey, delegations);
|
|
19636
19671
|
}
|
|
19637
|
-
this._delegationManager = new
|
|
19672
|
+
this._delegationManager = new import_sdk_core6.DelegationManager({
|
|
19638
19673
|
hosts: [this.config.host],
|
|
19639
19674
|
session: serviceSession,
|
|
19640
19675
|
invoke: this.invokeWithRuntimePermissions,
|
|
19641
19676
|
fetch: globalThis.fetch.bind(globalThis)
|
|
19642
19677
|
});
|
|
19643
|
-
this._spaceService = new
|
|
19678
|
+
this._spaceService = new import_sdk_core6.SpaceService({
|
|
19644
19679
|
hosts: [this.config.host],
|
|
19645
19680
|
session: serviceSession,
|
|
19646
19681
|
invoke: this.wasmBindings.invoke,
|
|
@@ -19797,7 +19832,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19797
19832
|
...prepared,
|
|
19798
19833
|
signature: signature2
|
|
19799
19834
|
});
|
|
19800
|
-
const activateResult = await (0,
|
|
19835
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
19801
19836
|
host,
|
|
19802
19837
|
delegationSession.delegationHeader
|
|
19803
19838
|
);
|
|
@@ -19807,7 +19842,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19807
19842
|
return {
|
|
19808
19843
|
cid: delegationSession.delegationCid,
|
|
19809
19844
|
delegateDID: params.shareKeyDID,
|
|
19810
|
-
delegatorDID: (0,
|
|
19845
|
+
delegatorDID: (0, import_sdk_core6.pkhDid)(session.address, session.chainId),
|
|
19811
19846
|
spaceId: params.spaceId,
|
|
19812
19847
|
path: params.path,
|
|
19813
19848
|
actions: params.actions,
|
|
@@ -19864,7 +19899,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19864
19899
|
if (!this._sql) {
|
|
19865
19900
|
const features = this.nodeFeatures;
|
|
19866
19901
|
if (features.length > 0 && !features.includes("sql")) {
|
|
19867
|
-
throw new
|
|
19902
|
+
throw new import_sdk_core6.UnsupportedFeatureError("sql", this.config.host, features);
|
|
19868
19903
|
}
|
|
19869
19904
|
throw new Error("Not signed in. Call signIn() first.");
|
|
19870
19905
|
}
|
|
@@ -19888,8 +19923,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19888
19923
|
if (!this._serviceContext || !this._serviceContext.session) {
|
|
19889
19924
|
throw new Error("Not signed in. Call signIn() first.");
|
|
19890
19925
|
}
|
|
19891
|
-
const sql = new
|
|
19892
|
-
const spaceScopedContext = new
|
|
19926
|
+
const sql = new import_sdk_core6.SQLService({});
|
|
19927
|
+
const spaceScopedContext = new import_sdk_core6.ServiceContext({
|
|
19893
19928
|
invoke: this._serviceContext.invoke,
|
|
19894
19929
|
fetch: this._serviceContext.fetch,
|
|
19895
19930
|
hosts: this._serviceContext.hosts,
|
|
@@ -19917,8 +19952,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19917
19952
|
if (!this._serviceContext || !this._serviceContext.session) {
|
|
19918
19953
|
throw new Error("Not signed in. Call signIn() first.");
|
|
19919
19954
|
}
|
|
19920
|
-
const kv = new
|
|
19921
|
-
const spaceScopedContext = new
|
|
19955
|
+
const kv = new import_sdk_core6.KVService({});
|
|
19956
|
+
const spaceScopedContext = new import_sdk_core6.ServiceContext({
|
|
19922
19957
|
invoke: this._serviceContext.invoke,
|
|
19923
19958
|
fetch: this._serviceContext.fetch,
|
|
19924
19959
|
hosts: this._serviceContext.hosts
|
|
@@ -19934,7 +19969,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19934
19969
|
if (!this._duckdb) {
|
|
19935
19970
|
const features = this.nodeFeatures;
|
|
19936
19971
|
if (features.length > 0 && !features.includes("duckdb")) {
|
|
19937
|
-
throw new
|
|
19972
|
+
throw new import_sdk_core6.UnsupportedFeatureError("duckdb", this.config.host, features);
|
|
19938
19973
|
}
|
|
19939
19974
|
throw new Error("Not signed in. Call signIn() first.");
|
|
19940
19975
|
}
|
|
@@ -19986,7 +20021,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19986
20021
|
type: NETWORK_ADMIN_TYPE,
|
|
19987
20022
|
targetNode,
|
|
19988
20023
|
networkId,
|
|
19989
|
-
bodyHash: (0,
|
|
20024
|
+
bodyHash: (0, import_sdk_core6.canonicalHashHex)(
|
|
19990
20025
|
crypto2.sha256,
|
|
19991
20026
|
body
|
|
19992
20027
|
),
|
|
@@ -20004,7 +20039,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20004
20039
|
Authorization: signed2.authorization,
|
|
20005
20040
|
"Content-Type": "application/json"
|
|
20006
20041
|
},
|
|
20007
|
-
body: (0,
|
|
20042
|
+
body: (0, import_sdk_core6.canonicalizeEncryptionJson)(
|
|
20008
20043
|
body
|
|
20009
20044
|
)
|
|
20010
20045
|
});
|
|
@@ -20022,7 +20057,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20022
20057
|
if (existing) {
|
|
20023
20058
|
return existing;
|
|
20024
20059
|
}
|
|
20025
|
-
const parsed = (0,
|
|
20060
|
+
const parsed = (0, import_sdk_core6.parseNetworkId)(networkId);
|
|
20026
20061
|
if (!didPrincipalMatches2(parsed.ownerDid, this.did)) {
|
|
20027
20062
|
throw new Error(
|
|
20028
20063
|
`Cannot create encryption network ${networkId}: owner ${parsed.ownerDid} does not match signed-in DID ${this.did}`
|
|
@@ -20055,7 +20090,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20055
20090
|
throw new Error("Not signed in. Call signIn() first.");
|
|
20056
20091
|
}
|
|
20057
20092
|
if (!this._baseSecrets) {
|
|
20058
|
-
this._baseSecrets = new
|
|
20093
|
+
this._baseSecrets = new import_sdk_core6.SecretsService(() => this.space("secrets").vault);
|
|
20059
20094
|
}
|
|
20060
20095
|
return this._baseSecrets;
|
|
20061
20096
|
}
|
|
@@ -20170,10 +20205,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20170
20205
|
async useRuntimeDelegation(delegation) {
|
|
20171
20206
|
const session = this.currentTinyCloudSession();
|
|
20172
20207
|
if (!session) {
|
|
20173
|
-
throw new
|
|
20208
|
+
throw new import_sdk_core6.SessionExpiredError(/* @__PURE__ */ new Date(0));
|
|
20174
20209
|
}
|
|
20175
20210
|
if (delegation.expiry.getTime() <= Date.now()) {
|
|
20176
|
-
throw new
|
|
20211
|
+
throw new import_sdk_core6.SessionExpiredError(delegation.expiry);
|
|
20177
20212
|
}
|
|
20178
20213
|
const expectedDids = [session.verificationMethod, this.sessionDid];
|
|
20179
20214
|
if (!expectedDids.some((did) => didPrincipalMatches2(delegation.delegateDID, did))) {
|
|
@@ -20182,7 +20217,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20182
20217
|
);
|
|
20183
20218
|
}
|
|
20184
20219
|
const targetHost = delegation.host ?? this.config.host;
|
|
20185
|
-
const activateResult = await (0,
|
|
20220
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20186
20221
|
targetHost,
|
|
20187
20222
|
delegation.delegationHeader
|
|
20188
20223
|
);
|
|
@@ -20209,13 +20244,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20209
20244
|
}
|
|
20210
20245
|
const session = this.currentTinyCloudSession();
|
|
20211
20246
|
if (!session) {
|
|
20212
|
-
throw new
|
|
20247
|
+
throw new import_sdk_core6.SessionExpiredError(/* @__PURE__ */ new Date(0));
|
|
20213
20248
|
}
|
|
20214
20249
|
const sessionExpiry = extractSiweExpiration(session.siwe);
|
|
20215
20250
|
if (sessionExpiry !== void 0) {
|
|
20216
20251
|
const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
|
|
20217
20252
|
if (sessionExpiry.getTime() <= Date.now() + marginMs) {
|
|
20218
|
-
throw new
|
|
20253
|
+
throw new import_sdk_core6.SessionExpiredError(sessionExpiry);
|
|
20219
20254
|
}
|
|
20220
20255
|
}
|
|
20221
20256
|
const expanded = this.expandPermissionEntries(permissions);
|
|
@@ -20278,7 +20313,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20278
20313
|
...prepared,
|
|
20279
20314
|
signature: signature2
|
|
20280
20315
|
});
|
|
20281
|
-
const activateResult = await (0,
|
|
20316
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20282
20317
|
this.config.host,
|
|
20283
20318
|
delegatedSession.delegationHeader
|
|
20284
20319
|
);
|
|
@@ -20451,7 +20486,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20451
20486
|
];
|
|
20452
20487
|
const abilities = { kv: { "": kvActions } };
|
|
20453
20488
|
const now = /* @__PURE__ */ new Date();
|
|
20454
|
-
const expiryMs =
|
|
20489
|
+
const expiryMs = import_sdk_core6.EXPIRY.EPHEMERAL_MS;
|
|
20455
20490
|
const expirationTime = new Date(now.getTime() + expiryMs);
|
|
20456
20491
|
const prepared = this.wasmBindings.prepareSession({
|
|
20457
20492
|
abilities,
|
|
@@ -20469,7 +20504,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20469
20504
|
...prepared,
|
|
20470
20505
|
signature: signature2
|
|
20471
20506
|
});
|
|
20472
|
-
const activateResult = await (0,
|
|
20507
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20473
20508
|
this.config.host,
|
|
20474
20509
|
delegationSession.delegationHeader
|
|
20475
20510
|
);
|
|
@@ -20496,8 +20531,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20496
20531
|
}]);
|
|
20497
20532
|
}
|
|
20498
20533
|
if (this._serviceContext) {
|
|
20499
|
-
const publicKV = new
|
|
20500
|
-
const publicContext = new
|
|
20534
|
+
const publicKV = new import_sdk_core6.KVService({ prefix: "" });
|
|
20535
|
+
const publicContext = new import_sdk_core6.ServiceContext({
|
|
20501
20536
|
invoke: this.invokeWithRuntimePermissions,
|
|
20502
20537
|
fetch: this._serviceContext.fetch,
|
|
20503
20538
|
hosts: this._serviceContext.hosts,
|
|
@@ -20624,14 +20659,14 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20624
20659
|
async delegateTo(did, permissions, options) {
|
|
20625
20660
|
const session = this.currentTinyCloudSession();
|
|
20626
20661
|
if (!session) {
|
|
20627
|
-
throw new
|
|
20662
|
+
throw new import_sdk_core6.SessionExpiredError(/* @__PURE__ */ new Date(0));
|
|
20628
20663
|
}
|
|
20629
20664
|
const sessionExpiry = extractSiweExpiration(session.siwe);
|
|
20630
20665
|
if (sessionExpiry !== void 0) {
|
|
20631
20666
|
const now2 = Date.now();
|
|
20632
20667
|
const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
|
|
20633
20668
|
if (sessionExpiry.getTime() <= now2 + marginMs) {
|
|
20634
|
-
throw new
|
|
20669
|
+
throw new import_sdk_core6.SessionExpiredError(sessionExpiry);
|
|
20635
20670
|
}
|
|
20636
20671
|
}
|
|
20637
20672
|
if (!Array.isArray(permissions) || permissions.length === 0) {
|
|
@@ -20660,11 +20695,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20660
20695
|
);
|
|
20661
20696
|
return { delegation: delegation2, prompted: true };
|
|
20662
20697
|
}
|
|
20663
|
-
const granted = (0,
|
|
20698
|
+
const granted = (0, import_sdk_core6.parseRecapCapabilities)(
|
|
20664
20699
|
(siwe) => this.wasmBindings.parseRecapFromSiwe(siwe),
|
|
20665
20700
|
session.siwe
|
|
20666
20701
|
);
|
|
20667
|
-
const { subset, missing } = (0,
|
|
20702
|
+
const { subset, missing } = (0, import_sdk_core6.isCapabilitySubset)(expandedEntries, granted);
|
|
20668
20703
|
if (!subset) {
|
|
20669
20704
|
const runtimeGrant = this.findGrantForOperations(
|
|
20670
20705
|
this.permissionEntriesToOperations(expandedEntries, session)
|
|
@@ -20672,7 +20707,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20672
20707
|
if (runtimeGrant) {
|
|
20673
20708
|
const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
|
|
20674
20709
|
if (runtimeGrant.expiresAt.getTime() <= Date.now() + marginMs) {
|
|
20675
|
-
throw new
|
|
20710
|
+
throw new import_sdk_core6.SessionExpiredError(runtimeGrant.expiresAt);
|
|
20676
20711
|
}
|
|
20677
20712
|
const runtimeExpiration = runtimeGrant.expiresAt < effectiveExpiration ? runtimeGrant.expiresAt : effectiveExpiration;
|
|
20678
20713
|
const delegation2 = await this.createDelegationViaRuntimeGrant(
|
|
@@ -20683,7 +20718,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20683
20718
|
);
|
|
20684
20719
|
return { delegation: delegation2, prompted: false };
|
|
20685
20720
|
}
|
|
20686
|
-
throw new
|
|
20721
|
+
throw new import_sdk_core6.PermissionNotInManifestError(missing, granted);
|
|
20687
20722
|
}
|
|
20688
20723
|
const delegation = await this.createDelegationViaWasmPath(
|
|
20689
20724
|
did,
|
|
@@ -20765,7 +20800,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20765
20800
|
const spaceId = resolvedSpaces.size === 1 ? [...resolvedSpaces][0] : session.spaceId;
|
|
20766
20801
|
const abilities = {};
|
|
20767
20802
|
for (const entry of entries) {
|
|
20768
|
-
const shortService =
|
|
20803
|
+
const shortService = import_sdk_core6.SERVICE_LONG_TO_SHORT[entry.service];
|
|
20769
20804
|
if (shortService === void 0) {
|
|
20770
20805
|
throw new Error(
|
|
20771
20806
|
`delegateTo: unknown service '${entry.service}' \u2014 no short-form mapping`
|
|
@@ -20805,7 +20840,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20805
20840
|
});
|
|
20806
20841
|
const primary = result.resources[0];
|
|
20807
20842
|
const delegationHeader = { Authorization: result.delegation };
|
|
20808
|
-
const activateResult = await (0,
|
|
20843
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20809
20844
|
this.config.host,
|
|
20810
20845
|
delegationHeader
|
|
20811
20846
|
);
|
|
@@ -20840,7 +20875,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20840
20875
|
const primary = result.resources[0];
|
|
20841
20876
|
const delegationHeader = { Authorization: result.delegation };
|
|
20842
20877
|
const targetHost = grant.delegation.host ?? this.config.host;
|
|
20843
|
-
const activateResult = await (0,
|
|
20878
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
20844
20879
|
targetHost,
|
|
20845
20880
|
delegationHeader
|
|
20846
20881
|
);
|
|
@@ -20881,10 +20916,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20881
20916
|
return this.wasmBindings.makeSpaceId(session.address, session.chainId, space);
|
|
20882
20917
|
}
|
|
20883
20918
|
expandPermissionEntries(permissions) {
|
|
20884
|
-
return (0,
|
|
20919
|
+
return (0, import_sdk_core6.expandPermissionEntries)(permissions);
|
|
20885
20920
|
}
|
|
20886
20921
|
shortServiceName(service) {
|
|
20887
|
-
const short =
|
|
20922
|
+
const short = import_sdk_core6.SERVICE_LONG_TO_SHORT[service];
|
|
20888
20923
|
if (short === void 0) {
|
|
20889
20924
|
throw new Error(
|
|
20890
20925
|
`unknown service '${service}' \u2014 no short-form mapping`
|
|
@@ -20910,7 +20945,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20910
20945
|
return abilities;
|
|
20911
20946
|
}
|
|
20912
20947
|
isEncryptionPermissionEntry(entry) {
|
|
20913
|
-
return entry.service ===
|
|
20948
|
+
return entry.service === import_sdk_core6.ENCRYPTION_PERMISSION_SERVICE && entry.path.startsWith("urn:tinycloud:encryption:");
|
|
20914
20949
|
}
|
|
20915
20950
|
permissionsToRawAbilities(entries) {
|
|
20916
20951
|
const rawAbilities = {};
|
|
@@ -20943,11 +20978,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20943
20978
|
}
|
|
20944
20979
|
sessionCoversPermissionEntries(session, entries) {
|
|
20945
20980
|
try {
|
|
20946
|
-
const granted = (0,
|
|
20981
|
+
const granted = (0, import_sdk_core6.parseRecapCapabilities)(
|
|
20947
20982
|
(siwe) => this.wasmBindings.parseRecapFromSiwe(siwe),
|
|
20948
20983
|
session.siwe
|
|
20949
20984
|
);
|
|
20950
|
-
return (0,
|
|
20985
|
+
return (0, import_sdk_core6.isCapabilitySubset)(entries, granted).subset;
|
|
20951
20986
|
} catch {
|
|
20952
20987
|
return false;
|
|
20953
20988
|
}
|
|
@@ -21278,7 +21313,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21278
21313
|
if (resolvedDelegateDID.endsWith(".eth") && this.config.ensResolver) {
|
|
21279
21314
|
const address = await this.config.ensResolver.resolveAddress(resolvedDelegateDID);
|
|
21280
21315
|
if (!address) throw new Error(`Could not resolve ENS name: ${resolvedDelegateDID}`);
|
|
21281
|
-
resolvedDelegateDID = (0,
|
|
21316
|
+
resolvedDelegateDID = (0, import_sdk_core6.pkhDid)(address, 1);
|
|
21282
21317
|
}
|
|
21283
21318
|
const entries = legacyParamsToPermissionEntries(
|
|
21284
21319
|
params.actions,
|
|
@@ -21293,7 +21328,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21293
21328
|
);
|
|
21294
21329
|
return result.delegation;
|
|
21295
21330
|
} catch (err) {
|
|
21296
|
-
if (err instanceof
|
|
21331
|
+
if (err instanceof import_sdk_core6.PermissionNotInManifestError) {
|
|
21297
21332
|
} else {
|
|
21298
21333
|
throw err;
|
|
21299
21334
|
}
|
|
@@ -21350,7 +21385,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21350
21385
|
...prepared,
|
|
21351
21386
|
signature: signature2
|
|
21352
21387
|
});
|
|
21353
|
-
const activateResult = await (0,
|
|
21388
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
21354
21389
|
this.config.host,
|
|
21355
21390
|
delegationSession.delegationHeader
|
|
21356
21391
|
);
|
|
@@ -21372,7 +21407,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21372
21407
|
};
|
|
21373
21408
|
const hasKvActions = params.actions.some((a) => a.startsWith("tinycloud.kv/"));
|
|
21374
21409
|
if (hasKvActions && params.includePublicSpace !== false) {
|
|
21375
|
-
const publicSpaceId = (0,
|
|
21410
|
+
const publicSpaceId = (0, import_sdk_core6.makePublicSpaceId)(
|
|
21376
21411
|
this.wasmBindings.ensureEip55(session.address),
|
|
21377
21412
|
session.chainId
|
|
21378
21413
|
);
|
|
@@ -21395,7 +21430,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21395
21430
|
...publicPrepared,
|
|
21396
21431
|
signature: publicSignature
|
|
21397
21432
|
});
|
|
21398
|
-
const publicActivateResult = await (0,
|
|
21433
|
+
const publicActivateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
21399
21434
|
this.config.host,
|
|
21400
21435
|
publicSession.delegationHeader
|
|
21401
21436
|
);
|
|
@@ -21500,7 +21535,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21500
21535
|
...prepared,
|
|
21501
21536
|
signature: signature2
|
|
21502
21537
|
});
|
|
21503
|
-
const activateResult = await (0,
|
|
21538
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
21504
21539
|
targetHost,
|
|
21505
21540
|
invokerSession.delegationHeader
|
|
21506
21541
|
);
|
|
@@ -21606,7 +21641,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21606
21641
|
...prepared,
|
|
21607
21642
|
signature: signature2
|
|
21608
21643
|
});
|
|
21609
|
-
const activateResult = await (0,
|
|
21644
|
+
const activateResult = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
21610
21645
|
targetHost,
|
|
21611
21646
|
subDelegationSession.delegationHeader
|
|
21612
21647
|
);
|
|
@@ -21648,11 +21683,11 @@ TinyCloudNode.registerNodeDefaults({
|
|
|
21648
21683
|
});
|
|
21649
21684
|
|
|
21650
21685
|
// src/index.ts
|
|
21651
|
-
var import_sdk_core7 = require("@tinycloud/sdk-core");
|
|
21652
21686
|
var import_sdk_core8 = require("@tinycloud/sdk-core");
|
|
21687
|
+
var import_sdk_core9 = require("@tinycloud/sdk-core");
|
|
21653
21688
|
|
|
21654
21689
|
// src/storage/FileSessionStorage.ts
|
|
21655
|
-
var
|
|
21690
|
+
var import_sdk_core7 = require("@tinycloud/sdk-core");
|
|
21656
21691
|
var import_fs = require("fs");
|
|
21657
21692
|
var import_path = require("path");
|
|
21658
21693
|
var FileSessionStorage = class {
|
|
@@ -21707,7 +21742,7 @@ var FileSessionStorage = class {
|
|
|
21707
21742
|
try {
|
|
21708
21743
|
const data = (0, import_fs.readFileSync)(filePath, "utf-8");
|
|
21709
21744
|
const parsed = JSON.parse(data);
|
|
21710
|
-
const validation = (0,
|
|
21745
|
+
const validation = (0, import_sdk_core7.validatePersistedSessionData)(parsed);
|
|
21711
21746
|
if (!validation.ok) {
|
|
21712
21747
|
console.warn(`Invalid session data for ${address}:`, validation.error.message);
|
|
21713
21748
|
(0, import_fs.unlinkSync)(filePath);
|
|
@@ -21772,7 +21807,7 @@ var FileSessionStorage = class {
|
|
|
21772
21807
|
};
|
|
21773
21808
|
|
|
21774
21809
|
// src/index.ts
|
|
21775
|
-
var
|
|
21810
|
+
var import_sdk_core10 = require("@tinycloud/sdk-core");
|
|
21776
21811
|
|
|
21777
21812
|
// src/delegation.ts
|
|
21778
21813
|
async function grantAuthRequest(authority, request, options) {
|
|
@@ -21817,7 +21852,6 @@ function deserializeDelegation(data) {
|
|
|
21817
21852
|
}
|
|
21818
21853
|
|
|
21819
21854
|
// src/index.ts
|
|
21820
|
-
var import_sdk_core10 = require("@tinycloud/sdk-core");
|
|
21821
21855
|
var import_sdk_core11 = require("@tinycloud/sdk-core");
|
|
21822
21856
|
var import_sdk_core12 = require("@tinycloud/sdk-core");
|
|
21823
21857
|
var import_sdk_core13 = require("@tinycloud/sdk-core");
|
|
@@ -21828,10 +21862,12 @@ var import_sdk_core17 = require("@tinycloud/sdk-core");
|
|
|
21828
21862
|
var import_sdk_core18 = require("@tinycloud/sdk-core");
|
|
21829
21863
|
var import_sdk_core19 = require("@tinycloud/sdk-core");
|
|
21830
21864
|
var import_sdk_core20 = require("@tinycloud/sdk-core");
|
|
21865
|
+
var import_sdk_core21 = require("@tinycloud/sdk-core");
|
|
21831
21866
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21832
21867
|
0 && (module.exports = {
|
|
21833
21868
|
ACCOUNT_REGISTRY_PATH,
|
|
21834
21869
|
ACCOUNT_REGISTRY_SPACE,
|
|
21870
|
+
AccountService,
|
|
21835
21871
|
AutoApproveSpaceCreationHandler,
|
|
21836
21872
|
CapabilityKeyRegistry,
|
|
21837
21873
|
CapabilityKeyRegistryErrorCodes,
|