Skip to main content

Link credentials

In many cases, it is necessary to create relationships between different credentials. For example, you might link a diploma credential to a professional license, or a national ID to a work visa. The Truvity SDK allows you to link credentials together to form a hierarchy of related data.

Linking credentials provides several benefits:

  • Data integrity: Maintain the integrity of related credentials, ensuring they are connected in a meaningful way.
  • Hierarchical relationships: Create relationships between credentials, such as educational qualifications and work history, to form a complete identity profile.
  • Simplified verification: Verifiers can easily check related credentials in one verification request.

To link one credential to another, use the @VcLinkedCredentialClaim decorator and the LinkedCredential custom claim type available as part of the user-defined types (UDTs):

@VcContext({ name: "Foo", namespace: "https://www.w3.org/ns/credentials/issuer-dependent" })
class Foo {
@VcNotEmptyClaim
foo!: string;
}

@VcContext({ name: "ClaimsModelExample", namespace: "https://www.w3.org/ns/credentials/issuer-dependent" })
class ClaimsModelExample {
@VcLinkedCredentialClaim(Foo)
@VcNotEmptyClaim
field1!: LinkedCredential<Foo>;
}

Further reading