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.
This module requires Go 1.15 or greater.
git clone https://github.com/jamesjoshuahill/secret.git
cd secret
Install golangci-lint.
Run linters:
golangci-lint run
Run the tests using the Ginkgo test runner:
go install github.com/onsi/ginkgo/ginkgo
ginkgo -race -cover -r
or:
go test -race -cover ./...
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"}'
The client
package provides a Client
to interact with the server.
Please refer to the package documentation.
Please refer to the API specification.