Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Latest commit

 

History

History
66 lines (48 loc) · 1.79 KB

README.md

File metadata and controls

66 lines (48 loc) · 1.79 KB

SecretHub Client for Java

SecretHub has been discontinued, so this project has been archived.

Build Status Apache 2.0 Maven Central

A library that provides a Java client for the SecretHub Secrets Management API.

Installation

Add the dependency to your project:

Using Maven

<dependency>
  <groupId>com.jshobe.secrethub</groupId>
  <artifactId>secrethub-java</artifactId>
  <version>1.0.0</version>
</dependency>

Using Gradle

implementation 'com.jshobe.secrethub:secrethub-java:1.0.0'

Usage

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.

License

The SecretHub Client for Java is releases under version 2.0 of the Apache License.