DIF Logo

Universal Resolver Driver: did:factom

This is a Universal Resolver driver for did:factom identifiers.

CI/CD Workflow for driver-did-factom

Specifications

The factom driver uses the factom-identity-java client as well as java gson models which are generated from an OpenAPI v3 specification.

A drop in replacement for the universal resolver endpoints is available in the Factom Identity Server

Example DIDs

did:factom:testnet:6aa7d4afe4932885b5b6e93accb5f4f6c14bd1827733e05e3324ae392c0b2764

Running the container and configuration

You can run the container using the docker command or using the docker-compose command. In either case there are several environment variables to configure runtime parameters

Environment variables

The universal resolver can connect to multiple networks and nodes. There are 9 of these slots available, and they can be configured using environment variables. By default the public Factom mainnet and testnet are configured using Factom OpenNode. If you want to disable them, overwrite the values, or disable the slot. The 9 slots denoted by are ranging from 1-9.

NODE_ENABLED

Enables or disables the node. Please see below to disable default OpenNode mainnet and testnet nodes when required (slots 1 and 2 respectively)

NODE_NETWORK_ID

Defines the network Id (name). There can only be one network ID per driver instance. If loadbalancing/HA is needed that is the responsibility of the node itself. The network name can be supplied in 2 ways. As a parameter within the request or as part of the DID, eg for testnet.

did:factom:testnet:6aa7d4afe4932885b5b6e93accb5f4f6c14bd1827733e05e3324ae392c0b2764

The <network_id> part in the did:factom:<network_id>:<chain_id> is completely optional. Default mainnet and testnet can be used for the respective networks. "mainnet" is the default when no network is supplied in the param or DID. For public mainnet the whole :<network_id> part in the DID would be committed., eg:

did:factom:6aa7d4afe4932885b5b6e93accb5f4f6c14bd1827733e05e3324ae392c0b2764

A request param for the network name always takes precedence over the DID method part.

example:

NODE1_NETWORK_ID=mainnet

NODE_NETWORK_URL

Defines the RPC API URL for the factomd note. Example: https://api.factomd.net/v2

Configuration

For downloading the dependencies of this project a Personal Access Token for GitHub must be configured in file settings.xml according to Creating a personal access token for the command line. Make sure to pass in the following environment variables:

  • GITHUB_READ_PACKAGES_OWNER="<github_user_name>"
  • GITHUB_READ_PACKAGES_TOKEN="<github_access_token_repo_read>"

Build (native Java)

Maven build:

mvn clean install

Build and Run (Docker)

docker build . -t sphereon/uni-resolver-driver-did-factom
docker run -p 8080:8080 sphereon/uni-resolver-driver-did-factom
 curl -X GET http://localhost:8080/1.0/identifiers/did:factom:testnet:6aa7d4afe4932885b5b6e93accb5f4f6c14bd1827733e05e3324ae392c0b2764