An open API service indexing awesome lists of open source software.

https://github.com/danubetech/data-integrity-java

Java implementation of Data Integrity
https://github.com/danubetech/data-integrity-java

shared-libraries

Last synced: 26 days ago
JSON representation

Java implementation of Data Integrity

Awesome Lists containing this project

README

          

# data-integrity-java

## Information

**This library is a direct continuation of our earlier library [ld-signatures-java](https://github.com/weboftrustinfo/ld-signatures-java).**

It provides an implementation of the following proof types for [Data Integrity](https://www.w3.org/TR/vc-data-integrity/):

- [DataIntegrityProof](https://www.w3.org/TR/vc-data-integrity/)
- [JsonWebSignature2020](https://w3c-ccg.github.io/lds-jws2020/)
- [Ed25519Signature2018](https://w3c-ccg.github.io/lds-ed25519-2018/)
- [Ed25519Signature2020](https://www.w3.org/community/reports/credentials/CG-FINAL-di-eddsa-2020-20220724/)
- [EcdsaSecp256k1Signature2019](https://w3c-ccg.github.io/lds-ecdsa-secp256k1-2019/)
- [EcdsaSecp256r1Signature2019](https://www.w3.org/community/reports/credentials/CG-FINAL-di-ecdsa-2019-20220724/)
- [EcdsaSecp384r1Signature2019](https://www.w3.org/community/reports/credentials/CG-FINAL-di-ecdsa-2019-20220724/)
- [RsaSignature2018](https://w3c-ccg.github.io/lds-rsa2018/)
- [JcsEd25519Signature2020](https://identity.foundation/JcsEd25519Signature2020/)
- JcsEcdsaSecp256k1Signature2019

For [DataIntegrityProof](https://www.w3.org/TR/vc-data-integrity/), this implementation supports the following cryptosuites:

- [eddsa-rdfc-2022](https://www.w3.org/TR/vc-di-eddsa/)
- [eddsa-jcs-2022](https://www.w3.org/TR/vc-di-eddsa/)
- [ecdsa-rdfc-2019](https://www.w3.org/TR/vc-di-ecdsa/)
- [ecdsa-jcs-2019](https://www.w3.org/TR/vc-di-ecdsa/)
- [bip340-rdfc-2025](https://dcdpr.github.io/data-integrity-schnorr-secp256k1/)
- [bip340-jcs-2025](https://dcdpr.github.io/data-integrity-schnorr-secp256k1/)

## Maven

Build:

mvn clean install

Dependency:



danubetech-maven-public
https://repo.danubetech.com/repository/maven-public/


com.danubetech
data-integrity-java
1.18-SNAPSHOT

## Example

Example JSON-LD document:

{
"@context": {
"schema": "http://schema.org/",
"name": "schema:name",
"homepage": "schema:url",
"image": "schema:image"
},
"name": "Manu Sporny",
"homepage": "https://manu.sporny.org/",
"image": "https://manu.sporny.org/images/manu.png"
}

Example code:

JsonLDObject jsonLdObject = JsonLDObject.fromJson(new FileReader("input.jsonld"));

byte[] testEd25519PrivateKey = Hex.decodeHex("984b589e121040156838303f107e13150be4a80fc5088ccba0b0bdc9b1d89090de8777a28f8da1a74e7a13090ed974d879bf692d001cddee16e4cc9f84b60580".toCharArray());

Ed25519Signature2018LdSigner signer = new Ed25519Signature2018LdSigner(testEd25519PrivateKey);
signer.setCreated(new Date());
signer.setProofPurpose(DataIntegrityKeywords.JSONLD_TERM_ASSERTIONMETHOD);
signer.setVerificationMethod(URI.create("https://example.com/jdoe/keys/1"));
signer.setDomain("example.com");
signer.setNonce("343s$FSFDa-");
DataIntegrityProof dataIntegrityProof = signer.sign(jsonLdObject);

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

Example Linked Data Proof:

{
"type": "Ed25519Signature2018",
"created": "2020-10-15T09:42:46Z",
"domain": "example.com",
"nonce" : "343s$FSFDa-",
"proofPurpose": "assertionMethod",
"verificationMethod": "https://example.com/jdoe/keys/1",
"jws": "eyJiNjQiOmZhbHNlLCJjcml0IjpbImI2NCJdLCJhbGciOiJFZERTQSJ9..8sFJcDtO_pYLjIkJNKfIOL3IOgm_bpbOqqr8ha0ZDa-e6XorbywVQmFCATNXPqMV10deru-zajF79tVelKo-Bw"
}

## About

Danube Tech - https://danubetech.com/

Originally built during [Rebooting Web-of-Trust](http://www.weboftrust.info/) in Paris on April 21st 2017.


This software library is part of a project that has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 871932