Skip to content

Commit c3ebc51

Browse files
Do not throw errors on createPresentatino if verify: false.
Signed-off-by: Dmitri Zagidulin <dzagidulin@gmail.com>
1 parent 453efd4 commit c3ebc51

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

lib/index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,8 @@ async function _verifyOBv3LegacySignature(credential,
419419
* @param {string|Date} [options.now] - A string representing date time in
420420
* ISO 8601 format or an instance of Date. Defaults to current date time.
421421
* @param {number} [options.version = 2.0] - The VC context version to use.
422-
* @param {boolean} [options.verify=true]
422+
* @param {boolean} [options.verify=true] - If set to true, throw verification
423+
* errors for individual VCs (such as when the VC is expired, etc).
423424
*
424425
* @throws {TypeError} If verifiableCredential param is missing.
425426
* @throws {Error} If the credential (or the presentation params) are missing
@@ -439,11 +440,15 @@ export function createPresentation({
439440
};
440441
if(verifiableCredential) {
441442
const credentials = [].concat(verifiableCredential);
442-
// ensure all credentials are valid
443-
for(const credential of credentials) {
444-
_checkCredential(
445-
{credential, now, mode: verify ? 'verify' : 'do not force verify'});
443+
444+
if(verify) {
445+
// ensure all credentials are valid and verified
446+
for(const credential of credentials) {
447+
_checkCredential(
448+
{credential, now, mode: verify ? 'verify' : 'do not force verify'});
449+
}
446450
}
451+
447452
presentation.verifiableCredential = credentials;
448453
}
449454
if(id) {

0 commit comments

Comments
 (0)