SDK Documentation

The SDK documentation explains the series of libraries and functions that help dApps interact with the Litentry protocol and the IdentityHub.

The client-sdk is a series of libraries authored by the Litentry team to help dApps interact with the Litentry protocol and the IdentityHub.

With the client-sdk , dApps can:

  • Link identities.

  • Request Verifiable Credentials.

  • Verify Verifiable Credentials.

  • Query an id_graph and its hash

Installation of the Client SDK packages

The client-sdk is distributed as a series of TypeScript packages available publicly on NPM. Install the packages by running:

npm install @litentry/parachain-api @litentry/sidechain-api @litentry/chaindata @litentry/client-sdk

The following dependencies are needed too, if not installed already:

npm install @polkadot/api

Instantiate a new API connection

The client-sdk requires a Polkadot.js ApiPromise instance with the provider pointing to the Litentry Protocol networks.

Create a new Api instance using Litentry’s network type definitions.

import { ApiPromise, WsProvider } from '@polkadot/api';
import { getChain } from '@litentry/chaindata';
import {
  identity,
  vc,
  sidechain,
  trusted_operations,
} from '@litentry/parachain-api';

const litentryNetworkApiTypes = {
  ...identity.types,
  ...vc.types,
  ...sidechain.types,
  ...trusted_operations.types,
};

const litentryProductionSpec = getChain('litentry-prod');

const wsProvider = new WsProvider(
  litentryProductionSpec.rpcs[0].url
);

const api = await ApiPromise.create({
  provider: wsProvider,
  types: litentryNetworkApiTypes,
});

Next, check what dApps can do with the client-sdk.

Last updated