Code Monkey home page Code Monkey logo

slip39-rust's Introduction

slip39-rust

Rust compilation results

SLIP-0039 compatible secret sharing tool

Table of Contents

Installation

For now we do not make a binary release, but after installing rust and checking out the repository you can create the binary for your platform. On a Unix, these steps might give you and idea:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
...
$ rustc --version
rustc 1.37.0 (eae3437df 2019-08-13)
$ cargo --version
cargo 1.37.0 (9edd08916 2019-08-02)
$ git clone https://github.com/Internet-of-People/slip39-rust.git
...
$ cd slip39-rust
$ cargo install --path . --force
$ slip39 --version
slip39 0.1.0

Usage

Getting help

Most of this README.md is compiled from the actual help available in the tool.

$ slip39 --help
...
$ slip39 split --help
...

Generate master secret and split it to parts

SLIP-0039 defines a 2-level split: The master secret is split into group secrets and then those are split further into member secrets. You can define the required and total number of members in each group, and also define how many groups are required to restore the master secret.

# The example from the specification
$ slip39 generate --password "morpheus" --bits 256 --required-groups 2 --group 1of1 --group 1of1 --group 3of5 --group 2of6
{
  "group_count": 4,
  "group_threshold": 2,
  "groups": [
    {
      "member_threshold": 1,
      "member_count": 1,
      "shares": [
        {
          "group_index": 1,
          "member_index": 1,
          "mnemonic": "transfer flea acrobat romp anatomy leader axis impulse premium junction salt type smith maximum class clogs ruler talent alpha exchange alien total debut early presence skunk mixed platform dramatic provide center pumps year"
        }
      ]
    },
    {
      "member_threshold": 1,
      "member_count": 1,
      "shares": [
        {
          "group_index": 2,
          "member_index": 1,
          "mnemonic": "transfer flea beard romp always loyalty grasp adequate wildlife petition identify duke fake umbrella explain various uncover diploma wits volume sprinkle enjoy seafood prevent welcome voting elevator flame coastal charity detailed timely antenna"
        }
      ]
    },
    {
      "member_threshold": 3,
      "member_count": 5,
      "shares": [
        {
          "group_index": 3,
          "member_index": 1,
          "mnemonic": "transfer flea ceramic round ajar magazine clogs ending listen cover flip sack anxiety hunting shaft fatal again alien union express vexed grin database smoking rhyme carve again valid idle smoking toxic clock nervous"
        },
        {
          "group_index": 3,
          "member_index": 2,
          "mnemonic": "transfer flea ceramic scatter aunt mortgage fancy admit clothes slavery rebuild isolate dough scout explain usual evoke filter tracks strategy kitchen wits slavery fatal elite grant spray regret iris device season intend blessing"
        },
        {
          "group_index": 3,
          "member_index": 3,
          "mnemonic": "transfer flea ceramic shaft avoid pajamas literary budget duckling recover living critical axle graduate scramble glimpse afraid glimpse orange seafood subject fridge frequent quantity require merit umbrella guest trial starting email amuse flip"
        },
        {
          "group_index": 3,
          "member_index": 4,
          "mnemonic": "transfer flea ceramic skin agree revenue vanish funding orbit frequent have mixed category slim elegant ruin evening debris move eyebrow fancy segment rhythm debut enemy true drift ceramic unwrap demand grasp forget spirit"
        },
        {
          "group_index": 3,
          "member_index": 5,
          "mnemonic": "transfer flea ceramic snake ajar blanket froth promise mountain public news infant toxic broken purchase velvet idea educate mineral alive ecology umbrella expand wrist erode infant mule makeup rumor veteran faint spark literary"
        }
      ]
    },
    {
      "member_threshold": 2,
      "member_count": 6,
      "shares": [
        {
          "group_index": 4,
          "member_index": 1,
          "mnemonic": "transfer flea decision roster alive frequent flash enjoy flash arena hazard disease walnut overall finger paper papa silent software capture company royal trend necklace romp sympathy trash merit surface exotic analysis tadpole curious"
        },
        {
          "group_index": 4,
          "member_index": 2,
          "mnemonic": "transfer flea decision scared auction pitch mandate ivory trip episode speak activity crisis slavery prize species listen grasp believe webcam racism sheriff beaver category drove bracelet answer easy season fantasy remember stick client"
        },
        {
          "group_index": 4,
          "member_index": 3,
          "mnemonic": "transfer flea decision shadow agency depict victim drove material enjoy acne evaluate frozen dismiss regret eclipse fluff soul example spirit public space adjust lily critical maiden detect friar very ranked overall salon amuse"
        },
        {
          "group_index": 4,
          "member_index": 4,
          "mnemonic": "transfer flea decision sister argue season counter adequate debris adjust reject improve marvel hawk element demand knit laden mental deny cinema surface western dream sprinkle elite sprinkle march unkind pipeline daisy science acne"
        },
        {
          "group_index": 4,
          "member_index": 5,
          "mnemonic": "transfer flea decision smug actress scholar angel realize elbow formal reunion rebound agency mustang mortgage august easy distance upstairs marathon remove thumb clay skunk alive ranked epidemic amuse nylon duckling empty length guilt"
        },
        {
          "group_index": 4,
          "member_index": 6,
          "mnemonic": "transfer flea decision spew ambition decorate squeeze magazine zero cargo airline medal standard scatter hunting kidney golden multiple depend hearing credit unfair swimming inform welfare lawsuit plot stilt losing civil view living genre"
        }
      ]
    }
  ]
}

