4 releases

new 0.2.0 May 14, 2024
0.1.3 Jan 20, 2024
0.1.2 Jan 18, 2024
0.1.1 Dec 12, 2023
0.1.0 Nov 28, 2023

#1093 in Cryptography

Download history 9/week @ 2024-01-17 2/week @ 2024-02-14 8/week @ 2024-02-21 3/week @ 2024-02-28 1/week @ 2024-03-13 10/week @ 2024-03-27 18/week @ 2024-04-03

305 downloads per month

GPL-3.0 license

57KB
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–57MB
~1M SLoC