algolia/sup3rS3cretMes5age

create an API

Closed this issue · 2 comments

is it possible to create secrets through an API? I see nothing in the documentation, and in the code.
For instance, privnote has an API, to create secrets from the command line.

Basically there is only one API endpoint as you can see here:
https://github.com/algolia/sup3rS3cretMes5age/blob/master/main.go#L31

The /secret endpoint supports POST and GET to set and get the secret respectively.

For example you can use curl to create a secret message :

curl -X POST -sF 'msg=my secret msg' https://secret.example.com/secret  

this will return a secret token:

{"token":"s.Lbiu2zwgL7hGprQt1K7WF1KN"}

Than you can get the secret by using the secret token like so:

curl -X GET "https://secret.example.com/secret?token=s.Lbiu2zwgL7hGprQt1K7WF1KN"
{"msg":"my secret msg"}

thanks @eranchetz ! I'm gonna deploy the container on Nomad ASAP.
I'll close the ticket, but perhaps, you may want to mention these example in the README ?