2
2
* Copyright 2024 Digital Bazaar, Inc.
3
3
* SPDX-License-Identifier: BSD-3-Clause
4
4
*/
5
+ import { createInitialVc , endpointCheck } from '../helpers.js' ;
5
6
import {
6
7
assertions ,
7
8
} from 'data-integrity-test-suite-assertion' ;
9
+ import { expect } from 'chai' ;
8
10
9
11
export function dataModelSuite ( {
10
12
issuers,
11
13
suiteName,
12
14
keyType,
13
15
vcVersion,
14
16
credential,
15
- mandatoryPointers,
16
- selectivePointers,
17
+ mandatoryPointers
17
18
} ) {
18
19
describe ( `${ suiteName } - Data Model - VC ${ vcVersion } ` , function ( ) {
19
20
this . matrix = true ;
@@ -23,42 +24,61 @@ export function dataModelSuite({
23
24
this . columnLabel = 'Implementation' ;
24
25
for ( const [ name , { endpoints} ] of issuers ) {
25
26
const [ issuer ] = endpoints ;
27
+ // does the endpoint support this test?
28
+ if ( ! endpointCheck ( { endpoint : issuer , keyType, vcVersion} ) ) {
29
+ continue ;
30
+ }
26
31
describe ( `${ name } : ${ keyType } ` , function ( ) {
27
32
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
+ } ) ;
31
40
} ) ;
32
41
beforeEach ( function ( ) {
33
42
this . currentTest . cell = {
34
43
rowId : this . currentTest . title ,
35
44
columnId : this . currentTest . parent . title
36
45
} ;
37
46
} ) ;
47
+ function assertBefore ( ) {
48
+ expect (
49
+ securedCredential ,
50
+ `Expected issuer ${ name } : ${ keyType } to issue a VC`
51
+ ) . to . exist ;
52
+ }
38
53
it ( 'The publicKeyMultibase value of the verification method MUST ' +
39
54
'start with the base-58-btc prefix (z), as defined in the ' +
40
55
'Multibase section of Controller Documents 1.0. A ' +
41
56
'Multibase-encoded Ed25519 256-bit public key value follows, as ' +
42
57
'defined in the Multikey section of Controller Documents 1.0.' ,
43
58
async function ( ) {
44
59
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 ( ) ;
45
61
} ) ;
46
62
it ( 'Any other encoding MUST NOT be allowed. (verificationMethod)' ,
47
63
async function ( ) {
48
64
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 ( ) ;
49
66
} ) ;
50
67
it ( 'The type property MUST be DataIntegrityProof.' , async function ( ) {
51
68
this . test . link = 'https://w3c.github.io/vc-di-eddsa/#data-model:~:text=The%20type%20property%20MUST%20be%20DataIntegrityProof.' ;
69
+ assertBefore ( ) ;
52
70
} ) ;
53
71
it ( 'The cryptosuite property of the proof MUST be eddsa-rdfc-2022 or ' +
54
72
'eddsa-jcs-2022.' , async function ( ) {
55
73
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 ( ) ;
56
75
} ) ;
57
76
it ( 'The proofValue property of the proof MUST be a detached EdDSA ' +
58
77
'signature produced according to [RFC8032], encoded using the ' +
59
78
'base-58-btc header and alphabet as described in the Multibase ' +
60
79
'section of Controller Documents 1.0.' , async function ( ) {
61
80
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 ( ) ;
62
82
63
83
} ) ;
64
84
} ) ;
0 commit comments