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 5.0.2 to 5.0.3

35

dist/eccrypto.cjs.js

@@ -103,5 +103,10 @@ /******/ (() => { // webpackBootstrap

async function sha512(msg) {
const hash = await subtle.digest("SHA-512", msg);
const result = new Uint8Array(hash);
return result;
if (!browserCrypto.createHash) {
const hash = await subtle.digest("SHA-512", msg);
const result = new Uint8Array(hash);
return result;
}
const hash = browserCrypto.createHash("sha512");
const result = hash.update(msg).digest();
return new Uint8Array(result);
}

@@ -140,11 +145,17 @@ function getAes(op) {

async function hmacSha256Sign(key, msg) {
const importAlgorithm = {
name: "HMAC",
hash: {
name: "SHA-256"
}
};
const cryptoKey = await subtle.importKey("raw", new Uint8Array(key), importAlgorithm, false, ["sign", "verify"]);
const sig = await subtle.sign("HMAC", cryptoKey, msg);
const result = Buffer.from(new Uint8Array(sig));
if (!browserCrypto.createHmac) {
const importAlgorithm = {
name: "HMAC",
hash: {
name: "SHA-256"
}
};
const cryptoKey = await subtle.importKey("raw", new Uint8Array(key), importAlgorithm, false, ["sign", "verify"]);
const sig = await subtle.sign("HMAC", cryptoKey, msg);
const result = Buffer.from(new Uint8Array(sig));
return result;
}
const hmac = browserCrypto.createHmac("sha256", Buffer.from(key));
hmac.update(msg);
const result = hmac.digest();
return result;

@@ -151,0 +162,0 @@ }

@@ -48,5 +48,10 @@ import { ec as ec$1 } from 'elliptic';

async function sha512(msg) {
const hash = await subtle.digest("SHA-512", msg);
const result = new Uint8Array(hash);
return result;
if (!browserCrypto.createHash) {
const hash = await subtle.digest("SHA-512", msg);
const result = new Uint8Array(hash);
return result;
}
const hash = browserCrypto.createHash("sha512");
const result = hash.update(msg).digest();
return new Uint8Array(result);
}

@@ -85,11 +90,17 @@ function getAes(op) {

async function hmacSha256Sign(key, msg) {
const importAlgorithm = {
name: "HMAC",
hash: {
name: "SHA-256"
}
};
const cryptoKey = await subtle.importKey("raw", new Uint8Array(key), importAlgorithm, false, ["sign", "verify"]);
const sig = await subtle.sign("HMAC", cryptoKey, msg);
const result = Buffer.from(new Uint8Array(sig));
if (!browserCrypto.createHmac) {
const importAlgorithm = {
name: "HMAC",
hash: {
name: "SHA-256"
}
};
const cryptoKey = await subtle.importKey("raw", new Uint8Array(key), importAlgorithm, false, ["sign", "verify"]);
const sig = await subtle.sign("HMAC", cryptoKey, msg);
const result = Buffer.from(new Uint8Array(sig));
return result;
}
const hmac = browserCrypto.createHmac("sha256", Buffer.from(key));
hmac.update(msg);
const result = hmac.digest();
return result;

@@ -96,0 +107,0 @@ }

@@ -50,5 +50,10 @@ 'use strict';

async function sha512(msg) {
const hash = await subtle.digest("SHA-512", msg);
const result = new Uint8Array(hash);
return result;
if (!browserCrypto.createHash) {
const hash = await subtle.digest("SHA-512", msg);
const result = new Uint8Array(hash);
return result;
}
const hash = browserCrypto.createHash("sha512");
const result = hash.update(msg).digest();
return new Uint8Array(result);
}

@@ -87,11 +92,17 @@ function getAes(op) {

async function hmacSha256Sign(key, msg) {
const importAlgorithm = {
name: "HMAC",
hash: {
name: "SHA-256"
}
};
const cryptoKey = await subtle.importKey("raw", new Uint8Array(key), importAlgorithm, false, ["sign", "verify"]);
const sig = await subtle.sign("HMAC", cryptoKey, msg);
const result = Buffer.from(new Uint8Array(sig));
if (!browserCrypto.createHmac) {
const importAlgorithm = {
name: "HMAC",
hash: {
name: "SHA-256"
}
};
const cryptoKey = await subtle.importKey("raw", new Uint8Array(key), importAlgorithm, false, ["sign", "verify"]);
const sig = await subtle.sign("HMAC", cryptoKey, msg);
const result = Buffer.from(new Uint8Array(sig));
return result;
}
const hmac = browserCrypto.createHmac("sha256", Buffer.from(key));
hmac.update(msg);
const result = hmac.digest();
return result;

@@ -98,0 +109,0 @@ }

@@ -48,5 +48,10 @@ import { ec as ec$1 } from 'elliptic';

async function sha512(msg) {
const hash = await subtle.digest("SHA-512", msg);
const result = new Uint8Array(hash);
return result;
if (!browserCrypto.createHash) {
const hash = await subtle.digest("SHA-512", msg);
const result = new Uint8Array(hash);
return result;
}
const hash = browserCrypto.createHash("sha512");
const result = hash.update(msg).digest();
return new Uint8Array(result);
}

@@ -85,11 +90,17 @@ function getAes(op) {

async function hmacSha256Sign(key, msg) {
const importAlgorithm = {
name: "HMAC",
hash: {
name: "SHA-256"
}
};
const cryptoKey = await subtle.importKey("raw", new Uint8Array(key), importAlgorithm, false, ["sign", "verify"]);
const sig = await subtle.sign("HMAC", cryptoKey, msg);
const result = Buffer.from(new Uint8Array(sig));
if (!browserCrypto.createHmac) {
const importAlgorithm = {
name: "HMAC",
hash: {
name: "SHA-256"
}
};
const cryptoKey = await subtle.importKey("raw", new Uint8Array(key), importAlgorithm, false, ["sign", "verify"]);
const sig = await subtle.sign("HMAC", cryptoKey, msg);
const result = Buffer.from(new Uint8Array(sig));
return result;
}
const hmac = browserCrypto.createHmac("sha256", Buffer.from(key));
hmac.update(msg);
const result = hmac.digest();
return result;

@@ -96,0 +107,0 @@ }

@@ -1,2 +0,1 @@

/// <reference types="node" />
export interface Ecies {

@@ -3,0 +2,0 @@ iv: Buffer;

{
"name": "@toruslabs/eccrypto",
"version": "5.0.2",
"version": "5.0.3",
"description": "JavaScript Elliptic curve cryptography library, includes fix to browser.js so that encrypt/decrypt works",

@@ -67,6 +67,6 @@ "main": "./dist/lib.cjs/index.js",

"karma-mocha-reporter": "^2.2.5",
"karma-safari-launcher": "^1.0.0",
"mocha": "^10.4.0",
"playwright": "^1.44.1",
"typescript": "^5.4.5"
"karma-webkit-launcher": "^2.4.0",
"mocha": "^10.6.0",
"playwright": "^1.45.1",
"typescript": "^5.5.3"
},

@@ -73,0 +73,0 @@ "dependencies": {

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