Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

EOSJS v21.0.2-rc3 Release Notes

Pre-release
Pre-release
Compare
Choose a tag to compare
@bradlhart bradlhart released this 16 Jun 20:55
· 1015 commits to master since this release

This is a RELEASE CANDIDATE for version 21.0.0. The latest STABLE release is v20.0.0.

This Release Candidate can be accessed by running yarn add eosjs@RC.

Switch to elliptic cryptography library

Additional Helpers with elliptic

elliptic has methods to sign, verify, and recover keys and signatures. For ease of use, helper functions that perform the conversion and operation of those methods have been added. These are added to PublicKey, PrivateKey, and Signature classes located in src/eosjs-key-conversions.ts as well as re-exported in src/eosjs-jssig.ts. Usage examples of each can be found in src/tests/eosjs-jssig.test.ts. Additionally, sha256 and generateKeyPair are available in src/eosjs-key-conversions.ts. A glimpse of the functions follows:

// Create a message digest with sha256
const digest = sha256(message);

// Generate a Key Pair with specified curve key type.  Intended for non-browser environments or development
const { publicKey, privateKey } = generateKeyPair(KeyType.k1);

// Export private key as Legacy EOSIO-format private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const legacyPrivateKey = privateKey.getLegacyString();

// Export public key as Legacy EOSIO-format public key
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const legacyPublicKey = publicKey.getLegacyString();

// Retrieve the public key from a private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const publicKey = privateKey.getPublicKey();

// Sign a message digest with private key
const digest = sha256(message); // optional, setting shouldHash to true will hash the message
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const signature = privateKey.sign(digest, false);

// Validate a private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const valid = publicKey.isValid();

// Validate a public key
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const valid = publicKey.isValid();

// Verify a signature with a message digest and public key
const digest = sha256(message); // optional, setting shouldHash to true will hash the message
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const signature = Signature.fromString(eosioSignatureAsString);
const verified = signature.verify(digest, publicKey, false);

// Recover a public key from a message digest and signature
const digest = sha256(message); // optional, setting shouldHash to true will hash the message
const signature = Signature.fromString(eosioSignatureAsString);
const publicKey = signature.recover(digest, false);

eosjs-ecc Migration Guide

In an effort to make migration easier from eosjs-ecc, a new module from eosjs-ecc-migration.ts is available that provides many of the eosjs-ecc methods. These methods are available to be used for easy migration to this new version but additionally as guides to how to convert code to use the new elliptic helper methods and new key formats. This module will be removed at a later release.

Transaction compression and useLastIrreversible

Adding the compression argument to transaction methods will use compression for the transaction. Adding the useLastIrreversible argument to transaciton methods will use the last irreversible block number for the transaction TAPOS headers.

Other Changes

  • (#687) Backwards/currently compatible fetch
  • (#692) Switching to browser compatible .toArrayLike (release/21.0.x branch)
  • (#695) Fix broken link to intro page
  • (#709) eosjs-ecc methods and migration (release/21.0.x branch)
  • (#715) Added false for shouldHash to sign() usages (release/21.0.x branch)
  • (#730) 2020 License
  • (#744) Resolving deprecation of new Buffer() (release/21.0.x branch)
  • (#745) Adds functionality to use the last irreversible block for transactions (release/21.0.x branch)
  • (#746) Supporting transaction compression (release/21.0.x branch)
  • (#747) Remove unnecessary call to get_block_header_state (release/21.0.x branch)
  • (#748) Adding regex to validate name during serialization (release/21.0.x branch)
  • (#749) Adding an alternative option for browser to generate key pairs (release/21.0.x branch)
  • (#750) New CI/CD Utilizing GitHub Actions (release/21.0.x branch)
  • (#751) Fix R1 Signatures (release/21.0.x branch)
  • (#752) Migrating from tslint to eslint (release/21.0.x branch)
  • (#753) Bumping versions or removing unused dependencies (release/21.0.x branch)
  • (#754) Resolves differences missed in merging
  • (#756) Updating CI/CD to check for protected branch and use token so workflow re-runs (release/21.0.x branch)
  • (#768) Bump elliptic - v21

Disclaimer: All repositories and other materials are provided subject to this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.