Comparing version 0.0.48 to 0.0.49
@@ -11,4 +11,4 @@ import { decrypt } from 'eciesjs' | ||
const decryptStandardECIES = (privateKey,message) => { | ||
return decrypt(privateKey, Buffer.from(message)).toString() | ||
return decrypt(privateKey, Buffer.from(message,"hex")).toString() | ||
} | ||
export default decryptStandardECIES |
{ | ||
"name": "doichain", | ||
"version": "0.0.48", | ||
"version": "0.0.49", | ||
"description": "A js-Doichain library. The goal is to fully cover the Doichain protocol", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -281,12 +281,23 @@ import chai from 'chai' | ||
const message2 = "That is a simple message" | ||
const message2 = "http://localhost:3000" | ||
const publicKeyOfBob2 = publicKey | ||
const encryptedMessage2 = encryptStandardECIES(publicKeyOfBob2,message2) | ||
console.log('encryptedMessage2',encryptedMessage2.toString('hex')) | ||
const decryptedMessage2 = decryptStandardECIES(privateKeyOfBob2,encryptedMessage2) | ||
console.log(decryptedMessage2) | ||
chai.assert.equal(decryptedMessage2, message2, "encryption and decryption didn't work") | ||
const encryptedMessage3 = "04f24211b7e993a8d6c822b1e3100dbdf01cad8b84ef4b7cce0fddf32418061ae8352d064c5b7b746721e6927eabef3cebcabaf2ff0cbf468fb9659367d98a9ba7171cc577bc9afdaf9ec05b88f9a7716b679e8470d68332aac276790fa38b030fb14d8914fb20b5d752c34ea69d5d3f802ba8f6c470eb"//, "hex") | ||
const privateKeyWif = "cP3EigkzsWuyKEmxk8cC6qXYb4ZjwUo5vzvZpAPmDQ83RCgXQruj" | ||
const keyPair3 = bitcoin.ECPair.fromWIF(privateKeyWif,DOICHAIN_REGTEST) //getPrivateKeyFromWif(privateKeyWif,DOICHAIN_REGTEST) | ||
const privateKey = "2b7d05ba4d4903ab99f5740bd0bd51a088ac077c460d67dcdafcbafed71b0195" | ||
chai.assert.equal(privateKey,keyPair3.privateKey.toString('hex'),"privatekeys are not the same") | ||
const decryptedMessage3 = decryptStandardECIES(keyPair3.privateKey.toString('hex'),encryptedMessage3) | ||
console.log("decryptedMessage3",decryptedMessage3) | ||
chai.assert.equal(decryptedMessage3, "http://localhost:3000/", "decrypting not successful") | ||
}) | ||
it.only('create and verify a signature ', async () => { | ||
it('create and verify a signature ', async () => { | ||
function rng () { | ||
@@ -305,4 +316,3 @@ return Buffer.from('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') | ||
chai.assert.equal(true, validSignature, "signature not valid") | ||
}) | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
196934
1200