@tinycloudlabs/web-sdk 0.2.0 → 1.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/LICENSE.md +320 -0
- package/dist/625.index.js +1 -0
- package/dist/authorization/WebSpaceCreationHandler.d.ts +40 -0
- package/dist/authorization/WebSpaceCreationHandler.d.ts.map +1 -0
- package/dist/authorization/WebUserAuthorization.d.ts +295 -0
- package/dist/authorization/WebUserAuthorization.d.ts.map +1 -0
- package/dist/authorization/index.d.ts +12 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/delegation.d.ts +85 -0
- package/dist/delegation.d.ts.map +1 -0
- package/dist/index.d.ts +12 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/modules/Storage/index.d.ts +1 -2
- package/dist/modules/Storage/index.d.ts.map +1 -1
- package/dist/modules/Storage/tinycloud/KVServiceAdapter.d.ts +24 -0
- package/dist/modules/Storage/tinycloud/KVServiceAdapter.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/index.d.ts +1 -4
- package/dist/modules/Storage/tinycloud/index.d.ts.map +1 -1
- package/dist/modules/Storage/tinycloud/module.d.ts +1 -1
- package/dist/modules/Storage/tinycloud/types.d.ts +7 -9
- package/dist/modules/Storage/tinycloud/types.d.ts.map +1 -1
- package/dist/modules/Storage/tinycloud/types.schema.d.ts +159 -0
- package/dist/modules/Storage/tinycloud/types.schema.d.ts.map +1 -0
- package/dist/modules/UserAuthorization.d.ts +191 -58
- package/dist/modules/UserAuthorization.d.ts.map +1 -1
- package/dist/modules/WasmInitializer.d.ts +26 -0
- package/dist/modules/WasmInitializer.d.ts.map +1 -0
- package/dist/modules/index.d.ts +5 -2
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/keys/WasmKeyProvider.d.ts +126 -0
- package/dist/modules/keys/WasmKeyProvider.d.ts.map +1 -0
- package/dist/modules/keys/index.d.ts +7 -0
- package/dist/modules/keys/index.d.ts.map +1 -0
- package/dist/modules/registry/Registry.d.ts +59 -0
- package/dist/modules/registry/Registry.d.ts.map +1 -0
- package/dist/modules/tcw.d.ts +649 -53
- package/dist/modules/tcw.d.ts.map +1 -1
- package/dist/notifications/ModalManager.d.ts +6 -3
- package/dist/notifications/ModalManager.d.ts.map +1 -1
- package/dist/notifications/NodeSelectionModal.d.ts +29 -0
- package/dist/notifications/NodeSelectionModal.d.ts.map +1 -0
- package/dist/notifications/{OrbitCreationModal.d.ts → SpaceCreationModal.d.ts} +8 -8
- package/dist/notifications/{OrbitCreationModal.d.ts.map → SpaceCreationModal.d.ts.map} +1 -1
- package/dist/notifications/index.d.ts +3 -2
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/types.schema.d.ts +224 -0
- package/dist/notifications/types.schema.d.ts.map +1 -0
- package/dist/utils/debug.d.ts +9 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/multiaddr.d.ts +36 -0
- package/dist/utils/multiaddr.d.ts.map +1 -0
- package/package.json +14 -6
- package/dist/index.js.LICENSE.txt +0 -21
- package/dist/modules/Storage/TinyCloudStorage.d.ts +0 -182
- package/dist/modules/Storage/TinyCloudStorage.d.ts.map +0 -1
- package/dist/modules/Storage/interfaces.d.ts +0 -119
- package/dist/modules/Storage/interfaces.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/authenticator.d.ts +0 -12
- package/dist/modules/Storage/tinycloud/authenticator.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/capabilities.d.ts +0 -25
- package/dist/modules/Storage/tinycloud/capabilities.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/kv.d.ts +0 -18
- package/dist/modules/Storage/tinycloud/kv.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/orbit.d.ts +0 -167
- package/dist/modules/Storage/tinycloud/orbit.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/tinycloud.d.ts +0 -43
- package/dist/modules/Storage/tinycloud/tinycloud.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/walletProvider.d.ts +0 -19
- package/dist/modules/Storage/tinycloud/walletProvider.d.ts.map +0 -1
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { ConfigOverrides, TCWClientSession } from '@tinycloudlabs/web-core/client';
|
|
2
|
-
import { OrbitConnection, Response, Session } from './tinycloud';
|
|
3
|
-
import { IStorage, ITinyCloud, IStorageListOptions, IStoragePutOptions, IStorageGetOptions, IStorageDeleteOptions } from './interfaces';
|
|
4
|
-
import { IUserAuthorization, UserAuthorizationConnected } from '../..';
|
|
5
|
-
export type DelegateParams = {
|
|
6
|
-
/** The target file or folder you are sharing */
|
|
7
|
-
target: string;
|
|
8
|
-
/** The DID of the key you are delegating to. */
|
|
9
|
-
delegateDID: string;
|
|
10
|
-
/** The actions you are authorizing the delegate to do. */
|
|
11
|
-
actions: string[];
|
|
12
|
-
/** The statement in the SIWE message */
|
|
13
|
-
statement?: string;
|
|
14
|
-
};
|
|
15
|
-
export type DelegateResponse = {
|
|
16
|
-
/** The contents of the SIWE message */
|
|
17
|
-
siwe: string;
|
|
18
|
-
/** The signature of the SIWE message */
|
|
19
|
-
signature: string;
|
|
20
|
-
/** The version of the delegation issued */
|
|
21
|
-
version: number;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* TinyCloudStorage provides decentralized storage functionality through the TinyCloud protocol.
|
|
25
|
-
* This class implements both the IStorage and ITinyCloud interfaces.
|
|
26
|
-
*
|
|
27
|
-
* @remarks
|
|
28
|
-
* TinyCloudStorage allows for storing, retrieving, and managing data in a decentralized way.
|
|
29
|
-
* It handles authentication and session management for secure data operations.
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
export declare class TinyCloudStorage implements IStorage, ITinyCloud {
|
|
34
|
-
/**
|
|
35
|
-
* The namespace identifier for TinyCloud storage.
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
namespace: string;
|
|
39
|
-
/**
|
|
40
|
-
* The prefix used for all storage operations.
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
prefix: string;
|
|
44
|
-
/**
|
|
45
|
-
* Array of TinyCloud host endpoints.
|
|
46
|
-
* @private
|
|
47
|
-
*/
|
|
48
|
-
private hosts;
|
|
49
|
-
/**
|
|
50
|
-
* Whether to automatically create a new orbit if one doesn't exist.
|
|
51
|
-
* @private
|
|
52
|
-
*/
|
|
53
|
-
private autoCreateNewOrbit;
|
|
54
|
-
/**
|
|
55
|
-
* User authorization service for authentication.
|
|
56
|
-
* @private
|
|
57
|
-
*/
|
|
58
|
-
private userAuth;
|
|
59
|
-
/**
|
|
60
|
-
* Reference to the TinyCloud WASM module.
|
|
61
|
-
* @private
|
|
62
|
-
*/
|
|
63
|
-
private tinycloudModule?;
|
|
64
|
-
/**
|
|
65
|
-
* The user's orbit identifier.
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
orbitId?: string;
|
|
69
|
-
/**
|
|
70
|
-
* The connection to the orbit.
|
|
71
|
-
* @private
|
|
72
|
-
*/
|
|
73
|
-
private _orbit?;
|
|
74
|
-
/**
|
|
75
|
-
* Session Manager. Holds session keys and session objects.
|
|
76
|
-
* @private
|
|
77
|
-
*/
|
|
78
|
-
private sessionManager?;
|
|
79
|
-
/**
|
|
80
|
-
* The domain to display in the SIWE message.
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
domain?: string;
|
|
84
|
-
/**
|
|
85
|
-
* Creates a new instance of the TinyCloudStorage class.
|
|
86
|
-
*
|
|
87
|
-
* @param config - Configuration options for TinyCloud storage
|
|
88
|
-
* @param config.hosts - Optional array of TinyCloud host endpoints
|
|
89
|
-
* @param config.prefix - Optional prefix to use for all storage operations
|
|
90
|
-
* @param config.autoCreateNewOrbit - Whether to automatically create a new orbit if one doesn't exist
|
|
91
|
-
* @param userAuth - User authorization interface for authentication
|
|
92
|
-
*
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
constructor(config: any, userAuth: IUserAuthorization);
|
|
96
|
-
afterConnect(tcw: UserAuthorizationConnected): Promise<ConfigOverrides>;
|
|
97
|
-
targetedActions(): Promise<{
|
|
98
|
-
[target: string]: string[];
|
|
99
|
-
}>;
|
|
100
|
-
generateTinyCloudSession(tcwSession: TCWClientSession): Promise<Session>;
|
|
101
|
-
afterSignIn(tcwSession: TCWClientSession): Promise<void>;
|
|
102
|
-
get orbit(): OrbitConnection;
|
|
103
|
-
/**
|
|
104
|
-
* Retrieves data from storage by key.
|
|
105
|
-
*
|
|
106
|
-
* @param key - The key to retrieve
|
|
107
|
-
* @param options - Optional configuration for the get operation
|
|
108
|
-
* @returns A Promise containing the response with the data
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* ```ts
|
|
112
|
-
* const response = await tinycloudStorage.get('myData');
|
|
113
|
-
* console.log(response.data);
|
|
114
|
-
* ```
|
|
115
|
-
*
|
|
116
|
-
* @public
|
|
117
|
-
*/
|
|
118
|
-
get(key: string, options?: IStorageGetOptions): Promise<Response>;
|
|
119
|
-
/**
|
|
120
|
-
* Stores data in storage with the specified key.
|
|
121
|
-
*
|
|
122
|
-
* @param key - The key to store the data under
|
|
123
|
-
* @param value - The value to store
|
|
124
|
-
* @param options - Optional configuration for the put operation
|
|
125
|
-
* @returns A Promise containing the response from the storage operation
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```ts
|
|
129
|
-
* const data = { name: 'Example', value: 42 };
|
|
130
|
-
* await tinycloudStorage.put('myData', data);
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* @public
|
|
134
|
-
*/
|
|
135
|
-
put(key: string, value: any, options?: IStoragePutOptions): Promise<Response>;
|
|
136
|
-
/**
|
|
137
|
-
* Lists keys in storage, optionally filtered by path.
|
|
138
|
-
*
|
|
139
|
-
* @param options - Configuration options for the list operation
|
|
140
|
-
* @param options.prefix - Custom prefix to use instead of the default
|
|
141
|
-
* @param options.path - Sub-path to list within the prefix
|
|
142
|
-
* @param options.removePrefix - Whether to remove the prefix from the returned keys
|
|
143
|
-
* @param options.request - Additional request options
|
|
144
|
-
* @returns A Promise containing the response with the list of keys
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```ts
|
|
148
|
-
* const response = await tinycloudStorage.list({
|
|
149
|
-
* path: 'folder',
|
|
150
|
-
* removePrefix: true
|
|
151
|
-
* });
|
|
152
|
-
* console.log(response.data); // List of keys
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* @public
|
|
156
|
-
*/
|
|
157
|
-
list(options?: IStorageListOptions): Promise<Response>;
|
|
158
|
-
/**
|
|
159
|
-
* Deletes the data stored under the specified key.
|
|
160
|
-
*
|
|
161
|
-
* @param key - The key to delete
|
|
162
|
-
* @param options - Optional configuration for the delete operation
|
|
163
|
-
* @returns A Promise containing the response from the delete operation
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```ts
|
|
167
|
-
* await tinycloudStorage.delete('myData');
|
|
168
|
-
* ```
|
|
169
|
-
*
|
|
170
|
-
* @public
|
|
171
|
-
*/
|
|
172
|
-
delete(key: string, options?: IStorageDeleteOptions): Promise<Response>;
|
|
173
|
-
deleteAll(prefix?: string): Promise<Response[]>;
|
|
174
|
-
activateSession(tcwSession?: TCWClientSession, onError?: () => void): Promise<boolean>;
|
|
175
|
-
private showOrbitCreationModal;
|
|
176
|
-
hostOrbit(tcwSession?: TCWClientSession): Promise<void>;
|
|
177
|
-
delegate({ target, delegateDID, actions, statement, }: DelegateParams): Promise<DelegateResponse>;
|
|
178
|
-
generateSharingLink(path: string, params?: any): Promise<string>;
|
|
179
|
-
retrieveSharingLink(encodedShare: string): Promise<Response>;
|
|
180
|
-
}
|
|
181
|
-
export default TinyCloudStorage;
|
|
182
|
-
//# sourceMappingURL=TinyCloudStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TinyCloudStorage.d.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C,UAAU,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BvD,QAAQ,CAAC,EACpB,MAAM,EACN,WAAW,EACX,OAAO,EACP,SAAS,GACV,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkChC,mBAAmB,CAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,GAAG,GACX,OAAO,CAAC,MAAM,CAAC;IA2DL,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;CAyB1E;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { TCWClientSession, TCWExtension } from '@tinycloudlabs/web-core/client';
|
|
2
|
-
import type { Request, Response, Session } from './tinycloud';
|
|
3
|
-
/**
|
|
4
|
-
* @interface IStorageBaseOptions
|
|
5
|
-
* @property prefix - Optional string identifying the folder in the storage.
|
|
6
|
-
* @property request - Optional request object to use for the operation.
|
|
7
|
-
*/
|
|
8
|
-
export interface IStorageBaseOptions {
|
|
9
|
-
prefix?: string;
|
|
10
|
-
request?: Request;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @interface IStorageGetOptions
|
|
14
|
-
* @property prefix - Optional string identifying the folder in the storage.
|
|
15
|
-
* @property request - Optional request object to use for the operation.
|
|
16
|
-
*/
|
|
17
|
-
export interface IStorageGetOptions extends IStorageBaseOptions {
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* @interface IStoragePutOptions
|
|
21
|
-
* @property prefix - Optional string identifying the folder in the storage.
|
|
22
|
-
* @property request - Optional request object to use for the operation.
|
|
23
|
-
*/
|
|
24
|
-
export interface IStoragePutOptions extends IStorageBaseOptions {
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @interface IStorageDeleteOptions
|
|
28
|
-
* @property prefix - Optional string identifying the folder in the storage.
|
|
29
|
-
* @property request - Optional request object to use for the operation.
|
|
30
|
-
*/
|
|
31
|
-
export interface IStorageDeleteOptions extends IStorageBaseOptions {
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @interface IStorageListOptions
|
|
35
|
-
* @property prefix - Optional string identifying the folder in the storage.
|
|
36
|
-
* @property path - Optional string identifying the path to be combined with the prefix in the storage.
|
|
37
|
-
* @property removePrefix - Optional boolean to remove the prefix from the file names.
|
|
38
|
-
* @property request - Optional request object to use for the operation.
|
|
39
|
-
*/
|
|
40
|
-
export interface IStorageListOptions extends IStorageBaseOptions {
|
|
41
|
-
path?: string;
|
|
42
|
-
removePrefix?: boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Represents a storage interface that defines basic storage operations.
|
|
46
|
-
*/
|
|
47
|
-
interface IStorage extends TCWExtension {
|
|
48
|
-
/**
|
|
49
|
-
* Retrieves the stored value associated with the specified key.
|
|
50
|
-
* @param key - The unique identifier for the stored value.
|
|
51
|
-
* @param options - IStorageGetOptions object.
|
|
52
|
-
* @returns A Promise that resolves to the value associated with the given key or undefined if the key does not exist.
|
|
53
|
-
*/
|
|
54
|
-
get(key: string, options?: IStorageGetOptions): Promise<Response>;
|
|
55
|
-
/**
|
|
56
|
-
* Stores a value with the specified key.
|
|
57
|
-
* @param key - The unique identifier for the stored value.
|
|
58
|
-
* @param value - The value to store under the given key.
|
|
59
|
-
* @param options - IStoragePutOptions object.
|
|
60
|
-
* @returns A Promise that resolves when the operation is complete.
|
|
61
|
-
*/
|
|
62
|
-
put(key: string, value: any, options?: IStoragePutOptions): Promise<Response>;
|
|
63
|
-
/**
|
|
64
|
-
* Lists all keys currently stored in the storage.
|
|
65
|
-
* @returns A Promise that resolves to an array of strings representing the stored keys.
|
|
66
|
-
*/
|
|
67
|
-
list(): Promise<Response>;
|
|
68
|
-
/**
|
|
69
|
-
* Lists all keys currently stored in the storage.
|
|
70
|
-
* @param options - IStorageListOptions object.
|
|
71
|
-
* @returns A Promise that resolves to an array of strings representing the stored keys.
|
|
72
|
-
*/
|
|
73
|
-
list(options?: IStorageListOptions): Promise<Response>;
|
|
74
|
-
/**
|
|
75
|
-
* Deletes the stored value associated with the specified key.
|
|
76
|
-
* @param key - The unique identifier for the stored value to be deleted.
|
|
77
|
-
* @param options - IStorageDeleteOptions object.
|
|
78
|
-
* @returns A Promise that resolves when the operation is complete.
|
|
79
|
-
*/
|
|
80
|
-
delete(key: string, options?: IStorageListOptions): Promise<Response>;
|
|
81
|
-
/**
|
|
82
|
-
* Deletes all stored key-value pairs in the storage.
|
|
83
|
-
* @param prefix - String identifying the folder in the storage.
|
|
84
|
-
* @returns A Promise that resolves when the operation is complete.
|
|
85
|
-
*/
|
|
86
|
-
deleteAll(prefix?: string): Promise<Response[]>;
|
|
87
|
-
}
|
|
88
|
-
export interface ITinyCloud extends IStorage {
|
|
89
|
-
hostOrbit(tcwSession?: TCWClientSession): Promise<void>;
|
|
90
|
-
activateSession(tcwSession?: TCWClientSession, onError?: () => void): Promise<boolean>;
|
|
91
|
-
generateSharingLink(key: string, params?: any): Promise<string>;
|
|
92
|
-
retrieveSharingLink(link: string): Promise<Response>;
|
|
93
|
-
generateTinyCloudSession(tcwSession: TCWClientSession): Promise<Session>;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Represents a storage configuration object with an optional prefix.
|
|
97
|
-
*/
|
|
98
|
-
interface IStorageConfig {
|
|
99
|
-
prefix?: string;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Represents a TinyCloud storage configuration object that extends IStorageConfig.
|
|
103
|
-
*/
|
|
104
|
-
interface ITinyCloudStorageConfig extends IStorageConfig {
|
|
105
|
-
/**
|
|
106
|
-
* The TinyCloud Peer to connect to
|
|
107
|
-
* @default 'https://node.tinycloud.xyz'
|
|
108
|
-
*/
|
|
109
|
-
hosts?: string[];
|
|
110
|
-
/**
|
|
111
|
-
* Automatically create a new orbit if one does not exist.
|
|
112
|
-
* If this is false, you will need to manually create an orbit before using
|
|
113
|
-
* the storage operations on TinyCloudDataVault.
|
|
114
|
-
* @default true
|
|
115
|
-
*/
|
|
116
|
-
autoCreateNewOrbit?: boolean;
|
|
117
|
-
}
|
|
118
|
-
export { IStorage, IStorageConfig, ITinyCloudStorageConfig };
|
|
119
|
-
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/modules/Storage/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;CAAG;AAElE;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;CAAG;AAElE;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;CAAG;AAErE;;;;;;GAMG;AACH,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,UAAU,QAAS,SAAQ,YAAY;IACrC;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAElE;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE9E;;;OAGG;IACH,IAAI,IAA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import { SessionConfig, Session } from './types';
|
|
3
|
-
export declare function startSession(wallet: WalletProvider, config?: Partial<SessionConfig>): Promise<Session>;
|
|
4
|
-
export declare function activateSession(session: Session, url: string): Promise<Authenticator>;
|
|
5
|
-
export declare class Authenticator {
|
|
6
|
-
private orbitId;
|
|
7
|
-
private serializedSession;
|
|
8
|
-
constructor(session: Session);
|
|
9
|
-
invocationHeaders: (service: string, action: string, path: string) => Promise<HeadersInit>;
|
|
10
|
-
getOrbitId: () => string;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=authenticator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authenticator.d.ts","sourceRoot":"","sources":["../../../../src/modules/Storage/tinycloud/authenticator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEjD,wBAAsB,YAAY,CAChC,MAAM,EAAE,cAAc,EACtB,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC,CA2ClB;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,aAAa,CAAC,CAcxB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAS;gBACtB,OAAO,EAAE,OAAO;IAK5B,iBAAiB,YACN,MAAM,UACP,MAAM,QACR,MAAM,KACX,OAAO,CAAC,WAAW,CAAC,CACkD;IACzE,UAAU,QAAO,MAAM,CAAiB;CACzC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Authenticator } from './authenticator';
|
|
2
|
-
export declare class Capabilities {
|
|
3
|
-
private url;
|
|
4
|
-
private auth;
|
|
5
|
-
constructor(url: string, auth: Authenticator);
|
|
6
|
-
get(query: string): Promise<{
|
|
7
|
-
[cid: string]: CapSummary;
|
|
8
|
-
}>;
|
|
9
|
-
invoke: (params: {
|
|
10
|
-
headers: HeadersInit;
|
|
11
|
-
body?: Blob;
|
|
12
|
-
}) => Promise<Response>;
|
|
13
|
-
}
|
|
14
|
-
export type Capability = {
|
|
15
|
-
action: string;
|
|
16
|
-
resource: string;
|
|
17
|
-
};
|
|
18
|
-
export type CapSummary = {
|
|
19
|
-
capabilities: Capability[];
|
|
20
|
-
delegator: string;
|
|
21
|
-
delegate: string;
|
|
22
|
-
parents: string[];
|
|
23
|
-
raw: string;
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../../src/modules/Storage/tinycloud/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,qBAAa,YAAY;IACX,OAAO,CAAC,GAAG;IAAU,OAAO,CAAC,IAAI;gBAAzB,GAAG,EAAE,MAAM,EAAU,IAAI,EAAE,aAAa;IAEtD,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAC;IAWhE,MAAM,WAAY;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,KAAG,OAAO,CAAC,QAAQ,CAAC,CAChD;CAC5B;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Authenticator } from './authenticator';
|
|
2
|
-
export declare class KV {
|
|
3
|
-
private url;
|
|
4
|
-
private auth;
|
|
5
|
-
constructor(url: string, auth: Authenticator);
|
|
6
|
-
get(key: string): Promise<Response>;
|
|
7
|
-
head(key: string): Promise<Response>;
|
|
8
|
-
put(key: string, value: Blob, metadata: {
|
|
9
|
-
[key: string]: string;
|
|
10
|
-
}): Promise<Response>;
|
|
11
|
-
del(key: string): Promise<Response>;
|
|
12
|
-
list(prefix: string): Promise<Response>;
|
|
13
|
-
invoke: (params: {
|
|
14
|
-
headers: HeadersInit;
|
|
15
|
-
body?: Blob;
|
|
16
|
-
}) => Promise<Response>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=kv.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kv.d.ts","sourceRoot":"","sources":["../../../../src/modules/Storage/tinycloud/kv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,qBAAa,EAAE;IACD,OAAO,CAAC,GAAG;IAAU,OAAO,CAAC,IAAI;gBAAzB,GAAG,EAAE,MAAM,EAAU,IAAI,EAAE,aAAa;IAE/C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAMnC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAMpC,GAAG,CACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAClC,OAAO,CAAC,QAAQ,CAAC;IAUP,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAMnC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAMpD,MAAM,WAAY;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,KAAG,OAAO,CAAC,QAAQ,CAAC,CAChD;CAC5B"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { Authenticator } from './authenticator';
|
|
2
|
-
import { WalletProvider } from './walletProvider';
|
|
3
|
-
import { CapSummary } from './capabilities';
|
|
4
|
-
/**
|
|
5
|
-
* a connection to an orbit in a TinyCloud instance.
|
|
6
|
-
*
|
|
7
|
-
* This class provides methods for interacting with an orbit. Construct an instance of this class using {@link TinyCloud.orbit}.
|
|
8
|
-
*/
|
|
9
|
-
export declare class OrbitConnection {
|
|
10
|
-
private orbitId;
|
|
11
|
-
private kv;
|
|
12
|
-
private caps;
|
|
13
|
-
/** @ignore */
|
|
14
|
-
constructor(tinycloudUrl: string, authn: Authenticator);
|
|
15
|
-
/** Get the id of the connected orbit.
|
|
16
|
-
*
|
|
17
|
-
* @returns The id of the connected orbit.
|
|
18
|
-
*/
|
|
19
|
-
id(): string;
|
|
20
|
-
/** Store an object in the connected orbit.
|
|
21
|
-
*
|
|
22
|
-
* Supports storing values that are of type string,
|
|
23
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object | Object},
|
|
24
|
-
* and values that are a {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob | Blob} or Blob-like
|
|
25
|
-
* (e.g. {@link https://developer.mozilla.org/en-US/docs/Web/API/File | File}).
|
|
26
|
-
* ```ts
|
|
27
|
-
* await orbitConnection.put('a', 'value');
|
|
28
|
-
* await orbitConnection.put('b', {x: 10});
|
|
29
|
-
*
|
|
30
|
-
* let blob: Blob = new Blob(['value'], {type: 'text/plain'});
|
|
31
|
-
* await orbitConnection.put('c', blob);
|
|
32
|
-
*
|
|
33
|
-
* let file: File = fileList[0];
|
|
34
|
-
* await orbitConnection.put('d', file);
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @param key The key with which the object is indexed.
|
|
38
|
-
* @param value The value to be stored.
|
|
39
|
-
* @param req Optional request parameters. Request Headers can be passed via the `headers` property.
|
|
40
|
-
* @returns A {@link Response} without the `data` property.
|
|
41
|
-
*/
|
|
42
|
-
put(key: string, value: any, req?: Request): Promise<Response>;
|
|
43
|
-
/** Retrieve an object from the connected orbit.
|
|
44
|
-
*
|
|
45
|
-
* String and Object values, along with
|
|
46
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob | Blobs}
|
|
47
|
-
* of type `text/plain` or `application/json` are converted into their respective
|
|
48
|
-
* types on retrieval:
|
|
49
|
-
* ```ts
|
|
50
|
-
* await orbitConnection.put('string', 'value');
|
|
51
|
-
* await orbitConnection.put('json', {x: 10});
|
|
52
|
-
*
|
|
53
|
-
* let blob = new Blob(['value'], {type: 'text/plain'});
|
|
54
|
-
* await orbitConnection.put('stringBlob', blob);
|
|
55
|
-
*
|
|
56
|
-
* let blob = new Blob([{x: 10}], {type: 'application/json'});
|
|
57
|
-
* await orbitConnection.put('jsonBlob', blob);
|
|
58
|
-
*
|
|
59
|
-
* let stringData: string = await orbitConnection.get('string').then(({ data }) => data);
|
|
60
|
-
* let jsonData: {x: number} = await orbitConnection.get('json').then(({ data }) => data);
|
|
61
|
-
* let stringBlobData: string = await orbitConnection.get('stringBlob').then(({ data }) => data);
|
|
62
|
-
* let jsonBlobData: {x: number} = await orbitConnection.get('jsonBlob').then(({ data }) => data);
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* If the object has any other MIME type then a Blob will be returned:
|
|
66
|
-
* ```ts
|
|
67
|
-
* let blob = new Blob([new ArrayBuffer(8)], {type: 'image/gif'});
|
|
68
|
-
* await orbitConnection.put('gif', blob);
|
|
69
|
-
* let gifData: Blob = await orbitConnection.get('gif').then(({ data }) => data);
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* Alternatively you can retrieve any object as a
|
|
73
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream | ReadableStream},
|
|
74
|
-
* by supplying request parameters:
|
|
75
|
-
* ```ts
|
|
76
|
-
* let data = await orbitConnection.get('key', {streamBody: true}).then(
|
|
77
|
-
* ({ data }: { data?: ReadableStream }) => {
|
|
78
|
-
* // consume the stream
|
|
79
|
-
* }
|
|
80
|
-
* );
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* @param key The key with which the object is indexed.
|
|
84
|
-
* @param req Optional request parameters.
|
|
85
|
-
* @returns A {@link Response} with the `data` property (see possible types in the documentation above).
|
|
86
|
-
*/
|
|
87
|
-
get(key: string, req?: Request): Promise<Response>;
|
|
88
|
-
/** Delete an object from the connected orbit.
|
|
89
|
-
*
|
|
90
|
-
* @param key The key with which the object is indexed.
|
|
91
|
-
* @param req Optional request parameters (unused).
|
|
92
|
-
* @returns A {@link Response} without the `data` property.
|
|
93
|
-
*/
|
|
94
|
-
delete(key: string, req?: Request): Promise<Response>;
|
|
95
|
-
/**
|
|
96
|
-
* Delete all objects with the specified key prefix from the connected orbit.
|
|
97
|
-
*
|
|
98
|
-
* @param prefix Optional key prefix for filtering the objects to remove. Removes all objects if not specified.
|
|
99
|
-
* @returns A Promise of an array of {@link Response} objects for each delete operation performed.
|
|
100
|
-
*/
|
|
101
|
-
deleteAll(prefix?: string): Promise<Response[]>;
|
|
102
|
-
/** List objects in the connected orbit.
|
|
103
|
-
*
|
|
104
|
-
* The list of keys is retrieved as a list of strings:
|
|
105
|
-
* ```ts
|
|
106
|
-
* let keys: string[] = await orbitConnection.list().then(({ data }) => data);
|
|
107
|
-
* ```
|
|
108
|
-
* Optionally, you can retrieve the list of objects as a
|
|
109
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream | ReadableStream},
|
|
110
|
-
* by supplying request parameters:
|
|
111
|
-
* ```ts
|
|
112
|
-
* let data = await orbitConnection.list("", {streamBody: true}).then(
|
|
113
|
-
* ({ data }: { data?: ReadableStream }) => {
|
|
114
|
-
* // consume the stream
|
|
115
|
-
* }
|
|
116
|
-
* );
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* @param prefix The prefix that the returned keys should have.
|
|
120
|
-
* @param req Optional request parameters.
|
|
121
|
-
* @returns A {@link Response} with the `data` property as a string[].
|
|
122
|
-
*/
|
|
123
|
-
list(prefix?: string, req?: Request): Promise<Response>;
|
|
124
|
-
/** Retrieve metadata about an object from the connected orbit.
|
|
125
|
-
*
|
|
126
|
-
* @param key The key with which the object is indexed.
|
|
127
|
-
* @param req Optional request parameters (unused).
|
|
128
|
-
* @returns A {@link Response} without the `data` property.
|
|
129
|
-
*/
|
|
130
|
-
head(key: string, req?: Request): Promise<Response>;
|
|
131
|
-
sessions(): Promise<{
|
|
132
|
-
[cid: string]: CapSummary;
|
|
133
|
-
}>;
|
|
134
|
-
}
|
|
135
|
-
/** Optional request parameters.
|
|
136
|
-
*
|
|
137
|
-
* Not all options are applicable on every {@link OrbitConnection} method. See the documentation
|
|
138
|
-
* of each method to discover what options are supported.
|
|
139
|
-
*/
|
|
140
|
-
export type Request = {
|
|
141
|
-
/** Request to receive the data as a {@link https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream | ReadableStream}. */
|
|
142
|
-
streamBody?: boolean;
|
|
143
|
-
/** Add additional entries to the request HTTP Headers. */
|
|
144
|
-
headers?: {
|
|
145
|
-
[key: string]: string;
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
/** Response from tinycloud requests.
|
|
149
|
-
*
|
|
150
|
-
* The methods on {@link OrbitConnection} return a Response that may have `data` property. See the
|
|
151
|
-
* documentation of each method to discover whether a method will return data and what type you
|
|
152
|
-
* can expect.
|
|
153
|
-
*/
|
|
154
|
-
export type Response = {
|
|
155
|
-
/** Whether the request was successful or not. */
|
|
156
|
-
ok: boolean;
|
|
157
|
-
/** The HTTP status code of the response from TinyCloud. */
|
|
158
|
-
status: number;
|
|
159
|
-
/** The textual representation of the HTTP status of the response from TinyCloud. */
|
|
160
|
-
statusText: string;
|
|
161
|
-
/** Metadata about the object and the request. */
|
|
162
|
-
headers: Headers;
|
|
163
|
-
/** The body of the response from TinyCloud. */
|
|
164
|
-
data?: any;
|
|
165
|
-
};
|
|
166
|
-
export declare const hostOrbit: (wallet: WalletProvider, tinycloudUrl: string, orbitId: string, domain?: string) => Promise<Response>;
|
|
167
|
-
//# sourceMappingURL=orbit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orbit.d.ts","sourceRoot":"","sources":["../../../../src/modules/Storage/tinycloud/orbit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAgB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG1D;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,EAAE,CAAK;IACf,OAAO,CAAC,IAAI,CAAe;IAE3B,cAAc;gBACF,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IAMtD;;;OAGG;IACH,EAAE,IAAI,MAAM;IAIZ;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IA4BpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IAyBxD;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IAS3D;;;;;OAKG;IACG,SAAS,CAAC,MAAM,SAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAOjD;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,IAAI,CAAC,MAAM,SAAK,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkBzD;;;;;OAKG;IACG,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IASnD,QAAQ,IAAI,OAAO,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAC;CAGzD;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,iIAAiI;IACjI,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0DAA0D;IAC1D,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,iDAAiD;IACjD,EAAE,EAAE,OAAO,CAAC;IACZ,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,UAAU,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAIF,eAAO,MAAM,SAAS,WACZ,cAAc,gBACR,MAAM,WACX,MAAM,WACP,MAAM,KACb,OAAO,CAAC,QAAQ,CA6BlB,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { OrbitConnection } from './orbit';
|
|
2
|
-
import { WalletProvider } from './walletProvider';
|
|
3
|
-
import { SessionConfig } from './types';
|
|
4
|
-
/** Configuration for [[TinyCloud]]. */
|
|
5
|
-
export type TinyCloudOptions = {
|
|
6
|
-
/** The TinyCloud hosts that you wish to connect to.
|
|
7
|
-
*
|
|
8
|
-
* Currently only a single host is supported, but for future compatibility this property is
|
|
9
|
-
* expected to be a list. Only the first host in the list will be used.
|
|
10
|
-
*/
|
|
11
|
-
hosts: string[];
|
|
12
|
-
};
|
|
13
|
-
/** An object for interacting with TinyCloud instances. */
|
|
14
|
-
export declare class TinyCloud {
|
|
15
|
-
private config;
|
|
16
|
-
private wallet;
|
|
17
|
-
/**
|
|
18
|
-
* @param wallet The controller of the orbit that you wish to access.
|
|
19
|
-
* @param config Optional configuration for TinyCloud.
|
|
20
|
-
*/
|
|
21
|
-
constructor(wallet: WalletProvider, config: TinyCloudOptions);
|
|
22
|
-
/** Make a connection to an orbit.
|
|
23
|
-
*
|
|
24
|
-
* This method handles the creation and connection to an orbit in TinyCloud. This method should
|
|
25
|
-
* usually be used without providing any ConnectionOptions:
|
|
26
|
-
* ```ts
|
|
27
|
-
* let orbitConnection = await tinycloud.orbit();
|
|
28
|
-
* ```
|
|
29
|
-
* In this case the orbit ID will be derived from the wallet's address. The wallet will be
|
|
30
|
-
* asked to sign a message delegating access to a session key for 1 hour. If the orbit does not
|
|
31
|
-
* already exist in the TinyCloud instance, then the wallet will be asked to sign another message
|
|
32
|
-
* to permit the TinyCloud instance to host the orbit.
|
|
33
|
-
*
|
|
34
|
-
* @param config Optional parameters to configure the orbit connection.
|
|
35
|
-
* @returns Returns undefined if the TinyCloud instance was unable to host the orbit.
|
|
36
|
-
*/
|
|
37
|
-
orbit(config?: Partial<SessionConfig>): Promise<OrbitConnection | undefined>;
|
|
38
|
-
}
|
|
39
|
-
export declare const invoke: (url: string, params: {
|
|
40
|
-
headers: HeadersInit;
|
|
41
|
-
body?: Blob;
|
|
42
|
-
}) => Promise<Response>;
|
|
43
|
-
//# sourceMappingURL=tinycloud.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tinycloud.d.ts","sourceRoot":"","sources":["../../../../src/modules/Storage/tinycloud/tinycloud.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,eAAe,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,uCAAuC;AACvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,0DAA0D;AAC1D,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAAiB;IAE/B;;;OAGG;gBACS,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB;IAO5D;;;;;;;;;;;;;;OAcG;IACG,KAAK,CACT,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;CAyBxC;AAED,eAAO,MAAM,MAAM,QACZ,MAAM,UACH;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE,sBACW,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** An array of bytes represented as an array of integers. */
|
|
2
|
-
export type Bytes = ArrayLike<number>;
|
|
3
|
-
/** A common interface that a wallet must implement to be compatible with this SDK.
|
|
4
|
-
*
|
|
5
|
-
* Wallet representations implement APIs that can be reduced to this subset of functionality. The
|
|
6
|
-
* {@link https://docs.ethers.io/v5/api/signer/#Signer | Signer} from ethers is fully compatible
|
|
7
|
-
* with this interface.
|
|
8
|
-
*/
|
|
9
|
-
export interface WalletProvider {
|
|
10
|
-
/** Returns the account address. */
|
|
11
|
-
getAddress(): Promise<string>;
|
|
12
|
-
/** Returns the chain ID that this wallet is connected to. */
|
|
13
|
-
getChainId(): Promise<number>;
|
|
14
|
-
/** Performs a `personal_sign` on the message and returns the signature as a hex string of the
|
|
15
|
-
* format `"0x<65 bytes>"`.
|
|
16
|
-
*/
|
|
17
|
-
signMessage(message: Bytes | string): Promise<string>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=walletProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"walletProvider.d.ts","sourceRoot":"","sources":["../../../../src/modules/Storage/tinycloud/walletProvider.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,6DAA6D;IAC7D,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACvD"}
|