@tinycloud/node-sdk 3.0.0-beta.7 → 3.0.0-beta.9
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-WJQ9KiSD.d.cts → core-BTuD37zN.d.cts} +10 -64
- package/dist/{core-WJQ9KiSD.d.ts → core-BTuD37zN.d.ts} +10 -64
- package/dist/core.cjs +36 -10
- 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 +37 -10
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +36 -10
- 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 +37 -10
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -17157,6 +17157,7 @@ __export(index_exports, {
|
|
|
17157
17157
|
parseExpiry: () => import_sdk_core12.parseExpiry,
|
|
17158
17158
|
parseNetworkId: () => import_sdk_core17.parseNetworkId,
|
|
17159
17159
|
parsePkhDid: () => import_sdk_core11.parsePkhDid,
|
|
17160
|
+
parseSecretCatalogKey: () => import_sdk_core16.parseSecretCatalogKey,
|
|
17160
17161
|
parseSpaceUri: () => import_sdk_core21.parseSpaceUri,
|
|
17161
17162
|
pkhDid: () => import_sdk_core11.pkhDid,
|
|
17162
17163
|
principalDid: () => import_sdk_core11.principalDid,
|
|
@@ -19108,6 +19109,11 @@ var NodeSecretsService = class {
|
|
|
19108
19109
|
if (!permission.ok) return permission;
|
|
19109
19110
|
return options === void 0 ? this.service.list() : this.service.list(options);
|
|
19110
19111
|
}
|
|
19112
|
+
async listAll() {
|
|
19113
|
+
const permission = await this.ensurePermission("", void 0, "list");
|
|
19114
|
+
if (!permission.ok) return permission;
|
|
19115
|
+
return this.service.listAll();
|
|
19116
|
+
}
|
|
19111
19117
|
get service() {
|
|
19112
19118
|
return this.config.getService();
|
|
19113
19119
|
}
|
|
@@ -19169,7 +19175,11 @@ var NodeSecretsService = class {
|
|
|
19169
19175
|
(entry) => manifests.some((candidate) => {
|
|
19170
19176
|
const resolved = (0, import_sdk_core6.resolveManifest)(candidate);
|
|
19171
19177
|
return resolved.resources.some(
|
|
19172
|
-
(resource) => resource.service === entry.service && spaceMatches(
|
|
19178
|
+
(resource) => resource.service === entry.service && spaceMatches(
|
|
19179
|
+
resource.space,
|
|
19180
|
+
entry.space,
|
|
19181
|
+
this.config.resolveSpace
|
|
19182
|
+
) && resource.path === entry.path && entry.actions.every((action) => resource.actions.includes(action))
|
|
19173
19183
|
);
|
|
19174
19184
|
})
|
|
19175
19185
|
);
|
|
@@ -19864,6 +19874,29 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19864
19874
|
const authHosts = this.auth?.hosts ?? [];
|
|
19865
19875
|
return authHosts.length > 0 ? authHosts : [this.config.host];
|
|
19866
19876
|
}
|
|
19877
|
+
/** The registry-resolved Node endpoint and the identity returned by that exact Node. */
|
|
19878
|
+
async activeNodeIdentity() {
|
|
19879
|
+
const host = this.hosts[0];
|
|
19880
|
+
if (host === void 0) throw new Error("TinyCloud node host has not been resolved");
|
|
19881
|
+
const parsed = new URL(host);
|
|
19882
|
+
if (parsed.protocol !== "https:" && !(parsed.protocol === "http:" && (parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost")) || parsed.origin !== host) {
|
|
19883
|
+
throw new Error("TinyCloud node host is not a canonical origin");
|
|
19884
|
+
}
|
|
19885
|
+
const nodeDid = await this.fetchNodeId();
|
|
19886
|
+
if (!nodeDid.startsWith("did:key:z")) throw new Error("TinyCloud node identity is not a did:key");
|
|
19887
|
+
return Object.freeze({ origin: parsed.origin, nodeDid });
|
|
19888
|
+
}
|
|
19889
|
+
/** Publish the active owner Node as a session-signed registry record. */
|
|
19890
|
+
async publishActiveNodeLocation(registryUrl, fetchFn = globalThis.fetch.bind(globalThis)) {
|
|
19891
|
+
const node = await this.activeNodeIdentity();
|
|
19892
|
+
return (0, import_sdk_core7.publishLocationRecord)({
|
|
19893
|
+
registryUrl,
|
|
19894
|
+
subject: this.credentialHolderDid,
|
|
19895
|
+
nodeOrigin: node.origin,
|
|
19896
|
+
signer: { type: "did:key", signBytes: (bytes) => this.signSessionBytes(bytes) },
|
|
19897
|
+
fetch: fetchFn
|
|
19898
|
+
});
|
|
19899
|
+
}
|
|
19867
19900
|
/**
|
|
19868
19901
|
* Get the primary identity DID for this user.
|
|
19869
19902
|
* - If wallet connected and signed in: returns PKH DID (did:pkh:eip155:{chainId}:{address})
|
|
@@ -22220,11 +22253,6 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
22220
22253
|
fetch: globalThis.fetch.bind(globalThis)
|
|
22221
22254
|
});
|
|
22222
22255
|
}
|
|
22223
|
-
/** @deprecated Policy/v2 delivery transport is retired. Use authorizeShareDeliveryV3. */
|
|
22224
|
-
async authorizeShareDelivery(input) {
|
|
22225
|
-
void input;
|
|
22226
|
-
throw new Error("Policy/v2 share delivery is retired; use authorizeShareDeliveryV3");
|
|
22227
|
-
}
|
|
22228
22256
|
/** Authorize one short-lived v3 delivery against the signed v3 envelope and registered roots. */
|
|
22229
22257
|
async authorizeShareDeliveryV3(input) {
|
|
22230
22258
|
const session = this.currentTinyCloudSession();
|
|
@@ -22232,8 +22260,6 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
22232
22260
|
if (!session || !serviceSession) throw new Error("Share delivery requires an authenticated session");
|
|
22233
22261
|
const body = {
|
|
22234
22262
|
envelope: input.envelope,
|
|
22235
|
-
sealedEnvelope: input.sealedEnvelope,
|
|
22236
|
-
envelopeKey: input.envelopeKey,
|
|
22237
22263
|
shareCid: input.shareCid,
|
|
22238
22264
|
recipientEmail: input.recipientEmail,
|
|
22239
22265
|
shareUrl: input.shareUrl,
|
|
@@ -22253,9 +22279,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
22253
22279
|
const verified = (0, import_sdk_core7.validateShareDeliveryAuthorizationV3Bytes)(new Uint8Array(await response.arrayBuffer()), {
|
|
22254
22280
|
request,
|
|
22255
22281
|
senderKeyDid: this.credentialHolderDid,
|
|
22256
|
-
|
|
22282
|
+
deliveryAudience: input.deliveryAudience
|
|
22257
22283
|
});
|
|
22258
|
-
void input.nodeProof;
|
|
22259
22284
|
const requestDigest = new Uint8Array(await crypto.subtle.digest(
|
|
22260
22285
|
"SHA-256",
|
|
22261
22286
|
new TextEncoder().encode(`${import_sdk_core7.CREDENTIAL_INVITATION_REQUEST_DOMAIN}${(0, import_sdk_core7.canonicalizeEncryptionJson)(verified.request)}`)
|
|
@@ -25066,6 +25091,7 @@ var import_sdk_core23 = require("@tinycloud/sdk-core");
|
|
|
25066
25091
|
parseExpiry,
|
|
25067
25092
|
parseNetworkId,
|
|
25068
25093
|
parsePkhDid,
|
|
25094
|
+
parseSecretCatalogKey,
|
|
25069
25095
|
parseSpaceUri,
|
|
25070
25096
|
pkhDid,
|
|
25071
25097
|
principalDid,
|