@arcblock/vc
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -6,10 +6,10 @@ /** | ||
* @requires @arcblock/did | ||
* @requires @arcblock/forge-util | ||
* @requires @ocap/util | ||
*/ | ||
const stringify = require('json-stable-stringify'); | ||
const cloneDeep = require('lodash/cloneDeep'); | ||
const { types } = require('@arcblock/mcrypto'); | ||
const { fromPublicKey } = require('@arcblock/forge-wallet'); | ||
const { types } = require('@ocap/mcrypto'); | ||
const { fromPublicKey } = require('@ocap/wallet'); | ||
const { toTypeInfo, isValid, isFromPublicKey, fromPublicKeyHash } = require('@arcblock/did'); | ||
const { toBase58, toBase64, fromBase64, fromBase58 } = require('@arcblock/forge-util'); | ||
const { toBase58, toBase64, fromBase64, fromBase58 } = require('@ocap/util'); | ||
@@ -58,3 +58,3 @@ // eslint-disable-next-line | ||
// The { pk, hash } type should be same as issuer, role type must be `ROLE_VC` | ||
const vcType = Object.assign({}, typeInfo, { role: types.RoleType.ROLE_VC }); | ||
const vcType = { ...typeInfo, role: types.RoleType.ROLE_VC }; | ||
const vcDid = fromPublicKeyHash(wallet.hash(stringify(subject)), vcType); | ||
@@ -92,3 +92,3 @@ | ||
// NOTE: we should be able to verify the vc before return | ||
const result = Object.assign({ proof }, vcObj); | ||
const result = { proof, ...vcObj }; | ||
@@ -146,3 +146,3 @@ debug('create', result); | ||
const issuers = Array.isArray(trustedIssuers) ? trustedIssuers : [trustedIssuers]; | ||
const issuerDid = issuers.find(x => x === vc.issuer.id); | ||
const issuerDid = issuers.find((x) => x === vc.issuer.id); | ||
if (!issuerDid) { | ||
@@ -203,5 +203,5 @@ throw new Error('Verifiable credential not issued by trusted issuers'); | ||
vcList.forEach(vcStr => { | ||
vcList.forEach((vcStr) => { | ||
const vcObj = JSON.parse(vcStr); | ||
const proof = proofList.find(x => isFromPublicKey(vcObj.credentialSubject.id, x.pk)); | ||
const proof = proofList.find((x) => isFromPublicKey(vcObj.credentialSubject.id, x.pk)); | ||
@@ -208,0 +208,0 @@ if (!proof) { |
{ | ||
"name": "@arcblock/vc", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "Javascript lib to work with ArcBlock Verifiable Credentials", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
}, | ||
"homepage": "https://github.com/ArcBlock/forge-js/tree/master/did/vc", | ||
"homepage": "https://github.com/ArcBlock/ocap-js/tree/master/did/vc", | ||
"license": "Apache-2.0", | ||
@@ -32,3 +32,3 @@ "main": "lib/index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/ArcBlock/forge-js.git" | ||
"url": "git+https://github.com/ArcBlock/ocap-js.git" | ||
}, | ||
@@ -38,20 +38,18 @@ "scripts": { | ||
"lint:fix": "eslint --fix tests lib", | ||
"docs": "yarn generate-dts && yarn generate-docs && yarn cleanup-docs && yarn format-docs", | ||
"docs": "yarn gen-dts && yarn gen-docs && yarn cleanup-docs && yarn format-docs", | ||
"cleanup-docs": "node ../../tools/cleanup-docs.js docs/README.md $npm_package_name", | ||
"generate-docs": "jsdoc2md lib/index.js > docs/README.md", | ||
"generate-dts": "j2d lib/index.js", | ||
"gen-docs": "jsdoc2md lib/index.js > docs/README.md", | ||
"gen-dts": "j2d lib/index.js", | ||
"format-docs": "remark . -o", | ||
"precommit": "CI=1 yarn test", | ||
"prepush": "CI=1 yarn test", | ||
"test": "yarn lint && node tools/jest.js", | ||
"coverage": "yarn lint && yarn test -- --coverage" | ||
"test": "node tools/jest.js", | ||
"coverage": "yarn test -- --coverage" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ArcBlock/forge-js/issues" | ||
"url": "https://github.com/ArcBlock/ocap-js/issues" | ||
}, | ||
"dependencies": { | ||
"@arcblock/did": "^1.6.0", | ||
"@arcblock/forge-util": "^1.6.0", | ||
"@arcblock/forge-wallet": "^1.6.0", | ||
"@arcblock/mcrypto": "^1.6.0", | ||
"@arcblock/did": "^1.6.1", | ||
"@ocap/mcrypto": "^1.6.1", | ||
"@ocap/util": "^1.6.1", | ||
"@ocap/wallet": "^1.6.1", | ||
"debug": "^4.3.1", | ||
@@ -61,3 +59,3 @@ "json-stable-stringify": "^1.0.1", | ||
}, | ||
"gitHead": "d57fa0e7110d95e971729e38cef41d7d5c477f90" | ||
"gitHead": "c07e321ce16f899909f51eb7345456e3e133db49" | ||
} |
@@ -9,3 +9,2 @@ ![Verifiable Credentials](https://www.arcblock.io/.netlify/functions/badge/?text=Verifiable+Credentials) | ||
## Usage | ||
@@ -41,5 +40,4 @@ | ||
## Documentation | ||
For full documentation, checkout [https://forge-js.netlify.com](https://forge-js.netlify.com/) | ||
For full documentation, checkout [https://ocap-js.netlify.com](https://ocap-js.netlify.com/) |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
11995
1
42
+ Added@ocap/mcrypto@^1.6.1
+ Added@ocap/util@^1.6.1
+ Added@ocap/wallet@^1.6.1
+ Added@ocap/wallet@1.18.162(transitive)
- Removed@arcblock/forge-util@^1.6.0
- Removed@arcblock/forge-wallet@^1.6.0
- Removed@arcblock/mcrypto@^1.6.0
- Removed@arcblock/forge-util@1.7.1(transitive)
- Removed@arcblock/forge-wallet@1.7.1(transitive)
- Removed@arcblock/mcrypto@1.7.1(transitive)
- Removed@multiformats/base-x@4.0.1(transitive)
- Removed@zxing/text-encoding@0.9.0(transitive)
- Removedavailable-typed-arrays@1.0.7(transitive)
- Removedbn.js@5.1.3(transitive)
- Removedfor-each@0.3.3(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedis-arguments@1.2.0(transitive)
- Removedis-callable@1.2.7(transitive)
- Removedis-generator-function@1.0.10(transitive)
- Removedis-typed-array@1.1.15(transitive)
- Removedmultibase@3.1.2(transitive)
- Removedpossible-typed-array-names@1.0.0(transitive)
- Removedutil@0.12.5(transitive)
- Removedweb-encoding@1.1.5(transitive)
- Removedwhich-typed-array@1.1.18(transitive)
Updated@arcblock/did@^1.6.1