@tinycloud/node-sdk 0.0.0-beta-20260401001229

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.
@@ -0,0 +1,91 @@
1
+ import { ISigner, Bytes, IWasmBindings, ISessionManager } from '@tinycloud/sdk-core';
2
+ export { AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, ClientSession, ColumnInfo, CreateDelegationParams, DataVaultConfig, DataVaultService, DatabaseHandle, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceSession, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TinyCloud, TinyCloudConfig, TinyCloudSession, UnsupportedFeatureError, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, buildSpaceUri, checkNodeInfo, createCapabilityKeyRegistry, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, makePublicSpaceId, parseSpaceUri } from '@tinycloud/sdk-core';
3
+ export { DelegatedAccess, FileSessionStorage, MemorySessionStorage, NodeEventEmitterStrategy, NodeUserAuthorization, NodeUserAuthorizationConfig, PortableDelegation, SignStrategy, TinyCloudNode, TinyCloudNodeConfig, WasmKeyProvider, WasmKeyProviderConfig, createWasmKeyProvider, defaultSignStrategy, deserializeDelegation, serializeDelegation } from './core.cjs';
4
+ import { invoke, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
5
+ import 'events';
6
+ import '@tinycloud/sdk-services';
7
+
8
+ /**
9
+ * Private key signer for Node.js environments.
10
+ *
11
+ * Uses the node-sdk-wasm package for Ethereum signing operations.
12
+ * The private key should be a hex string (with or without 0x prefix).
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const signer = new PrivateKeySigner(process.env.PRIVATE_KEY);
17
+ * const address = await signer.getAddress();
18
+ * const signature = await signer.signMessage("Hello, world!");
19
+ * ```
20
+ */
21
+ declare class PrivateKeySigner implements ISigner {
22
+ private readonly privateKeyHex;
23
+ private readonly chainId;
24
+ private cachedAddress?;
25
+ /**
26
+ * Create a new PrivateKeySigner.
27
+ *
28
+ * @param privateKey - Hex-encoded private key (with or without 0x prefix)
29
+ * @param chainId - Chain ID for signing (default: 1 for mainnet)
30
+ */
31
+ constructor(privateKey: string, chainId?: number);
32
+ /**
33
+ * Get the Ethereum address for this signer.
34
+ */
35
+ getAddress(): Promise<string>;
36
+ /**
37
+ * Derive Ethereum address from private key.
38
+ * Uses secp256k1 public key derivation via ethers.js.
39
+ */
40
+ private deriveAddress;
41
+ /**
42
+ * Get the chain ID for this signer.
43
+ */
44
+ getChainId(): Promise<number>;
45
+ /**
46
+ * Sign a message.
47
+ *
48
+ * @param message - The message to sign (string or bytes)
49
+ * @returns The signature as a hex string
50
+ */
51
+ signMessage(message: Bytes | string): Promise<string>;
52
+ }
53
+
54
+ /**
55
+ * NodeWasmBindings - Default IWasmBindings implementation for Node.js.
56
+ *
57
+ * Wraps @tinycloud/node-sdk-wasm functions into the IWasmBindings interface.
58
+ * This is used as the default when no custom wasmBindings is provided in config.
59
+ *
60
+ * @packageDocumentation
61
+ */
62
+
63
+ /**
64
+ * Node.js WASM bindings using @tinycloud/node-sdk-wasm.
65
+ *
66
+ * This is the default IWasmBindings implementation for Node.js environments.
67
+ * Browser environments provide their own BrowserWasmBindings via config.wasmBindings.
68
+ */
69
+ declare class NodeWasmBindings implements IWasmBindings {
70
+ private static panicHookInitialized;
71
+ constructor();
72
+ invoke: typeof invoke;
73
+ prepareSession: typeof prepareSession;
74
+ completeSessionSetup: typeof completeSessionSetup;
75
+ ensureEip55: typeof ensureEip55;
76
+ makeSpaceId: typeof makeSpaceId;
77
+ createDelegation: typeof createDelegation;
78
+ generateHostSIWEMessage: typeof generateHostSIWEMessage;
79
+ siweToDelegationHeaders: typeof siweToDelegationHeaders;
80
+ protocolVersion: typeof protocolVersion;
81
+ vault_encrypt: typeof vault_encrypt;
82
+ vault_decrypt: typeof vault_decrypt;
83
+ vault_derive_key: typeof vault_derive_key;
84
+ vault_x25519_from_seed: typeof vault_x25519_from_seed;
85
+ vault_x25519_dh: typeof vault_x25519_dh;
86
+ vault_random_bytes: typeof vault_random_bytes;
87
+ vault_sha256: typeof vault_sha256;
88
+ createSessionManager(): ISessionManager;
89
+ }
90
+
91
+ export { NodeWasmBindings, PrivateKeySigner };
@@ -0,0 +1,91 @@
1
+ import { ISigner, Bytes, IWasmBindings, ISessionManager } from '@tinycloud/sdk-core';
2
+ export { AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, ClientSession, ColumnInfo, CreateDelegationParams, DataVaultConfig, DataVaultService, DatabaseHandle, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceSession, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TinyCloud, TinyCloudConfig, TinyCloudSession, UnsupportedFeatureError, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, buildSpaceUri, checkNodeInfo, createCapabilityKeyRegistry, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, makePublicSpaceId, parseSpaceUri } from '@tinycloud/sdk-core';
3
+ export { DelegatedAccess, FileSessionStorage, MemorySessionStorage, NodeEventEmitterStrategy, NodeUserAuthorization, NodeUserAuthorizationConfig, PortableDelegation, SignStrategy, TinyCloudNode, TinyCloudNodeConfig, WasmKeyProvider, WasmKeyProviderConfig, createWasmKeyProvider, defaultSignStrategy, deserializeDelegation, serializeDelegation } from './core.js';
4
+ import { invoke, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
5
+ import 'events';
6
+ import '@tinycloud/sdk-services';
7
+
8
+ /**
9
+ * Private key signer for Node.js environments.
10
+ *
11
+ * Uses the node-sdk-wasm package for Ethereum signing operations.
12
+ * The private key should be a hex string (with or without 0x prefix).
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const signer = new PrivateKeySigner(process.env.PRIVATE_KEY);
17
+ * const address = await signer.getAddress();
18
+ * const signature = await signer.signMessage("Hello, world!");
19
+ * ```
20
+ */
21
+ declare class PrivateKeySigner implements ISigner {
22
+ private readonly privateKeyHex;
23
+ private readonly chainId;
24
+ private cachedAddress?;
25
+ /**
26
+ * Create a new PrivateKeySigner.
27
+ *
28
+ * @param privateKey - Hex-encoded private key (with or without 0x prefix)
29
+ * @param chainId - Chain ID for signing (default: 1 for mainnet)
30
+ */
31
+ constructor(privateKey: string, chainId?: number);
32
+ /**
33
+ * Get the Ethereum address for this signer.
34
+ */
35
+ getAddress(): Promise<string>;
36
+ /**
37
+ * Derive Ethereum address from private key.
38
+ * Uses secp256k1 public key derivation via ethers.js.
39
+ */
40
+ private deriveAddress;
41
+ /**
42
+ * Get the chain ID for this signer.
43
+ */
44
+ getChainId(): Promise<number>;
45
+ /**
46
+ * Sign a message.
47
+ *
48
+ * @param message - The message to sign (string or bytes)
49
+ * @returns The signature as a hex string
50
+ */
51
+ signMessage(message: Bytes | string): Promise<string>;
52
+ }
53
+
54
+ /**
55
+ * NodeWasmBindings - Default IWasmBindings implementation for Node.js.
56
+ *
57
+ * Wraps @tinycloud/node-sdk-wasm functions into the IWasmBindings interface.
58
+ * This is used as the default when no custom wasmBindings is provided in config.
59
+ *
60
+ * @packageDocumentation
61
+ */
62
+
63
+ /**
64
+ * Node.js WASM bindings using @tinycloud/node-sdk-wasm.
65
+ *
66
+ * This is the default IWasmBindings implementation for Node.js environments.
67
+ * Browser environments provide their own BrowserWasmBindings via config.wasmBindings.
68
+ */
69
+ declare class NodeWasmBindings implements IWasmBindings {
70
+ private static panicHookInitialized;
71
+ constructor();
72
+ invoke: typeof invoke;
73
+ prepareSession: typeof prepareSession;
74
+ completeSessionSetup: typeof completeSessionSetup;
75
+ ensureEip55: typeof ensureEip55;
76
+ makeSpaceId: typeof makeSpaceId;
77
+ createDelegation: typeof createDelegation;
78
+ generateHostSIWEMessage: typeof generateHostSIWEMessage;
79
+ siweToDelegationHeaders: typeof siweToDelegationHeaders;
80
+ protocolVersion: typeof protocolVersion;
81
+ vault_encrypt: typeof vault_encrypt;
82
+ vault_decrypt: typeof vault_decrypt;
83
+ vault_derive_key: typeof vault_derive_key;
84
+ vault_x25519_from_seed: typeof vault_x25519_from_seed;
85
+ vault_x25519_dh: typeof vault_x25519_dh;
86
+ vault_random_bytes: typeof vault_random_bytes;
87
+ vault_sha256: typeof vault_sha256;
88
+ createSessionManager(): ISessionManager;
89
+ }
90
+
91
+ export { NodeWasmBindings, PrivateKeySigner };