7 releases

0.3.0 Sep 5, 2024
0.2.2 Aug 13, 2024
0.2.1 May 23, 2024
0.1.3 Jan 20, 2024
0.1.0 Nov 28, 2023

#1210 in Cryptography

Download history 96/week @ 2024-08-08 25/week @ 2024-08-15 125/week @ 2024-09-05 23/week @ 2024-09-12 10/week @ 2024-09-19 22/week @ 2024-09-26 6/week @ 2024-10-03

61 downloads per month

GPL-3.0 license

65KB
1.5K SLoC

    __________  ____  ___________              
   / ____/ __ \/ __ \/ ___/_  __/___  ________ 
  / /_  / /_/ / / / /\__ \ / / / __ \/ ___/ _ \
 / __/ / _, _/ /_/ /___/ // / / /_/ / /  /  __/
/_/   /_/ |_|\____//____//_/  \____/_/   \___/
-------------------------------------------------
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:

Dependencies

~17–54MB
~1M SLoC