This repository contains the Java SDK for managing DID Documents & Verifiable Credentials registry using the Hedera Consensus Service.
Identity networks are set of artifacts on Hedera Consensus Service that allow applications to share common channels to publish and resolve DID documents, issue verifiable credentials and control their validity status. These artifacts include:
- address book - a file on Hedera File Service that provides information about HCS topics and appnet servers,
- DID topic - an HCS topic intended for publishing DID documents,
- and VC topic - an HCS topic playing a role of verifiable credentials registry.
This SDK is designed to simplify :
- creation of identity networks within appnets, that is: creation and initialization of the artifacts mentioned above,
- generation of decentralized identifiers for Hedera DID Method and creation of their basic DID documents,
- creation (publishing), update, deletion and resolution of DID documents in appnet identity networks,
- issuance, revocation and status verification of Verifiable Credentials.
The SDK does not impose any particular way of how the DID or verifiable credential documents are constructed. Each appnet creators can choose their best way of creating those documents and as long as these are valid JSON-LD files adhering to W3C standards, they will be handled by the SDK.
<dependency>
<groupId>com.hedera.hashgraph</groupId>
<artifactId>did-sdk-java</artifactId>
<version>0.0.1</version>
</dependency>implementation 'com.hedera.hashgraph:did-sdk-java:0.0.1'The /examples/appnet-api-server folder contains an example implementation of an appnet that utilizes DID and VC SDK and exposes a REST API interface according to the Hedera DID Method Specification.
The appnet runs on localhost port 5050 be default. It does not expose any user interface, instead there is a collection of POSTMAN requests available here that demonstrate a full end-to-end flow of DID documents generation, publishing, update and deletion, as well as verifiable credential generation, issuance and revocation.
Please refer to the README file of the appnet project for more details.
Install Docker for Mac, or Docker for Windows
cd did-sdk-java/examples cp .env.sample .env nano .env
update the following environment variables with your `testnet` account details
* OPERATOR_ID=0.0.xxxx
* OPERATOR_KEY=302...
you may also edit the following to use a different network (ensure your OPERATOR_ID and OPERATOR_KEY are valid)
* NETWORK=testnet (can be `testnet`, `previewnet` or `mainnet`)
* MIRROR_PROVIDER=hedera (can be `hedera` or `kabuto` (note `kabuto` not available on `previewnet`))
```cmd
docker build -t did-demo .
docker run -p 5050:5050 did-demo:latest
cd did-sdk-java/examples
cp .env.sample .env
nano .envupdate the following environment variables with your testnet account details
- OPERATOR_ID=0.0.xxxx
- OPERATOR_KEY=302...
you may also edit the following to use a different network (ensure your OPERATOR_ID and OPERATOR_KEY are valid)
- NETWORK=testnet (can be
testnet,previewnetormainnet) - MIRROR_PROVIDER=hedera (can be
hederaorkabuto(notekabutonot available onpreviewnet))
return to the did-sdk-java folder
cd ..run the appnet example
./gradlew :appnet-api-server:runWe welcome participation from all developers! For instructions on how to contribute to this repo, please review the Contributing Guide.
Licensed under Apache License, Version 2.0.
- https://github.com/hashgraph/did-method
- https://github.com/hashgraph/hedera-sdk-java
- https://docs.hedera.com/hedera-api/
- https://www.hedera.com/
- https://www.w3.org/TR/did-core/
- https://www.w3.org/TR/vc-data-model/
from the command line (gradle version 6.7.1)
Note: a gradle.properties file must exist and contain the following information
sonatypeUsername=
sonatypePassword=
signing.keyId=
signing.password=
signing.secretKeyRingFile=
gradle publishToSonatype closeAndReleaseSonatypeStagingRepository