22 * Copyright 2024 Digital Bazaar, Inc.
33 * SPDX-License-Identifier: BSD-3-Clause
44 */
5+ import { createInitialVc , endpointCheck } from '../helpers.js' ;
56import {
67 assertions ,
78} from 'data-integrity-test-suite-assertion' ;
9+ import { expect } from 'chai' ;
810
911export function dataModelSuite ( {
1012 issuers,
1113 suiteName,
1214 keyType,
1315 vcVersion,
1416 credential,
15- mandatoryPointers,
16- selectivePointers,
17+ mandatoryPointers
1718} ) {
1819 describe ( `${ suiteName } - Data Model - VC ${ vcVersion } ` , function ( ) {
1920 this . matrix = true ;
@@ -23,42 +24,61 @@ export function dataModelSuite({
2324 this . columnLabel = 'Implementation' ;
2425 for ( const [ name , { endpoints} ] of issuers ) {
2526 const [ issuer ] = endpoints ;
27+ // does the endpoint support this test?
28+ if ( ! endpointCheck ( { endpoint : issuer , keyType, vcVersion} ) ) {
29+ continue ;
30+ }
2631 describe ( `${ name } : ${ keyType } ` , function ( ) {
2732 let securedCredential = null ;
28- let issuerError = null ;
29- before ( async function ( ) {
30-
33+ before ( async function ( ) {
34+ securedCredential = await createInitialVc ( {
35+ issuer,
36+ vcVersion,
37+ vc : credential ,
38+ mandatoryPointers
39+ } ) ;
3140 } ) ;
3241 beforeEach ( function ( ) {
3342 this . currentTest . cell = {
3443 rowId : this . currentTest . title ,
3544 columnId : this . currentTest . parent . title
3645 } ;
3746 } ) ;
47+ function assertBefore ( ) {
48+ expect (
49+ securedCredential ,
50+ `Expected issuer ${ name } : ${ keyType } to issue a VC`
51+ ) . to . exist ;
52+ }
3853 it ( 'The publicKeyMultibase value of the verification method MUST ' +
3954 'start with the base-58-btc prefix (z), as defined in the ' +
4055 'Multibase section of Controller Documents 1.0. A ' +
4156 'Multibase-encoded Ed25519 256-bit public key value follows, as ' +
4257 'defined in the Multikey section of Controller Documents 1.0.' ,
4358 async function ( ) {
4459 this . test . link = 'https://w3c.github.io/vc-di-eddsa/#data-model:~:text=in%20this%20specification.-,The%20publicKeyMultibase%20value%20of%20the%20verification%20method%20MUST%20start%20with%20the%20base%2D58%2Dbtc%20prefix,-(z)%2C%20as' ;
60+ assertBefore ( ) ;
4561 } ) ;
4662 it ( 'Any other encoding MUST NOT be allowed. (verificationMethod)' ,
4763 async function ( ) {
4864 this . test . link = 'https://w3c.github.io/vc-di-eddsa/#data-model:~:text=of%20Controller%20Documents%201.0.-,Any%20other%20encoding%20MUST%20NOT%20be%20allowed.,-Developers%20are%20advised%20to%20not' ;
65+ assertBefore ( ) ;
4966 } ) ;
5067 it ( 'The type property MUST be DataIntegrityProof.' , async function ( ) {
5168 this . test . link = 'https://w3c.github.io/vc-di-eddsa/#data-model:~:text=The%20type%20property%20MUST%20be%20DataIntegrityProof.' ;
69+ assertBefore ( ) ;
5270 } ) ;
5371 it ( 'The cryptosuite property of the proof MUST be eddsa-rdfc-2022 or ' +
5472 'eddsa-jcs-2022.' , async function ( ) {
5573 this . test . link = 'https://w3c.github.io/vc-di-eddsa/#data-model:~:text=The%20cryptosuite%20property%20of%20the%20proof%20MUST%20be%20eddsa%2Drdfc%2D2022%20or%20eddsa%2Djcs%2D2022.' ;
74+ assertBefore ( ) ;
5675 } ) ;
5776 it ( 'The proofValue property of the proof MUST be a detached EdDSA ' +
5877 'signature produced according to [RFC8032], encoded using the ' +
5978 'base-58-btc header and alphabet as described in the Multibase ' +
6079 'section of Controller Documents 1.0.' , async function ( ) {
6180 this . test . link = 'https://w3c.github.io/vc-di-eddsa/#data-model:~:text=The%20proofValue%20property%20of%20the%20proof%20MUST%20be%20a%20detached%20EdDSA%20signature%20produced%20according%20to%20%5BRFC8032%5D%2C%20encoded%20using%20the%20base%2D58%2Dbtc%20header%20and%20alphabet%20as%20described%20in%20the%20Multibase%20section%20of%20Controller%20Documents%201.0.' ;
81+ assertBefore ( ) ;
6282
6383 } ) ;
6484 } ) ;
0 commit comments