New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eosjs-ecc

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eosjs-ecc - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

lib/eosjs-ecc.js

9

lib/api_common.js

@@ -194,10 +194,11 @@ "use strict";

/** @arg {string|Buffer} data
@arg {string} [encoding = 'hex'] - 'hex', 'binary' or 'base64'
/** @arg {string|Buffer} data - always binary, you may need Buffer.from(data, 'hex')
@arg {string} [encoding = 'hex'] - result encoding 'hex', 'binary' or 'base64'
@return {string|Buffer} - Buffer when encoding is null, or string
@example ecc.sha256('hashme') === '02208b..'
@example ecc.sha256(Buffer.from('02208b', 'hex')) === '29a23..'
*/
sha256: function sha256(data) {
var encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'hex';
return hash.sha256(data, encoding);
var resultEncoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'hex';
return hash.sha256(data, resultEncoding);
}

@@ -204,0 +205,0 @@ };

@@ -9,23 +9,23 @@ 'use strict';

/** @arg {string|Buffer} data
@arg {string} [encoding = null] - 'hex', 'binary' or 'base64'
@return {string|Buffer} - Buffer when encoding is null, or string
@arg {string} [resultEncoding = null] - 'hex', 'binary' or 'base64'
@return {string|Buffer} - Buffer when resultEncoding is null, or string
*/
function sha1(data, encoding) {
return createHash('sha1').update(data).digest(encoding);
function sha1(data, resultEncoding) {
return createHash('sha1').update(data).digest(resultEncoding);
}
/** @arg {string|Buffer} data
@arg {string} [encoding = null] - 'hex', 'binary' or 'base64'
@return {string|Buffer} - Buffer when encoding is null, or string
@arg {string} [resultEncoding = null] - 'hex', 'binary' or 'base64'
@return {string|Buffer} - Buffer when resultEncoding is null, or string
*/
function sha256(data, encoding) {
return createHash('sha256').update(data).digest(encoding);
function sha256(data, resultEncoding) {
return createHash('sha256').update(data).digest(resultEncoding);
}
/** @arg {string|Buffer} data
@arg {string} [encoding = null] - 'hex', 'binary' or 'base64'
@return {string|Buffer} - Buffer when encoding is null, or string
@arg {string} [resultEncoding = null] - 'hex', 'binary' or 'base64'
@return {string|Buffer} - Buffer when resultEncoding is null, or string
*/
function sha512(data, encoding) {
return createHash('sha512').update(data).digest(encoding);
function sha512(data, resultEncoding) {
return createHash('sha512').update(data).digest(resultEncoding);
}

@@ -32,0 +32,0 @@

@@ -143,3 +143,3 @@ 'use strict';

function parseKey(privateStr) {
assert(typeof privateStr === 'undefined' ? 'undefined' : _typeof(privateStr), 'string', 'privateStr');
assert.equal(typeof privateStr === 'undefined' ? 'undefined' : _typeof(privateStr), 'string', 'privateStr');
var match = privateStr.match(/^PVT_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/);

@@ -146,0 +146,0 @@

@@ -142,3 +142,3 @@ 'use strict';

PublicKey.fromStringOrThrow = function (public_key) {
assert(typeof public_key === 'undefined' ? 'undefined' : _typeof(public_key), 'string', 'public_key');
assert.equal(typeof public_key === 'undefined' ? 'undefined' : _typeof(public_key), 'string', 'public_key');
var match = public_key.match(/^PUB_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/);

@@ -145,0 +145,0 @@ if (match === null) {

@@ -45,4 +45,4 @@ 'use strict';

assert(typeof cpuEntropyBits === 'undefined' ? 'undefined' : _typeof(cpuEntropyBits), 'number', 'cpuEntropyBits');
assert(typeof safe === 'undefined' ? 'undefined' : _typeof(safe), 'boolean', 'boolean');
assert.equal(typeof cpuEntropyBits === 'undefined' ? 'undefined' : _typeof(cpuEntropyBits), 'number', 'cpuEntropyBits');
assert.equal(typeof safe === 'undefined' ? 'undefined' : _typeof(safe), 'boolean', 'boolean');

@@ -49,0 +49,0 @@ if (safe) {

@@ -263,3 +263,3 @@ 'use strict';

Signature.fromStringOrThrow = function (signature) {
assert(typeof signature === 'undefined' ? 'undefined' : _typeof(signature), 'string', 'signature');
assert.equal(typeof signature === 'undefined' ? 'undefined' : _typeof(signature), 'string', 'signature');
var match = signature.match(/^SIG_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/);

@@ -266,0 +266,0 @@ assert(match != null && match.length === 3, 'Expecting signature like: SIG_K1_base58signature..');

{
"name": "eosjs-ecc",
"version": "4.0.1",
"version": "4.0.2",
"description": "Elliptic curve cryptography functions",
"keywords": "ECC, Private Key, Public Key, Signature, AES, Encryption, Decryption",
"main": "lib/index.js",
"files": [
"README.md",
"docs",
"lib"
],
"scripts": {

@@ -12,8 +17,10 @@ "test": "mocha --use_strict src/*.test.js",

"coveralls": "npm run coverage && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls",
"build": "babel src --out-dir lib",
"build_browser": "npm run build && mkdir -p dist && browserify -o dist/eosjs-ecc.js -s eosjs_ecc lib/index.js && sha256sum dist/eosjs-ecc.js",
"build_browser_test": "npm run build && mkdir -p dist && browserify -o dist/test.js lib/*.test.js",
"build": "rm -f lib/* && babel src --out-dir lib",
"build_browser": "npm run build && mkdir -p lib && browserify -o lib/eosjs-ecc.js -s eosjs_ecc lib/index.js && sha256sum lib/eosjs-ecc.js",
"build_browser_test": "npm run build && browserify -o dist/test.js lib/*.test.js",
"documentation": "node_modules/documentation/bin/documentation.js",
"minimize": "uglifyjs lib/eosjs-ecc.js -o lib/eosjs-ecc.min.js --source-map --compress --mangle",
"docs": "npm run documentation -- readme src/api_common.js --section \"Common API\" --shallow",
"prepublishOnly": "npm run build_browser && npm run test_lib && npm run docs"
"srisum": "npx srisum lib/eosjs-ecc.*",
"prepublishOnly": "npm run build_browser && npm run test_lib && npm run minimize && npm run docs && npm run srisum"
},

@@ -44,3 +51,4 @@ "repository": {

"mocha": "^3.5.3",
"nyc": "^11.7.1"
"nyc": "^11.7.1",
"uglify-js": "^3.4.2"
},

@@ -47,0 +55,0 @@ "babel": {

@@ -201,4 +201,5 @@ [![NPM](https://img.shields.io/npm/v/eosjs-ecc.svg)](https://www.npmjs.org/package/eosjs-ecc)

- `data` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html))**
- `encoding` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 'hex', 'binary' or 'base64' (optional, default `'hex'`)
- `data` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html))** always binary, you may need Buffer.from(data, 'hex')
- `resultEncoding` (optional, default `'hex'`)
- `encoding` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** result encoding 'hex', 'binary' or 'base64' (optional, default `'hex'`)

@@ -211,2 +212,6 @@ **Examples**

```javascript
ecc.sha256(Buffer.from('02208b', 'hex')) === '29a23..'
```
Returns **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html))** Buffer when encoding is null, or string

@@ -230,3 +235,3 @@

// Convert to a public key
pubkey = PrivateKey.fromWif(privateWif).toPublic().toString()
pubkey = PrivateKey.fromString(privateWif).toPublic().toString()
```

@@ -233,0 +238,0 @@

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