UNPKG

@alepop/lisk-musig

Version:

Three round m-of-m key aggregation for Lisk using the MuSig signature scheme

30 lines (29 loc) 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const lisk_cryptography_1 = require("@liskhq/lisk-cryptography"); const ed25519_musig_1 = require("@futuretense/ed25519-musig"); exports.Round = ed25519_musig_1.Round; class Config extends ed25519_musig_1.Config { constructor(publicKeys) { const pbKeys = publicKeys.map(pb => lisk_cryptography_1.hexToBuffer(pb)); super(pbKeys); } get publicKey() { return lisk_cryptography_1.bufferToHex(super.publicKey); } } exports.Config = Config; class Session extends ed25519_musig_1.Session { constructor(config, keyPair, transaction) { const { _seed: seed } = keyPair; const txBytes = transaction.getBytes(); super(config, seed, txBytes); } } exports.Session = Session; exports.generateKeyPairFromPassphrase = (passphrase) => { return { ...lisk_cryptography_1.getKeys(passphrase), _seed: lisk_cryptography_1.hash(passphrase, "utf8") }; };