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

@aztec/typed-data

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aztec/typed-data - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

CHANGELOG.md

29

lib/index.js

@@ -17,14 +17,11 @@ "use strict";

*/
var _require = require('web3-eth-abi'),
AbiCoder = _require.AbiCoder;
var AbiCoder = require('web3-eth-abi');
var _require2 = require('web3-utils'),
keccak256 = _require2.keccak256,
padLeft = _require2.padLeft;
var _require = require('web3-utils'),
keccak256 = _require.keccak256;
var abiCoder = new AbiCoder();
var signer = {};
function padKeccak256(data) {
return padLeft(keccak256(data).slice(2), 64);
function sliceKeccak256(data) {
return keccak256(data).slice(2);
}

@@ -50,15 +47,15 @@ /**

if (types[type]) {
return "".concat(acc).concat(padKeccak256("0x".concat(encodeMessageData(types, type, message[name]))));
return "".concat(acc).concat(sliceKeccak256("0x".concat(encodeMessageData(types, type, message[name]))));
}
if (type === 'string' || type === 'bytes') {
return "".concat(acc).concat(padKeccak256(message[name]));
return "".concat(acc).concat(sliceKeccak256(message[name]));
}
if (type.includes('[')) {
return "".concat(acc).concat(padKeccak256(abiCoder.encodeParameter(type, message[name])));
return "".concat(acc).concat(sliceKeccak256(AbiCoder.encodeParameter(type, message[name])));
}
return "".concat(acc).concat(abiCoder.encodeParameters([type], [message[name]]).slice(2));
}, padKeccak256(signer.encodeStruct(primaryType, types)));
return "".concat(acc).concat(AbiCoder.encodeParameters([type], [message[name]]).slice(2));
}, sliceKeccak256(signer.encodeStruct(primaryType, types)));
};

@@ -113,7 +110,7 @@ /**

signer.encodeTypedData = function (typedData) {
var domainHash = padKeccak256("0x".concat(signer.encodeMessageData(typedData.types, 'EIP712Domain', typedData.domain)));
var structHash = padKeccak256("0x".concat(signer.encodeMessageData(typedData.types, typedData.primaryType, typedData.message)));
return "0x".concat(padKeccak256("0x1901".concat(domainHash).concat(structHash)));
var domainHash = sliceKeccak256("0x".concat(signer.encodeMessageData(typedData.types, 'EIP712Domain', typedData.domain)));
var structHash = sliceKeccak256("0x".concat(signer.encodeMessageData(typedData.types, typedData.primaryType, typedData.message)));
return keccak256("0x1901".concat(domainHash).concat(structHash));
};
module.exports = signer;
{
"name": "@aztec/typed-data",
"description": "JavaScript library for working with typed structured data as defined by EIP-712",
"version": "1.0.1",
"version": "1.0.2",
"author": "AZTEC",

@@ -10,4 +10,3 @@ "bugs": {

"dependencies": {
"web3-eth-abi": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55"
"web3-utils": "1.2.1"
},

@@ -22,5 +21,4 @@ "devDependencies": {

"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-prettier": "^4.1.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.16.0",
"fixpack": "^2.3.1",
"mocha": "^6.0.2",

@@ -27,0 +25,0 @@ "shx": "^0.3.2"

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