Socket
Book a DemoInstallSign in
Socket

@toruslabs/eccrypto

Package Overview
Dependencies
Maintainers
5
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toruslabs/eccrypto

JavaScript Elliptic curve cryptography library, includes fix to browser.js so that encrypt/decrypt works

latest
Source
npmnpm
Version
6.1.0
Version published
Weekly downloads
200K
11.97%
Maintainers
5
Weekly downloads
 
Created

What is @toruslabs/eccrypto?

@toruslabs/eccrypto is a JavaScript library that provides elliptic curve cryptography functionalities. It allows developers to perform cryptographic operations such as key generation, encryption, decryption, signing, and verification using elliptic curve algorithms.

What are @toruslabs/eccrypto's main functionalities?

Key Generation

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

const eccrypto = require('@toruslabs/eccrypto');
const privateKey = eccrypto.generatePrivate();
const publicKey = eccrypto.getPublic(privateKey);

Encryption

This feature allows you to encrypt a message using a public key. The encrypted message can only be decrypted by the corresponding private key.

const eccrypto = require('@toruslabs/eccrypto');
const publicKey = Buffer.from('...'); // Replace with actual public key
const message = Buffer.from('Hello, world!');
eccrypto.encrypt(publicKey, message).then(function(encrypted) {
  console.log(encrypted);
});

Decryption

This feature allows you to decrypt a message using a private key. The message must have been encrypted with the corresponding public key.

const eccrypto = require('@toruslabs/eccrypto');
const privateKey = Buffer.from('...'); // Replace with actual private key
eccrypto.decrypt(privateKey, encrypted).then(function(plaintext) {
  console.log(plaintext.toString());
});

Signing

This feature allows you to sign a message using a private key. The signature can be verified by anyone with the corresponding public key.

const eccrypto = require('@toruslabs/eccrypto');
const privateKey = Buffer.from('...'); // Replace with actual private key
const message = Buffer.from('Hello, world!');
eccrypto.sign(privateKey, message).then(function(sig) {
  console.log(sig);
});

Verification

This feature allows you to verify a signature using a public key. It checks if the signature is valid for the given message and public key.

const eccrypto = require('@toruslabs/eccrypto');
const publicKey = Buffer.from('...'); // Replace with actual public key
const message = Buffer.from('Hello, world!');
const signature = Buffer.from('...'); // Replace with actual signature
eccrypto.verify(publicKey, message, signature).then(function() {
  console.log('Signature is valid');
}).catch(function() {
  console.log('Signature is invalid');
});

Other packages similar to @toruslabs/eccrypto

Keywords

ecc

FAQs

Package last updated on 24 Apr 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.