From a36416c0c563a1349e6943e95d5aeea64c9f7a9e Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Wed, 19 Nov 2025 16:45:29 -0500 Subject: [PATCH] Do not throw errors on createPresentation if verify: false. Signed-off-by: Dmitri Zagidulin --- lib/index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 262ef11f..c368eca5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -419,7 +419,8 @@ async function _verifyOBv3LegacySignature(credential, * @param {string|Date} [options.now] - A string representing date time in * ISO 8601 format or an instance of Date. Defaults to current date time. * @param {number} [options.version = 2.0] - The VC context version to use. - * @param {boolean} [options.verify=true] + * @param {boolean} [options.verify=true] - If set to true, throw verification + * errors for individual VCs (such as when the VC is expired, etc). * * @throws {TypeError} If verifiableCredential param is missing. * @throws {Error} If the credential (or the presentation params) are missing @@ -439,11 +440,15 @@ export function createPresentation({ }; if(verifiableCredential) { const credentials = [].concat(verifiableCredential); - // ensure all credentials are valid - for(const credential of credentials) { - _checkCredential( - {credential, now, mode: verify ? 'verify' : 'do not force verify'}); + + if(verify) { + // ensure all credentials are valid and verified + for(const credential of credentials) { + _checkCredential( + {credential, now, mode: verify ? 'verify' : 'do not force verify'}); + } } + presentation.verifiableCredential = credentials; } if(id) {