Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する

Overview


This library provides a toolkit for Node.js applications to integrate decentralized identity authentication using the DID Connect protocol. It simplifies the process of requesting information and actions from a user's digital wallet, enabling secure and seamless user interactions.

Built upon the ABT-DID-Protocol specification, this SDK is designed to work in tandem with a frontend library like the DID Connect UX package. For developers building on ArcBlock's platform, the Blocklet SDK offers a more integrated experience.

Core Components#

The library is built around two primary classes that handle the logic of a DID Connect session:

WalletAuthenticator

The core engine responsible for cryptographic operations. It creates, signs, and verifies the authentication messages exchanged between your application and the user's wallet, ensuring the integrity and security of the communication.

WalletHandlers

A high-level abstraction for easy integration into web server frameworks like Express.js. It manages the entire session lifecycle—from generating a QR code to handling the final wallet response—through a set of simple lifecycle callbacks.

How DID Connect Works#

A typical DID Connect session involves a secure, QR-code-based interaction between your application and the user's DID Wallet. The application requests specific information (called "claims"), and the user grants or denies this request directly from their wallet.

The following diagram illustrates the sequence of events in a standard session:

The DID Connect Workflow

The Concept of Claims#

The central concept in a DID Connect session is the Claim. A claim is a specific piece of information or an action that your application requests from the user. You can ask for a single piece of data, multiple items at once, or even dynamically determine which claims to request based on the user's DID.

Common examples include:

  • Profile Information: Requesting the user's name, email, or avatar.
  • Asset Ownership: Asking the user to prove they own a specific NFT.
  • Digital Signature: Requesting the user to sign a message or transaction to confirm an action.

This library supports a wide variety of claim types, each detailed in the Claims Reference section.

Next Steps#

Now that you understand the basic concepts, you're ready to start building.