@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, INotificationHandler, IENSResolver, AccountService, RegisterOwnerSharePolicyParams, OwnerSharePolicyRegistrationReceipt, ShareDeliveryAuthorizationReceipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
|
|
1
|
+
import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, INotificationHandler, IENSResolver, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, RegisterOwnerSharePolicyParams, OwnerSharePolicyRegistrationReceipt, ShareDeliveryAuthorizationReceipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
|
|
4
4
|
|
|
@@ -1102,6 +1102,7 @@ declare class TinyCloudNode {
|
|
|
1102
1102
|
* {@link currentTinyCloudSession} as a fallback for `auth.tinyCloudSession`.
|
|
1103
1103
|
*/
|
|
1104
1104
|
private _restoredTcSession?;
|
|
1105
|
+
private _activeServiceSession?;
|
|
1105
1106
|
/**
|
|
1106
1107
|
* True when the last signIn() detected an interactive signer and skipped
|
|
1107
1108
|
* client-side bootstrap. Apps can read this to know whether bootstrap was
|
|
@@ -1470,6 +1471,16 @@ declare class TinyCloudNode {
|
|
|
1470
1471
|
* rehydration set by {@link restoreSession} (session-only mode).
|
|
1471
1472
|
*/
|
|
1472
1473
|
private currentTinyCloudSession;
|
|
1474
|
+
/**
|
|
1475
|
+
* Mint a multi-capability invocation through the established session key.
|
|
1476
|
+
* Callers receive only the signed headers; session key material remains
|
|
1477
|
+
* owned by the session manager and is never part of the caller contract.
|
|
1478
|
+
*/
|
|
1479
|
+
invokeAny(entries: Parameters<InvokeAnyFunction$1>[1], facts?: Parameters<InvokeAnyFunction$1>[2]): ReturnType<InvokeAnyFunction$1>;
|
|
1480
|
+
/** Sign protocol bytes with the established in-memory session key. */
|
|
1481
|
+
signSessionBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
1482
|
+
/** Bind a session-signed invocation to the canonical service audience. */
|
|
1483
|
+
bindInvocationAudience(authorization: string, audience: string): Promise<string>;
|
|
1473
1484
|
/**
|
|
1474
1485
|
* Connect a wallet to upgrade from session-only mode to wallet mode.
|
|
1475
1486
|
*
|
|
@@ -1597,6 +1608,7 @@ declare class TinyCloudNode {
|
|
|
1597
1608
|
readonly recipientEmail: string;
|
|
1598
1609
|
readonly shareUrl: string;
|
|
1599
1610
|
readonly documentName: string;
|
|
1611
|
+
readonly idempotencyKey: string;
|
|
1600
1612
|
readonly expiresAt: string;
|
|
1601
1613
|
/** The enrolled receipt key from the node trust bundle. */
|
|
1602
1614
|
readonly nodeProof: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, INotificationHandler, IENSResolver, AccountService, RegisterOwnerSharePolicyParams, OwnerSharePolicyRegistrationReceipt, ShareDeliveryAuthorizationReceipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
|
|
1
|
+
import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ClientSession, TinyCloudSession, Extension, SignRequest, SignInOptions, Delegation, DelegatedResource, PermissionEntry, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, INotificationHandler, IENSResolver, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, RegisterOwnerSharePolicyParams, OwnerSharePolicyRegistrationReceipt, ShareDeliveryAuthorizationReceipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
|
|
4
4
|
|
|
@@ -1102,6 +1102,7 @@ declare class TinyCloudNode {
|
|
|
1102
1102
|
* {@link currentTinyCloudSession} as a fallback for `auth.tinyCloudSession`.
|
|
1103
1103
|
*/
|
|
1104
1104
|
private _restoredTcSession?;
|
|
1105
|
+
private _activeServiceSession?;
|
|
1105
1106
|
/**
|
|
1106
1107
|
* True when the last signIn() detected an interactive signer and skipped
|
|
1107
1108
|
* client-side bootstrap. Apps can read this to know whether bootstrap was
|
|
@@ -1470,6 +1471,16 @@ declare class TinyCloudNode {
|
|
|
1470
1471
|
* rehydration set by {@link restoreSession} (session-only mode).
|
|
1471
1472
|
*/
|
|
1472
1473
|
private currentTinyCloudSession;
|
|
1474
|
+
/**
|
|
1475
|
+
* Mint a multi-capability invocation through the established session key.
|
|
1476
|
+
* Callers receive only the signed headers; session key material remains
|
|
1477
|
+
* owned by the session manager and is never part of the caller contract.
|
|
1478
|
+
*/
|
|
1479
|
+
invokeAny(entries: Parameters<InvokeAnyFunction$1>[1], facts?: Parameters<InvokeAnyFunction$1>[2]): ReturnType<InvokeAnyFunction$1>;
|
|
1480
|
+
/** Sign protocol bytes with the established in-memory session key. */
|
|
1481
|
+
signSessionBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
1482
|
+
/** Bind a session-signed invocation to the canonical service audience. */
|
|
1483
|
+
bindInvocationAudience(authorization: string, audience: string): Promise<string>;
|
|
1473
1484
|
/**
|
|
1474
1485
|
* Connect a wallet to upgrade from session-only mode to wallet mode.
|
|
1475
1486
|
*
|
|
@@ -1597,6 +1608,7 @@ declare class TinyCloudNode {
|
|
|
1597
1608
|
readonly recipientEmail: string;
|
|
1598
1609
|
readonly shareUrl: string;
|
|
1599
1610
|
readonly documentName: string;
|
|
1611
|
+
readonly idempotencyKey: string;
|
|
1600
1612
|
readonly expiresAt: string;
|
|
1601
1613
|
/** The enrolled receipt key from the node trust bundle. */
|
|
1602
1614
|
readonly nodeProof: {
|
package/dist/core.cjs
CHANGED
|
@@ -2020,7 +2020,9 @@ function base64UrlDecode(value) {
|
|
|
2020
2020
|
return new Uint8Array(bytes);
|
|
2021
2021
|
}
|
|
2022
2022
|
async function signJwtInputWithJwk(signingInput, jwk) {
|
|
2023
|
-
|
|
2023
|
+
return signBytesWithJwk(new TextEncoder().encode(signingInput), jwk);
|
|
2024
|
+
}
|
|
2025
|
+
async function signBytesWithJwk(bytes, jwk) {
|
|
2024
2026
|
try {
|
|
2025
2027
|
const subtle = globalThis.crypto?.subtle;
|
|
2026
2028
|
if (!subtle) {
|
|
@@ -3364,6 +3366,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3364
3366
|
this._delegationManager = stagedGraph.delegationManager;
|
|
3365
3367
|
this._spaceService = stagedGraph.spaceService;
|
|
3366
3368
|
this._serviceGraph = stagedGraph.graph;
|
|
3369
|
+
this._activeServiceSession = serviceSession;
|
|
3367
3370
|
this._baseSecrets = /* @__PURE__ */ new Map();
|
|
3368
3371
|
this._secrets = /* @__PURE__ */ new Map();
|
|
3369
3372
|
this._publicKV = void 0;
|
|
@@ -3681,6 +3684,28 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3681
3684
|
currentTinyCloudSession() {
|
|
3682
3685
|
return this.auth?.tinyCloudSession ?? this._restoredTcSession;
|
|
3683
3686
|
}
|
|
3687
|
+
/**
|
|
3688
|
+
* Mint a multi-capability invocation through the established session key.
|
|
3689
|
+
* Callers receive only the signed headers; session key material remains
|
|
3690
|
+
* owned by the session manager and is never part of the caller contract.
|
|
3691
|
+
*/
|
|
3692
|
+
invokeAny(entries, facts) {
|
|
3693
|
+
const session = this.currentTinyCloudSession() ?? this._activeServiceSession;
|
|
3694
|
+
if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
|
|
3695
|
+
return this._serviceGraph.invokeAny(session, entries, facts);
|
|
3696
|
+
}
|
|
3697
|
+
/** Sign protocol bytes with the established in-memory session key. */
|
|
3698
|
+
async signSessionBytes(bytes) {
|
|
3699
|
+
const session = this.currentTinyCloudSession() ?? this._activeServiceSession;
|
|
3700
|
+
if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
|
|
3701
|
+
return signBytesWithJwk(bytes, session.jwk);
|
|
3702
|
+
}
|
|
3703
|
+
/** Bind a session-signed invocation to the canonical service audience. */
|
|
3704
|
+
async bindInvocationAudience(authorization, audience) {
|
|
3705
|
+
const session = this.currentTinyCloudSession() ?? this._activeServiceSession;
|
|
3706
|
+
if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
|
|
3707
|
+
return rewriteInvocationAudience(authorization, audience, session.jwk);
|
|
3708
|
+
}
|
|
3684
3709
|
/**
|
|
3685
3710
|
* Connect a wallet to upgrade from session-only mode to wallet mode.
|
|
3686
3711
|
*
|
|
@@ -4528,6 +4553,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4528
4553
|
shareUrl: input.shareUrl,
|
|
4529
4554
|
documentName: input.documentName,
|
|
4530
4555
|
jti: base64UrlEncode(crypto.getRandomValues(new Uint8Array(16))),
|
|
4556
|
+
idempotencyKey: input.idempotencyKey,
|
|
4531
4557
|
expiresAt: input.expiresAt
|
|
4532
4558
|
};
|
|
4533
4559
|
const requestBodyDigest = base64UrlEncode(new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode((0, import_sdk_core8.canonicalizeEncryptionJson)(body)))));
|