Skip to content

Commit 36cb201

Browse files
committed
Add further assertions on proofs to data model suite.
1 parent 42d791f commit 36cb201

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/suites/data-model.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,49 @@ export function dataModelSuite({
8282
async function() {
8383
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';
8484
assertBefore();
85+
for(const proof of proofs) {
86+
expect(proof.verificationMethod).to.exist;
87+
expect(proof.verificationMethod).to.be.a('string');
88+
expect(
89+
assertions.shouldBeBs58(proof.verificationMethod),
90+
'Expected "proof.verificationMethod" to be Base58 encoded'
91+
).to.be.true;
92+
}
8593
});
8694
it('The type property MUST be DataIntegrityProof.', async function() {
8795
this.test.link = 'https://w3c.github.io/vc-di-eddsa/#data-model:~:text=The%20type%20property%20MUST%20be%20DataIntegrityProof.';
8896
assertBefore();
97+
for(const proof of proofs) {
98+
expect(proof.type).to.exist;
99+
expect(proof.type).to.be.a('string');
100+
expect(proof.type).to.equal('DataIntegrityProof');
101+
}
89102
});
90103
it('The cryptosuite property of the proof MUST be eddsa-rdfc-2022 or ' +
91104
'eddsa-jcs-2022.', async function() {
92105
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.';
93106
assertBefore();
107+
for(const proof of proofs) {
108+
expect(proof.cryptosuite).to.exist;
109+
expect(proof.cryptosuite).to.be.a('string');
110+
expect(proof.cryptosuite).to.oneOf(
111+
['eddsa-rdfc-2022', 'eddsa-jcs-2022']);
112+
}
94113
});
95114
it('The proofValue property of the proof MUST be a detached EdDSA ' +
96115
'signature produced according to [RFC8032], encoded using the ' +
97116
'base-58-btc header and alphabet as described in the Multibase ' +
98117
'section of Controller Documents 1.0.', async function() {
99118
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.';
100119
assertBefore();
101-
120+
for(const proof of proofs) {
121+
expect(proof.proofValue).to.exist;
122+
expect(proof.proofValue).to.be.a('string');
123+
expect(
124+
assertions.shouldBeBs58(proof.proofValue),
125+
'Expected "proof.proofValue" to be Base58 encoded'
126+
).to.be.true;
127+
}
102128
});
103129
});
104130
}

0 commit comments

Comments
 (0)