@arcblock/vc
Advanced tools
Comparing version 1.10.16 to 1.10.17
@@ -8,2 +8,3 @@ /** | ||
*/ | ||
const isAbsoluteUrl = require('is-absolute-url'); | ||
const stringify = require('json-stable-stringify'); | ||
@@ -34,5 +35,7 @@ const cloneDeep = require('lodash/cloneDeep'); | ||
* @param {Date} params.expirationDate | ||
* @param {String} params.endpoint - Status endpoint url | ||
* @param {String} params.endpointScope - Endpoint scope, either be public or private | ||
* @returns {object} | ||
*/ | ||
function create({ type, subject, issuer, issuanceDate, expirationDate }) { | ||
function create({ type, subject, issuer, issuanceDate, expirationDate, endpoint = '', endpointScope = 'public' }) { | ||
if (!type) { | ||
@@ -55,2 +58,10 @@ throw new Error('Can not create verifiable credential without empty type'); | ||
if (endpoint && isAbsoluteUrl(endpoint) === false) { | ||
throw new Error('VC Endpoint must be absolute url'); | ||
} | ||
if (endpointScope && ['public', 'private'].includes(endpointScope) === false) { | ||
throw new Error('VC Endpoint scope must be either public or private'); | ||
} | ||
const { wallet, name: issuerName } = issuer; | ||
@@ -81,2 +92,10 @@ const issuerDid = wallet.toAddress(); | ||
if (endpoint) { | ||
vcObj.credentialStatus = { | ||
id: endpoint, | ||
type: 'NFTStatusList2021', | ||
scope: endpointScope || 'public', | ||
}; | ||
} | ||
if (!proofTypes[typeInfo.pk]) { | ||
@@ -175,2 +194,4 @@ throw new Error('Unsupported signer type when create verifiable credential'); | ||
// TODO: support verify revoked from endpoint | ||
return true; | ||
@@ -177,0 +198,0 @@ } |
{ | ||
"name": "@arcblock/vc", | ||
"version": "1.10.16", | ||
"version": "1.10.17", | ||
"description": "Javascript lib to work with ArcBlock Verifiable Credentials", | ||
@@ -48,11 +48,12 @@ "keywords": [ | ||
"dependencies": { | ||
"@arcblock/did": "^1.10.16", | ||
"@ocap/mcrypto": "^1.10.16", | ||
"@ocap/util": "^1.10.16", | ||
"@ocap/wallet": "^1.10.16", | ||
"@arcblock/did": "^1.10.17", | ||
"@ocap/mcrypto": "^1.10.17", | ||
"@ocap/util": "^1.10.17", | ||
"@ocap/wallet": "^1.10.17", | ||
"debug": "^4.3.1", | ||
"is-absolute-url": "^3.0.3", | ||
"json-stable-stringify": "^1.0.1", | ||
"lodash": "^4.17.20" | ||
}, | ||
"gitHead": "5995d961b28d3ccf28aeb17f1f92cf7868f155cb" | ||
"gitHead": "09e642197e21248688bcf6456ea390b611ea48f1" | ||
} |
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
15767
350
8
+ Addedis-absolute-url@^3.0.3
+ Addedis-absolute-url@3.0.3(transitive)
Updated@arcblock/did@^1.10.17
Updated@ocap/mcrypto@^1.10.17
Updated@ocap/util@^1.10.17
Updated@ocap/wallet@^1.10.17