Giter Site home page Giter Site logo

cinorid / ssb-keys-mnemonic-dotnet Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 3.0 81 KB

C# (.NET Standard) implementation of the NodeJS ssb-keys-mnemonic https://github.com/staltz/ssb-keys-mnemonic

License: MIT License

C# 100.00%
ssb ssb-server ssb-key bip39 bip39-mnemonic-codes mnemonic ssb-keys

ssb-keys-mnemonic-dotnet's Introduction

SSB.Keys.Mnemonic

Module that converts from/to SSB keys and BIP39 mnemonic codes.

C# (.NET Standard) implementation of the https://github.com/staltz/ssb-keys-mnemonic

Donate

If you like this little project and find it worthy of a donation, send some coins to:
bitcoin: 3GSpoWVTwjbt9BGiivZmsWe9DBkTR87Wpf
ethereum: 0xF0942E600B976F343DE6660C53392D5a37A7ca12
monero: 4Jy22AgYpZEQ9D4yVrm8cD9MX5hPqycQmR7vA96r9LP18gASE8nFYGSLd7fZ4LZQChLTwFPZDbd2hDVTrLnaVXCcNYHc6U9jES2JErc8Uu

Usage

CLI

Usage: SSB.Keys.Mnemonic.CLI [OPERAND]...

Secret file conversion, converting, and formatting according to the operands.

-m=MODE convertion mode, can be: 's2w' or 'w2s' -m=s2w secret to words -m=w2s words to secret

-s="secret" secret file content from stdin -w="words" words list from stdin -sf=FILE secret FILE name instead of stdin -wf=FILE words FILE name instead of stdout

Samples:

  1.  dotnet SSB.Keys.Mnemonic.CLI.dll -m=s2w -sf=C:\Users\user\.ssb\secret
    
  2.  dotnet SSB.Keys.Mnemonic.CLI.dll -m=s2w -sf=C:\Users\user\.ssb\secret -wf=words.txt
    
  3.  dotnet SSB.Keys.Mnemonic.CLI.dll -m=w2s -w=C:\Users\user\.ssb\secret -sf=secret.txt
    
  4.  dotnet SSB.Keys.Mnemonic.CLI.dll -m=w2s -w="body hair useful camp warm into cause riot two bamboo kick educate dinosaur advice seed type crisp where guilt avocado output rely lunch goddess" -sf=secret.txt
    

API

using SSB.Keys.Mnemonic;

string KeysToWords(Keys keys)

var mnemonic = new MnemonicConverter();
var keys = new Keys
{
	Curve = "ed25519",
	Public = "1nf1T1tUSa43dWglCHzyKIxV61jG/EeeL1Xq1Nk8I3U=.ed25519",
	Private = "GO0Lv5BvcuuJJdHrokHoo0PmCDC/XjO/SZ6H+ddq4UvWd/VPW1RJrjd1aCUIfPIojFXrWMb8R54vVerU2TwjdQ==.ed25519",
	ID = "@1nf1T1tUSa43dWglCHzyKIxV61jG/EeeL1Xq1Nk8I3U=.ed25519"
};
var words = mnemonic.KeysToWords(keys);
Console.WriteLine(words)
/*

body hair useful camp warm into cause riot two bamboo kick educate dinosaur advice seed type crisp where guilt avocado output rely lunch goddess

*/

Keys WordsToKeys(string words)

var mnemonic = new MnemonicConverter();
var words = "body hair useful camp warm into cause riot two bamboo kick educate dinosaur advice seed type crisp where guilt avocado output rely lunch goddess";
var keys = mnemonic.WordsToKeys(words);
Console.WriteLine(keys)
/*

{
  "curve": "ed25519",
  "public": "1nf1T1tUSa43dWglCHzyKIxV61jG/EeeL1Xq1Nk8I3U=.ed25519",
  "private": "GO0Lv5BvcuuJJdHrokHoo0PmCDC/XjO/SZ6H+ddq4UvWd/VPW1RJrjd1aCUIfPIojFXrWMb8R54vVerU2TwjdQ==.ed25519",
  "id": "@1nf1T1tUSa43dWglCHzyKIxV61jG/EeeL1Xq1Nk8I3U=.ed25519"
}

*/

License

MIT

ssb-keys-mnemonic-dotnet's People

Contributors

cinorid avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

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.