Socket
Socket
Sign inDemoInstall

@toruslabs/eccrypto

Package Overview
Dependencies
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toruslabs/eccrypto - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

dist/lib.cjs/index.js

6

dist/eccrypto.cjs.js

@@ -87,3 +87,3 @@ /******/ (() => { // webpackBootstrap

const ec = new external_elliptic_namespaceObject.ec("secp256k1");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any, n/no-unsupported-features/node-builtins
const browserCrypto = __webpack_require__.g.crypto || __webpack_require__.g.msCrypto || {};

@@ -120,3 +120,2 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

}
return res === 0;

@@ -337,3 +336,2 @@ }

/******/ })()
;
//# sourceMappingURL=eccrypto.cjs.js.map
;

@@ -5,3 +5,3 @@ import nodeCrypto from 'crypto';

const ec = new ec$1("secp256k1");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any, n/no-unsupported-features/node-builtins
const browserCrypto = global.crypto || global.msCrypto || {};

@@ -38,3 +38,2 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

}
return res === 0;

@@ -255,2 +254,1 @@ }

export { decrypt, derive, derivePadded, deriveUnpadded, encrypt, generatePrivate, getPublic, getPublicCompressed, sign, verify };
//# sourceMappingURL=eccrypto.esm.js.map
{
"name": "@toruslabs/eccrypto",
"version": "4.0.0",
"version": "5.0.0",
"description": "JavaScript Elliptic curve cryptography library, includes fix to browser.js so that encrypt/decrypt works",
"main": "./dist/eccrypto.cjs.js",
"module": "./dist/eccrypto.esm.js",
"main": "./dist/lib.cjs/index.js",
"module": "./dist/lib.esm/index.js",
"types": "./dist/types/index.d.ts",
"sideEffects": false,
"scripts": {

@@ -23,3 +24,2 @@ "build": "torus-scripts build",

"files": [
"src",
"dist"

@@ -46,13 +46,13 @@ ],

"devDependencies": {
"@babel/cli": "^7.22.10",
"@babel/core": "^7.22.10",
"@babel/plugin-transform-runtime": "^7.22.10",
"@babel/preset-env": "^7.22.10",
"@babel/runtime": "^7.22.10",
"@toruslabs/config": "^2.0.1",
"@toruslabs/eslint-config-node": "^3.0.0",
"@toruslabs/torus-scripts": "^5.0.1",
"@types/buffer-equal": "^1.0.0",
"@types/chai": "^4.3.5",
"@types/elliptic": "^6.4.14",
"@babel/cli": "^7.24.7",
"@babel/core": "^7.24.7",
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@babel/runtime": "^7.24.7",
"@toruslabs/config": "^2.1.0",
"@toruslabs/eslint-config-node": "^3.3.1",
"@toruslabs/torus-scripts": "^6.0.1",
"@types/buffer-equal": "^1.0.2",
"@types/chai": "^4.3.16",
"@types/elliptic": "^6.4.18",
"browserify": "^17.0.0",

@@ -62,16 +62,16 @@ "buffer-equal": "^1.0.1",

"eslint": "^8.46.0",
"karma": "^6.4.2",
"karma": "^6.4.3",
"karma-browserify": "^8.1.0",
"karma-chrome-launcher": "^3.2.0",
"karma-cli": "^2.0.0",
"karma-firefox-launcher": "^2.1.2",
"karma-firefox-launcher": "^2.1.3",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-safari-launcher": "^1.0.0",
"mocha": "^10.2.0",
"playwright": "^1.36.2",
"typescript": "^5.1.6"
"mocha": "^10.4.0",
"playwright": "^1.44.1",
"typescript": "^5.4.5"
},
"dependencies": {
"elliptic": "^6.5.4"
"elliptic": "^6.5.5"
},

@@ -78,0 +78,0 @@ "engines": {

@@ -1,5 +0,9 @@

# eccrypto [![Build Status](https://github.com/torusresearch/eccrypto/workflows/master/badge.svg)](https://github.com/torusresearch/eccrypto/actions)
# eccrypto
[![NPM](https://nodei.co/npm/eccrypto.png)](https://www.npmjs.com/package/eccrypto)
![Build Status](https://github.com/torusresearch/eccrypto/actions/workflows/master.yml/badge.svg)
[![npm downloads](https://img.shields.io/npm/dm/@toruslabs/eccrypto.svg?style=flat-square)](https://www.npmjs.com/package/@toruslabs/eccrypto)
[![NPM](https://nodei.co/npm/@toruslabs/eccrypto.png)](https://www.npmjs.com/package/@toruslabs/eccrypto)
JavaScript Elliptic curve cryptography library for both browserify and node.

@@ -15,7 +19,7 @@

* Use Node.js crypto module/library bindings where possible
* Use WebCryptoAPI where possible
* Promise-driven API
* Only secp256k1 curve, only SHA-512 (KDF), HMAC-SHA-256 (HMAC) and AES-256-CBC for ECIES
* Compressed key support
- Use Node.js crypto module/library bindings where possible
- Use WebCryptoAPI where possible
- Promise-driven API
- Only secp256k1 curve, only SHA-512 (KDF), HMAC-SHA-256 (HMAC) and AES-256-CBC for ECIES
- Compressed key support

@@ -36,3 +40,3 @@ ### Native crypto API limitations

* Support other curves/KDF/MAC/symmetric encryption schemes
- Support other curves/KDF/MAC/symmetric encryption schemes

@@ -56,9 +60,12 @@ ## Usage

eccrypto.sign(privateKey, msg).then(function(sig) {
eccrypto.sign(privateKey, msg).then(function (sig) {
console.log("Signature in DER format:", sig);
eccrypto.verify(publicKey, msg, sig).then(function() {
console.log("Signature is OK");
}).catch(function() {
console.log("Signature is BAD");
});
eccrypto
.verify(publicKey, msg, sig)
.then(function () {
console.log("Signature is OK");
})
.catch(function () {
console.log("Signature is BAD");
});
});

@@ -77,4 +84,4 @@ ```

eccrypto.derive(privateKeyA, publicKeyB).then(function(sharedKey1) {
eccrypto.derive(privateKeyB, publicKeyA).then(function(sharedKey2) {
eccrypto.derive(privateKeyA, publicKeyB).then(function (sharedKey1) {
eccrypto.derive(privateKeyB, publicKeyA).then(function (sharedKey2) {
console.log("Both shared keys are equal:", sharedKey1, sharedKey2);

@@ -96,5 +103,5 @@ });

// Encrypting the message for B.
eccrypto.encrypt(publicKeyB, Buffer.from("msg to b")).then(function(encrypted) {
eccrypto.encrypt(publicKeyB, Buffer.from("msg to b")).then(function (encrypted) {
// B decrypting the message.
eccrypto.decrypt(privateKeyB, encrypted).then(function(plaintext) {
eccrypto.decrypt(privateKeyB, encrypted).then(function (plaintext) {
console.log("Message to part B:", plaintext.toString());

@@ -105,5 +112,5 @@ });

// Encrypting the message for A.
eccrypto.encrypt(publicKeyA, Buffer.from("msg to a")).then(function(encrypted) {
eccrypto.encrypt(publicKeyA, Buffer.from("msg to a")).then(function (encrypted) {
// A decrypting the message.
eccrypto.decrypt(privateKeyA, encrypted).then(function(plaintext) {
eccrypto.decrypt(privateKeyA, encrypted).then(function (plaintext) {
console.log("Message to part A:", plaintext.toString());

@@ -110,0 +117,0 @@ });

Sorry, the diff of this file is too big to display

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