UNPKG

@signumjs/crypto

Version:

Cryptographic functions for building Signum Network apps.

23 lines 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Strength = void 0; exports.generateMnemonic = generateMnemonic; const en_1 = require("./dictionaries/en"); const random_1 = require("./random"); var Strength; (function (Strength) { Strength[Strength["Bits_128"] = 12] = "Bits_128"; Strength[Strength["Bits_160"] = 15] = "Bits_160"; Strength[Strength["Bits_192"] = 18] = "Bits_192"; Strength[Strength["Bits_224"] = 21] = "Bits_224"; Strength[Strength["Bits_256"] = 24] = "Bits_256"; })(Strength || (exports.Strength = Strength = {})); function generateMnemonic(args = { strength: Strength.Bits_192, dictionary: en_1.words }) { const { strength = Strength.Bits_192, dictionary = en_1.words } = args; if (dictionary.length < 1024) { throw new Error('Dictionary too weak'); } const randomWords = (0, random_1.getRandomWords)(strength.valueOf(), dictionary); return randomWords.join(' '); } //# sourceMappingURL=mnemonic.js.map