Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

nimiq/mnemonic-phrase

Repository files navigation

Attention!

This repository is outdated and does not produce BIP39-compliant mnemonic phrases. Please use https://github.com/nimiq/core-js/blob/master/src/main/generic/utils/mnemonic/MnemonicUtils.js instead.

Mnemonic Phrase

Create mnemonic phrases from HEX strings and vice-versa.

Used in the Nimiq blockchain to create mnemonic phrases from private keys.

Usage

In HTML as a standard script tag:

<script type="text/javascript" src="mnemonic-phrase.es5.min.js"></script>

If using JS imports:

import MnemonicPhrase from '/path/to/mnemonic-phrase.min.js';
// The input HEX string must be 16-32 bytes long.
var key = 'a18532abfb31ba4e26d64a3ac3430969639aeb5f84b1c4124da0f3e323cdaced';

var mnemonic = MnemonicPhrase.keyToMnemonic(key);
// Result: 'pave civil priority wait brick check opera sing depart borrow seat spot defy interest lawn normal series mystery habit treat cram traffic recipe risk'

var key = MnemonicPhrase.mnemonicToKey(mnemonic);
// Result: 'a18532abfb31ba4e26d64a3ac3430969639aeb5f84b1c4124da0f3e323cdaced'

Based on

Releases

No releases published

Packages

No packages published