Skip to content

Add support for multiple Verifiable Credentials in a Verifiable Presentation #48

Open
@robertschubert

Description

@robertschubert

This issue strongly relates to this issue

The current implementation assumes to have one Verifiable Credential inside a Verifiable Presentation. The Builder component inside the VerifiablePresentation class has an attribute verifiableCredential instead of a List.

Moreover the getVerifiableCredential() method will fail if the presentation has more than one `` Verifiable Credential:

	public VerifiableCredential getVerifiableCredential() {
		Object verifiableCredentialObject = this.getJsonObject().get(VerifiableCredentialKeywords.JSONLD_TERM_VERIFIABLECREDENTIAL);
		if ((verifiableCredentialObject instanceof List<?> && ! ((List<?>) verifiableCredentialObject).isEmpty() && ((List<?>) verifiableCredentialObject).get(0) instanceof Map)) {
			return VerifiableCredential.getFromJsonLDObject(this);
		} else if (verifiableCredentialObject instanceof Map) {
			return VerifiableCredential.getFromJsonLDObject(this);
		}
		return null;
	}

The code produces an error when we are in the case of the verifiableCredentialObject instanceof List

The class VerifiableCredential should have another method like this to be called in the List case:
public static Set<VerifiableCredential> getFromJsonLDObject(JsonLDObject jsonLdObject)
which iterates over the List.

Are you planning to merge the PR mentioned in the other issue?
Are you planning to support multiple VCs in a VP?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions