UNPKG

@stricahq/bip32ed25519

Version:

Pure javascript implementation of Bip32Ed25519, used for Cardano blockchain key pair.

22 lines (21 loc) 591 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("./utils"); const EDDSA = require("./ed25519e"); const eddsa = new EDDSA(); class PublicKey { constructor(pubKey) { this.pubKey = pubKey; } toBytes() { return this.pubKey; } hash() { return utils_1.hash28(this.pubKey); } verify(signature, data) { const keyPair = eddsa.keyFromPublic(this.pubKey.toString("hex")); return keyPair.verify(data.toString("hex"), signature.toString("hex")); } } exports.default = PublicKey;