ajile-in / did-common-java

Shared DID Java library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DIF Logo

did-common-java

Information

This is a work-in-progress implementation of the DID Core specification:

Not ready for production use! Use at your own risk! Pull requests welcome.

Maven

Build:

mvn clean install

Dependency:

<repositories>
	<repository>
		<id>danubetech-maven-public</id>
		<url>https://repo.danubetech.com/repository/maven-public/</url>
	</repository>
</repositories>

<dependency>
	<groupId>decentralized-identity</groupId>
	<artifactId>did-common-java</artifactId>
	<version>0.3-SNAPSHOT</version>
</dependency>

Example

Example code:

URI did = URI.create("did:ex:1234");

Service service = Service.builder()
        .type("ServiceEndpointProxyService")
        .serviceEndpoint("https://myservice.com/myendpoint")
        .build();

VerificationMethod verificationMethod = VerificationMethod.builder()
        .id(URI.create(did + "#key-1"))
        .type("Ed25519VerificationKey2018")
        .publicKeyBase58("FyfKP2HvTKqDZQzvyL38yXH7bExmwofxHf2NR5BrcGf1")
        .build();

DIDDocument diddoc = DIDDocument.builder()
        .id(did)
        .service(service)
        .verificationMethod(verificationMethod)
        .build();

System.out.println(diddoc.toJson(true));

Example DID document:

{
  "@context" : "https://www.w3.org/ns/did/v1",
  "id" : "did:ex:1234",
  "verificationMethod" : {
    "type" : "Ed25519VerificationKey2018",
    "id" : "did:ex:1234#key-1",
    "publicKeyBase58" : "FyfKP2HvTKqDZQzvyL38yXH7bExmwofxHf2NR5BrcGf1"
  },
  "service" : {
    "type" : "ServiceEndpointProxyService",
    "serviceEndpoint" : "https://myservice.com/myendpoint"
  }
}

About

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

About

Shared DID Java library.

License:Apache License 2.0


Languages

Language:Java 100.0%