1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const bcrypto_1 = require("bcrypto");
|
4 | class Hash {
|
5 | static signECDSA(hash, keys) {
|
6 | return bcrypto_1.secp256k1.signatureExport(bcrypto_1.secp256k1.sign(hash, Buffer.from(keys.privateKey, "hex"))).toString("hex");
|
7 | }
|
8 | static verifyECDSA(hash, signature, publicKey) {
|
9 | return bcrypto_1.secp256k1.verify(hash, bcrypto_1.secp256k1.signatureImport(signature instanceof Buffer ? signature : Buffer.from(signature, "hex")), publicKey instanceof Buffer ? publicKey : Buffer.from(publicKey, "hex"));
|
10 | }
|
11 | static signSchnorr(hash, keys) {
|
12 | return bcrypto_1.secp256k1.schnorrSign(hash, Buffer.from(keys.privateKey, "hex")).toString("hex");
|
13 | }
|
14 | static verifySchnorr(hash, signature, publicKey) {
|
15 | return bcrypto_1.secp256k1.schnorrVerify(hash, signature instanceof Buffer ? signature : Buffer.from(signature, "hex"), publicKey instanceof Buffer ? publicKey : Buffer.from(publicKey, "hex"));
|
16 | }
|
17 | }
|
18 | exports.Hash = Hash;
|
19 |
|
\ | No newline at end of file |