Service for managing and retrieving verifiable credentials from different sources. By default, it includes procedures for IPFS and Crossmint, but additional procedures can be added by the user.

  • CredentialService().getById(credentialId: string) : Fetches the credential from crossmint using the credentialId.
  • CredentialService().getCredential(collection: CredentialsCollection, tokenId: string) : Fetches the credential from the source that matches the storage location of the credential.

Remarks

To use the Crossmint procedure, a Crossmint API key with the credentials.read scope must be set.

Extends

  • CredentialService

Constructors

new CredentialService()

new CredentialService(retrievalProcedures): CredentialService

Parameters

ParameterType
retrievalProceduresCredentialRetrievalProcedure[]

Returns

CredentialService

Overrides

CredentialServiceRaw.constructor

Defined in

presentation/getCredential.ts:100

Properties

PropertyTypeInherited fromDefined in
retrievalProceduresCredentialRetrievalProcedure[]CredentialServiceRaw.retrievalProceduresverifiableCredentialsSDK/presentation/getCredential.ts:45

Methods

getById()

getById(credentialId): Promise<null | VerifiableCredentialType>

Retrieves a verifiable credential from Crossmint using its credential ID.

Parameters

ParameterTypeDescription
credentialIdstringThe ID of the credential to retrieve.

Returns

Promise<null | VerifiableCredentialType>

A promise that resolves to a VerifiableCredentialType or null if the credential is not found.

Throws

Will throw an error if the credential retrieval fails.

Defined in

presentation/getCredential.ts:112


getCredential()

getCredential(collection, tokenId): Promise<VerifiableCredentialType>

Retrieves a Verifiable Credential from a given collection and token ID.

This function finds the appropriate retrieval procedure based on the collection’s metadata and uses it to fetch the credential.

Parameters

ParameterTypeDescription
collectionCredentialsCollectionThe CredentialsCollection containing the credential’s metadata.
tokenIdstringThe token ID of the credential to retrieve.

Returns

Promise<VerifiableCredentialType>

A promise that resolves to a VerifiableCredentialType.

Throws

Will throw an error if the collection is not a verifiable credential collection or if the retrieval endpoint is unsupported.

Inherited from

CredentialServiceRaw.getCredential

Defined in

verifiableCredentialsSDK/presentation/getCredential.ts:65