From c6d8de2ea8b3c02e940fcb098c037e7a0de1f7e4 Mon Sep 17 00:00:00 2001 From: sksadjad Date: Fri, 28 Jun 2024 17:11:19 +0200 Subject: [PATCH] fix: added a guard to check the issuerBranding --- packages/oid4vci-holder/src/agent/OID4VCIHolder.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/oid4vci-holder/src/agent/OID4VCIHolder.ts b/packages/oid4vci-holder/src/agent/OID4VCIHolder.ts index 70471f0b5..4f40f0d13 100644 --- a/packages/oid4vci-holder/src/agent/OID4VCIHolder.ts +++ b/packages/oid4vci-holder/src/agent/OID4VCIHolder.ts @@ -15,6 +15,7 @@ import { IBasicIssuerLocaleBranding, Identity, IdentityOrigin, + IIssuerBranding, NonPersistedIdentity, Party, } from '@sphereon/ssi-sdk.data-store' @@ -522,7 +523,10 @@ export class OID4VCIHolder implements IAgentPlugin { .filter((identity) => identity.roles.includes(CredentialRole.ISSUER)) .map((identity) => identity.identifier.correlationId)[0] ?? undefined if (issuerBrandings && issuerBrandings.length) { - await context.agent.ibAddIssuerBranding({ localeBranding: issuerBrandings, issuerCorrelationId }) + const brandings: IIssuerBranding[] = await context.agent.ibGetIssuerBranding({filter:[{issuerCorrelationId}]}) + if (!brandings || !brandings.length) { + await context.agent.ibAddIssuerBranding({ localeBranding: issuerBrandings, issuerCorrelationId }) + } } } }