Skip to content

JS SDK Overview

The Polygon ID JS SDK is a Software Development Kit created in JavaScript. Based on the Iden3 core protocol libraries, it is used for interacting with REST APIs and developing browser-based applications.

The Polygon ID JS SDK allows developers to create applications like mobile or web wallets, browser extensions, and issuer nodes. Using this SDK developers can start creating and issuing verifiable credentials, and generate zero knowledge proofs based on our Iden3 protocol. Individuals and organizations can use this SDK for their existing applications.

Note

With JS SDK, you can build custom applications/modules by providing your implementation of our core interfaces. The functionalities that we provide in these tutorials can be extended as per your requirements. For example, JS SDK does not provide a codebase for database storage but you can implement that by extending SDK's functionality.

Why JS SDK?

The Polygon ID JS SDK has been developed to provide the following functionalities for a user's browser-based wallet:

  • Create and manage Identity wallet
  • Issue and manage credentials
  • Generate zero-knowledge proofs after credential issuance
  • Publish the updated state of the Issuer once a credential is added to the claims Merkle tree.
  • Handle authorization requests

Components of JS SDK

The following components form the inherent part of the JS SDK:

  • Identity Wallet
  • Credential Wallet
  • Iden3comm (Authentication Handler/Fetch Handler)
  • Proof Generation

In the upcoming tutorials, we shall read more about the implementation of these components in JS SDK. To know what each of these components stands for, go through the following links:

Prerequisites

  • Node.js must be installed on your system. Version 16.14 or above is required for Polygon ID JS SDK.

    Note

    While installing Node.js, make sure that you select all the checkboxes related to the dependencies.

  • A browser where you can install and manage your browser wallet.

Dependencies

You can install project dependencies using either of the following ways:

  • Using npm:
npm install @0xpolygonid/js-sdk
  • For browser-based applications, you can use the following script tag, adding import to your index.html file after npm run build:
<script src="./dist/umd/index.js"></script>
<script>
    const {
    LocalStoragePrivateKeyStore,
    IdentityStorage,
    MerkleTreeLocalStorage,
    CredentialStorage,
    W3CCredential,
    BrowserDataSource,
    BjjProvider,
    KmsKeyType,
    IdentityWallet,
    CredentialWallet,
    KMS,
    core,
    CredentialStatusType
} = PolygonIdSdk;
</script>

Core Libraries

JS SDK is a fully-functional wrapper on top of our Iden3 core libraries. The following set of core Iden3 libraries has been used to implement Polygon ID JS SDK:

Info

Follow the links below to know more about W3C standards for DID (Decentralised Identifier) and Verifiable Credentials:

What Can Be Built Upon JS SDK?

On the Polygon ID JS SDK, you can build the following functionalities:

  • An Issuer on a Merkle Tree
  • A Verifier that can verify zero-knowledge proofs generated by a user's identity wallet
  • An Identity Wallet based on the Iden3 core protocol
  • The JS SDK also provides a revocation feature for credentials and proof generation


Note

As our JS SDK is still in the public beta stage, you might find a few functionalities missing or not fully updated.