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

@ethersproject/signing-key

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethersproject/signing-key

Elliptic curve library functions for the secp256k1 curve.

  • 5.0.0-beta.131
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
438K
decreased by-53.49%
Maintainers
1
Weekly downloads
 
Created

What is @ethersproject/signing-key?

@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.

What are @ethersproject/signing-key's main functionalities?

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);

Other packages similar to @ethersproject/signing-key

Keywords

FAQs

Package last updated on 28 Sep 2019

Did you know?

Socket

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.

Install

Related posts

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