@arcblock/did
Advanced tools
Comparing version 0.33.0 to 0.33.1
@@ -28,3 +28,3 @@ // Generate by [js2dts@0.3.3](https://github.com/whxaxes/js2dts#readme) | ||
fromPublicKey: (pk: string, type: any) => string; | ||
fromPublicKeyHash: (buffer: any, type: any) => any; | ||
fromPublicKeyHash: (buffer: any, type: any) => string; | ||
fromHash: (hash: string, role: any) => string; | ||
@@ -31,0 +31,0 @@ toTypeInfo: (did: string, returnString?: boolean) => any; |
@@ -11,3 +11,3 @@ /** | ||
const BN = require('bn.js'); | ||
const { numberToHex, stripHexPrefix, toBase58 } = require('@arcblock/forge-util'); | ||
const { numberToHex, stripHexPrefix, toBase58, toAddress, toDid } = require('@arcblock/forge-util'); | ||
const { DID_PREFIX, toBits, toBytes, toStrictHex } = require('./util'); | ||
@@ -219,26 +219,2 @@ | ||
/** | ||
* Convert did to address: remove `did:abt:` prefix if exists | ||
* | ||
* @public | ||
* @static | ||
* @param {string} did - address string | ||
* @returns {string} | ||
*/ | ||
function toAddress(did) { | ||
return did.replace(DID_PREFIX, ''); | ||
} | ||
/** | ||
* Convert address to did: prepend `did:abt:` prefix | ||
* | ||
* @public | ||
* @static | ||
* @param {string} did - address string | ||
* @returns {string} | ||
*/ | ||
function toDid(address) { | ||
return `${DID_PREFIX}${toAddress(address)}`; | ||
} | ||
module.exports = { | ||
@@ -245,0 +221,0 @@ types, |
{ | ||
"name": "@arcblock/did", | ||
"version": "0.33.0", | ||
"version": "0.33.1", | ||
"description": "Javascript lib to work with ArcBlock DID", | ||
@@ -36,2 +36,3 @@ "keywords": [ | ||
"lint:fix": "eslint --fix tests lib", | ||
"upgrade": "yarn generate-dts && yarn generate-docs && yarn format-docs", | ||
"generate-docs": "jsdoc2md lib/index.js > docs/README.md", | ||
@@ -49,9 +50,9 @@ "generate-dts": "j2d lib/index.js", | ||
"dependencies": { | ||
"@arcblock/forge-util": "^0.33.0", | ||
"@arcblock/mcrypto": "^0.33.0", | ||
"@arcblock/forge-util": "^0.33.1", | ||
"@arcblock/mcrypto": "^0.33.1", | ||
"bn.js": "^5.0.0", | ||
"debug": "^4.1.1", | ||
"lodash": "^4.17.11" | ||
"lodash": "^4.17.14" | ||
}, | ||
"gitHead": "9e30e3a049b194fc6e1657156c54220217744b36" | ||
"gitHead": "398740a29b186416c777e4d35df810a167e24599" | ||
} |
@@ -9,2 +9,3 @@ ![DID](https://www.arcblock.io/.netlify/functions/badge/?text=DID) | ||
## Usage | ||
@@ -11,0 +12,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55
12490
292
Updated@arcblock/forge-util@^0.33.1
Updated@arcblock/mcrypto@^0.33.1
Updatedlodash@^4.17.14