NOVA SDK for Rust
Version: 1.0.3
License: MIT
Network: NEAR Protocol Mainnet
Crates: nova-sdk-rs
A Rust SDK for NOVA's secure, decentralized file-sharing primitive on NEAR. NOVA hybridizes on-chain access control with off-chain TEE-secured keys via Shade Agents, using nonce-based ed25519-signed tokens for ephemeral, verifiable access. This ensures privacy-first data sharing for AI datasets, healthcare/financial records, and sensitive documents.
Features
- š Zero-Knowledge Architecture - Keys managed in TEE; never exposed to SDK
- š IPFS Storage - Decentralized file storage via Pinata
- āļø NEAR Blockchain - Immutable access control & transaction logs
- š”ļø API Key Auth - Secure authentication via API keys (get yours at nova-sdk.com)
- š Automated Signing - MCP server signs transactions using keys from Shade TEE
- š„ Group Management - Fine-grained membership with automatic key rotation on revocation
- š Composite Operations - Simplified workflows for upload/retrieve
Installation
Add to Cargo.toml:
[]
= "1.0.3"
= { = "1", = ["full"] }
= "0.4"
ā ļø Mainnet Notice
NOVA v1.0.0 operates on NEAR mainnet by default. All operations consume real NEAR tokens.
Typical costs:
- Register group:
0.05 NEAR ($0.15 USD) - Upload file: ~0.01 NEAR + IPFS storage
- Retrieve file: ~0.001 NEAR
For development, use testnet configuration.
Quick Start
1. Prerequisites
- Create a NOVA account at nova-sdk.com
- Generate an API key from the "Manage Account" menu
- Fund your account with NEAR tokens for transaction fees
2. Basic Usage
use ;
use fs;
async
Core Concepts
Groups
Groups manage shared access to encrypted files. Each group has:
- A unique identifier (
group_id) - An owner who manages membership
- A shared encryption key stored off-chain in Shade Agent/TEE (never stored publicly).
- A list of authorized members
Access Control (Ephemeral Tokens)
NOVA uses signed tokens for key access:
- Generate payload (group_id/user_id/nonce/timestamp/signing_pk_b58).
- Sign with ed25519 (from account keypair).
- Claim on-chain (claim_token): Verifies sig/membership/nonce (5min window), returns token.
- Present to Shade: TEE decrypts key, verifies checksum, responds transiently.
Encryption
All data is encrypted client-side using AES-256-GCM:
- 256-bit symmetric keys (retrieved from Shade TEE)
- 12-byte random IV per encryption
- Authenticated encryption with integrity verification
- SHA256 hashing for file integrity
- Keys never leave the client unencrypted
Transaction Recording
File metadata (CID/hash) is recorded on-chain automatically during composite_upload.
// Query group transactions
let txs = sdk.get_transactions_for_group.await?;
for tx in txs
Authentication
The SDK uses API keys for secure authentication. Get your key at nova-sdk.com:
- Create or log into your NOVA account
- Click "Manage Account"
- Click "Generate API Key"
- Copy the key (shown only once!)
# Store in .env (never commit to git!)
NOVA_ACCOUNT_ID=alice.nova-sdk.near
NOVA_API_KEY=nova_sk_xxxxxxxxxxxxxxxxxxxxx
use ;
// Initialize with API key
let config = default
.with_api_key;
let sdk = with_config?;
// Force refresh session token if needed
sdk.refresh_token.await?;
Note: One API key per account. Generating a new key invalidates the old one.
API Reference
Initialization
use ;
// Standard usage (mainnet) - API key required
let config = default
.with_api_key;
let sdk = with_config?;
// Testnet
let config = testnet
.with_api_key;
let sdk = with_config?;
// Force session token refresh if needed
sdk.refresh_token.await?;
Group Management
// Check authorization
sdk.auth_status.await?;
// Register group
sdk.register_group.await?;
// Add member
sdk.add_group_member.await?;
// Revoke member
sdk.revoke_group_member.await?;
File Operations
// Upload (encrypts locally, uploads to IPFS, records on NEAR)
let result = sdk.upload.await?;
// Returns: UploadResult { cid, trans_id, file_hash }
// Retrieve (fetches from IPFS, decrypts locally)
let retrieved = sdk.retrieve.await?;
// Returns: RetrieveResult { data, ipfs_hash, group_id }
Deprecated methods (still work, but emit warnings):
// Use upload() instead
sdk.composite_upload.await?;
// Use retrieve() instead
sdk.composite_retrieve.await?;
Error Handling
The SDK uses a custom NovaError enum:
use NovaError;
match sdk.upload.await
š Security Considerations
- Never commit API keys - Use environment variables
- Verify network - Check
sdk.network_id()before operations - Validate file hashes - Compare after retrieval
- Use TLS - Always connect over secure connections
- Regenerate API keys - If compromised, generate a new key at nova-sdk.com
- Client-side encryption - Keys are fetched from TEE and used locally; encrypted data travels separately from keys
Examples
See the examples directory for complete working examples:
simple_upload.rs- Basic file uploadgroup_management.rs- Managing groups and members
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass (
cargo test) - Submit a pull request
License
MIT LICENSE - Copyright (c) 2026 CivicTech OĆ
Resources
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions