New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@canvas-js/signed-cid

Package Overview
Dependencies
Maintainers
3
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@canvas-js/signed-cid - npm Package Compare versions

Comparing version 0.8.21 to 0.8.22

77

lib/eip712Codec.js

@@ -49,23 +49,58 @@ import * as web3 from "web3";

if (message.payload.type === "session") {
const sessionType = [
{ name: "address", type: "address" },
{ name: "publicKey", type: "string" },
{ name: "blockhash", type: "string" },
{ name: "timestamp", type: "uint256" },
{ name: "duration", type: "uint256" },
];
const { address, publicKey, blockhash, timestamp, duration } = message.payload;
hashedPayload = TypedDataEncoder.hash({}, { Session: sessionType }, { address: address.split(":")[2], publicKey, blockhash, timestamp, duration });
const types = {
Message: [
{ name: "clock", type: "uint256" },
{ name: "parents", type: "string[]" },
{ name: "payload", type: "Session" },
{ name: "topic", type: "string" },
],
Session: [
{ name: "address", type: "address" },
{ name: "blockhash", type: "string" },
{ name: "duration", type: "uint256" },
{ name: "publicKey", type: "string" },
{ name: "timestamp", type: "uint256" },
],
};
hashedPayload = TypedDataEncoder.hash({}, types, {
clock: message.clock,
parents: message.parents,
payload: {
address: message.payload.address.split(":")[2],
publicKey: message.payload.publicKey,
blockhash: message.payload.blockhash,
timestamp: message.payload.timestamp,
duration: message.payload.duration,
},
topic: message.topic,
});
}
else if (message.payload.type === "action") {
const actionType = [
{ name: "name", type: "string" },
{ name: "args", type: "bytes" },
{ name: "address", type: "address" },
{ name: "blockhash", type: "string" },
{ name: "timestamp", type: "uint256" },
];
const { name, args, address, blockhash, timestamp } = message.payload;
const encodedArgs = dynamicAbiEncodeArgs(args);
hashedPayload = TypedDataEncoder.hash({}, { Action: actionType }, { name, args: encodedArgs, address: address.split(":")[2], blockhash: blockhash || "", timestamp });
const types = {
Message: [
{ name: "clock", type: "uint256" },
{ name: "parents", type: "string[]" },
{ name: "payload", type: "Action" },
{ name: "topic", type: "string" },
],
Action: [
{ name: "address", type: "address" },
{ name: "args", type: "bytes" },
{ name: "blockhash", type: "string" },
{ name: "name", type: "string" },
{ name: "timestamp", type: "uint256" },
],
};
hashedPayload = TypedDataEncoder.hash({}, types, {
clock: message.clock,
parents: message.parents,
payload: {
name: message.payload.name,
args: dynamicAbiEncodeArgs(message.payload.args),
address: message.payload.address.split(":")[2],
blockhash: message.payload.blockhash || "",
timestamp: message.payload.timestamp,
},
topic: message.topic,
});
}

@@ -75,6 +110,4 @@ else {

}
// encode outer message object
const encodedMessage = web3.eth.abi.encodeParameters(["uint8", "string[]", "bytes32", "string"], [message.clock, message.parents, hashedPayload, message.topic]);
return [getBytes(encodedMessage)];
return [getBytes(hashedPayload)];
},
};
{
"name": "@canvas-js/signed-cid",
"version": "0.8.21",
"version": "0.8.22",
"author": "Canvas Technologies, Inc. (https://canvas.xyz)",

@@ -19,4 +19,4 @@ "type": "module",

"devDependencies": {
"@canvas-js/interfaces": "0.8.21",
"@canvas-js/signed-cid": "0.8.21"
"@canvas-js/interfaces": "0.8.22",
"@canvas-js/signed-cid": "0.8.22"
},

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

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