Skip to content

Commit 7bed4dd

Browse files
RinkalBhojanitipusinghaw
authored andcommitted
fix: fixed issue with signeroption did in sdjwt create offer
Signed-off-by: Rinkal Bhojani <[email protected]>
1 parent 3eac788 commit 7bed4dd

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

apps/oid4vc-issuance/libs/helpers/credential-sessions.builder.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,16 @@ function buildSdJwtCredential(
279279
// // strip vct if present per requirement
280280
// delete payloadCopy.vct;
281281

282-
if (signerOptions[0].method === SignerMethodOption.X5C && credentialRequest.validityInfo) {
283-
const certificateDetail = activeCertificateDetails.find((x) => x.certificateBase64 === signerOptions[0].x5c[0]);
282+
let templateSignerOption: SignerOption;
283+
if (templateRecord.signerOption.toLowerCase() === SignerMethodOption.X5C) {
284+
templateSignerOption = signerOptions.find((x) => SignerMethodOption.X5C === x.method);
285+
} else if (templateRecord.signerOption.toLowerCase() === SignerMethodOption.DID) {
286+
templateSignerOption = signerOptions.find((x) => SignerMethodOption.DID === x.method);
287+
}
288+
289+
if (templateRecord.signerOption === SignerMethodOption.X5C && credentialRequest.validityInfo) {
290+
const certificateDetail = activeCertificateDetails.find((x) => x.certificateBase64 === templateSignerOption.x5c[0]);
291+
284292
const validationResult = validateCredentialDatesInCertificateWindow(
285293
credentialRequest.validityInfo,
286294
certificateDetail
@@ -319,7 +327,7 @@ function buildSdJwtCredential(
319327

320328
return {
321329
credentialSupportedId,
322-
signerOptions: signerOptions ? signerOptions[0] : undefined,
330+
signerOptions: templateSignerOption ? templateSignerOption : undefined,
323331
format: apiFormat,
324332
payload: payloadCopy,
325333
...(disclosureFrame ? { disclosureFrame } : {})

0 commit comments

Comments
 (0)