Sphereon-Opensource / SSI-SDK

Self Sovereign Identity SDK
Apache License 2.0
63 stars 18 forks source link

Credential branding issues #274

Open zpangrsic-eq opened 1 week ago

zpangrsic-eq commented 1 week ago

There seems to be a bug with Credential Branding.

When we itterate over the credential branding as linked bellow

https://github.com/Sphereon-Opensource/SSI-SDK/blob/c41d295c136cc35d7be3ea650fc610cf05aaf1a3/packages/oid4vci-holder/src/agent/OID4VCIHolder.ts#L753

the code here:

const localeBranding: Array<IBasicCredentialLocaleBranding> | undefined = credentialBranding?.[credentialId]

wants to find a object with key referencing the credentialId, but the

https://github.com/Sphereon-Opensource/SSI-SDK/blob/c41d295c136cc35d7be3ea650fc610cf05aaf1a3/packages/oid4vci-holder/src/agent/OID4VCIHolderService.ts#L77

The above command is ran here in the OID4VCIHolder class:

https://github.com/Sphereon-Opensource/SSI-SDK/blob/c41d295c136cc35d7be3ea650fc610cf05aaf1a3/packages/oid4vci-holder/src/agent/OID4VCIHolder.ts#L407

returns an Object containing types eg: UniversalCredential and not the credentialId.

sanderPostma commented 6 days ago

@zpangrsic-nchain credential_configurations_supported entries do not have an id field anymore, so I assume you mean the map key of credential_configurations_supported.

{
  "credential_configurations_supported": {
    "UniversityDegreeCredential": {
      "format": "jwt_vc_json",
      "scope": "UniversityDegree",
      "cryptographic_binding_methods_supported": [
        "did:example"
      ],
      "credential_signing_alg_values_supported": [
        "ES256"
      ],
      "credential_definition": {
        "type": [
          "VerifiableCredential",
          "UniversityDegreeCredential"
        ],
        "credentialSubject": {
        ...

I see we have been using the type (!= VerifyableCredential) which is often equal to the id. I am leaning towards adding a mapBy: 'key' | 'type' arg to not break existing implementations, but I will need to discuss internally.