Link files to credentials
In many cases, verifiable credentials need to include additional supporting documents, such as PDFs, images, or other file types. The Truvity SDK allows you to securely link external files to your credentials, enriching the data and providing further evidence to support the claims in the credential.
Why link files?
Linking files to credentials is particularly useful for:
- Supporting Documentation: Attach evidence to a credential, such as a scanned certificate, diploma, or ID card.
- Rich Data Representations: Provide additional context or resources that help verifiers understand the credential more deeply.
- Compliance: Attach regulatory documents or contracts required by specific industries (e.g., legal agreements or compliance certificates).
Example: Link a file to a credential
To link file to a credential, use the @VcLinkedFileClaim
decorator and the LinkedFile
custom claim type available as part of the user-defined types (UDTs):
- TypeScript
- Java
@VcContext({ name: "ClaimsModelExample", namespace: "https://www.w3.org/ns/credentials/issuer-dependent" })
class ClaimsModelExample {
@VcLinkedFileClaim
@VcNotEmptyClaim
field1!: LinkedFile;
}
@Data
@VcContext(name = "ClaimsModelExample", namespace = "https://www.w3.org/ns/credentials/issuer-dependent" })
class ClaimsModelExample {
@NotEmpty
private LinkedFile field1;
}