Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit fe82ae8

Browse files
authored
[DEVOPS-959] mnemonic generator script (#3276)
1 parent 0c60839 commit fe82ae8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

scripts/generate-mnemonic.hs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env nix-shell
2+
#!nix-shell -i runhaskell ../wallet-new/default.nix
3+
{-# LANGUAGE DataKinds #-}
4+
{-# LANGUAGE TypeApplications #-}
5+
import Data.Aeson (encode)
6+
import Data.ByteString.Lazy.Char8 (unpack)
7+
import Pos.Util.Mnemonic (EntropySize, Mnemonic, entropyToMnemonic,
8+
genEntropy)
9+
10+
main = do
11+
backupPhrase <- generateBackupPhrase
12+
let backupPhraseString = backupPhraseToString backupPhrase
13+
putStrLn backupPhraseString
14+
15+
backupPhraseToString :: Mnemonic 12 -> String
16+
backupPhraseToString backupPhrase = unpack $ encode backupPhrase
17+
18+
generateBackupPhrase :: IO (Mnemonic 12)
19+
generateBackupPhrase =
20+
entropyToMnemonic <$> genEntropy

0 commit comments

Comments
 (0)