@tinycloudlabs/web-sdk 0.1.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/README.md +151 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +21 -0
- package/dist/modules/Storage/TinyCloudStorage.d.ts +181 -0
- package/dist/modules/Storage/TinyCloudStorage.d.ts.map +1 -0
- package/dist/modules/Storage/index.d.ts +3 -0
- package/dist/modules/Storage/index.d.ts.map +1 -0
- package/dist/modules/Storage/interfaces.d.ts +119 -0
- package/dist/modules/Storage/interfaces.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/authenticator.d.ts +12 -0
- package/dist/modules/Storage/tinycloud/authenticator.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/capabilities.d.ts +25 -0
- package/dist/modules/Storage/tinycloud/capabilities.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/index.d.ts +6 -0
- package/dist/modules/Storage/tinycloud/index.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/kv.d.ts +18 -0
- package/dist/modules/Storage/tinycloud/kv.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/module.d.ts +10 -0
- package/dist/modules/Storage/tinycloud/module.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/orbit.d.ts +167 -0
- package/dist/modules/Storage/tinycloud/orbit.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/tinycloud.d.ts +43 -0
- package/dist/modules/Storage/tinycloud/tinycloud.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/types.d.ts +64 -0
- package/dist/modules/Storage/tinycloud/types.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/walletProvider.d.ts +19 -0
- package/dist/modules/Storage/tinycloud/walletProvider.d.ts.map +1 -0
- package/dist/modules/UserAuthorization.d.ts +166 -0
- package/dist/modules/UserAuthorization.d.ts.map +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/tcw.d.ts +95 -0
- package/dist/tcw.d.ts.map +1 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# TinyCloud Web SDK
|
|
2
|
+
|
|
3
|
+
<img src="https://github.com/TinyCloudLabs/web-sdk/blob/main/documentation/static/img/tinycloudheader.png?raw=true" alt="TinyCloud" width="100%" />
|
|
4
|
+
|
|
5
|
+
The TinyCloud Web SDK provides all the tools you need to build decentralized web applications with TinyCloud.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@tinycloudlabs/web-sdk)
|
|
8
|
+
[](https://github.com/TinyCloudLabs/web-sdk/blob/main/LICENSE-MIT)
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Decentralized Storage** - Store and retrieve data using TinyCloud's storage protocol
|
|
13
|
+
- **Web3 Authentication** - Sign-in with Ethereum (SIWE) integration
|
|
14
|
+
- **Wallet Integration** - Seamless connection with popular Ethereum wallets
|
|
15
|
+
- **Type Safety** - Written in TypeScript with comprehensive type definitions
|
|
16
|
+
- **Easy to Use** - Simple API for common decentralized application needs
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Using npm
|
|
22
|
+
npm install @tinycloudlabs/web-sdk
|
|
23
|
+
|
|
24
|
+
# Using Yarn
|
|
25
|
+
yarn add @tinycloudlabs/web-sdk
|
|
26
|
+
|
|
27
|
+
# Using Bun (recommended)
|
|
28
|
+
bun add @tinycloudlabs/web-sdk
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { TinyCloudWeb } from '@tinycloudlabs/web-sdk';
|
|
35
|
+
|
|
36
|
+
// Initialize the SDK
|
|
37
|
+
const tc = new TinyCloudWeb();
|
|
38
|
+
|
|
39
|
+
// Connect to the user's wallet
|
|
40
|
+
await tc.connect();
|
|
41
|
+
|
|
42
|
+
// Use storage
|
|
43
|
+
const storage = tc.storage;
|
|
44
|
+
await storage.put('myKey', { hello: 'world' });
|
|
45
|
+
const result = await storage.get('myKey');
|
|
46
|
+
console.log(result.data); // { hello: 'world' }
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Basic Storage Operations
|
|
50
|
+
|
|
51
|
+
### Storing Data
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// Store a simple object
|
|
55
|
+
await storage.put('user/profile', {
|
|
56
|
+
name: 'Alice',
|
|
57
|
+
email: 'alice@example.com',
|
|
58
|
+
preferences: {
|
|
59
|
+
theme: 'dark',
|
|
60
|
+
notifications: true
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Store a string
|
|
65
|
+
await storage.put('messages/welcome', 'Welcome to the app!');
|
|
66
|
+
|
|
67
|
+
// Store binary data (as a Uint8Array)
|
|
68
|
+
const binaryData = new Uint8Array([0x00, 0x01, 0x02, 0x03]);
|
|
69
|
+
await storage.put('files/data.bin', binaryData);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Retrieving Data
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// Get an object
|
|
76
|
+
const profileResponse = await storage.get('user/profile');
|
|
77
|
+
const profile = profileResponse.data;
|
|
78
|
+
console.log(`User name: ${profile.name}`);
|
|
79
|
+
|
|
80
|
+
// Get a string
|
|
81
|
+
const messageResponse = await storage.get('messages/welcome');
|
|
82
|
+
console.log(messageResponse.data); // "Welcome to the app!"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Listing Data
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// List all keys under 'user/'
|
|
89
|
+
const userKeysResponse = await storage.list({
|
|
90
|
+
path: 'user',
|
|
91
|
+
removePrefix: true // Remove the prefix from the returned keys
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const userKeys = userKeysResponse.data;
|
|
95
|
+
console.log('User keys:', userKeys); // ['profile', ...]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Deleting Data
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
// Delete a single key
|
|
102
|
+
await storage.delete('messages/welcome');
|
|
103
|
+
|
|
104
|
+
// Delete all data under a prefix
|
|
105
|
+
await storage.deleteAll('user');
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Core Values
|
|
109
|
+
|
|
110
|
+
TinyCloud is built on these fundamental principles:
|
|
111
|
+
|
|
112
|
+
- **Sovereignty** - Built so that each user controls their data outright. Requests to access or compute on that data must be explicitly permissioned.
|
|
113
|
+
- **Privacy** - Data is stored, streamed, and computed upon in ways that minimize leakage with encryption strategies that ensure users do not need to trust an external party.
|
|
114
|
+
- **Interoperability** - Embracing artifact-based formats like Markdown, JSON Canvas, CSV, and SQLite so that data remains portable and future-proof.
|
|
115
|
+
- **Open Innovation** - We view AI's rapid growth as an opportunity to endow individuals with new capabilities—before these capabilities are seized exclusively by large institutions.
|
|
116
|
+
|
|
117
|
+
## Documentation
|
|
118
|
+
|
|
119
|
+
For complete documentation, please visit:
|
|
120
|
+
|
|
121
|
+
- [**TinyCloud SDK Documentation**](https://docs.tinycloud.xyz/)
|
|
122
|
+
- [**Guides**](https://docs.tinycloud.xyz/docs/web-sdk/guides/)
|
|
123
|
+
- [Getting Started Guide](https://docs.tinycloud.xyz/docs/web-sdk/guides/getting-started)
|
|
124
|
+
- [Storage Guide](https://docs.tinycloud.xyz/docs/web-sdk/guides/storage-guide)
|
|
125
|
+
- [Authentication Guide](https://docs.tinycloud.xyz/docs/web-sdk/guides/authentication-guide)
|
|
126
|
+
- [**API Reference**](https://docs.tinycloud.xyz/docs/web-sdk/api/)
|
|
127
|
+
- [TinyCloudStorage](https://docs.tinycloud.xyz/docs/web-sdk/api/tinycloudstorage)
|
|
128
|
+
- [UserAuthorization](https://docs.tinycloud.xyz/docs/web-sdk/api/userauthorization)
|
|
129
|
+
|
|
130
|
+
## Examples
|
|
131
|
+
|
|
132
|
+
Check out our [examples directory](https://github.com/TinyCloudLabs/web-sdk/tree/main/examples) for complete working examples of TinyCloud SDK integration.
|
|
133
|
+
|
|
134
|
+
## Contributing
|
|
135
|
+
|
|
136
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
This project is licensed under the MIT License - see the [LICENSE-MIT](https://github.com/TinyCloudLabs/web-sdk/blob/main/LICENSE-MIT) file for details.
|
|
141
|
+
|
|
142
|
+
## Support
|
|
143
|
+
|
|
144
|
+
If you encounter any issues or have questions, please file an issue on our [GitHub repository](https://github.com/TinyCloudLabs/web-sdk/issues).
|
|
145
|
+
|
|
146
|
+
## Community
|
|
147
|
+
|
|
148
|
+
Join the TinyCloud community:
|
|
149
|
+
|
|
150
|
+
- [Twitter](https://twitter.com/TinyCloudLabs)
|
|
151
|
+
- [Telegram](https://t.me/+pplkv1XbbU01MDVh)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './tcw';
|
|
2
|
+
export * from './modules';
|
|
3
|
+
export * from '@tinycloudlabs/web-core/client';
|
|
4
|
+
export * from '@tinycloudlabs/web-core';
|
|
5
|
+
export {
|
|
6
|
+
/** @deprecated use TCWClientConfig field instead */
|
|
7
|
+
TCWClientConfig as TCWConfig,
|
|
8
|
+
/** @deprecated use TCWClientProviders field instead */
|
|
9
|
+
TCWClientProviders as TCWProviders,
|
|
10
|
+
/** @deprecated use TCWClientSession field instead */
|
|
11
|
+
TCWClientSession as TCWSession, } from '@tinycloudlabs/web-core/client';
|
|
12
|
+
export { SiweMessage } from 'siwe';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,OAAO;AACL,oDAAoD;AACpD,eAAe,IAAI,SAAS;AAC5B,uDAAuD;AACvD,kBAAkB,IAAI,YAAY;AAClC,qDAAqD;AACrD,gBAAgB,IAAI,UAAU,GAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC"}
|