Skip to content

Commit

Permalink
Only add issuanceDate to VC 1.1 vcs.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Apr 24, 2024
1 parent 86c99e7 commit d3d68f8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tests/10-rdfc-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ describe('ecdsa-rdfc-2019 (create)', function() {
before(async function() {
issuedVc = await createInitialVc({
issuer,
vc: credentials.create[vcVersion].document
vc: credentials.create[vcVersion].document,
vcVersion
});
// VCs can have multiple proofs so account for that
proofs = Array.isArray(issuedVc?.proof) ? issuedVc.proof :
Expand Down
3 changes: 2 additions & 1 deletion tests/30-rdfc-interop.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ const {
before(async function() {
issuedVc = await createInitialVc({
issuer: issuerEndpoint,
vc: credentials.interop['1.1'].document
vc: credentials.interop['1.1'].document,
vcVersion: '1.1'
});
});
it(`"${verifierDisplayName}" should verify "${issuerDisplayName}"`,
Expand Down
3 changes: 2 additions & 1 deletion tests/40-sd-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ describe('ecdsa-sd-2023 (create)', function() {
issuer,
vc: credentials.create[vcVersion].document,
mandatoryPointers:
credentials.create[vcVersion].mandatoryPointers
credentials.create[vcVersion].mandatoryPointers,
vcVersion
});
// Support multiple proofs
proofs = Array.isArray(issuedVc?.proof) ? issuedVc.proof :
Expand Down
3 changes: 2 additions & 1 deletion tests/60-sd-interop.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const {
const issuedVc = await createInitialVc({
issuer: issuerEndpoint,
vc: credentials.interop['2.0'].document,
mandatoryPointers: credentials.interop['2.0'].mandatoryPointers
mandatoryPointers: credentials.interop['2.0'].mandatoryPointers,
vcVersion: '2.0'
});
const {match: matchingVcHolders} = endpoints.filterByTag({
tags: ['vcHolder'],
Expand Down
12 changes: 10 additions & 2 deletions tests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,23 @@ export const ISOTimeStamp = ({date = new Date()} = {}) => {
* @param {object} options.vc - The credential to be issued.
* @param {Array<string>} [options.mandatoryPointers] - An optional
* array of mandatory pointers.
* @param {string} options.vcVersion - The version of the VC.
*
* @returns {Promise<object>} The resulting issuance result.
*/
export const createInitialVc = async ({issuer, vc, mandatoryPointers}) => {
export const createInitialVc = async ({
issuer,
vc,
mandatoryPointers,
vcVersion
}) => {
const {settings: {id: issuerId, options = {}}} = issuer;
const credential = klona(vc);
credential.id = `urn:uuid:${uuidv4()}`;
credential.issuer = issuerId;
credential.issuanceDate = ISOTimeStamp();
if(vcVersion === '1.1') {
credential.issuanceDate = ISOTimeStamp();
}
const body = {credential, options};
// if there are mandatoryPointers for sd tests add them
if(Array.isArray(mandatoryPointers)) {
Expand Down

0 comments on commit d3d68f8

Please sign in to comment.