openwallet-foundation/credo-ts

Make verifiableCredential property on W3cPresentation optional

Opened this issue · 0 comments

The VC data model (both v1.1 and v2.0) allow the verifiableCredential property on a VerifiablePresentation to be optional. There are cases where it may not be present, such as an authentication VP. However, the current Credo code expects that it exists as an instance or an array:

@W3cVerifiableCredentialTransformer()
@IsInstanceOrArrayOfInstances({ classType: [W3cJsonLdVerifiableCredential, W3cJwtVerifiableCredential] })
@ValidateNested({ each: true })
public verifiableCredential!: SingleOrArray<W3cVerifiableCredential>

As a first attempt, I think simply adding the @IsOptional decorator to the property may be sufficient to resolve this issue.