Add a test for verification of the sha256 signatures

This commit is contained in:
Lee Miller 2024-03-04 00:25:46 +02:00
parent 67712c69fa
commit 01ecc4a4cd
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63
1 changed files with 10 additions and 0 deletions

10
test.js
View File

@ -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);