<commit_before><a href="http://projectdanube.org/" target="_blank"><img src="http://projectdanube.github.com/xdi2/images/projectdanube_logo.png" align="right"></a>

## Sovrin Client (Java)

This is a **work-in-progress** Java client library for [Sovrin](https://github.com/sovrin-foundation/sovrin-client/). It is implemented using a foreign function interface (FFI) to a native library written in Rust.

Pull requests welcome!

**Not ready for production use! Not all commands work properly! Use at your own risk!**

### How to build

First, build the native "sovclient" library at https://github.com/sovrin-foundation/sovrin-client/tree/master/sovrin_client/client/lib:

	cargo build

Then copy the resulting `libsovclient.so` to `./lib/`.

Then run

    mvn clean install

### Example use

	public class Example {
	
		public static void main(String[] args) {
	
			SovrinClient client = new SovrinClientImpl("localhost:1234");
	
			try {
	
				int result = client.setDid("did:sov:21tDAKCERh95uGgKbJNHYp", "lji9qTtkCydxtez/bt1zdLxVMMbz4SzWvlqgOBmURoM=", null, null, "USER");
				System.out.println("setDid result: " + result);
			} finally {
	
				client.close();
			}
		}
	}

Output:

	0
<commit_msg>change Sovrin link<commit_after><a href="http://projectdanube.org/" target="_blank"><img src="http://projectdanube.github.com/xdi2/images/projectdanube_logo.png" align="right"></a>

## Sovrin Client (Java)

This is a **work-in-progress** Java client library for [Sovrin](https://sovrin.org/). It is implemented using a foreign function interface (FFI) to a native library written in Rust.

Pull requests welcome!

**Not ready for production use! Not all commands work properly! Use at your own risk!**

### How to build

First, build the native "sovclient" library at https://github.com/sovrin-foundation/sovrin-client/tree/master/sovrin_client/client/lib:

	cargo build

Then copy the resulting `libsovclient.so` to `./lib/`.

Then run

    mvn clean install

### Example use

	public class Example {
	
		public static void main(String[] args) {
	
			SovrinClient client = new SovrinClientImpl("localhost:1234");
	
			try {
	
				int result = client.setDid("did:sov:21tDAKCERh95uGgKbJNHYp", "lji9qTtkCydxtez/bt1zdLxVMMbz4SzWvlqgOBmURoM=", null, null, "USER");
				System.out.println("setDid result: " + result);
			} finally {
	
				client.close();
			}
		}
	}

Output:

	0

{'fraction_non_alphanumeric': 0.12873369793857803, 'fraction_numerical': 0.01093815734118637, 'mean_word_length': 4.249448123620309, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2027170', 'n_tokens_mistral': 889, 'n_tokens_neox': 789, 'n_words': 212}