tiny-secp256k1
Advanced tools
Comparing version 1.0.1 to 1.1.0
14
index.js
'use strict' | ||
try { | ||
let binding = require('bindings')('secp256k1') | ||
delete binding.path | ||
// NaN drops function names, add them for is* (via toJSON) | ||
for (let key in binding) { | ||
if (key.indexOf('is') !== 0) continue | ||
binding[key].toJSON = function () { return key } | ||
} | ||
module.exports = binding | ||
module.exports = require('./native') | ||
} catch (err) { | ||
module.exports = require('./ecurve') | ||
module.exports = require('./js') | ||
} |
{ | ||
"name": "tiny-secp256k1", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A tiny secp256k1 native/JS wrapper", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"build": "node-gyp rebuild", | ||
"unit": "tape tests/index.js", | ||
"unit": "tape tests/index.js | tap-difflet -p", | ||
"test-browser": "browserify tests/index.js > tests/bundle.js", | ||
@@ -22,3 +22,3 @@ "test": "npm run unit" | ||
"author": "", | ||
"license": "ISC", | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -33,11 +33,12 @@ "url": "https://github.com/bitcoinjs/tiny-secp256k1/issues" | ||
"elliptic": "^6.4.0", | ||
"nan": "^2.10.0" | ||
"nan": "^2.12.1" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^16.2.2", | ||
"tap-difflet": "^0.7.1", | ||
"tape": "^4.9.0" | ||
}, | ||
"browser": { | ||
"./index.js": "./ecurve.js" | ||
"./index.js": "./js.js" | ||
} | ||
} |
@@ -139,2 +139,16 @@ # tiny-secp256k1 | ||
### signWithEntropy (h, d, e) | ||
``` haskell | ||
sign :: Buffer -> Buffer -> Buffer -> Buffer | ||
``` | ||
Returns normalized signatures, each of (r, s) values are guaranteed to less than `order / 2`. | ||
Uses RFC6979. | ||
Adds `e` as Added Entropy to the deterministic k generation. | ||
##### Throws: | ||
* `Expected Private` if `!isPrivate(d)` | ||
* `Expected Scalar` if `h` is not 256-bit | ||
* `Expected Extra Data (32 bytes)` if `e` is not 256-bit | ||
### verify (h, Q, signature[, strict = false]) | ||
@@ -158,5 +172,5 @@ ``` haskell | ||
https://github.com/bitcoin-core/secp256k1 - for the secp256k1 library | ||
This library uses the native library [secp256k1](https://github.com/bitcoin-core/secp256k1) by the bitcoin-core developers, including derivatives of its tests and test vectors. | ||
# LICENSE [MIT](LICENSE) |
@@ -7,3 +7,3 @@ const createHmac = require('create-hmac') | ||
// https://tools.ietf.org/html/rfc6979#section-3.2 | ||
function deterministicGenerateK (hash, x, checkSig, isPrivate) { | ||
function deterministicGenerateK (hash, x, checkSig, isPrivate, extraEntropy) { | ||
// Step A, ignored as hash already provided | ||
@@ -21,2 +21,3 @@ // Step B | ||
.update(hash) | ||
.update(extraEntropy || '') | ||
.digest() | ||
@@ -33,2 +34,3 @@ | ||
.update(hash) | ||
.update(extraEntropy || '') | ||
.digest() | ||
@@ -35,0 +37,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
279
175
865670
3
105
3
Updatednan@^2.12.1