Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@ethersproject/signing-key
Advanced tools
Elliptic curve library functions for the secp256k1 curve.
@ethersproject/signing-key is a part of the ethers.js library, which provides utilities for handling cryptographic signing keys. It allows you to create, manage, and use signing keys for cryptographic operations, particularly in the context of Ethereum and other blockchain technologies.
Creating a Signing Key
This feature allows you to create a new signing key from a given private key. The SigningKey object can then be used for various cryptographic operations.
const { SigningKey } = require('@ethersproject/signing-key');
const privateKey = '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
const signingKey = new SigningKey(privateKey);
console.log(signingKey);
Signing a Message
This feature allows you to sign a message using the signing key. The message is first hashed, and then the hash is signed to produce a signature.
const { SigningKey } = require('@ethersproject/signing-key');
const privateKey = '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
const signingKey = new SigningKey(privateKey);
const message = 'Hello, world!';
const messageHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(message));
const signature = signingKey.signDigest(messageHash);
console.log(signature);
Recovering a Public Key
This feature allows you to recover the public key from a signed message. This can be useful for verifying the authenticity of a message.
const { SigningKey } = require('@ethersproject/signing-key');
const privateKey = '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
const signingKey = new SigningKey(privateKey);
const message = 'Hello, world!';
const messageHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(message));
const signature = signingKey.signDigest(messageHash);
const recoveredPublicKey = SigningKey.recoverPublicKey(messageHash, signature);
console.log(recoveredPublicKey);
The elliptic package is a widely-used library for elliptic curve cryptography in JavaScript. It provides a comprehensive set of tools for working with elliptic curves, including key generation, signing, and verification. Compared to @ethersproject/signing-key, elliptic is more general-purpose and not specifically tailored for Ethereum.
The secp256k1 package is a native binding to the secp256k1 library used in Bitcoin and Ethereum for elliptic curve cryptography. It offers high-performance cryptographic operations but requires native compilation. Unlike @ethersproject/signing-key, it is more low-level and may require more effort to integrate into applications.
The noble-secp256k1 package is a pure JavaScript implementation of the secp256k1 elliptic curve. It is designed to be fast and secure, with no dependencies. It provides similar functionalities to @ethersproject/signing-key but is focused on being lightweight and easy to use in various environments.
This sub-module is part of the ethers project.
It is responsible for secp256-k1 signing, verifying and recovery operations.
For more information, see the documentation.
Most users will prefer to use the umbrella package, but for those with more specific needs, individual components can be imported.
const {
SigningKey,
computePublicKey,
recoverPublicKey
} = require("@ethersproject/signing-key");
MIT License
FAQs
Elliptic curve library functions for the secp256k1 curve.
The npm package @ethersproject/signing-key receives a total of 890,391 weekly downloads. As such, @ethersproject/signing-key popularity was classified as popular.
We found that @ethersproject/signing-key demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.