@tinycloud/node-sdk 2.11.0-beta.4 → 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-BmfrcQcJ.d.cts → core-Bkptd8qZ.d.cts} +36 -3
- package/dist/{core-BmfrcQcJ.d.ts → core-Bkptd8qZ.d.ts} +36 -3
- package/dist/core.cjs +57 -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 +57 -10
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +57 -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 +57 -10
- 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
|
|
|
@@ -1026,6 +1026,23 @@ interface NodeDefaults {
|
|
|
1026
1026
|
createWasmBindings: () => IWasmBindings;
|
|
1027
1027
|
createSigner: (privateKey: string, chainId?: number) => ISigner;
|
|
1028
1028
|
}
|
|
1029
|
+
/**
|
|
1030
|
+
* A bootstrap step that COMPLETED but did so in a degraded way — e.g. a KV
|
|
1031
|
+
* batch write that failed ambiguously and was recovered by per-space
|
|
1032
|
+
* reconciliation. Structured (not prose) so callers can branch on `kind` and
|
|
1033
|
+
* `code` without parsing messages (TC-361).
|
|
1034
|
+
*/
|
|
1035
|
+
interface BootstrapWarning {
|
|
1036
|
+
/** The BootstrapStep.id that degraded, e.g. "account:seed-spaces"
|
|
1037
|
+
* (BootstrapStepBase.id — packages/bootstrap/src/index.ts:642-645). */
|
|
1038
|
+
stepId: string;
|
|
1039
|
+
/** What kind of degradation. Additive union; one member today. */
|
|
1040
|
+
kind: "batch-write-reconciled";
|
|
1041
|
+
/** ServiceError.code of the underlying failure that was recovered from. */
|
|
1042
|
+
code: string;
|
|
1043
|
+
/** Human-readable detail. Diagnostics only — never parse this. */
|
|
1044
|
+
message: string;
|
|
1045
|
+
}
|
|
1029
1046
|
declare class TinyCloudNode {
|
|
1030
1047
|
/** @internal Registered by importing @tinycloud/node-sdk (not /core) */
|
|
1031
1048
|
private static nodeDefaults?;
|
|
@@ -1085,6 +1102,7 @@ declare class TinyCloudNode {
|
|
|
1085
1102
|
* {@link currentTinyCloudSession} as a fallback for `auth.tinyCloudSession`.
|
|
1086
1103
|
*/
|
|
1087
1104
|
private _restoredTcSession?;
|
|
1105
|
+
private _activeServiceSession?;
|
|
1088
1106
|
/**
|
|
1089
1107
|
* True when the last signIn() detected an interactive signer and skipped
|
|
1090
1108
|
* client-side bootstrap. Apps can read this to know whether bootstrap was
|
|
@@ -1095,7 +1113,10 @@ declare class TinyCloudNode {
|
|
|
1095
1113
|
* Outcome of the last signIn()'s account-bootstrap attempt. `skipped` is
|
|
1096
1114
|
* true when bootstrap did not complete (interactive signer, auto-sign
|
|
1097
1115
|
* denied, or a bootstrap step failed); `reason` carries the cause so apps
|
|
1098
|
-
* can surface a "finish account setup" call-to-action.
|
|
1116
|
+
* can surface a "finish account setup" call-to-action. `warnings` is
|
|
1117
|
+
* present when bootstrap completed, but one or more steps recovered from
|
|
1118
|
+
* an ambiguous failure (e.g. a KV batch write reconciled via per-space
|
|
1119
|
+
* fallback) — clean vs. recovered runs are otherwise byte-identical.
|
|
1099
1120
|
*/
|
|
1100
1121
|
private _bootstrapStatus;
|
|
1101
1122
|
/** Whether the last signIn() skipped client-side bootstrap because the
|
|
@@ -1105,6 +1126,7 @@ declare class TinyCloudNode {
|
|
|
1105
1126
|
get bootstrapStatus(): {
|
|
1106
1127
|
skipped: boolean;
|
|
1107
1128
|
reason?: string;
|
|
1129
|
+
warnings?: BootstrapWarning[];
|
|
1108
1130
|
};
|
|
1109
1131
|
private get nodeFeatures();
|
|
1110
1132
|
/** SIWE domain — uses config override or defaults to app.tinycloud.xyz */
|
|
@@ -1449,6 +1471,16 @@ declare class TinyCloudNode {
|
|
|
1449
1471
|
* rehydration set by {@link restoreSession} (session-only mode).
|
|
1450
1472
|
*/
|
|
1451
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>;
|
|
1452
1484
|
/**
|
|
1453
1485
|
* Connect a wallet to upgrade from session-only mode to wallet mode.
|
|
1454
1486
|
*
|
|
@@ -1576,6 +1608,7 @@ declare class TinyCloudNode {
|
|
|
1576
1608
|
readonly recipientEmail: string;
|
|
1577
1609
|
readonly shareUrl: string;
|
|
1578
1610
|
readonly documentName: string;
|
|
1611
|
+
readonly idempotencyKey: string;
|
|
1579
1612
|
readonly expiresAt: string;
|
|
1580
1613
|
/** The enrolled receipt key from the node trust bundle. */
|
|
1581
1614
|
readonly nodeProof: {
|
|
@@ -2232,4 +2265,4 @@ declare class WasmKeyProvider implements KeyProvider {
|
|
|
2232
2265
|
*/
|
|
2233
2266
|
declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
|
|
2234
2267
|
|
|
2235
|
-
export { type AuthDelegationArtifact as A, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };
|
|
2268
|
+
export { type AuthDelegationArtifact as A, type BootstrapWarning as B, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };
|
|
@@ -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
|
|
|
@@ -1026,6 +1026,23 @@ interface NodeDefaults {
|
|
|
1026
1026
|
createWasmBindings: () => IWasmBindings;
|
|
1027
1027
|
createSigner: (privateKey: string, chainId?: number) => ISigner;
|
|
1028
1028
|
}
|
|
1029
|
+
/**
|
|
1030
|
+
* A bootstrap step that COMPLETED but did so in a degraded way — e.g. a KV
|
|
1031
|
+
* batch write that failed ambiguously and was recovered by per-space
|
|
1032
|
+
* reconciliation. Structured (not prose) so callers can branch on `kind` and
|
|
1033
|
+
* `code` without parsing messages (TC-361).
|
|
1034
|
+
*/
|
|
1035
|
+
interface BootstrapWarning {
|
|
1036
|
+
/** The BootstrapStep.id that degraded, e.g. "account:seed-spaces"
|
|
1037
|
+
* (BootstrapStepBase.id — packages/bootstrap/src/index.ts:642-645). */
|
|
1038
|
+
stepId: string;
|
|
1039
|
+
/** What kind of degradation. Additive union; one member today. */
|
|
1040
|
+
kind: "batch-write-reconciled";
|
|
1041
|
+
/** ServiceError.code of the underlying failure that was recovered from. */
|
|
1042
|
+
code: string;
|
|
1043
|
+
/** Human-readable detail. Diagnostics only — never parse this. */
|
|
1044
|
+
message: string;
|
|
1045
|
+
}
|
|
1029
1046
|
declare class TinyCloudNode {
|
|
1030
1047
|
/** @internal Registered by importing @tinycloud/node-sdk (not /core) */
|
|
1031
1048
|
private static nodeDefaults?;
|
|
@@ -1085,6 +1102,7 @@ declare class TinyCloudNode {
|
|
|
1085
1102
|
* {@link currentTinyCloudSession} as a fallback for `auth.tinyCloudSession`.
|
|
1086
1103
|
*/
|
|
1087
1104
|
private _restoredTcSession?;
|
|
1105
|
+
private _activeServiceSession?;
|
|
1088
1106
|
/**
|
|
1089
1107
|
* True when the last signIn() detected an interactive signer and skipped
|
|
1090
1108
|
* client-side bootstrap. Apps can read this to know whether bootstrap was
|
|
@@ -1095,7 +1113,10 @@ declare class TinyCloudNode {
|
|
|
1095
1113
|
* Outcome of the last signIn()'s account-bootstrap attempt. `skipped` is
|
|
1096
1114
|
* true when bootstrap did not complete (interactive signer, auto-sign
|
|
1097
1115
|
* denied, or a bootstrap step failed); `reason` carries the cause so apps
|
|
1098
|
-
* can surface a "finish account setup" call-to-action.
|
|
1116
|
+
* can surface a "finish account setup" call-to-action. `warnings` is
|
|
1117
|
+
* present when bootstrap completed, but one or more steps recovered from
|
|
1118
|
+
* an ambiguous failure (e.g. a KV batch write reconciled via per-space
|
|
1119
|
+
* fallback) — clean vs. recovered runs are otherwise byte-identical.
|
|
1099
1120
|
*/
|
|
1100
1121
|
private _bootstrapStatus;
|
|
1101
1122
|
/** Whether the last signIn() skipped client-side bootstrap because the
|
|
@@ -1105,6 +1126,7 @@ declare class TinyCloudNode {
|
|
|
1105
1126
|
get bootstrapStatus(): {
|
|
1106
1127
|
skipped: boolean;
|
|
1107
1128
|
reason?: string;
|
|
1129
|
+
warnings?: BootstrapWarning[];
|
|
1108
1130
|
};
|
|
1109
1131
|
private get nodeFeatures();
|
|
1110
1132
|
/** SIWE domain — uses config override or defaults to app.tinycloud.xyz */
|
|
@@ -1449,6 +1471,16 @@ declare class TinyCloudNode {
|
|
|
1449
1471
|
* rehydration set by {@link restoreSession} (session-only mode).
|
|
1450
1472
|
*/
|
|
1451
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>;
|
|
1452
1484
|
/**
|
|
1453
1485
|
* Connect a wallet to upgrade from session-only mode to wallet mode.
|
|
1454
1486
|
*
|
|
@@ -1576,6 +1608,7 @@ declare class TinyCloudNode {
|
|
|
1576
1608
|
readonly recipientEmail: string;
|
|
1577
1609
|
readonly shareUrl: string;
|
|
1578
1610
|
readonly documentName: string;
|
|
1611
|
+
readonly idempotencyKey: string;
|
|
1579
1612
|
readonly expiresAt: string;
|
|
1580
1613
|
/** The enrolled receipt key from the node trust bundle. */
|
|
1581
1614
|
readonly nodeProof: {
|
|
@@ -2232,4 +2265,4 @@ declare class WasmKeyProvider implements KeyProvider {
|
|
|
2232
2265
|
*/
|
|
2233
2266
|
declare function createWasmKeyProvider(sessionManager: SessionManagerWithListing): WasmKeyProvider;
|
|
2234
2267
|
|
|
2235
|
-
export { type AuthDelegationArtifact as A, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };
|
|
2268
|
+
export { type AuthDelegationArtifact as A, type BootstrapWarning as B, type CreateOwnerDelegationParams as C, type DelegateToOptions as D, type EnsureEncryptionNetworkOptions as E, FileSessionStorage as F, MemorySessionStorage as M, type NodeEventEmitterStrategy as N, type OwnerDelegationReceipt as O, type PortableDelegation as P, type RestorableSession as R, type SecretPermissionHint as S, TinyCloudNode as T, UnsupportedSessionRestoreError as U, type ValidatedRuntimeDelegation as V, WasmKeyProvider as W, type AuthRequestArtifact as a, type DelegateToResult as b, DelegatedAccess as c, type DelegationAuthority as d, NodeUserAuthorization as e, type NodeUserAuthorizationConfig as f, type RuntimeDelegationActivator as g, type RuntimePermissionGrantOptions as h, type SecretReadInput as i, type SecretReadResult as j, type SignStrategy as k, type TinyCloudNodeConfig as l, type WasmKeyProviderConfig as m, activateValidatedRuntimeDelegation as n, createWasmKeyProvider as o, defaultSignStrategy as p, deserializeDelegation as q, grantAuthRequest as r, serializeDelegation as s };
|
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) {
|
|
@@ -2117,7 +2119,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2117
2119
|
* Outcome of the last signIn()'s account-bootstrap attempt. `skipped` is
|
|
2118
2120
|
* true when bootstrap did not complete (interactive signer, auto-sign
|
|
2119
2121
|
* denied, or a bootstrap step failed); `reason` carries the cause so apps
|
|
2120
|
-
* can surface a "finish account setup" call-to-action.
|
|
2122
|
+
* can surface a "finish account setup" call-to-action. `warnings` is
|
|
2123
|
+
* present when bootstrap completed, but one or more steps recovered from
|
|
2124
|
+
* an ambiguous failure (e.g. a KV batch write reconciled via per-space
|
|
2125
|
+
* fallback) — clean vs. recovered runs are otherwise byte-identical.
|
|
2121
2126
|
*/
|
|
2122
2127
|
this._bootstrapStatus = {
|
|
2123
2128
|
skipped: false
|
|
@@ -2558,7 +2563,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2558
2563
|
return false;
|
|
2559
2564
|
}
|
|
2560
2565
|
try {
|
|
2561
|
-
await this.runAccountBootstrap(steps);
|
|
2566
|
+
const warnings = await this.runAccountBootstrap(steps);
|
|
2567
|
+
if (warnings.length > 0) {
|
|
2568
|
+
this._bootstrapStatus = { skipped: false, warnings };
|
|
2569
|
+
this.notificationHandler.warning(
|
|
2570
|
+
`Account bootstrap completed with warnings: ${warnings.map((w) => `${w.stepId} (${w.kind}: ${w.code})`).join("; ")}`
|
|
2571
|
+
);
|
|
2572
|
+
}
|
|
2562
2573
|
} catch (err) {
|
|
2563
2574
|
const reason = err instanceof Error ? err.message : String(err);
|
|
2564
2575
|
this._bootstrapSkipped = true;
|
|
@@ -2607,6 +2618,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2607
2618
|
const auth = this.auth;
|
|
2608
2619
|
const sessions = /* @__PURE__ */ new Map();
|
|
2609
2620
|
const rawAbilitiesBySpace = /* @__PURE__ */ new Map();
|
|
2621
|
+
const warnings = [];
|
|
2610
2622
|
const primarySession = auth.tinyCloudSession;
|
|
2611
2623
|
const defaultSpaceId = this.ownedSpaceId("default");
|
|
2612
2624
|
const canReusePrimaryBootstrapSession = primarySession?.spaceId === defaultSpaceId && auth.capabilityRequest === import_sdk_core8.BOOTSTRAP_SESSION_REQUESTS.default;
|
|
@@ -2668,20 +2680,29 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2668
2680
|
}
|
|
2669
2681
|
}
|
|
2670
2682
|
if (step.kind === "seed-spaces") {
|
|
2671
|
-
|
|
2672
|
-
|
|
2683
|
+
const registered = await this.account.spaces.registerBatch(
|
|
2684
|
+
step.spaces.map((space) => ({
|
|
2673
2685
|
spaceId: space.spaceId,
|
|
2674
2686
|
name: space.name,
|
|
2675
2687
|
ownerDid: this.did,
|
|
2676
2688
|
type: "owned",
|
|
2677
2689
|
permissions: ["*"],
|
|
2678
2690
|
status: "active"
|
|
2691
|
+
}))
|
|
2692
|
+
);
|
|
2693
|
+
if (!registered.ok) {
|
|
2694
|
+
throw new Error(
|
|
2695
|
+
`Failed to seed account spaces: ${registered.error.message}`
|
|
2696
|
+
);
|
|
2697
|
+
}
|
|
2698
|
+
const batchError = registered.data.recoveredFromBatchError;
|
|
2699
|
+
if (batchError) {
|
|
2700
|
+
warnings.push({
|
|
2701
|
+
stepId: step.id,
|
|
2702
|
+
kind: "batch-write-reconciled",
|
|
2703
|
+
code: batchError.code,
|
|
2704
|
+
message: batchError.message
|
|
2679
2705
|
});
|
|
2680
|
-
if (!registered.ok) {
|
|
2681
|
-
throw new Error(
|
|
2682
|
-
`Failed to seed account space ${space.spaceId}: ${registered.error.message}`
|
|
2683
|
-
);
|
|
2684
|
-
}
|
|
2685
2706
|
}
|
|
2686
2707
|
}
|
|
2687
2708
|
if (step.kind === "seed-applications") {
|
|
@@ -2717,6 +2738,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2717
2738
|
}
|
|
2718
2739
|
}
|
|
2719
2740
|
}
|
|
2741
|
+
return warnings;
|
|
2720
2742
|
}
|
|
2721
2743
|
registerBootstrapRuntimeGrant(session, request, rawAbilities) {
|
|
2722
2744
|
const operations = [];
|
|
@@ -3344,6 +3366,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3344
3366
|
this._delegationManager = stagedGraph.delegationManager;
|
|
3345
3367
|
this._spaceService = stagedGraph.spaceService;
|
|
3346
3368
|
this._serviceGraph = stagedGraph.graph;
|
|
3369
|
+
this._activeServiceSession = serviceSession;
|
|
3347
3370
|
this._baseSecrets = /* @__PURE__ */ new Map();
|
|
3348
3371
|
this._secrets = /* @__PURE__ */ new Map();
|
|
3349
3372
|
this._publicKV = void 0;
|
|
@@ -3661,6 +3684,28 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3661
3684
|
currentTinyCloudSession() {
|
|
3662
3685
|
return this.auth?.tinyCloudSession ?? this._restoredTcSession;
|
|
3663
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
|
+
}
|
|
3664
3709
|
/**
|
|
3665
3710
|
* Connect a wallet to upgrade from session-only mode to wallet mode.
|
|
3666
3711
|
*
|
|
@@ -3842,6 +3887,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3842
3887
|
if (this._serviceContext) {
|
|
3843
3888
|
const spaceScopedContext = this._serviceGraph.track(new import_sdk_core8.ServiceContext({
|
|
3844
3889
|
invoke: this._serviceContext.invoke,
|
|
3890
|
+
invokeAny: this._serviceContext.invokeAny,
|
|
3845
3891
|
fetch: this._serviceContext.fetch,
|
|
3846
3892
|
hosts: this._serviceContext.hosts,
|
|
3847
3893
|
telemetry: this.config.telemetry
|
|
@@ -4507,6 +4553,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4507
4553
|
shareUrl: input.shareUrl,
|
|
4508
4554
|
documentName: input.documentName,
|
|
4509
4555
|
jti: base64UrlEncode(crypto.getRandomValues(new Uint8Array(16))),
|
|
4556
|
+
idempotencyKey: input.idempotencyKey,
|
|
4510
4557
|
expiresAt: input.expiresAt
|
|
4511
4558
|
};
|
|
4512
4559
|
const requestBodyDigest = base64UrlEncode(new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode((0, import_sdk_core8.canonicalizeEncryptionJson)(body)))));
|