Split an existing secret (hex or BIP-0039)

# Nothing prevents you to use a single member share if you like that better :)
$ slip39 split --password "morpheus" --entropy "shell view flock obvious believe final afraid caught page second arrow predict" --group 1of1
{
  "group_count": 1,
  "group_threshold": 1,
  "groups": [
    {
      "member_threshold": 1,
      "member_count": 1,
      "shares": [
        {
          "group_index": 1,
          "member_index": 1,
          "mnemonic": "location recover academic academic easel false playoff galaxy process strategy exercise forecast yoga union execute herd problem luck dynamic already"
        }
      ]
    }
  ]
}

Inspect a member share

$ slip39 inspect --mnemonic "location recover academic academic easel false playoff galaxy process strategy exercise forecast yoga union execute herd problem luck dynamic already"
{
  "identifier": 17239,
  "iterations": 0,
  "group_threshold": 1,
  "group_index": 1,
  "member_threshold": 1,
  "member_index": 1
}

Contributing

Feel free to open issues and send pull requests in this repository. By sending contributions, you are agreeing to transfer all intellectual property from your changes to the Decentralized Society Foundation, Panama, who owns the copyright of this code.

slip39-rust's People

Contributors

wigy-opensource-developer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slip39-rust's Issues

Splitting a BIP-0039 mnemonic is not SLIP-0039

The master key in SLIP-0039 wallets are not derived from a BIP-0039 seed, so there is no actual way to convert a set of SLIP-0039 shares into a BIP-0039 mnemonic (would need to break a hash for that).

iancoleman/slip39#1 (comment)

This is all fine, but it needs to be documented better that if someone actually wants to use the SLIP-0039 algorithms to share a BIP-0039 seed instead of the master key, it is not conforming to the specification. Also, it is somewhat unclear how SLIP-0039 would extend to support multiple curves, like it is described in SLIP-0010

'--required-groups 1' with multiple '--group' does not produce multiple groups in the output

I wanted to split a mnemonic into 2 groups where only one is required to restore the seed. I'm running the following command:

slip39 split --password "morpheus" --entropy "shell view flock obvious believe final afraid caught page second arrow predict" --required-groups 1 --group 3of5 --group 3of6

In the result output I see

{
  "group_count": 1,
  "group_threshold": 1,
  "groups": [
    {
      "member_threshold": 3,
      "member_count": 5,
      "shares": [ ...skipped... ]
   }]
}

but I expect it to be

{
  "group_count": 2,
  "group_threshold": 1,
  "groups": [
    {
      "member_threshold": 3,
      "member_count": 5,
      "shares": [ ...skipped... ]
   },
   {
      "member_threshold": 3,
      "member_count": 6,
      "shares": [ ...skipped... ]
   }]
}

Is it a bug or am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.