secrets-go

module
v0.32.2-0...-071f0ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2021 License: Apache-2.0

README

[GoDoc][godoc] [CircleCI][circle-ci] [Go Report Card][goreportcard] [Version][latest-version] [Discord][discord]

secrets-go provides a client for various Secrets APIs.

Gopher

Usage

You can install secrets-go with:

go get github.com/rossmerr/secrets-go

Or install a specific version with:

go get github.com/rossmerr/secrets-go@vX.Y.Z

Then, import it using:

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

Note: 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.

Examples

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

Below are a few simple examples:

Read Secrets
package main

import (
    "fmt"

    "github.com/rossmerr/secrets-go/pkg/secrethub"
)

func main() {
    client, _ := secrethub.NewClient()
    secret, _ := client.Secrets().ReadString("path/to/db/pass")
    fmt.Println(secret)
    // Output: wFc16W#96N1$
}
Write Secrets
package main

import (
    "fmt"

    "github.com/rossmerr/secrets-go/pkg/secrethub"
)

func main() {
    client, _ := secrethub.NewClient()
    _, _ = client.Secrets().Write("path/to/secret", []byte("password123"))
}
Generate Secrets
package main

import (
    "fmt"

    "github.com/rossmerr/secrets-go/pkg/randchar"
    "github.com/rossmerr/secrets-go/pkg/secrethub"
)

func main() {
    client, _ := secrethub.NewClient()
    data, _ := randchar.Generate(30)
    _, _ = client.Secrets().Write("path/to/secret", data)
}

Run tests for one package:

go test ./pkg/secrethub

Run a single test:

go test ./pkg/secrethub -run TestSignup

Attributions

["gopher.png"][original-gopher] by [Takuya Ueda][tenntenn] is licensed under CC BY 3.0

Directories

Path Synopsis
internals
api
Package api provides request and response types for interacting with the SecretHub API.
Package api provides request and response types for interacting with the SecretHub API.
api/uuid
Package uuid is a utility package to standardize and abstract away how UUIDs are generated and used.
Package uuid is a utility package to standardize and abstract away how UUIDs are generated and used.
assert
Package assert is a utility package that provides simple assertions to help with writing tests.
Package assert is a utility package that provides simple assertions to help with writing tests.
auth
Package auth provides authentication to the SecretHub API.
Package auth provides authentication to the SecretHub API.
aws
Package aws provides Keyless Authentication for services running on AWS.
Package aws provides Keyless Authentication for services running on AWS.
crypto
Package crypto provides the all cryptographic functions used by the client (e.g.
Package crypto provides the all cryptographic functions used by the client (e.g.
errio
Package errio contains custom error types to easily transfer errors between applications and output them to the user in a consistent way.
Package errio contains custom error types to easily transfer errors between applications and output them to the user in a consistent way.
gcp
pkg
randchar
Package randchar helps to generate random sequences of characters from a configured character set, which can be useful for e.g.
Package randchar helps to generate random sequences of characters from a configured character set, which can be useful for e.g.
randchar/fakes
Package fakes provides mock implementations to be used in testing.
Package fakes provides mock implementations to be used in testing.
secrethub
Package secrethub provides the SecretHub API client, look here to read, write and manage secrets.
Package secrethub provides the SecretHub API client, look here to read, write and manage secrets.
secrethub/configdir
Package configdir provides simple functions to manage the SecretHub configuration directory.
Package configdir provides simple functions to manage the SecretHub configuration directory.
secrethub/credentials
Package credentials provides utilities for managing SecretHub API credentials.
Package credentials provides utilities for managing SecretHub API credentials.
secrethub/credentials/sessions
Package sessions provides session authentication to the SecretHub API for the HTTP client.
Package sessions provides session authentication to the SecretHub API for the HTTP client.
secrethub/fakeclient
Package fakeclient provides mock implementations of the client to be used for testing.
Package fakeclient provides mock implementations of the client to be used for testing.
secrethub/internals/http
Package http implements the RESTful HTTP client that talks directly to the API, as opposed to the client package, which wraps the http client with additional logic (e.g.
Package http implements the RESTful HTTP client that talks directly to the API, as opposed to the client package, which wraps the http client with additional logic (e.g.
secrethub/iterator
Package iterator provides a generic iterator to be used as a building block for typed iterators.
Package iterator provides a generic iterator to be used as a building block for typed iterators.
secretpath
Package secretpath implements utility functions for manipulating paths compatible with SecretHub (e.g.
Package secretpath implements utility functions for manipulating paths compatible with SecretHub (e.g.
scripts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL