Skip to content

Latest commit

 

History

History
82 lines (52 loc) · 3.92 KB

README.md

File metadata and controls

82 lines (52 loc) · 3.92 KB

Universal Resolver — Java Components

This is a Java implementation of a Universal Resolver. See universal-resolver for a general introduction to Universal Resolvers and drivers.

Configuration

For downloading the dependencies of this project a Personal Access Token for GitHub must be configured in file resolver/java/settings.xml, according to Creating a personal access token for the command line. Only the scope read:packages is required.

Build (native Java)

Maven build:

cd resolver/java
mvn --settings settings.xml clean install

Local Resolver

You can use a Local Resolver in your Java project that invokes drivers locally (either directly via their JAVA API or via a Docker REST API).

Dependency:

<dependency>
	<groupId>decentralized-identity</groupId>
	<artifactId>uni-resolver-local</artifactId>
	<version>0.1-SNAPSHOT</version>
</dependency>

Example Use:

LocalUniResolver uniResolver = LocalUniResolver.getDefault();
uniResolver.getDriver(DidSovDriver.class).setLibIndyPath("./sovrin/lib/");
uniResolver.getDriver(DidSovDriver.class).setPoolConfigName("live");
uniResolver.getDriver(DidSovDriver.class).setPoolGenesisTxn("live.txn");
uniResolver.getDriver(DidBtcrDriver.class).setBitcoinConnection(BlockcypherAPIBitcoinConnection.get());

DIDDocument didDocument1 = uniResolver.resolve("did:sov:WRfXPg8dantKVubE3HX8pw").getDidDocument();
System.out.println(didDocument1.toJson());

DIDDocument didDocument2 = uniResolver.resolve("did:btcr:xkrn-xzcr-qqlv-j6sl").getDidDocument();
System.out.println(didDocument2.toJson());

DIDDocument didDocument3 = uniResolver.resolve("did:stack:v0:16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg-0").getDidDocument();
System.out.println(didDocument3.toJson());

Web Resolver

You can deploy a Web Resolver that can be called by clients and invokes drivers locally (either directly via their JAVA API or via a Docker REST API).

See the Example Configuration.

How to run:

mvn jetty:run

Client Resolver

You can use a Client Resolver in your Java project that calls a remote Web Resolver.

Dependency:

<dependency>
	<groupId>decentralized-identity</groupId>
	<artifactId>uni-resolver-client</artifactId>
	<version>0.1-SNAPSHOT</version>
</dependency>

Example Use:

ClientUniResolver uniResolver = new ClientUniResolver();
uniResolver.setResolveUri("https://uniresolver.danubetech.com/1.0/identifiers/");

DIDDocument didDocument1 = uniResolver.resolve("did:sov:WRfXPg8dantKVubE3HX8pw").getDidDocument();
System.out.println(didDocument1.toJson());

DIDDocument didDocument2 = uniResolver.resolve("did:btcr:xz35-jzv2-qqs2-9wjt").getDidDocument();
System.out.println(didDocument2.toJson());

DIDDocument didDocument3 = uniResolver.resolve("did:stack:v0:16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg-0").getDidDocument();
System.out.println(didDocument3.toJson());

About

Decentralized Identity Foundation - http://identity.foundation/