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

@arcblock/did-util

Package Overview
Dependencies
Maintainers
1
Versions
577
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcblock/did-util - npm Package Compare versions

Comparing version 0.27.10 to 0.27.11

13

lib/index.js

@@ -13,4 +13,4 @@ /**

const { fromHash, toDid } = require('@arcblock/did');
const { createMessage } = require('@arcblock/forge-message/lite');
const { transactions } = require('@arcblock/forge-proto/lite');
const { createMessage } = require('@arcblock/forge-message');
const { transactions } = require('@arcblock/forge-proto');

@@ -26,3 +26,3 @@ /**

function toAssetAddress(itx) {
return toItxAddress(itx, 'CreateAssetTx');
return toItxAddress(itx, 'CreateAssetTx', types.RoleType.ROLE_ASSET);
}

@@ -48,5 +48,7 @@

* @param {object} itx - an object of forge supported itx
* @param {string} type - itx type string
* @param {enum} [role=types.RoleType.ROLE_TX] - role type
* @returns {string} itx address without `did:abt:` prefix
*/
function toItxAddress(itx, type) {
function toItxAddress(itx, type, role = types.RoleType.ROLE_TX) {
if (transactions.indexOf(type) === -1) {

@@ -57,5 +59,6 @@ throw new Error(`Unsupported itx type ${type}`);

const message = createMessage(type, itx);
// console.log({ message: message.toObject(), itx });
const itxBytes = message.serializeBinary();
const hash = Hasher.SHA3.hash256(itxBytes);
const address = fromHash(hash, types.RoleType.ROLE_ASSET);
const address = fromHash(hash, role);
return address;

@@ -62,0 +65,0 @@ }

{
"name": "@arcblock/did-util",
"description": "Helper function to calculate did",
"version": "0.27.10",
"version": "0.27.11",
"author": {

@@ -21,7 +21,7 @@ "name": "wangshijun",

"dependencies": {
"@arcblock/did": "^0.27.10",
"@arcblock/forge-message": "^0.27.0",
"@arcblock/did": "^0.27.11",
"@arcblock/forge-message": "^0.27.11",
"@arcblock/forge-util": "^0.27.0",
"@arcblock/forge-wallet": "^0.27.10",
"@arcblock/mcrypto": "^0.27.10"
"@arcblock/forge-wallet": "^0.27.11",
"@arcblock/mcrypto": "^0.27.11"
},

@@ -71,3 +71,3 @@ "devDependencies": {

},
"gitHead": "21a4ed3390beb480e028962773e3eb3c5feccc33"
"gitHead": "2f8546fd7257926b7452e2be68d0485e6b4ffdd1"
}
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