The Client SDK is a powerful tool for managing verifiable credentials. It simplifies several key processes, making it easier to work with these credentials. NOTE: The SDK can be used also server-side.

You can download the SDK from here.

The SDK assists with the following processes:

  • Verification: The SDK provides a straightforward method to verify any given credential.

  • Presentation: By inputting a user’s wallet address, the SDK allows you to retrieve all credentials issued to that address. It also provides a filtering option for easy navigation through the credentials.

  • Decryption: In case of encrypted credentials, the SDK enables you to decrypt a credential for a specific user interacting with the lit protocol. Decryption works only client-side.

Verification

The verifyCredential function simplifies the process of verifying a credential. It requires a VerifiableCredential object as an argument.

The verification process is performed locally, eliminating the need for interaction with Crossmint. Consequently, a Crossmint developer account is not necessary for using the verification SDK.

Presentation

The SDK provides utilities to retrieve and filter NFTs associated with credentials issued to a specific user.

The getCredentialCollections function returns all the CredentialCollection[] associated with a given wallet address.

getCredentialCollections(
  "polygon",
  "user_wallet_address",
  <CredentialFilter>{},
  environment // "production" or "staging"
);

The getCredentialCollections function accepts a CredentialFilter object and returns all the collections that match the filter criteria (for example, you can filter by type, issuer, etc.).

The retrieved NFTs can be presented to the user, who can then select the desired credential for retrieval.

Please note that the presentation process requires interaction with the Crossmint API, and therefore, a Crossmint developer account is necessary.

The getCredentialFromId function wraps the API call to retrieve a credential and can be used to get the credential associated with the selected NFT.

Decryption

In instances where the retrieved credential is encrypted, the SDK provides a Lit().decrypt(<credential_payload>) function that decrypts the credential for the user. The user will be prompt to sign a message with its wallet to authenticate, then the credential will be decryped. Decryption will not work server-side. Refer to the @lit-protocol/lit-node-client-nodejs package for server side decryption or call our API.

Authentication

In order to use the presentation or decryption features of the SDK, you will need to authenticate with Crossmint. If the sdk is used client side you will need to provide a client-side-api-key to the SDK.

Generate a client-side-api-key from the Crossmint console: Go to the API Keys tab, click on New API Key in the Client-side keys section, and select the scopes wallets.read, wallets:nfts.read.

import { CrossmintAPI } from "@crossmint/verify-credentials";

CrossmintAPI.init("<api_key>");