Skip to content

TinyCloudLabs/js-sdk

Repository files navigation

TinyCloud SDK

TinyCloud

TinyCloud SDK is a comprehensive toolkit for building decentralized applications with TinyCloud. It provides easy-to-use interfaces for storage, authentication, delegations, and sharing.

license version

Features

  • Web3 Authentication - Sign-in with Ethereum (SIWE) using your wallet
  • Space Management - Create and manage user-owned data spaces
  • KV Storage - Content-addressed key-value store scoped to user spaces
  • Delegation System - Cryptographic capability chains for fine-grained access control
  • Sharing - Portable delegation bundles for cross-user data sharing
  • Protocol Version Check - Automatic SDK-node compatibility verification during sign-in
  • Wallet Integration - Seamless connection with popular Ethereum wallets (browser SDK)
  • Server Support - Node.js SDK for server-side delegation chains and automation
  • Type Safety - Written in TypeScript with comprehensive type definitions

Packages

This monorepo contains the following packages:

Core SDKs

Package Description Platform
@tinycloud/web-sdk Browser SDK with wallet integration Browser
@tinycloud/node-sdk Node.js SDK for server-side applications Node.js

Core Libraries

Package Description
@tinycloud/web-core Shared types and utilities for browser SDK
@tinycloud/sdk-core Core utilities and types shared across all SDKs
@tinycloud/sdk-rs Rust implementation with cryptographic primitives

WASM Bindings

Package Description
@tinycloud/web-sdk-wasm WASM bindings for browser environments
@tinycloud/node-sdk-wasm WASM bindings for Node.js environments

Quick Start

Browser SDK

npm install @tinycloud/web-sdk
import { TinyCloudWeb } from '@tinycloud/web-sdk';

const tc = new TinyCloudWeb();
await tc.signIn();

// KV storage
await tc.kv.put('myKey', { hello: 'world' });
const result = await tc.kv.get('myKey');

Node.js SDK

npm install @tinycloud/node-sdk
import { TinyCloudNode } from '@tinycloud/node-sdk';

const tc = new TinyCloudNode({
  privateKey: process.env.PRIVATE_KEY,
  domain: 'api.myapp.com',
});

await tc.signIn();

// KV storage
await tc.kv.put('myKey', { hello: 'world' });
const result = await tc.kv.get('myKey');

// Delegations
const delegation = await tc.createDelegation({
  delegateDID: 'did:pkh:eip155:1:0x...',
  abilities: ['tinycloud.kv/get', 'tinycloud.kv/put'],
});

Documentation

For complete documentation, please visit:

Examples

Check out our examples directory for complete working examples of TinyCloud SDK integration.

Development

Prerequisites

  • Bun (recommended) or Node.js v16+
  • Rust for sdk-rs package

Building the SDK

# Clone the repository
git clone https://github.com/TinyCloudLabs/web-sdk.git
cd web-sdk

# Install dependencies
bun install

# Build all packages
bun run build

Running Tests

bun run test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Inspiration

The TinyCloud Web SDK is the spiritual successor to the SSX SDK. SSX was an open source project built at SpruceID, made to make it easier to build apps with Sign in with Ethereum. While SSX saw limited adoption, it was a great project that pioneered the use of Ethereum for authentication and authorization. TinyCloud Web takes some of its architectural shape from SSX, but is built to be a modern SDK for building applications with TinyCloud.

License

This project is licensed under the TinyCloud Ecosystem General Public License (EGPL) v1.5 - see the LICENSE.md file for details.

Support

If you encounter any issues or have questions, please file an issue on our GitHub repository.

Community

Join the TinyCloud community:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors