secret

module
v0.0.0-...-2dfd109 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: Unlicense

README

secret

Build Status Go Report Card

A microservice written in Go that stores secrets encrypted with AES.

Ciphertext is stored in memory and can be retrieved with the correct AES key.

Get

This module requires Go 1.15 or greater.

git clone https://github.com/jamesjoshuahill/secret.git
cd secret

Lint

Install golangci-lint.

Run linters:

golangci-lint run

Test

Run the tests using the Ginkgo test runner:

go install github.com/onsi/ginkgo/ginkgo
ginkgo -race -cover -r

or:

go test -race -cover ./...

Run

The server requires TLS configuration.

For example, use the self-signed certificate and private key used by the test suite:

go run cmd/secret-server/main.go \
  --host localhost \
  --port 8080 \
  --cert acceptance_test/testdata/cert.pem \
  --key acceptance_test/testdata/key.pem

Then, create a secret:

curl \
  --cacert acceptance_test/testdata/cert.pem \
  https://localhost:8080/v1/secrets \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"id":"some-id","data":"some plain text"}'

and retrieve it using the AES key:

curl \
  --cacert acceptance_test/testdata/cert.pem \
  https://localhost:8080/v1/secrets/some-id \
  -X GET \
  -H 'Content-Type: application/json' \
  -d '{"key":"AES KEY for secret"}'

Client

The client package provides a Client to interact with the server.

Please refer to the package documentation.

API

Please refer to the API specification.

Directories

Path Synopsis
cmd
internal
aes
pkg
client
Package client provides a Client for secret-server.
Package client provides a Client for secret-server.

Jump to

Keyboard shortcuts

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