NEAR
Return
near-api-js 0.44.0 Released – NEAR Protocol

near-api-js 0.44.0 Released

Developers
December 10, 2021

We have just released a new minor version of our JavaScript client library (NEAR-API-JS). v0.44.0 brings some significant changes, so let’s take a moment to go over the changelog and review what’s new.

RPC API Keys

  • TL;DR: Added support for RPC Server API Keys (PR #729)

The JavaScript library now allows you to define an API key to authenticate with the target RPC server. This feature comes in preparation for the upcoming change that will require keys to access our public RPC servers. Supporting API keys will also allow you to connect to third-party and non-public RPC servers in the future. If you’re wondering about the integration, you can find some practical code examples in our Cookbook.

For the moment there’s no need to take action on your side: currently, this is a non-breaking change, and your JavaScript code will continue to work correctly if you don’t provide an API key.

New verify method

  • TL;DR: Added a verify method on PublicKey type to verify signature correctness (PR #710)

Before this change, you could only verify a message or signature with KeyPair, which also required having a secret key. This requirement was completely irrelevant in the context of the signature verification process.

Thanks to the new verify method, it’s now possible to verify signatures using just a public key. You can find a code example on how to verify with a public key in our GitHub repository.

Key file permissions

  • TL;DR: Key file permissions changed to 0o600 (#706)

Account credentials are stored on your hard drive whenever you use the CLI with NEAR login. Regular file permissions allowed anyone on the system to access and read those credentials. As we care about security, we changed how the stored credentials’ file permissions are set, so only the owner can access the content.

Please note that this change won’t affect the permissions on existing keys. If you are handling sensitive keys, we recommend changing the file permissions manually.

Before:

[near@x1 ~] stat –format ‘%a’ ~/.near-credentials/testnet/near-test.testnet.json

644

After:

[near@x1 ~] stat –format ‘%a’ ~/.near-credentials/testnet/near-test.testnet.json

600

Fixes

We also added some fixes and minor changes; if you’re curious, feel free to check them on the NEAR-API-JS 0.44.0 Official Changelog.


Share this:

Join the community:

Follow NEAR:

More posts