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

@waves/ts-lib-crypto

Package Overview
Dependencies
Maintainers
17
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waves/ts-lib-crypto - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

38

crypto/rsa.js

@@ -42,2 +42,14 @@ "use strict";

var string_bytes_1 = require("../conversions/string-bytes");
var sha3 = require("js-sha3");
// HACK. Monkey patch node-forge library to provide oids for missing hash algorithms
node_forge_1.pki.oids['sha224'] = '2.16.840.1.101.3.4.2.4';
node_forge_1.pki.oids['2.16.840.1.101.3.4.2.4'] = 'sha224';
node_forge_1.pki.oids['sha3-224'] = '2.16.840.1.101.3.4.2.7';
node_forge_1.pki.oids['2.16.840.1.101.3.4.2.7'] = 'sha3-224';
node_forge_1.pki.oids['sha3-256'] = '2.16.840.1.101.3.4.2.8';
node_forge_1.pki.oids['2.16.840.1.101.3.4.2.8'] = 'sha3-256';
node_forge_1.pki.oids['sha3-384'] = '2.16.840.1.101.3.4.2.9';
node_forge_1.pki.oids['2.16.840.1.101.3.4.2.9'] = 'sha3-384';
node_forge_1.pki.oids['sha3-512'] = '2.16.840.1.101.3.4.2.10';
node_forge_1.pki.oids['2.16.840.1.101.3.4.2.10'] = 'sha3-512';
exports.pemToBytes = function (pem) { return base_xx_1.base64Decode(pem.trim()

@@ -89,2 +101,20 @@ .split(/\r\n|\n/)

}; };
var MessageDigestAdapter = /** @class */ (function () {
function MessageDigestAdapter(sha3Digest) {
this.sha3Digest = sha3Digest;
this.algorithm = 'sha3-256'; //fixMe: HACK to make forge work
}
MessageDigestAdapter.makeCreator = function (sha3Hash) {
return { create: function () { return new MessageDigestAdapter(sha3Hash.create()); } };
};
MessageDigestAdapter.prototype.update = function (msg, encoding) {
this.sha3Digest.update(string_bytes_1.stringToBytes(msg, encoding == null ? 'raw' : encoding));
return this;
};
MessageDigestAdapter.prototype.digest = function () {
var bytes = Uint8Array.from(this.sha3Digest.digest());
return node_forge_1.util.createBuffer(string_bytes_1.bytesToString(bytes, 'raw'));
};
return MessageDigestAdapter;
}());
var digestMap = {

@@ -97,6 +127,6 @@ 'MD5': node_forge_1.md.md5,

'SHA512': node_forge_1.md.sha512,
'SHA3-224': digestCreatorPlaceHolder('SHA3-224'),
'SHA3-256': digestCreatorPlaceHolder('SHA3-256'),
'SHA3-384': digestCreatorPlaceHolder('SHA3-384'),
'SHA3-512': digestCreatorPlaceHolder('SHA3-512'),
'SHA3-224': MessageDigestAdapter.makeCreator(sha3.sha3_224),
'SHA3-256': MessageDigestAdapter.makeCreator(sha3.sha3_256),
'SHA3-384': MessageDigestAdapter.makeCreator(sha3.sha3_384),
'SHA3-512': MessageDigestAdapter.makeCreator(sha3.sha3_512),
};

@@ -103,0 +133,0 @@ exports.rsaSign = function (rsaPrivateKey, message, digest) {

3

package.json
{
"name": "@waves/ts-lib-crypto",
"version": "1.2.0",
"version": "1.3.0",
"description": "This library contains all algorithm implementations like signature verification and protocol entries like address used in Waves.",

@@ -28,4 +28,5 @@ "keywords": [

"dependencies": {
"js-sha3": "^0.8.0",
"node-forge": "^0.8.5"
}
}

Sorry, the diff of this file is not supported yet

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