All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog (modification: no type change headlines) and this project adheres to Semantic Versioning.
7.0.0 - 2020-04-30
This release comes with significant changes to the API, updated versions of the core crypto libraries and substantial developer improvements in the form of a refactored test suite and API documentation.
Changes to the API have been discussed in Issue #172 and are guided by the principles of:
- Make the API more typestrict
- Be less ambiguous regarding accepted values
- Avoid implicit type conversions
- Be more explicit on wrong input (just: throw)
While the implemented changes come with some additional need for manual type conversions depending on the usage context, they should finally lead to cleaner usage patterns on the cosuming side and more a predictable, robust and less error-prone control flow.
PR: #241
Hex prefixing is now enforced for all address string inputs and functions will throw if a non-hex string is provided:
Account.isValidAddress()Account.isZeroAddress()Account.toChecksumAddress()Account.isValidChecksumAddress()
The Account.isPrecompile() method was removed from the code base,
PR #242
PR: #245
Implicit Buffer conversions for the following methods have been removed
and Buffer inputs are now enforced:
Account.generateAddress()Account.generateAddress2()Account.pubToAddress()AccountprivateToPublic()AccountimportPublic()
PR: #244
- Enforced
Bufferinput forBytes.setLengthLeft(),Bytes.setLengthRight() Bytes.setLength()has been removed (alias forBytes.setLengthLeft())Bytes.stripZeros()has been removed (alias forBytes.unPad())Bytes.unpadhas been split up into:Bytes.unpadBuffer()Bytes.unpadHexString()Bytes.unpadArray()
PR #247
The following methods are now Buffer-only:
Hash.keccak()Hash.keccak256()Hash.sha256()Hash.ripemd160()
Hash.keccak() gets the following additional convenience methods:
Hash.keccakFromString()Hash.keccakFromHexString()(hex string enforced)Hash.keccakFromArray()
Hash.sha256() gets the following additional convenience methods:
Hash.sha256FromString()Hash.sha256FromArray()
Hash.ripemd160() gets the following additional convenience methods:
Hash.ripemd160FromString()Hash.ripemd160FromArray()
- Dropped support for Node
8along PR #228 - Removed
secp2561re-export (use methods provided or import directly), PR #228
Keccak dependency has been updated from 2.1.0 to 3.0.0. This version
comes with prebuilds for Linux, MacOS and Windows so most users won't need
to have node-gyp run on installation.
The version update also brings in feature compatibility with newer Node.js versions.
The secp2561 ECDSA dependency has been updated from 3.0.1 to 4.0.1.
- Refactored test suite (module split-up, headless Firefox and Chrome), PR #231
- Moved CI from Travis to GitHub Actions, PR #231
- Improved and updated
TypeDocAPI documentation, PR #232 and PR #236 - Basic API tests for re-exports (BN.js, RLP, ethjsUtil), PR #235
6.2.0 - 2019-11-06
This release comes with a new file structure, related functionality is now broken
down into separate files (like account.js) allowing for more oversight and
modular integration. All functionality is additionally exposed through an
aggregating index.js file, so this version remains backwards-compatible.
Overview on the new structure:
account: Private/public key and address-related functionality (creation, validation, conversion)byte: Byte-related helper and conversion functionsconstants: Exposed constants (e.g.KECCAK256_NULL_Sfor the string representation of the Keccak-256 hash of null)hash: Hash functionsobject: Helper function for creating a binary object (DEPRECATED)signature: Signing, signature validation, conversion, recovery
See associated PRs #182 and #179.
Features
account: AddedEIP-1191address checksum algorithm support fortoChecksumAddress(), PR #204
Bug Fixes
bytes:toBuffer()conversion function now throws if strings aren't0x-prefixed hex values making the behavior oftoBuffer()more predictable respectively less error-prone (you might generally want to check cases in your code where you eventually allowed non-0x-prefixed input before), PR #197
Dependencies / Environment
- Dropped Node
6, added Node11and12to officially supported Node versions, PR #207 - Dropped
safe-bufferdependency, PR #182 - Updated
rlpdependency fromv2.0.0tov2.2.3(TypeScriptimprovements for RLP hash functionality), PR #187 - Made
@types/bn.jsadependencyinstead of adevDependency, PR #205 - Updated
keccak256dependency fromv1.4.0tov2.0.0, PR #168
6.1.0 - 2019-02-12
First TypeScript based release of the library, now also including a type declaration file distributed along with the package published, see PR #170.
Bug Fixes
- Fixed a bug in
isValidSignature()not correctly returningfalseif passed ans-value greater thansecp256k1n/2onhomesteador later. If you use the method signature with more than three arguments (so not just passing inv,r,sand use it likeisValidSignature(v, r, s)and omit the optional args) please read the thread from PR #171 carefully and check your code.
Development
- Updated
@types/nodeto Node11types, PR #175 - Changed browser from Chrome to ChromeHeadless, PR #156
6.0.0 - 2018-10-08
- Support for
EIP-155replay protection by adding an optionalchainIdparameter toecsign(),ecrecover(),toRpcSig()andisValidSignature(), if present the
new signature format relying on thechainIdis used, see PR #143 - New
generateAddress2()forCREATE2opcode (EIP-1014) address creation (Constantinople HF), see PR #146 - [BREAKING] Fixed signature to comply with Geth and Parity in
toRpcSig()changingvfrom 0/1 to 27/28, this changes the resulting signature buffer, see PR #139 - [BREAKING] Remove deprecated
sha3-named constants and methods (seev5.2.0release), see PR #154
5.2.0 - 2018-04-27
- Rename all
sha3hash related constants and functions tokeccak, see this EIP discussion for context (tl;dr: Ethereum uses a slightly different hash algorithm then in the officialSHA-3standard) - Renamed constants:
SHA3_NULL_S->KECCAK256_NULL_SSHA3_NULL->KECCAK256_NULLSHA3_RLP_ARRAY_S->KECCAK256_RLP_ARRAY_SSHA3_RLP_ARRAY->KECCAK256_RLP_ARRAYSHA3_RLP_S->KECCAK256_RLP_SSHA3_RLP->KECCAK256_RLP
- Renamed functions:
sha3()->keccak()(number of bits determined in arguments)
- New
keccak256()alias function forkeccak(a, 256) - The usage of the
sha-named versions is nowDEPRECATEDand the related constants and functions will be removed on the next major releasev6.0.0
5.1.5 - 2018-02-28
- Fix
browserifyissue leading to 3rd-party build problems, PR #119
5.1.4 - 2018-02-03
- Moved to
ES5Node distribution version for easier toolchain integration, PR #114 - Updated
isPrecompile()with Byzantium precompile address range, PR #115
5.1.3 - 2018-01-03
ES6syntax updates- Dropped Node
5support - Moved babel to dev dependencies, switched to
envpreset - Usage of
safe-bufferinstead of NodeBuffer - Do not allow capital
0Xas valid address inisValidAddress() - New methods
zeroAddress()andisZeroAddress() - Updated dependencies
5.1.2 - 2017-05-31
- Add browserify for
ES2015compatibility - Fix hex validation
5.1.1 - 2017-02-10
- Use hex utils from
ethjs-util - Move secp vars into functions
- Dependency updates
5.1.0 - 2017-02-04
- Fix
toRpcSig()function - Updated Buffer creation (
Buffer.from) - Dependency updates
- Fix npm error
- Use
keccakpackage instead ofkeccakjs - Helpers for
eth_signRPC call
5.0.1 - 2016-11-08
- Fix
bufferToHex()
5.0.0 - 2016-11-08
- Added
isValidSignature()(ECDSA signature validation) - Change
vparam inecrecover()fromBuffertoint(breaking change!) - Fix property alias for setting with initial parameters
- Reject invalid signature lengths for
fromRpcSig() - Fix
sha3()widthparam (byte -> bit) - Fix overflow bug in
bufferToInt()
4.5.0 - 2016-17-12
- Introduced
toMessageSig()andfromMessageSig()