Socket
Socket
Sign inDemoInstall

hypercore-crypto

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypercore-crypto - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

6

index.js

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

2

package.json
{
"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()

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc