|
2 | 2 | * Copyright 2024 Digital Bazaar, Inc.
|
3 | 3 | * SPDX-License-Identifier: BSD-3-Clause
|
4 | 4 | */
|
5 |
| -import {assertions} from 'data-integrity-test-suite-assertion'; |
| 5 | +import { |
| 6 | + assertions, |
| 7 | + generators, |
| 8 | + issueCloned |
| 9 | +} from 'data-integrity-test-suite-assertion'; |
| 10 | +import {getMultiKey} from '../vc-generator/key-gen.js'; |
6 | 11 |
|
7 | 12 | export function assertConformance({
|
8 | 13 | verifiers,
|
@@ -39,19 +44,45 @@ export function assertConformance({
|
39 | 44 | it('Conforming processors MUST produce errors when non-conforming ' +
|
40 | 45 | 'documents are consumed.', async function() {
|
41 | 46 | this.test.link = 'https://w3c.github.io/vc-di-ecdsa/#:~:text=Conforming%20processors%20MUST%20produce%20errors%20when%20non%2Dconforming%20documents%20are%20consumed.';
|
42 |
| - await assertions.verificationFail({ |
43 |
| - verifier, |
44 |
| - credential: {}, |
45 |
| - reason: 'Should ' |
46 |
| - }); |
| 47 | + for(const [key, credential] of credentials) { |
| 48 | + await assertions.verificationFail({ |
| 49 | + verifier, |
| 50 | + credential, |
| 51 | + reason: `Should not verify VC with ${key}` |
| 52 | + }); |
| 53 | + } |
47 | 54 | });
|
48 | 55 | });
|
49 | 56 | }
|
50 | 57 | });
|
51 | 58 | }
|
52 |
| -async function _setup({}) { |
53 |
| - // not bs58 encoded verificationMethod |
54 |
| - // type is not DataIntegrityProof |
55 |
| - // invalid cryptosuite name |
| 59 | +async function _setup({ |
| 60 | + credential, |
| 61 | + suiteName, |
| 62 | + keyType, |
| 63 | + cryptosuite, |
| 64 | + mandatoryPointers, |
| 65 | + selectivePointers |
| 66 | +}) { |
| 67 | + const { |
| 68 | + invalidProofType, |
| 69 | + invalidVm, |
| 70 | + invalidCryptosuite |
| 71 | + } = generators?.mandatory; |
| 72 | + const credentials = new Map(); |
| 73 | + const keyPair = await getMultiKey({keyType}); |
| 74 | + const signer = keyPair.signer(); |
| 75 | + // not bs58 encoded verificationMethod via invalidVm |
| 76 | + // type is not DataIntegrityProof invalidType |
| 77 | + // invalid cryptosuite name invalidCryptosuite |
| 78 | + credentials.set('invalidCryptosuite', await issueCloned(invalidCryptosuite({ |
| 79 | + |
| 80 | + }))); |
| 81 | + credentials.set('invalidVerificationMethod', await issueCloned(invalidVm({ |
| 82 | + |
| 83 | + }))); |
| 84 | + credentials.set('invalidProofType', await issueCloned(invalidProofType({ |
56 | 85 |
|
| 86 | + }))); |
| 87 | + return credentials; |
57 | 88 | }
|
0 commit comments