Skip to content

Commit

Permalink
Replace _issueVc with signCredential.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Jul 28, 2024
1 parent 68d58fb commit cb197f3
Showing 1 changed file with 9 additions and 33 deletions.
42 changes: 9 additions & 33 deletions test/10-verify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ function _runSuite({
describe(title, async function() {
describe('verify API (credentials)', () => {
it('should verify a vc', async () => {
const credential = credentialFactory();
const verifiableCredential = await _issueVc({
credential,
issuerSuite,
const {verifiableCredential} = await signCredential({
credential: credentialFactory(),
suites,
issuer,
mandatoryPointers,
derived
});
const result = await vc.verifyCredential({
Expand Down Expand Up @@ -99,9 +100,11 @@ function _runSuite({
id: 'https://example.edu/status/24',
type: 'TestStatusList'
};
const verifiableCredential = await _issueVc({
const verifiableCredential = await signCredential({
credential,
issuerSuite,
suites,
issuer,
mandatoryPointers,
derived
});
const result = await vc.verifyCredential({
Expand Down Expand Up @@ -287,30 +290,3 @@ function _runSuite({
});
});
}

async function _issueVc({
credential,
cryptosuite,
issuerSuite,
Suite,
derived
}) {
const verifiableCredential = await vc.issue({
credential,
suite: issuerSuite,
documentLoader
});
if(!derived) {
return verifiableCredential;
}
const sdDeriveSuite = new Suite({
cryptosuite: cryptosuite.createDiscloseCryptosuite({
selectivePointers: ['/credentialSubject']
})
});
return vc.derive({
verifiableCredential,
suite: sdDeriveSuite,
documentLoader
});
}

0 comments on commit cb197f3

Please sign in to comment.