Skip to content

Support for the Hedera Hashgraph DID Method and Verifiable Credentials on the Hedera Java SDK

License

Notifications You must be signed in to change notification settings

hashgraph/did-sdk-java

Hedera™ Hashgraph DID - Java SDK

License: Apache-2.0 Documentation

LINE INSTRUCTION METHOD CLASS COMPLEXITY

This repository contains the Java SDK for managing DID Documents & Verifiable Credentials registry using the Hedera Consensus Service.

Table of Contents

Overview

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.

Usage

Dependency Declaration

Maven

<dependency>
  <groupId>com.hedera.hashgraph</groupId>
  <artifactId>did-sdk-java</artifactId>
  <version>0.0.1</version>
</dependency>

Gradle

implementation 'com.hedera.hashgraph:did-sdk-java:0.0.1'

Documentation

Getting Started Guides

Examples

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.

With Docker

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

With Gradle

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))

return to the did-sdk-java folder

cd ..

run the appnet example

./gradlew :appnet-api-server:run

Contributing

We welcome participation from all developers! For instructions on how to contribute to this repo, please review the Contributing Guide.

License Information

Licensed under Apache License, Version 2.0.

References

Publishing to maven

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

About

Support for the Hedera Hashgraph DID Method and Verifiable Credentials on the Hedera Java SDK

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published