This tutorial guides you through creating a Decentralized Identifier (DID) using the Onyx SSI SDK and resolving it with the Vidos Universal Resolver. You'll build a simple Node.js application that demonstrates the integration between these two systems, providing a foundation for more complex identity workflows.
In the digital asset economy, secure identity verification is essential. Financial service providers need robust solutions to authenticate traders and assets to manage compliance requirements, mitigate risks, and build trust. Traditional verification methods often come with limitations:
Decentralized identifiers (DIDs) and verifiable credentials (VCs) address these challenges by providing a secure, interoperable foundation for digital identity.
This tutorial combines two powerful technologies:
Onyx by J.P. Morgan is a bank-led blockchain platform that builds next-generation financial ecosystems. It provides institutional-grade infrastructure and services for developing purpose-built blockchain applications.
Vidos Universal Resolver enables resolving and validating DIDs across multiple methods, providing interoperability for identity verification across different blockchains and systems.
The integration delivers several key benefits:
Before starting, ensure you have:
First, set up a simple Node.js project structure:
Initialize the Node.js project:
Create your main file:
Test your setup with a simple script:
Run the project to verify everything works:
You should see Hello, Onyx and Vidos!
in your terminal.
Add the Onyx SSI SDK to your project:
::: code-group
:::
The Onyx SDK supports both did:key
and did:ethr
methods. For simplicity, we'll create a did:key
identifier.
Replace the contents of index.js
with:
Run the project:
You should see output similar to:
KeyDIDMethod
class from the Onyx SDKcreate()
method to generate a new random did:key
identifier
The import statement uses CommonJS syntax (require
) instead of ES module syntax (import
) because the Onyx SDK has invalid ESM exports. This is a known issue with an open PR: [fix]: update configuration for exporting package #25
Now we'll build a wrapper class for the Vidos Universal Resolver API to resolve our DID. Create a new file called VidosResolver.js
:
This class provides a simple interface to the Vidos Universal Resolver:
resolve()
method takes a DID URL and makes an authenticated request to the resolverFor security, store your Vidos credentials in environment variables rather than hardcoding them. Create a .env
file:
Now update index.js
to use your new resolver class:
Run the project with environment variables loaded:
You should see a complete DID resolution response that includes:
VidosResolver
with credentials from environment variablesresolver.resolve(did.did)
The --env-file
flag requires Node.js 16.6.0 or later. For older versions, use the dotenv
package to load environment variables.
You've successfully created and resolved a DID using the Onyx SSI SDK and Vidos Universal Resolver. This foundation opens up several possibilities:
The complete source code for this example is available on GitHub: onyx-vidos-example.
Here's how this technology can be applied in a financial services context:
Alice, an international trader, needs to execute a trade on Bob's digital asset management platform built with Onyx. The platform uses DIDs and verifiable credentials for secure authentication:
This workflow provides secure, compliant identity verification while significantly reducing fraud risks and improving the user experience.