Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
feat: next libp2p-crypto (#4)
Browse files Browse the repository at this point in the history
* feat: next libp2p-crypto

* chore: update deps
  • Loading branch information
daviddias authored Jul 22, 2017
1 parent 363cda5 commit 4ee48a7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 142 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"license": "MIT",
"dependencies": {
"async": "^2.5.0",
"libp2p-crypto": "~0.8.8",
"libp2p-crypto": "~0.9.0",
"multihashing-async": "~0.4.6",
"nodeify": "^1.0.1",
"safe-buffer": "^5.1.1",
Expand All @@ -38,6 +38,7 @@
"aegir": "^11.0.2",
"benchmark": "^2.1.4",
"chai": "^4.1.0",
"dirty-chai": "^2.0.1",
"pre-commit": "^1.2.2"
},
"pre-commit": [
Expand All @@ -61,4 +62,4 @@
"Friedel Ziegelmayer <[email protected]>",
"Yusef Napora <[email protected]>"
]
}
}
4 changes: 2 additions & 2 deletions src/crypto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports.hashAndSign = function (key, msg, callback) {
})

multihashing.digest(msg, HASH_ALGORITHM, (err, digest) => {
if (err) return done(err)
if (err) { return done(err) }
try {
const sig = secp256k1.sign(digest, key)
const sigDER = secp256k1.signatureExport(sig.signature)
Expand All @@ -45,7 +45,7 @@ exports.hashAndVerify = function (key, sig, msg, callback) {
})

multihashing.digest(msg, HASH_ALGORITHM, (err, digest) => {
if (err) return done(err)
if (err) { return done(err) }
try {
sig = secp256k1.signatureImport(sig)
const valid = secp256k1.verify(digest, sig, key)
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const multihashing = require('multihashing-async')
const crypto = require('./crypto')
const pbm = require('libp2p-crypto').protobuf
const pbm = require('libp2p-crypto').keys.pbm

class Secp256k1PublicKey {
constructor (key) {
Expand Down
Loading

0 comments on commit 4ee48a7

Please sign in to comment.