nft_storage_core

Crates.ionft_storage_core
lib.rsnft_storage_core
version0.2.0
sourcesrc
created_at2023-11-03 22:49:49.556543
updated_at2023-12-25 13:31:32.020727
descriptionA Rust client tailored for NFT.storage, providing an intuitive API wrapper for enhanced interaction with the service. It supports storing ERC-1155 compatible NFTs, encrypted file uploads with pluggable encryption modules, asset management, and decentralized identity (DID) handling. The client also enables encrypted downloads and decryption, ensuring secure data handling. It's designed with async capabilities to integrate smoothly into contemporary Rust async ecosystems.
homepagehttps://github.com/noplan-inc/nft.storage-rs
repositoryhttps://github.com/noplan-inc/nft.storage-rs
max_upload_size
id1024732
size3,379,689
serinuntius (serinuntius)

documentation

README

nft.storage-rs

Crates.io Documentation Build Status

nft.storage-rs is a Rust client for easily uploading a file to the nft.storage service.

Features

  • Upload a File, Directory, or JSON object

Installation

Add the following to your Cargo.toml:

[dependencies]
nft.storage-rs = "0.1.0"

Run:

$ cargo build

Usage

Here's a quick example:

use std::path::PathBuf;

use nft_storage_core::{encryptor::plugins::aes::AesEncryptor, NftStorageApi, NftStorageCore};

#[tokio::main]
async fn main() {
    let aes = AesEncryptor::generate_key().unwrap();

    let encryptor = Box::new(aes);
    // If pass none, use NFT_STORAGE_API_KEY envrioment variable.
    let api_key = Some("<FILL ME NFT_STORAGE_API_KEY>".to_string());
    let client = NftStorageCore::try_new(api_key, encryptor).unwrap();
    
    let path = vec![PathBuf::from("test.txt")];
    let resp = client.upload(&path, None).await.unwrap();
    println!("{}", serde_json::to_string_pretty(&resp).unwrap());
}

For more examples, please refer to the examples/ directory.

Documentation

For full documentation, please visit docs.rs/nft.storage-rs.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 172

cargo fmt