hypercore-crypto
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -82,2 +82,8 @@ const sodium = require('sodium-universal') | ||
exports.validateKeyPair = function (keyPair) { | ||
const pk = Buffer.allocUnsafe(sodium.crypto_sign_PUBLICKEYBYTES) | ||
sodium.crypto_sign_ed25519_sk_to_pk(pk, keyPair.secretKey) | ||
return pk.equals(keyPair.publicKey) | ||
} | ||
exports.sign = function (message, secretKey) { | ||
@@ -84,0 +90,0 @@ const signature = Buffer.allocUnsafe(sodium.crypto_sign_BYTES) |
{ | ||
"name": "hypercore-crypto", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "The crypto primitives used in hypercore, extracted into a separate module", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,2 +19,11 @@ const tape = require('tape') | ||
tape('validate key pair', function (t) { | ||
const keyPair1 = crypto.keyPair() | ||
const keyPair2 = crypto.keyPair() | ||
t.false(crypto.validateKeyPair({ publicKey: keyPair1.publicKey, secretKey: keyPair2.secretKey })) | ||
t.true(crypto.validateKeyPair({ publicKey: keyPair1.publicKey, secretKey: keyPair1.secretKey })) | ||
t.end() | ||
}) | ||
tape('sign', function (t) { | ||
@@ -21,0 +30,0 @@ const keyPair = crypto.keyPair() |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
10034
212
1