Socket
Book a DemoInstallSign in
Socket

@proton/mnemonic

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@proton/mnemonic

```sh npm install @proton/mnemonic ```

latest
npmnpm
Version
1.0.0
Version published
Maintainers
3
Created
Source

Welcome to Proton Mnemonic 👋

Version License: MIT

Generate BIP39+BIP44 compatible Proton mnemonic phrases

Install

npm install @proton/mnemonic

Usage

import { Mnemonic } from '@proton/mnemonic'

/**
 * mnemonic.phrase: e.g. 'reflect note upgrade mention marine sword track pride robust vessel tube sausage kind trick neglect'
 */
const mnemonic = new Mnemonic()

/**
 * Keys
 *  - publicKey: e.g. PUB_K1_71ESPbpkYsR9iQd1tgqxqZqUJFX8veJGUS5RnGGekq4Vb1ExPj
 *  - privateKey: e.g. PVT_K1_du8FBHSYpapVw17ZmWBU3u3dBCARMFe54X49yfPrFCUoXpADk
 */
const { publicKey, privateKey } = mnemonic.keyPairAtIndex(0)

/**
 * Legacy Keys
 *  - publicKeyLegacy: e.g. EOS71ESPbpkYsR9iQd1tgqxqZqUJFX8veJGUS5RnGGekq4Vd64yg6
 *  - privateKeyLegacy: e.g. 5JTBhvdNX1Pa5WKH9mDQGWo2GE17NZDLMt8JHL2Qdj6qeTjzqE6
 */
const { publicKey: publicKeyLegacy, privateKey: privateKeyLegacy } = mnemonic.keyPairAtIndex(0, true)

Options

const mnemonic = new Mnemonic({
  phrase, // Existing phrase, leave undefined to create new one
  passphrase, // Existing mnemonic password, leave undefined to not specify
  numWords // How long you want the mnemonic phrase to be
})

const newFormat = mnemonic.keyPairAtIndex(0) // PUB_K1_ and PVT_K1_
const oldFormat = mnemonic.keyPairAtIndex(0, true) // EOSXXX and 5XXXX

Run tests

npm run test

Show your support

Give a ⭐️ if this project helped you!

FAQs

Package last updated on 05 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts