frostore

Crates.iofrostore
lib.rsfrostore
version0.3.0
sourcesrc
created_at2023-11-28 18:15:21.113683
updated_at2024-09-05 16:59:35.516173
descriptionSchnorr Threshold Signature Database
homepage
repositoryhttps://github.com/GavBog/FROSTore
max_upload_size
id1052237
size101,303
Gavin Bogie (GavBog)

documentation

README

    __________  ____  ___________              
   / ____/ __ \/ __ \/ ___/_  __/___  ________ 
  / /_  / /_/ / / / /\__ \ / / / __ \/ ___/ _ \
 / __/ / _, _/ /_/ /___/ // / / /_/ / /  /  __/
/_/   /_/ |_|\____//____//_/  \____/_/   \___/
-------------------------------------------------
Ed25519 Threshold Signature Database

Crates.io License: GPLv3

Introduction

FROSTore is a tool to prevent your Private Key from being compromised and used to sign data without your permission.

FROSTore allows you to use Ed25519 threshold signatures to bring distributed trust to your application. Keys generated by FROSTore are never combined into a single key, and are never stored on any single device. This means that even if a device is compromised, your private key is still safe.

Features

  • Create, store, and manage threshold signatures
  • Sign data with threshold signatures
  • Distributed Key Generation (DKG)
  • Customizable Minimum and Maximum thresholds

Example

A basic example of how to use FROSTore to generate a keypair (using DKG) and sign some data.

use frostore::*;

static TOTAL_PEERS: u16 = 3;
static MIN_THRESHOLD: u16 = 2;
static BOOT_NODES: [&str; 3] = [
    "/ip4/127.0.0.1/tcp/63888/p2p/12D3KooWDThDUUhDC2bi26E8LhHKsvLZq4wi7dNN5zypNVucgbqx",
    "/ip4/127.0.0.1/tcp/58521/p2p/12D3KooWEk8vk2vFp7qTbif7X5kjQGJorFThxu8LheTF22Ef2fRc",
    "/ip4/127.0.0.1/tcp/58560/p2p/12D3KooWDs3SvAP4pfQAdqse9AroqaAsxDuswV6iFkc6aAwJooVu",
];

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create the network client
    let mut swarm = Swarm::builder().build_and_exec()?;

    // Add the boot nodes to the client
    for boot_node in BOOT_NODES.iter() {
        let multiaddr: Multiaddr = boot_node.parse()?;
        eprintln!("Adding peer: {:?}", multiaddr);
        swarm.add_peer(multiaddr)?.await?;
    }
    eprintln!("Finished adding peers");

    // Generate a new keypair on the network
    let pubkey = swarm.generate(MIN_THRESHOLD, TOTAL_PEERS)?.1.await?;
    println!("Generated pubkey: {:?}", pubkey);

    // Sign some data
    let data = b"Hello, World!".to_vec();
    eprintln!("Signing data: {:?}", data);
    let signature = swarm.sign(pubkey, data.clone())?.1.await?;
    println!("Signature: {:?}", signature);

    // Verify the signature
    let valid = pubkey.verify(&data, &signature).is_ok();
    println!("Signature Valid: {}", valid);
    assert!(valid);
    Ok(())
}

We have provided a few more examples to help you get started. You can find them in the /examples/ directory.

For more information on how to use FROSTore, please check our docs.

Research

FROSTore is primarily based on the following research papers:

Commit count: 45

cargo fmt