Skip to content

Commit 0b626e7

Browse files
jameseasterdlongley
authored andcommitted
Updates from code review.
1 parent aec0b5e commit 0b626e7

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

lib/verify.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,6 @@ export async function verify({
192192
return result;
193193
}
194194

195-
// removing this feature in the future, not the responsibility of vcb-verifier
196-
function _deprecatedExpirationCheck({result, checkExpiration, maxClockSkew}) {
197-
if(!checkExpiration) {
198-
return;
199-
}
200-
let vcs = result.presentation ?
201-
result.presentation.verifiableCredential : result.credential;
202-
vcs = Array.isArray(vcs) ? vcs : [vcs];
203-
result.expired = vcs.some(vc => isExpired({credential: vc, maxClockSkew}));
204-
}
205-
206195
export async function verifyVcb({text, barcode, req, getVerifyOptions} = {}) {
207196
try {
208197
const verifyOptions = await getVerifyOptions({barcode, text, req});
@@ -252,6 +241,17 @@ function _compareTime({t1, t2, maxClockSkew}) {
252241
return t1 < t2 ? -1 : 1;
253242
}
254243

244+
// removing this feature in the future, not the responsibility of vcb-verifier
245+
function _deprecatedExpirationCheck({result, checkExpiration, maxClockSkew}) {
246+
if(!checkExpiration) {
247+
return;
248+
}
249+
let vcs = result.presentation ?
250+
result.presentation.verifiableCredential : result.credential;
251+
vcs = Array.isArray(vcs) ? vcs : [vcs];
252+
result.expired = vcs.some(vc => isExpired({credential: vc, maxClockSkew}));
253+
}
254+
255255
function _getCredentialFromExchange({exchange} = {}) {
256256
// assume single step
257257
const stepResults = exchange.variables?.results;

test/mocha/10-api.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('http API', () => {
3232
}
3333
assertNoError(err);
3434
should.exist(result);
35-
result.should.include.keys(['credential', 'verified' ]);
35+
result.should.include.keys(['credential', 'verified']);
3636
result.verified.should.equal(true);
3737
});
3838

@@ -55,7 +55,7 @@ describe('http API', () => {
5555
}
5656
assertNoError(err);
5757
should.exist(result);
58-
result.should.include.keys(['credential', 'verified' ]);
58+
result.should.include.keys(['credential', 'verified']);
5959
result.verified.should.equal(true);
6060
});
6161

@@ -102,7 +102,7 @@ describe('http API', () => {
102102
}
103103
assertNoError(err);
104104
should.exist(result);
105-
result.should.include.keys(['presentation', 'verified' ]);
105+
result.should.include.keys(['presentation', 'verified']);
106106
result.verified.should.equal(true);
107107
});
108108

@@ -129,7 +129,7 @@ describe('http API', () => {
129129
result.verified.should.equal(true);
130130
});
131131

132-
it('fails to verify a VCB barcode containing an enveloped VP' +
132+
it('fails to verify a VCB barcode containing an enveloped VP ' +
133133
'with a VC with a bad signature', async () => {
134134
let err;
135135
let result;
@@ -149,7 +149,7 @@ describe('http API', () => {
149149
}
150150
assertNoError(err);
151151
should.exist(result);
152-
result.should.include.keys(['presentation', 'verified', 'error' ]);
152+
result.should.include.keys(['presentation', 'verified', 'error']);
153153
result.verified.should.equal(false);
154154
result.presentation.should.be.an('object');
155155
result.error.should.be.an('object');
@@ -177,7 +177,7 @@ describe('http API', () => {
177177
}
178178
assertNoError(err);
179179
should.exist(result);
180-
result.should.include.keys(['credential', 'verified' ]);
180+
result.should.include.keys(['credential', 'verified']);
181181
result.verified.should.equal(true);
182182
});
183183
});

0 commit comments

Comments
 (0)