bernardosecades / sharesecret

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ShareSecret

Test Super-Linter

ShareSecret is a service to share sensitive information that's both simple and secure.

If you share some text will be display it once and then delete it. After that it's gone forever.

We keep secrets for up to 5 days.

Why should I trust you?

General we can't do anything with your information even if we wanted to (which we don't). If it's a password for example, we don't know the username or even the application that the credentials are for.

If you include a password, we use it to encrypt the secret. We don't store the password (only a crypted hash) so we can never know what the secret is because we can't decrypt it.

Demo

Share Secret Demo

Create new secret

POST: http://localhost:8080/secret

Header (optional)

X-Password: "MyPassword"

Payload

{
    "content": "This is my secret"
}

Example

Without password:

curl -X POST http://localhost:8080/secret -d "{\"content\":\"This is my secret\"}"

With password:

curl -X POST http://localhost:8080/secret -H "X-Password: myPassword" -d "{\"content\":\"This is my secret\"}"

See secret

Header (optional)

X-Password: "MyPassword"

Request

GET

http://localhost:8080/secret/{id}

Example

Without password:

curl http://127.0.0.1:8080/secret/b3eb17a5-bda5-4e83-9690-56967857d03e

With password:

curl -H "X-Password: myPassword" http://127.0.0.1:8080/secret/19d38f65-18c3-4d06-9685-9b705ee9d734

Docker Compose

Up webserver and MySQL:

docker-compose up --build

Now you will can access to: localhost:8080/secret (POST/GET)

If you execute the command:

docker-compose ps

You will see two containers:

  • sharesecret_mysql_1
  • sharesecret_web_1

In the container "sharesecret_web_1" we already compile two binary (server and purge) in the Dockerfile and run the server. If you want to execute the binary "purge" (delete from database all secrets expired):

docker exec -it sharesecret_web_1 ./cmd/purge/purge

Note: You can compile the sever and purge using flags for version:

cd cmd/server && go build -ldflags "-X main.commitHash=$(git rev-parse --short HEAD)"
cd cmd/purge && go build -ldflags "-X main.commitHash=$(git rev-parse --short HEAD)"
docker build -t sharesecret-server .
docker run --env-file=../.ENV_PROD_SHARESECRET --rm -d -p 8080:8080 sharesecret-server

Remove docker images not used by any container:

docker system prune -a 

See ip container, you can check with docker inspect <container-ID>

Generate Swagger Doc

Install in your machine: go install github.com/swaggo/swag/cmd/swag@v1.8.12

 swag init -d cmd/server/,http/,types/

About


Languages

Language:Go 91.5%Language:Dockerfile 8.5%