@tinycloud/sdk-core 1.6.0 → 2.0.0
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/client-types.d.ts +128 -0
- package/dist/client-types.d.ts.map +1 -0
- package/dist/client-types.js +40 -0
- package/dist/client-types.js.map +1 -0
- package/dist/ens.d.ts +17 -0
- package/dist/ens.d.ts.map +1 -0
- package/dist/ens.js +10 -0
- package/dist/ens.js.map +1 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/notifications.d.ts +33 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +15 -0
- package/dist/notifications.js.map +1 -0
- package/dist/userAuthorization.d.ts +21 -3
- package/dist/userAuthorization.d.ts.map +1 -1
- package/dist/userAuthorization.js +2 -2
- package/dist/userAuthorization.js.map +1 -1
- package/dist/userAuthorization.schema.d.ts +6 -5
- package/dist/userAuthorization.schema.d.ts.map +1 -1
- package/dist/userAuthorization.schema.js +0 -6
- package/dist/userAuthorization.schema.js.map +1 -1
- package/dist/version.d.ts +5 -10
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +7 -13
- package/dist/version.js.map +1 -1
- package/dist/wasm.d.ts +66 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +10 -0
- package/dist/wasm.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic client types for TinyCloud SDK.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { SiweMessage } from "siwe";
|
|
8
|
+
export { SiweMessage };
|
|
9
|
+
/** ENS data associated with a user session. */
|
|
10
|
+
export interface EnsData {
|
|
11
|
+
domain?: string | null;
|
|
12
|
+
avatarUrl?: string | null;
|
|
13
|
+
}
|
|
14
|
+
export declare const EnsDataSchema: z.ZodObject<{
|
|
15
|
+
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
domain?: string | null | undefined;
|
|
19
|
+
avatarUrl?: string | null | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
domain?: string | null | undefined;
|
|
22
|
+
avatarUrl?: string | null | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
/** SIWE configuration. All fields optional — callers provide only what they need to override. */
|
|
25
|
+
export interface SiweConfig {
|
|
26
|
+
domain?: string;
|
|
27
|
+
uri?: string;
|
|
28
|
+
chainId?: number;
|
|
29
|
+
statement?: string;
|
|
30
|
+
nonce?: string;
|
|
31
|
+
expirationTime?: string;
|
|
32
|
+
notBefore?: string;
|
|
33
|
+
requestId?: string;
|
|
34
|
+
resources?: string[];
|
|
35
|
+
}
|
|
36
|
+
export declare const SiweConfigSchema: z.ZodObject<{
|
|
37
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
38
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
39
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
statement: z.ZodOptional<z.ZodString>;
|
|
41
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
42
|
+
expirationTime: z.ZodOptional<z.ZodString>;
|
|
43
|
+
notBefore: z.ZodOptional<z.ZodString>;
|
|
44
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
45
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
46
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
47
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
48
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
49
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
statement: z.ZodOptional<z.ZodString>;
|
|
51
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
52
|
+
expirationTime: z.ZodOptional<z.ZodString>;
|
|
53
|
+
notBefore: z.ZodOptional<z.ZodString>;
|
|
54
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
55
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
56
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
57
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
58
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
59
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
statement: z.ZodOptional<z.ZodString>;
|
|
61
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
62
|
+
expirationTime: z.ZodOptional<z.ZodString>;
|
|
63
|
+
notBefore: z.ZodOptional<z.ZodString>;
|
|
64
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
65
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
66
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
67
|
+
/** Representation of an active client session. */
|
|
68
|
+
export interface ClientSession {
|
|
69
|
+
/** User address (may be delegated) */
|
|
70
|
+
address: string;
|
|
71
|
+
/** User address without delegation */
|
|
72
|
+
walletAddress: string;
|
|
73
|
+
/** EIP-155 chain ID */
|
|
74
|
+
chainId: number;
|
|
75
|
+
/** Key to identify the session */
|
|
76
|
+
sessionKey: string;
|
|
77
|
+
/** The SIWE message text (from SiweMessage.prepareMessage()) */
|
|
78
|
+
siwe: string;
|
|
79
|
+
/** The signature of the SIWE message */
|
|
80
|
+
signature: string;
|
|
81
|
+
/** ENS data supported by TinyCloud */
|
|
82
|
+
ens?: EnsData;
|
|
83
|
+
}
|
|
84
|
+
export declare const ClientSessionSchema: z.ZodObject<{
|
|
85
|
+
address: z.ZodString;
|
|
86
|
+
walletAddress: z.ZodString;
|
|
87
|
+
chainId: z.ZodNumber;
|
|
88
|
+
sessionKey: z.ZodString;
|
|
89
|
+
siwe: z.ZodString;
|
|
90
|
+
signature: z.ZodString;
|
|
91
|
+
ens: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
93
|
+
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
domain?: string | null | undefined;
|
|
96
|
+
avatarUrl?: string | null | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
domain?: string | null | undefined;
|
|
99
|
+
avatarUrl?: string | null | undefined;
|
|
100
|
+
}>>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
siwe: string;
|
|
103
|
+
signature: string;
|
|
104
|
+
address: string;
|
|
105
|
+
chainId: number;
|
|
106
|
+
sessionKey: string;
|
|
107
|
+
walletAddress: string;
|
|
108
|
+
ens?: {
|
|
109
|
+
domain?: string | null | undefined;
|
|
110
|
+
avatarUrl?: string | null | undefined;
|
|
111
|
+
} | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
siwe: string;
|
|
114
|
+
signature: string;
|
|
115
|
+
address: string;
|
|
116
|
+
chainId: number;
|
|
117
|
+
sessionKey: string;
|
|
118
|
+
walletAddress: string;
|
|
119
|
+
ens?: {
|
|
120
|
+
domain?: string | null | undefined;
|
|
121
|
+
avatarUrl?: string | null | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
}>;
|
|
124
|
+
/** The URL of a server running tinycloud-node. */
|
|
125
|
+
export type ServerHost = string;
|
|
126
|
+
/** Validate unknown data as a ClientSession. Returns the parsed session or null. */
|
|
127
|
+
export declare function validateClientSession(data: unknown): ClientSession | null;
|
|
128
|
+
//# sourceMappingURL=client-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-types.d.ts","sourceRoot":"","sources":["../src/client-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,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CAAC;AAEhC,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAGzE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic client types for TinyCloud SDK.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { SiweMessage } from "siwe";
|
|
8
|
+
export { SiweMessage };
|
|
9
|
+
export const EnsDataSchema = z.object({
|
|
10
|
+
domain: z.string().nullable().optional(),
|
|
11
|
+
avatarUrl: z.string().nullable().optional(),
|
|
12
|
+
});
|
|
13
|
+
export const SiweConfigSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
domain: z.string().optional(),
|
|
16
|
+
uri: z.string().optional(),
|
|
17
|
+
chainId: z.number().optional(),
|
|
18
|
+
statement: z.string().optional(),
|
|
19
|
+
nonce: z.string().optional(),
|
|
20
|
+
expirationTime: z.string().optional(),
|
|
21
|
+
notBefore: z.string().optional(),
|
|
22
|
+
requestId: z.string().optional(),
|
|
23
|
+
resources: z.array(z.string()).optional(),
|
|
24
|
+
})
|
|
25
|
+
.passthrough();
|
|
26
|
+
export const ClientSessionSchema = z.object({
|
|
27
|
+
address: z.string(),
|
|
28
|
+
walletAddress: z.string(),
|
|
29
|
+
chainId: z.number(),
|
|
30
|
+
sessionKey: z.string(),
|
|
31
|
+
siwe: z.string(),
|
|
32
|
+
signature: z.string(),
|
|
33
|
+
ens: EnsDataSchema.optional(),
|
|
34
|
+
});
|
|
35
|
+
/** Validate unknown data as a ClientSession. Returns the parsed session or null. */
|
|
36
|
+
export function validateClientSession(data) {
|
|
37
|
+
const result = ClientSessionSchema.safeParse(data);
|
|
38
|
+
return result.success ? result.data : null;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=client-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-types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ACnB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,GAAG,EAAE,aAAa,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAKH,oFAAoF;AACpF,MAAM,UAAU,qBAAqB,CAAC,IAAa;IACjD,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC"}
|
package/dist/ens.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-agnostic ENS resolution interface.
|
|
3
|
+
*
|
|
4
|
+
* Browser implementations use ethers.js provider.
|
|
5
|
+
* Node implementations can use any Ethereum RPC.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export interface IENSResolver {
|
|
10
|
+
/** Resolve an ENS name to an Ethereum address */
|
|
11
|
+
resolveAddress(ensName: string): Promise<string | null>;
|
|
12
|
+
/** Reverse-resolve an address to an ENS name */
|
|
13
|
+
resolveName(address: string): Promise<string | null>;
|
|
14
|
+
/** Resolve an ENS name to an avatar URL */
|
|
15
|
+
resolveAvatar?(ensName: string): Promise<string | null>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ens.d.ts","sourceRoot":"","sources":["../src/ens.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC3B,iDAAiD;IACjD,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxD,gDAAgD;IAChD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACrD,2CAA2C;IAC3C,aAAa,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACzD"}
|
package/dist/ens.js
ADDED
package/dist/ens.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ens.js","sourceRoot":"","sources":["../src/ens.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,14 +9,19 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @packageDocumentation
|
|
11
11
|
*/
|
|
12
|
+
export { ClientSession, EnsData, SiweConfig, ServerHost, ClientSessionSchema, EnsDataSchema, SiweConfigSchema, validateClientSession, SiweMessage, } from "./client-types";
|
|
13
|
+
export { INotificationHandler, SilentNotificationHandler, } from "./notifications";
|
|
14
|
+
export { IENSResolver } from "./ens";
|
|
15
|
+
export { IWasmBindings, ISessionManager } from "./wasm";
|
|
12
16
|
export { ISigner, Bytes } from "./signer";
|
|
13
17
|
export { ISessionStorage, PersistedSessionData, PersistedTinyCloudSession, TinyCloudSession, ValidationError, validatePersistedSessionData, } from "./storage";
|
|
14
|
-
export { IUserAuthorization, Extension,
|
|
18
|
+
export { IUserAuthorization, Extension, PartialSiweMessage, UserAuthorizationConfig, } from "./userAuthorization";
|
|
15
19
|
export { TinyCloud, TinyCloudConfig, } from "./TinyCloud";
|
|
16
|
-
export { ServiceContext, type ServiceContextConfig, type IServiceContext, type IService, KVService, PrefixedKVService, type IKVService, type IPrefixedKVService, type KVServiceConfig, type KVGetOptions, type KVPutOptions, type KVListOptions, type KVDeleteOptions, type KVHeadOptions, type KVResponse, type KVListResponse, type KVResponseHeaders, type Result, ok, err, serviceError, ErrorCodes, type ErrorCode, type ServiceError, type ServiceSession, type InvokeFunction, type FetchFunction, type RetryPolicy, defaultRetryPolicy, SQLService, DatabaseHandle, SQLAction, type ISQLService, type IDatabaseHandle, type SQLServiceConfig, type SqlValue, type SqlStatement, type QueryOptions, type ExecuteOptions, type BatchOptions, type QueryResponse, type ExecuteResponse, type BatchResponse, type SQLActionType, DuckDbService, DuckDbDatabaseHandle, DuckDbAction, type IDuckDbService, type IDuckDbDatabaseHandle, type DuckDbServiceConfig, type DuckDbQueryOptions, type DuckDbExecuteOptions, type DuckDbBatchOptions, type DuckDbOptions, type DuckDbValue, type DuckDbStatement, type DuckDbQueryResponse, type DuckDbExecuteResponse, type DuckDbBatchResponse, type DuckDbActionType, type SchemaInfo, type TableInfo, type ColumnInfo, type ViewInfo, DataVaultService,
|
|
20
|
+
export { ServiceContext, type ServiceContextConfig, type IServiceContext, type IService, KVService, PrefixedKVService, type IKVService, type IPrefixedKVService, type KVServiceConfig, type KVGetOptions, type KVPutOptions, type KVListOptions, type KVDeleteOptions, type KVHeadOptions, type KVResponse, type KVListResponse, type KVResponseHeaders, type Result, ok, err, serviceError, ErrorCodes, type ErrorCode, type ServiceError, type ServiceSession, type InvokeFunction, type FetchFunction, type RetryPolicy, defaultRetryPolicy, SQLService, DatabaseHandle, SQLAction, type ISQLService, type IDatabaseHandle, type SQLServiceConfig, type SqlValue, type SqlStatement, type QueryOptions, type ExecuteOptions, type BatchOptions, type QueryResponse, type ExecuteResponse, type BatchResponse, type SQLActionType, DuckDbService, DuckDbDatabaseHandle, DuckDbAction, type IDuckDbService, type IDuckDbDatabaseHandle, type DuckDbServiceConfig, type DuckDbQueryOptions, type DuckDbExecuteOptions, type DuckDbBatchOptions, type DuckDbOptions, type DuckDbValue, type DuckDbStatement, type DuckDbQueryResponse, type DuckDbExecuteResponse, type DuckDbBatchResponse, type DuckDbActionType, type SchemaInfo, type TableInfo, type ColumnInfo, type ViewInfo, DataVaultService, VaultHeaders, VaultPublicSpaceKVActions, createVaultCrypto, type IDataVaultService, type VaultCrypto, type WasmVaultFunctions, type DataVaultConfig, type VaultPutOptions, type VaultGetOptions, type VaultListOptions, type VaultGrantOptions, type VaultEntry, type VaultError, } from "@tinycloud/sdk-services";
|
|
17
21
|
export { SpaceHostResult, fetchPeerId, submitHostDelegation, activateSessionWithHost, } from "./space";
|
|
18
22
|
export { Result as DelegationResult, DelegationError, DelegationErrorCodes, DelegationErrorCode, Delegation, CreateDelegationParams, CreateDelegationWasmParams, CreateDelegationWasmResult, DelegationChain, DelegationApiResponse, DelegationManagerConfig, KeyProvider, DelegationManager, SharingService, createSharingService, ISharingService, SharingServiceConfig, EncodedShareData, ReceiveOptions, ShareAccess, JWK, KeyType, KeyInfo, CapabilityEntry, DelegationRecord, DelegationChainV2, DelegationDirection, DelegationFilters, SpaceOwnership, SpaceInfo, ShareSchema, ShareLink, ShareLinkData, IngestOptions, GenerateShareParams, } from "./delegations";
|
|
19
23
|
export { CapabilityKeyRegistry, ICapabilityKeyRegistry, createCapabilityKeyRegistry, StoredDelegationChain, CapabilityKeyRegistryErrorCodes, CapabilityKeyRegistryErrorCode, SignRequest, SignResponse, SignCallback, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, EventEmitterStrategy, SignStrategy, defaultSignStrategy, SpaceCreationContext, ISpaceCreationHandler, AutoApproveSpaceCreationHandler, defaultSpaceCreationHandler, } from "./authorization";
|
|
20
24
|
export { Space, ISpace, SpaceConfig, ISpaceScopedDelegations, ISpaceScopedSharing, SpaceService, ISpaceService, SpaceServiceConfig, SpaceErrorCodes, SpaceErrorCode, createSpaceService, parseSpaceUri, buildSpaceUri, makePublicSpaceId, SpaceDelegationParams, CreateDelegationFunction, } from "./spaces";
|
|
21
|
-
export { ProtocolMismatchError, VersionCheckError, UnsupportedFeatureError,
|
|
25
|
+
export { ProtocolMismatchError, VersionCheckError, UnsupportedFeatureError, checkNodeInfo, } from "./version";
|
|
26
|
+
export type { NodeInfo } from "./version";
|
|
22
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAEL,eAAe,EAEf,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EAEf,4BAA4B,GAC7B,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACL,aAAa,EACb,OAAO,EACP,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGxD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAEL,eAAe,EAEf,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EAEf,4BAA4B,GAC7B,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,SAAS,EACT,eAAe,GAChB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAEL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,eAAe,EAEpB,KAAK,QAAQ,EA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rB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,12 +9,14 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @packageDocumentation
|
|
11
11
|
*/
|
|
12
|
+
// Platform-agnostic client types (canonical definitions)
|
|
13
|
+
export { ClientSessionSchema, EnsDataSchema, SiweConfigSchema, validateClientSession, SiweMessage, } from "./client-types";
|
|
14
|
+
// Notification handler
|
|
15
|
+
export { SilentNotificationHandler, } from "./notifications";
|
|
12
16
|
// Session storage interface and types
|
|
13
17
|
export {
|
|
14
18
|
// Validation
|
|
15
19
|
validatePersistedSessionData, } from "./storage";
|
|
16
|
-
// User authorization interface and types
|
|
17
|
-
export { SiweMessage, } from "./userAuthorization";
|
|
18
20
|
// Main TinyCloud class
|
|
19
21
|
export { TinyCloud, } from "./TinyCloud";
|
|
20
22
|
// Re-export service types from sdk-services for convenience
|
|
@@ -28,7 +30,7 @@ SQLService, DatabaseHandle, SQLAction,
|
|
|
28
30
|
// DuckDB Service
|
|
29
31
|
DuckDbService, DuckDbDatabaseHandle, DuckDbAction,
|
|
30
32
|
// Vault Service
|
|
31
|
-
DataVaultService,
|
|
33
|
+
DataVaultService, VaultHeaders, VaultPublicSpaceKVActions, createVaultCrypto, } from "@tinycloud/sdk-services";
|
|
32
34
|
// Space utilities
|
|
33
35
|
export { fetchPeerId, submitHostDelegation, activateSessionWithHost, } from "./space";
|
|
34
36
|
// Delegations
|
|
@@ -56,5 +58,5 @@ parseSpaceUri, buildSpaceUri,
|
|
|
56
58
|
// Public space utility
|
|
57
59
|
makePublicSpaceId, } from "./spaces";
|
|
58
60
|
// Protocol version checking
|
|
59
|
-
export { ProtocolMismatchError, VersionCheckError, UnsupportedFeatureError,
|
|
61
|
+
export { ProtocolMismatchError, VersionCheckError, UnsupportedFeatureError, checkNodeInfo, } from "./version";
|
|
60
62
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,yDAAyD;AACzD,OAAO,EAKL,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAExB,uBAAuB;AACvB,OAAO,EAEL,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAWzB,sCAAsC;AACtC,OAAO;AAQL,aAAa;AACb,4BAA4B,GAC7B,MAAM,WAAW,CAAC;AAUnB,uBAAuB;AACvB,OAAO,EACL,SAAS,GAEV,MAAM,aAAa,CAAC;AAErB,4DAA4D;AAC5D,OAAO;AACL,UAAU;AACV,cAAc;AAKd,aAAa;AACb,SAAS,EACT,iBAAiB,EAcjB,EAAE,EACF,GAAG,EACH,YAAY,EACZ,UAAU,EAUV,kBAAkB;AAClB,cAAc;AACd,UAAU,EACV,cAAc,EACd,SAAS;AAaT,iBAAiB;AACjB,aAAa,EACb,oBAAoB,EACpB,YAAY;AAkBZ,gBAAgB;AAChB,gBAAgB,EAChB,YAAY,EACZ,yBAAyB,EACzB,iBAAiB,GAWlB,MAAM,yBAAyB,CAAC;AAEjC,kBAAkB;AAClB,OAAO,EAEL,WAAW,EACX,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,cAAc;AACd,OAAO,EAIL,oBAAoB;AAYpB,UAAU;AACV,iBAAiB;AACjB,oBAAoB;AACpB,cAAc,EACd,oBAAoB,GAsBrB,MAAM,eAAe,CAAC;AAEvB,0BAA0B;AAC1B,OAAO;AACL,QAAQ;AACR,qBAAqB;AAGrB,UAAU;AACV,2BAA2B;AAG3B,cAAc;AACd,+BAA+B,EAW/B,mBAAmB,EAInB,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AAEzB,mBAAmB;AACnB,OAAO;AACL,eAAe;AACf,KAAK;AAKL,eAAe;AACf,YAAY,EAGZ,eAAe,EAEf,kBAAkB;AAClB,gBAAgB;AAChB,aAAa,EACb,aAAa;AACb,uBAAuB;AACvB,iBAAiB,GAIlB,MAAM,UAAU,CAAC;AAElB,4BAA4B;AAC5B,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,GACd,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification handler interface for TinyCloud SDK.
|
|
3
|
+
*
|
|
4
|
+
* Abstracts UI notifications so that web-sdk can show toasts
|
|
5
|
+
* while node-sdk uses a silent no-op handler.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Platform-agnostic notification handler.
|
|
11
|
+
*
|
|
12
|
+
* Implementations can provide different UX patterns:
|
|
13
|
+
* - Browser: toast notifications via antd or similar
|
|
14
|
+
* - Node.js: silent (default) or logging
|
|
15
|
+
* - CLI: console output
|
|
16
|
+
*/
|
|
17
|
+
export interface INotificationHandler {
|
|
18
|
+
/** Called on successful operations (e.g., "Successfully signed in") */
|
|
19
|
+
success(message: string, description?: string): void;
|
|
20
|
+
/** Called on warnings */
|
|
21
|
+
warning(message: string, description?: string): void;
|
|
22
|
+
/** Called on errors */
|
|
23
|
+
error(category: string, message: string, description?: string): void;
|
|
24
|
+
/** Optional cleanup (e.g., dismiss all active notifications) */
|
|
25
|
+
cleanup?(): void;
|
|
26
|
+
}
|
|
27
|
+
/** No-op handler for environments without UI (node-sdk default). */
|
|
28
|
+
export declare class SilentNotificationHandler implements INotificationHandler {
|
|
29
|
+
success(): void;
|
|
30
|
+
warning(): void;
|
|
31
|
+
error(): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,yBAAyB;IACzB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,uBAAuB;IACvB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrE,gEAAgE;IAChE,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB;AAED,oEAAoE;AACpE,qBAAa,yBAA0B,YAAW,oBAAoB;IACpE,OAAO,IAAI,IAAI;IACf,OAAO,IAAI,IAAI;IACf,KAAK,IAAI,IAAI;CACd"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification handler interface for TinyCloud SDK.
|
|
3
|
+
*
|
|
4
|
+
* Abstracts UI notifications so that web-sdk can show toasts
|
|
5
|
+
* while node-sdk uses a silent no-op handler.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/** No-op handler for environments without UI (node-sdk default). */
|
|
10
|
+
export class SilentNotificationHandler {
|
|
11
|
+
success() { }
|
|
12
|
+
warning() { }
|
|
13
|
+
error() { }
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAqBH,oEAAoE;AACpE,MAAM,OAAO,yBAAyB;IACpC,OAAO,KAAU,CAAC;IAClB,OAAO,KAAU,CAAC;IAClB,KAAK,KAAU,CAAC;CACjB"}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import { ISigner } from "./signer";
|
|
2
2
|
import { ISessionStorage } from "./storage";
|
|
3
3
|
import { SignStrategy, ISpaceCreationHandler } from "./authorization";
|
|
4
|
-
export { ClientSession,
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export { ClientSession, EnsData, SiweConfig, SiweMessage } from "./client-types";
|
|
5
|
+
import type { ClientSession, SiweConfig } from "./client-types";
|
|
6
|
+
/**
|
|
7
|
+
* Interface for an extension to TCW.
|
|
8
|
+
* This is the platform-agnostic subset — browser-coupled extensions
|
|
9
|
+
* (IConnected, ConfigOverrides, ExtraFields) live in web-sdk/providers.
|
|
10
|
+
*/
|
|
11
|
+
export interface Extension {
|
|
12
|
+
/** [recap] Capability namespace. */
|
|
13
|
+
namespace?: string;
|
|
14
|
+
/** [recap] Default delegated actions in capability namespace. */
|
|
15
|
+
defaultActions?(): Promise<string[]>;
|
|
16
|
+
/** [recap] Delegated actions by target in capability namespace. */
|
|
17
|
+
targetedActions?(): Promise<{
|
|
18
|
+
[target: string]: string[];
|
|
19
|
+
}>;
|
|
20
|
+
/** [recap] Extra metadata to help validate the capability. */
|
|
21
|
+
extraFields?(): Promise<Record<string, unknown>>;
|
|
22
|
+
/** Hook to run after TCW has signed in. */
|
|
23
|
+
afterSignIn?(session: ClientSession): Promise<void>;
|
|
24
|
+
}
|
|
7
25
|
/**
|
|
8
26
|
* Partial SIWE message for overrides.
|
|
9
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAuthorization.d.ts","sourceRoot":"","sources":["../src/userAuthorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,eAAe,EAAwB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+1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
export { SiweMessage } from "
|
|
1
|
+
// Re-export platform-agnostic types from client-types (canonical definitions)
|
|
2
|
+
export { SiweMessage } from "./client-types";
|
|
3
3
|
//# sourceMappingURL=userAuthorization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAuthorization.js","sourceRoot":"","sources":["../src/userAuthorization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"userAuthorization.js","sourceRoot":"","sources":["../src/userAuthorization.ts"],"names":[],"mappings":"AAIA,8EAA8E;AAC9E,OAAO,EAAsC,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -11,7 +11,8 @@ import type { Result } from "./delegations/types.schema";
|
|
|
11
11
|
import type { ValidationError } from "./storage.schema";
|
|
12
12
|
import type { ISigner } from "./signer";
|
|
13
13
|
import type { ISessionStorage } from "./storage";
|
|
14
|
-
import type { Extension
|
|
14
|
+
import type { Extension } from "./userAuthorization";
|
|
15
|
+
import type { SiweConfig } from "./client-types";
|
|
15
16
|
/**
|
|
16
17
|
* Schema for partial SIWE message overrides.
|
|
17
18
|
*
|
|
@@ -49,12 +50,12 @@ export declare const PartialSiweMessageSchema: z.ZodObject<{
|
|
|
49
50
|
domain?: string | undefined;
|
|
50
51
|
address?: string | undefined;
|
|
51
52
|
chainId?: number | undefined;
|
|
53
|
+
uri?: string | undefined;
|
|
52
54
|
nonce?: string | undefined;
|
|
53
|
-
issuedAt?: string | undefined;
|
|
54
55
|
expirationTime?: string | undefined;
|
|
55
56
|
requestId?: string | undefined;
|
|
56
57
|
resources?: string[] | undefined;
|
|
57
|
-
|
|
58
|
+
issuedAt?: string | undefined;
|
|
58
59
|
}, {
|
|
59
60
|
notBefore?: string | undefined;
|
|
60
61
|
statement?: string | undefined;
|
|
@@ -62,12 +63,12 @@ export declare const PartialSiweMessageSchema: z.ZodObject<{
|
|
|
62
63
|
domain?: string | undefined;
|
|
63
64
|
address?: string | undefined;
|
|
64
65
|
chainId?: number | undefined;
|
|
66
|
+
uri?: string | undefined;
|
|
65
67
|
nonce?: string | undefined;
|
|
66
|
-
issuedAt?: string | undefined;
|
|
67
68
|
expirationTime?: string | undefined;
|
|
68
69
|
requestId?: string | undefined;
|
|
69
70
|
resources?: string[] | undefined;
|
|
70
|
-
|
|
71
|
+
issuedAt?: string | undefined;
|
|
71
72
|
}>;
|
|
72
73
|
export type PartialSiweMessage = z.infer<typeof PartialSiweMessageSchema>;
|
|
73
74
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAuthorization.schema.d.ts","sourceRoot":"","sources":["../src/userAuthorization.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"userAuthorization.schema.d.ts","sourceRoot":"","sources":["../src/userAuthorization.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;IACnC,qCAAqC;;IAErC,uCAAuC;;IAEvC,+BAA+B;;IAE/B,mCAAmC;;IAEnC,kCAAkC;;IAElC,qCAAqC;;IAErC,kCAAkC;;IAElC,0BAA0B;;IAE1B,sBAAsB;;IAEtB,sBAAsB;;IAEtB,iBAAiB;;IAEjB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEtB,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;IACxC;;;OAGG;;IAMH;;;OAGG;;IAUH;;;OAGG;;IAUH;;;OAGG;;IAGH;;OAEG;;IAYH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGH;;;OAGG;;;;;;;;;;;;;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAIpF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,OAAO,GACZ,MAAM,CAAC,uBAAuB,EAAE,eAAe,CAAC,CAclD;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,OAAO,GACZ,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAc7C"}
|
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import { SignStrategySchema } from "./authorization/strategies.schema";
|
|
11
11
|
import { SpaceCreationHandlerSchema } from "./authorization/spaceCreation.schema";
|
|
12
|
-
// =============================================================================
|
|
13
12
|
// Partial SIWE Message Schema
|
|
14
|
-
// =============================================================================
|
|
15
13
|
/**
|
|
16
14
|
* Schema for partial SIWE message overrides.
|
|
17
15
|
*
|
|
@@ -43,9 +41,7 @@ export const PartialSiweMessageSchema = z.object({
|
|
|
43
41
|
/** Resources array */
|
|
44
42
|
resources: z.array(z.string()).optional(),
|
|
45
43
|
});
|
|
46
|
-
// =============================================================================
|
|
47
44
|
// User Authorization Config Schema
|
|
48
|
-
// =============================================================================
|
|
49
45
|
/**
|
|
50
46
|
* Schema for UserAuthorization configuration.
|
|
51
47
|
*
|
|
@@ -116,9 +112,7 @@ export const UserAuthorizationConfigSchema = z.object({
|
|
|
116
112
|
*/
|
|
117
113
|
sessionExpirationMs: z.number().int().positive().optional(),
|
|
118
114
|
});
|
|
119
|
-
// =============================================================================
|
|
120
115
|
// Validation Helpers
|
|
121
|
-
// =============================================================================
|
|
122
116
|
/**
|
|
123
117
|
* Validates a UserAuthorizationConfig object and returns a Result.
|
|
124
118
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAuthorization.schema.js","sourceRoot":"","sources":["../src/userAuthorization.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"userAuthorization.schema.js","sourceRoot":"","sources":["../src/userAuthorization.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,8BAA8B;AAE9B;;;;GAIG;AACH,M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AAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AACzC,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -24,14 +24,9 @@ export declare class UnsupportedFeatureError extends Error {
|
|
|
24
24
|
name: "UnsupportedFeatureError";
|
|
25
25
|
constructor(feature: string, host: string, availableFeatures: string[]);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* @param fetchFn - Fetch implementation (defaults to globalThis.fetch)
|
|
33
|
-
* @throws VersionCheckError if the /version endpoint is unreachable
|
|
34
|
-
* @throws ProtocolMismatchError if protocol versions don't match
|
|
35
|
-
*/
|
|
36
|
-
export declare function checkNodeVersion(host: string, sdkProtocol: number, fetchFn?: typeof globalThis.fetch): Promise<string[]>;
|
|
27
|
+
export interface NodeInfo {
|
|
28
|
+
features: string[];
|
|
29
|
+
quotaUrl?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function checkNodeInfo(host: string, sdkProtocol: number, fetchFn?: typeof globalThis.fetch): Promise<NodeInfo>;
|
|
37
32
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qBAAa,qBAAsB,SAAQ,KAAK;aAG5B,WAAW,EAAE,MAAM;aACnB,YAAY,EAAE,MAAM;aACpB,WAAW,EAAE,MAAM;aACnB,IAAI,EAAE,MAAM;IAL9B,IAAI,EAAG,uBAAuB,CAAU;gBAEtB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM;CAS/B;AAED,qBAAa,iBAAkB,SAAQ,KAAK;aAGxB,IAAI,EAAE,MAAM;aACZ,KAAK,CAAC,EAAE,KAAK;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ACnB;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,OAAO,UAAU,CAAC,KAAyC,GACnE,OAAO,CAAC,QAAQ,CAAC,CAkCnB"}
|
package/dist/version.js
CHANGED
|
@@ -18,7 +18,7 @@ export class ProtocolMismatchError extends Error {
|
|
|
18
18
|
}
|
|
19
19
|
export class VersionCheckError extends Error {
|
|
20
20
|
constructor(host, cause) {
|
|
21
|
-
super(`Failed to
|
|
21
|
+
super(`Failed to fetch node info at ${host}. Ensure the node is running and the /info endpoint is accessible.`);
|
|
22
22
|
this.host = host;
|
|
23
23
|
this.cause = cause;
|
|
24
24
|
this.name = "VersionCheckError";
|
|
@@ -34,19 +34,10 @@ export class UnsupportedFeatureError extends Error {
|
|
|
34
34
|
this.name = "UnsupportedFeatureError";
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
* Check that the SDK protocol version matches the node's protocol version.
|
|
39
|
-
*
|
|
40
|
-
* @param host - The TinyCloud node host URL
|
|
41
|
-
* @param sdkProtocol - The SDK's protocol version (from WASM)
|
|
42
|
-
* @param fetchFn - Fetch implementation (defaults to globalThis.fetch)
|
|
43
|
-
* @throws VersionCheckError if the /version endpoint is unreachable
|
|
44
|
-
* @throws ProtocolMismatchError if protocol versions don't match
|
|
45
|
-
*/
|
|
46
|
-
export async function checkNodeVersion(host, sdkProtocol, fetchFn = globalThis.fetch.bind(globalThis)) {
|
|
37
|
+
export async function checkNodeInfo(host, sdkProtocol, fetchFn = globalThis.fetch.bind(globalThis)) {
|
|
47
38
|
let response;
|
|
48
39
|
try {
|
|
49
|
-
response = await fetchFn(`${host}/
|
|
40
|
+
response = await fetchFn(`${host}/info`, {
|
|
50
41
|
signal: AbortSignal.timeout(5000),
|
|
51
42
|
});
|
|
52
43
|
}
|
|
@@ -60,6 +51,9 @@ export async function checkNodeVersion(host, sdkProtocol, fetchFn = globalThis.f
|
|
|
60
51
|
if (sdkProtocol !== data.protocol) {
|
|
61
52
|
throw new ProtocolMismatchError(sdkProtocol, data.protocol, data.version, host);
|
|
62
53
|
}
|
|
63
|
-
return
|
|
54
|
+
return {
|
|
55
|
+
features: data.features ?? [],
|
|
56
|
+
quotaUrl: data.quota_url,
|
|
57
|
+
};
|
|
64
58
|
}
|
|
65
59
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAE9C,YACkB,WAAmB,EACnB,YAAoB,EACpB,WAAmB,EACnB,IAAY;QAE5B,KAAK,CACH,wBAAwB,WAAW,+CAA+C,YAAY,WAAW,WAAW,QAAQ,IAAI,IAAI;YAClI,CAAC,WAAW,GAAG,YAAY;gBACzB,CAAC,CAAC,yBAAyB;gBAC3B,CAAC,CAAC,mCAAmC,CAAC,CAC3C,CAAC;QAVc,gBAAW,GAAX,WAAW,CAAQ;QACnB,iBAAY,GAAZ,YAAY,CAAQ;QACpB,gBAAW,GAAX,WAAW,CAAQ;QACnB,SAAI,GAAJ,IAAI,CAAQ;QAL9B,SAAI,GAAG,uBAAgC,CAAC;IAaxC,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAE1C,YACkB,IAAY,EACZ,KAAa;QAE7B,KAAK,CACH,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAE9C,YACkB,WAAmB,EACnB,YAAoB,EACpB,WAAmB,EACnB,IAAY;QAE5B,KAAK,CACH,wBAAwB,WAAW,+CAA+C,YAAY,WAAW,WAAW,QAAQ,IAAI,IAAI;YAClI,CAAC,WAAW,GAAG,YAAY;gBACzB,CAAC,CAAC,y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Y,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAKlC,CAAC;IAEF,IAAI,WAAW,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,qBAAqB,CAC7B,WAAW,EACX,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,OAAO,EACZ,IAAI,CACL,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;QAC7B,QAAQ,EAAE,IAAI,CAAC,SAAS;KACzB,CAAC;AACJ,CAAC"}
|
package/dist/wasm.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WASM binding abstraction for TinyCloud SDK.
|
|
3
|
+
*
|
|
4
|
+
* Allows TinyCloudNode to accept either @tinycloud/node-sdk-wasm (Node.js)
|
|
5
|
+
* or @tinycloud/web-sdk-wasm (browser) without direct dependency on either.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type { InvokeFunction } from "@tinycloud/sdk-services";
|
|
10
|
+
/**
|
|
11
|
+
* Platform-agnostic WASM bindings interface.
|
|
12
|
+
*
|
|
13
|
+
* Each platform provides its own implementation:
|
|
14
|
+
* - node-sdk-wasm: Node.js WASM bindings
|
|
15
|
+
* - web-sdk-wasm: Browser WASM bindings
|
|
16
|
+
*/
|
|
17
|
+
export interface IWasmBindings {
|
|
18
|
+
/** Invoke a TinyCloud action */
|
|
19
|
+
invoke: InvokeFunction;
|
|
20
|
+
/** Prepare a session (generate session key, build SIWE message) */
|
|
21
|
+
prepareSession: (params: any) => any;
|
|
22
|
+
/** Complete session setup (create delegation) */
|
|
23
|
+
completeSessionSetup: (params: any) => any;
|
|
24
|
+
/** Ensure an address is in EIP-55 checksummed format */
|
|
25
|
+
ensureEip55: (address: string) => string;
|
|
26
|
+
/** Generate a space ID from address, chain ID, and prefix */
|
|
27
|
+
makeSpaceId: (address: string, chainId: number, prefix: string) => string;
|
|
28
|
+
/** Create a delegation */
|
|
29
|
+
createDelegation: (...args: any[]) => any;
|
|
30
|
+
/** Generate a host SIWE message for space activation */
|
|
31
|
+
generateHostSIWEMessage: (params: any) => string;
|
|
32
|
+
/** Convert a signed SIWE message to delegation headers */
|
|
33
|
+
siweToDelegationHeaders: (params: any) => any;
|
|
34
|
+
/** Get the protocol version */
|
|
35
|
+
protocolVersion: () => number;
|
|
36
|
+
vault_encrypt: (key: Uint8Array, plaintext: Uint8Array) => Uint8Array;
|
|
37
|
+
vault_decrypt: (key: Uint8Array, blob: Uint8Array) => Uint8Array;
|
|
38
|
+
vault_derive_key: (salt: Uint8Array, signature: Uint8Array, info: Uint8Array) => Uint8Array;
|
|
39
|
+
vault_x25519_from_seed: (seed: Uint8Array) => {
|
|
40
|
+
publicKey: Uint8Array;
|
|
41
|
+
privateKey: Uint8Array;
|
|
42
|
+
};
|
|
43
|
+
vault_x25519_dh: (privateKey: Uint8Array, publicKey: Uint8Array) => Uint8Array;
|
|
44
|
+
vault_random_bytes: (length: number) => Uint8Array;
|
|
45
|
+
vault_sha256: (data: Uint8Array) => Uint8Array;
|
|
46
|
+
/** Factory for session managers */
|
|
47
|
+
createSessionManager: () => ISessionManager;
|
|
48
|
+
/** Ensure WASM module is initialized (optional — some bindings auto-init) */
|
|
49
|
+
ensureInitialized?: () => Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Session key manager backed by WASM.
|
|
53
|
+
*
|
|
54
|
+
* Manages Ed25519 session keys used for delegated authentication.
|
|
55
|
+
*/
|
|
56
|
+
export interface ISessionManager {
|
|
57
|
+
/** Create a new session key with the given ID, returns the DID */
|
|
58
|
+
createSessionKey(id: string): string;
|
|
59
|
+
/** Rename a session key ID */
|
|
60
|
+
renameSessionKeyId(oldId: string, newId: string): void;
|
|
61
|
+
/** Get the DID for a session key */
|
|
62
|
+
getDID(keyId: string): string;
|
|
63
|
+
/** Get the JWK representation of a session key */
|
|
64
|
+
jwk(keyId: string): string | undefined;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=wasm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,MAAM,EAAE,cAAc,CAAC;IACvB,mEAAmE;IACnE,cAAc,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IACrC,iDAAiD;IACjD,oBAAoB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAC3C,wDAAwD;IACxD,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,6DAA6D;IAC7D,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1E,0BAA0B;IAC1B,gBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;IAC1C,wDAAwD;IACxD,uBAAuB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;IACjD,0DAA0D;IAC1D,uBAAuB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAC9C,+BAA+B;IAC/B,eAAe,EAAE,MAAM,MAAM,CAAC;IAG9B,aAAa,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,KAAK,UAAU,CAAC;IACtE,aAAa,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,KAAK,UAAU,CAAC;IACjE,gBAAgB,EAAE,CAChB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,UAAU,KACb,UAAU,CAAC;IAChB,sBAAsB,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK;QAAE,SAAS,EAAE,UAAU,CAAC;QAAC,UAAU,EAAE,UAAU,CAAA;KAAE,CAAC;IAChG,eAAe,EAAE,CACf,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,UAAU,KAClB,UAAU,CAAC;IAChB,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,UAAU,CAAC;IACnD,YAAY,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,CAAC;IAE/C,mCAAmC;IACnC,oBAAoB,EAAE,MAAM,eAAe,CAAC;IAE5C,6EAA6E;IAC7E,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,8BAA8B;IAC9B,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACvD,oCAAoC;IACpC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,kDAAkD;IAClD,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACxC"}
|
package/dist/wasm.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WASM binding abstraction for TinyCloud SDK.
|
|
3
|
+
*
|
|
4
|
+
* Allows TinyCloudNode to accept either @tinycloud/node-sdk-wasm (Node.js)
|
|
5
|
+
* or @tinycloud/web-sdk-wasm (browser) without direct dependency on either.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=wasm.js.map
|
package/dist/wasm.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm.js","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinycloud/sdk-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Core TinyCloud SDK - shared interfaces and TinyCloud class",
|
|
5
5
|
"author": "TinyCloud, Inc.",
|
|
6
6
|
"license": "EGPL",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"test": "bun test"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tinycloud/sdk-services": "^1.
|
|
28
|
-
"
|
|
27
|
+
"@tinycloud/sdk-services": "^1.7.0",
|
|
28
|
+
"siwe": "^2.3.2",
|
|
29
29
|
"zod": "^3.22.0",
|
|
30
30
|
"zod-to-json-schema": "^3.22.0"
|
|
31
31
|
},
|