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

@noble/secp256k1

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@noble/secp256k1

Fastest 4KB JS implementation of secp256k1 ECDH & ECDSA signatures compliant with RFC6979

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
438K
increased by10.52%
Maintainers
1
Weekly downloads
 
Created

What is @noble/secp256k1?

@noble/secp256k1 is a JavaScript library for elliptic curve cryptography, specifically for the secp256k1 curve. It is commonly used in blockchain and cryptocurrency applications for key generation, signing, and verification.

What are @noble/secp256k1's main functionalities?

Key Generation

This feature allows you to generate a random private key and derive the corresponding public key using the secp256k1 curve.

const secp = require('@noble/secp256k1');
const privateKey = secp.utils.randomPrivateKey();
const publicKey = secp.getPublicKey(privateKey);
console.log('Private Key:', privateKey);
console.log('Public Key:', publicKey);

Signing

This feature allows you to sign a message using a private key. The message is an array of bytes, and the signature is generated using the secp256k1 curve.

const secp = require('@noble/secp256k1');
const message = new Uint8Array([1, 2, 3]);
const privateKey = secp.utils.randomPrivateKey();
const signature = secp.sign(message, privateKey);
console.log('Signature:', signature);

Verification

This feature allows you to verify a signature using the corresponding public key and the original message. It returns a boolean indicating whether the signature is valid.

const secp = require('@noble/secp256k1');
const message = new Uint8Array([1, 2, 3]);
const privateKey = secp.utils.randomPrivateKey();
const publicKey = secp.getPublicKey(privateKey);
const signature = secp.sign(message, privateKey);
const isValid = secp.verify(signature, message, publicKey);
console.log('Is the signature valid?', isValid);

Other packages similar to @noble/secp256k1

Keywords

FAQs

Package last updated on 24 Mar 2024

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