Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electrum-mnemonic

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electrum-mnemonic - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

package.json
{
"name": "electrum-mnemonic",
"version": "1.0.4",
"version": "1.0.5",
"description": "Electrum Mnemonics (electrum v2 and greater)",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -21,6 +21,6 @@ # Electrum Mnemonics (electrum v2 and greater)

console.log(mn.generateMnemonic()) // default segwit bech32 wallet
console.log(mn.generateMnemonic(mn.PREFIXES.segwit)) // explicit segwit bech32 wallet
console.log(mn.generateMnemonic(mn.PREFIXES.standard)) // legacy p2pkh wallet (base58 address starting with 1)
console.log(mn.generateMnemonic(mn.PREFIXES['2fa'])) // 2fa legacy
console.log(mn.generateMnemonic(mn.PREFIXES['2fa-segwit'])) // legacy p2pkh wallet (base58 address starting with 1)
console.log(mn.generateMnemonic({ prefix: mn.PREFIXES.segwit })) // explicit segwit bech32 wallet
console.log(mn.generateMnemonic({ prefix: mn.PREFIXES.standard })) // legacy p2pkh wallet (base58 address starting with 1)
console.log(mn.generateMnemonic({ prefix: mn.PREFIXES['2fa'] })) // 2fa legacy
console.log(mn.generateMnemonic({ prefix: mn.PREFIXES['2fa-segwit'] })) // legacy p2pkh wallet (base58 address starting with 1)
```

@@ -56,5 +56,5 @@

const mn = require('electrum-mnemonic')
const phrase = mn.generateMnemonic('fed')
const phrase = mn.generateMnemonic({ prefix: 'fed' })
const seed = mn.mnemonicToSeedSync(phrase, { validPrefixes: mn.PREFIXES.concat(['fed']) })
console.log(seed)
```

@@ -8,5 +8,10 @@ /// <reference types="node" />

};
export declare function generateMnemonic(prefix?: string, strength?: number, // 12 words x 2048 wordlist === 132 bits
rng?: (size: number) => Buffer, wordlist?: string[]): string;
interface Opts {
interface GenerateOpts {
prefix?: string;
strength?: number;
rng?: (size: number) => Buffer;
wordlist?: string[];
}
export declare function generateMnemonic(opts?: GenerateOpts): string;
interface SeedOpts {
passphrase?: string;

@@ -16,4 +21,4 @@ validPrefixes?: string[];

}
export declare function mnemonicToSeedSync(mnemonic: string, opts?: Opts): Buffer;
export declare function mnemonicToSeed(mnemonic: string, opts?: Opts): Promise<Buffer>;
export declare function mnemonicToSeedSync(mnemonic: string, opts?: SeedOpts): Buffer;
export declare function mnemonicToSeed(mnemonic: string, opts?: SeedOpts): Promise<Buffer>;
export {};

@@ -14,4 +14,10 @@ "use strict";

};
function generateMnemonic(prefix = exports.PREFIXES.segwit, strength = 132, // 12 words x 2048 wordlist === 132 bits
rng = randombytes, wordlist = ENGLISH) {
const DEFAULTGENOPTS = {
prefix: exports.PREFIXES.segwit,
strength: 132,
rng: randombytes,
wordlist: ENGLISH,
};
function generateMnemonic(opts) {
const { prefix, strength, rng, wordlist } = Object.assign({}, DEFAULTGENOPTS, opts);
const wordBitLen = encoding_1.bitlen(wordlist.length);

@@ -18,0 +24,0 @@ const wordCount = Math.ceil(strength / wordBitLen);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc