Skip to main content

SDK examples

This guide walks through the end-to-end issuance and verification flows available in the Hovi SDK. We reference our SDK Examples Repository to demonstrate how to use the @hovi/core-sdk package to simplify your integration.

Repository Access: All files referenced below can be found in the Hovi SDK Examples Repository.


Project setup​

Follow these steps to get the example project running on your local machine.

  1. Clone the Repository: Download the code to your local machine using git.

    git clone https://github.com/hovi-id/hovi-sdk-examples.git
    cd hovi-sdk-examples/typescript/sdk
  2. Install Dependencies: Install the necessary packages, including the Hovi Core SDK.

    npm install
  3. Configure Environment: Create a .env file by copying the provided example. Open it and add your API_KEY and the Hovi BASE_URL (e.g., https://api.hovi.id). These are the example project's own variable names; in the SDK itself, the options are called apiKey and apiBaseUrl.

    cp .env.example .env
  4. Explore Shared Utilities: To keep our code clean and DRY (Don't Repeat Yourself), we use a centralized utils folder for common actions.


General lifecycle​

The SDK simplifies the credential lifecycle by using Ecosystem Clients. You instantiate a client once, and it automatically handles authentication, request formatting, and ecosystem-specific nuances for you.

  1. Initialize Client: Instantiate the specific client (OpenIdEcosystem, EntraEcosystem, CheqdEcosystem, IndicioEcosystem or PrivadoEcosystem for Polygon) with your API key. This is your main gateway to the Hovi platform.

  2. Configure Issuer (Setup): Use the client to create an organization. This establishes the digital identity that will be issuing the credentials.

  3. Establish Secure Connection (Ecosystem Dependent):

    • For cheqd and Indicio (to issue and verify) and Polygon (to issue): you must establish a connection first. Create an invitation with createConnectionInvitation, then check its state with getConnectionById.
    • For EU Digital Identity and Microsoft Entra: no connection is needed. The offer comes back as a link you show the user as a QR code.
  4. Offer Credential: The issuer uses the client to send a credential offer. The SDK formats this request according to the specific standards of the chosen ecosystem.

  5. Receive Credential: The user accepts the offer in their wallet.

  6. Verify Credential: The issuer uses the client to request a proof, and the user shares the requested data.


Supported ecosystems​

Hovi is built on open standards to ensure your credentials work across different networks and wallets. We support a wide range of credential formats—including mDocs, SD-JWT, AnonCreds, and JSON-LD—allowing you to choose the right standard for your specific use case.

For a deep dive into how these standards work together, visit our Compatibility page.

EU Digital Identity​

The EU Digital Identity flow utilizes the OID4VCI standard. The SDK methods automatically generate the QR code URI needed for the user to claim the credential.

Credential FormatDescriptionExample Code
SD-JWTSupports complex claims with selective disclosure capabilities.See example
mDocMobile-optimized credential format standardized by ISO.See example
JSON-LDStandard W3C credentials signed using JSON Web Signatures.See example

cheqd​

The CheqdEcosystem client provides optimized methods for the cheqd network, handling both AnonCreds and JSON-LD formats.

Credential FormatDescriptionExample Code
JSON-LDStandard W3C credentials with cheqd network anchoring.See example
AnonCredsPrivacy-preserving credentials supporting Zero-Knowledge Proofs (ZKP).See example

Indicio​

The IndicioEcosystem client is designed for the Hyperledger Indy network, focusing on robust AnonCreds issuance and verification.

Credential FormatDescriptionExample Code
AnonCredsPrivacy-preserving credentials supporting Zero-Knowledge Proofs (ZKP).See example
JSON-LDStandard W3C credentials with Indy network anchoring.See example

Polygon​

The PrivadoEcosystem client handles the specific JSON-LD signature requirements and zero-knowledge features of the Polygon ecosystem.

Credential FormatDescriptionExample Code
JSON-LDW3C credentials optimized for the Polygon ecosystem.See example