- 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 thecredentials.read
scope must be set.
Extends
CredentialService
Constructors
new CredentialService()
new CredentialService(retrievalProcedures
):CredentialService
Parameters
Parameter | Type |
---|---|
retrievalProcedures | CredentialRetrievalProcedure [] |
Returns
CredentialService
Overrides
CredentialServiceRaw.constructor
Defined in
presentation/getCredential.ts:100Properties
Property | Type | Inherited from | Defined in |
---|---|---|---|
retrievalProcedures | CredentialRetrievalProcedure [] | CredentialServiceRaw.retrievalProcedures | verifiableCredentialsSDK/presentation/getCredential.ts:45 |
Methods
getById()
getById(Retrieves a verifiable credential from Crossmint using its credential ID.credentialId
):Promise
<null
|VerifiableCredentialType
>
Parameters
Parameter | Type | Description |
---|---|---|
credentialId | string | The 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:112getCredential()
getCredential(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.collection
,tokenId
):Promise
<VerifiableCredentialType
>
Parameters
Parameter | Type | Description |
---|---|---|
collection | CredentialsCollection | The CredentialsCollection containing the credential’s metadata. |
tokenId | string | The 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