Skip to content
Go client library for the SecretHub API
Branch: master
Clone or download
Latest commit 437559d Mar 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
internals Add EmailVerified field to api.User Mar 8, 2019
pkg Construct the new repo- and userservices inside the me service constr… Mar 19, 2019
.gitlab-ci.yml Download modules before running the linter Feb 26, 2019
.golangci.yml
.travis.yml
CONTRIBUTING.md
CONTRIBUTORS.md
LICENSE Create LICENSE Feb 12, 2019
Makefile
README.md
go.mod Rename the github organization in import paths to secrethub Feb 28, 2019
go.sum Remove redundant/old entries from go.sum Feb 28, 2019
metalinter.config

README.md

Go client for SecretHub

GoDoc Travis CI GolangCI Go Report Card

SecretHub is a developer tool to help you keep database passwords, API tokens, and other secrets out of IT automation scripts.

secrethub-go provides a client for various SecretHub APIs.

Gopher

Installation

Install secrethub-go with:

go get -u github.com/secrethub/secrethub-go

Or install a specific version with:

go get -u github.com/secrethub/secrethub-go@vX.Y.Z

Then, import it using:

import (
    "github.com/secrethub/secrethub-go/pkg/secrethub"
)

Documentation

For details on all functionality of this library, see the GoDoc documentation.

Below are a few simple examples:

import (
	"github.com/secrethub/secrethub-go/pkg/randchar"
	"github.com/secrethub/secrethub-go/pkg/secrethub"
)

// Setup
credential, err := secrethub.NewCredential("<your credential>", "<passphrase>")
client := secrethub.NewClient(credential, nil)

// Write
secret, err := client.Secrets().Write("path/to/secret", []byte("password123"))

// Read
secret, err = client.Secrets().Versions().GetWithData("path/to/secret:latest")
fmt.Println(secret.Data) // prints password123

// Generate a slice of 32 alphanumeric characters.
data, err := randchar.NewGenerator(false).Generate(32) 
secret, err = client.Secrets().Write("path/to/secret", data)

Note that only packages inside the /pkg directory should be considered library code that you can use in your projects. All other code is not guaranteed to be backwards compatible and may change in the future.

Development

Pull requests from the community are welcome. If you'd like to contribute, please checkout the contributing guidelines.

Test

Run all tests:

make test

Run tests for one package:

go test ./pkg/secrethub

Run a single test:

go test ./pkg/secrethub -run TestSignup

For any requests, bug or comments, please open an issue or submit a pull request.

Attributions

"gopher.png" by Takuya Ueda is licensed under CC BY 3.0

You can’t perform that action at this time.