SecretHub has been discontinued, so this project has been archived.
A library that provides a Java client for the SecretHub Secrets Management API.
Add the dependency to your project:
<dependency>
<groupId>com.jshobe.secrethub</groupId>
<artifactId>secrethub-java</artifactId>
<version>1.0.0</version>
</dependency>
implementation 'com.jshobe.secrethub:secrethub-java:1.0.0'
Put the credentials for your SecretHub service account in the
$HOME/.secrethub/credential
file or in the SECRETHUB_CREDENTIAL
environment variable.
NOTE: It is not necessary to install the SecretHub binaries to use this library.
In your Java code, create an instance of Client
and start using it.
import com.jshobe.secrethub.Client;
import com.jshobe.secrethub.SecretHubException;
public class MyClass {
public static void main(String[] args) {
try (Client client = new Client()) {
String secret = client.readString("com/example/test");
System.out.println("MY SECRET: " + secret);
} catch (SecretHubException e) {
e.printStackTrace();
}
}
}
The client API closely follows what is provided by the SecretHub SDK. See the API Documentation for details.
The SecretHub Client for Java is releases under version 2.0 of the Apache License.