From 7a3a3662198221a9fa8a2666af4dea67e425fe80 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Mon, 4 Mar 2024 00:25:46 +0200 Subject: [PATCH] Add a test for verification of the sha256 signatures --- test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test.js b/test.js index c87b95c..35854c3 100644 --- a/test.js +++ b/test.js @@ -101,6 +101,16 @@ describe("Crypto", function() { }); }); + // The samples are from PyBitmessage's tests + it("should verify sha256 signatures", function() { + var publicKey = bmcrypto.getPublic(Buffer.from( + "93d0b61371a54b53df143b954035d612f8efa8a3ed1cf842c2186bfd8f876665", + "hex")), + sig = Buffer.from("304402202302475351db6b822de15d922e29397541f10d8a19780ba2ca4a920b1035f07502205e5bba40d5f07a24c23a89ba5f01a3828371dfbb685dd5375fa1c29095fd232b", "hex"), + message = Buffer.from("0592a10584ffabf96539f3d780d776828c67da1ab5b169e9e8aed838aaecc9ed36d49ff1423c55f019e050c66c6324f53588be88894fef4dcffdb74b98e2b200", "hex"); + return bmcrypto.verify(publicKey, message, sig); + }); + it("should allow to encrypt and decrypt message", function() { var privateKeyA = bmcrypto.getPrivate(); var publicKeyA = bmcrypto.getPublic(privateKeyA);