From 83e7e4582ced96962ec9687090e09335d8c6e832 Mon Sep 17 00:00:00 2001 From: Zhen Yu Yong Date: Thu, 25 Jun 2020 20:15:09 +0800 Subject: [PATCH] wrote test --- test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test.js b/test.js index cd40f31..4e4e63c 100644 --- a/test.js +++ b/test.js @@ -217,6 +217,22 @@ describe("ECIES", function() { }); }); + it("should encrypt and decrypt", function() { + return eccrypto.encrypt(publicKeyA, Buffer.from("to a")).then(function(enc) { + return eccrypto.decrypt(privateKeyA, enc); + }).then(function(msg) { + expect(msg.toString()).to.equal("to a"); + }); + }); + + it("should encrypt and decrypt with message size > 15", function() { + return eccrypto.encrypt(publicKeyA, Buffer.from("message size that is greater than 15 for sure =)")).then(function(enc) { + return eccrypto.decrypt(privateKeyA, enc); + }).then(function(msg) { + expect(msg.toString()).to.equal("to a"); + }); + }); + it("should encrypt with compressed public key", function() { return eccrypto.encrypt(publicKeyBCompressed, Buffer.from("test"), encOpts) .then(function(enc) {