@tinycloud/node-sdk 2.11.0-beta.5 → 2.11.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{core-ool1expK.d.cts → core-Bkptd8qZ.d.cts} +13 -1
- package/dist/{core-ool1expK.d.ts → core-Bkptd8qZ.d.ts} +13 -1
- package/dist/core.cjs +27 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +27 -1
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +27 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -19043,7 +19043,9 @@ function base64UrlDecode(value) {
|
|
|
19043
19043
|
return new Uint8Array(bytes);
|
|
19044
19044
|
}
|
|
19045
19045
|
async function signJwtInputWithJwk(signingInput, jwk) {
|
|
19046
|
-
|
|
19046
|
+
return signBytesWithJwk(new TextEncoder().encode(signingInput), jwk);
|
|
19047
|
+
}
|
|
19048
|
+
async function signBytesWithJwk(bytes, jwk) {
|
|
19047
19049
|
try {
|
|
19048
19050
|
const subtle = globalThis.crypto?.subtle;
|
|
19049
19051
|
if (!subtle) {
|
|
@@ -20387,6 +20389,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20387
20389
|
this._delegationManager = stagedGraph.delegationManager;
|
|
20388
20390
|
this._spaceService = stagedGraph.spaceService;
|
|
20389
20391
|
this._serviceGraph = stagedGraph.graph;
|
|
20392
|
+
this._activeServiceSession = serviceSession;
|
|
20390
20393
|
this._baseSecrets = /* @__PURE__ */ new Map();
|
|
20391
20394
|
this._secrets = /* @__PURE__ */ new Map();
|
|
20392
20395
|
this._publicKV = void 0;
|
|
@@ -20704,6 +20707,28 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20704
20707
|
currentTinyCloudSession() {
|
|
20705
20708
|
return this.auth?.tinyCloudSession ?? this._restoredTcSession;
|
|
20706
20709
|
}
|
|
20710
|
+
/**
|
|
20711
|
+
* Mint a multi-capability invocation through the established session key.
|
|
20712
|
+
* Callers receive only the signed headers; session key material remains
|
|
20713
|
+
* owned by the session manager and is never part of the caller contract.
|
|
20714
|
+
*/
|
|
20715
|
+
invokeAny(entries, facts) {
|
|
20716
|
+
const session = this.currentTinyCloudSession() ?? this._activeServiceSession;
|
|
20717
|
+
if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
|
|
20718
|
+
return this._serviceGraph.invokeAny(session, entries, facts);
|
|
20719
|
+
}
|
|
20720
|
+
/** Sign protocol bytes with the established in-memory session key. */
|
|
20721
|
+
async signSessionBytes(bytes) {
|
|
20722
|
+
const session = this.currentTinyCloudSession() ?? this._activeServiceSession;
|
|
20723
|
+
if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
|
|
20724
|
+
return signBytesWithJwk(bytes, session.jwk);
|
|
20725
|
+
}
|
|
20726
|
+
/** Bind a session-signed invocation to the canonical service audience. */
|
|
20727
|
+
async bindInvocationAudience(authorization, audience) {
|
|
20728
|
+
const session = this.currentTinyCloudSession() ?? this._activeServiceSession;
|
|
20729
|
+
if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
|
|
20730
|
+
return rewriteInvocationAudience(authorization, audience, session.jwk);
|
|
20731
|
+
}
|
|
20707
20732
|
/**
|
|
20708
20733
|
* Connect a wallet to upgrade from session-only mode to wallet mode.
|
|
20709
20734
|
*
|
|
@@ -21551,6 +21576,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21551
21576
|
shareUrl: input.shareUrl,
|
|
21552
21577
|
documentName: input.documentName,
|
|
21553
21578
|
jti: base64UrlEncode(crypto.getRandomValues(new Uint8Array(16))),
|
|
21579
|
+
idempotencyKey: input.idempotencyKey,
|
|
21554
21580
|
expiresAt: input.expiresAt
|
|
21555
21581
|
};
|
|
21556
21582
|
const requestBodyDigest = base64UrlEncode(new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode((0, import_sdk_core7.canonicalizeEncryptionJson)(body)))));
|