Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tendermint

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tendermint - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

28

lib/verify.js

@@ -6,6 +6,8 @@ 'use strict';

// TODO: try to load native ed25519 implementation, fall back to supercop.js
var secp256k1 = require('secp256k1');
var _require = require('./hash.js'),
getBlockHash = _require.getBlockHash,
getValidatorSetHash = _require.getValidatorSetHash;
getValidatorSetHash = _require.getValidatorSetHash,
sha256 = _require.sha256;

@@ -156,2 +158,3 @@ var _require2 = require('./pubkey.js'),

validatorsByAddress[validator.address] = validator;
validator.voting_power = safeParseInt(validator.voting_power);
}

@@ -195,5 +198,18 @@ } catch (err) {

var pubKey = Buffer.from(_validator.pub_key.value, 'base64');
var pubKeyType = _validator.pub_key.type;
// TODO: support secp256k1 sigs
if (!ed25519.verify(signature, signBytes, pubKey)) {
var validSignature = void 0;
switch (pubKeyType) {
case 'tendermint/PubKeyEd25519':
validSignature = ed25519.verify(signature, signBytes, pubKey);
break;
case 'tendermint/PubKeySecp256k1':
validSignature = secp256k1.verify(sha256(signBytes), signature, pubKey);
break;
default:
throw Error('Unknown pubkey type "' + _validator.pub_key.type + '"');
}
if (validSignature !== true) {
throw Error('Invalid precommit signature');

@@ -256,5 +272,5 @@ }

validator.voting_power = safeParseInt(validator.voting_power);
verifyPositiveInt(validator.voting_power);
if (validator.voting_power === 0) {
var votingPower = safeParseInt(validator.voting_power);
verifyPositiveInt(votingPower);
if (votingPower === 0) {
throw Error('Validator voting power must be > 0');

@@ -261,0 +277,0 @@ }

{
"name": "tendermint",
"version": "3.2.1",
"version": "3.3.0",
"description": "A light client which talks to your Tendermint node over RPC",

@@ -23,2 +23,3 @@ "main": "index.js",

"pumpify": "^1.3.5",
"secp256k1": "^3.5.2",
"supercop.js": "^2.0.1",

@@ -25,0 +26,0 @@ "varstruct": "^6.1.1",

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