UNPKG

@bitgo/bls

Version:

Implementation of bls signature verification for ethereum 2.0

43 lines (30 loc) 977 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Keypair = void 0; var _publicKey = require("./publicKey"); var _privateKey = require("./privateKey"); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } class Keypair { constructor(privateKey, publicKey) { _defineProperty(this, "_publicKey", void 0); _defineProperty(this, "_privateKey", void 0); this._privateKey = privateKey; if (!publicKey) { this._publicKey = _publicKey.PublicKey.fromPrivateKey(this._privateKey); } else { this._publicKey = publicKey; } } get publicKey() { return this._publicKey; } get privateKey() { return this._privateKey; } static generate() { return new Keypair(_privateKey.PrivateKey.random()); } } exports.Keypair = Keypair;