The Headline Puzzle Encryptor
May 02, 2020
I wrote a few months ago about the headline puzzle, a fun encryption puzzle I used to do. I finally got around to making an API to help with encrypting them.
The API has it’s own api docs - available at https://api.andrewnorman.uk/api-docs. You can use that specification on the swagger petstore page to play around with it. Click on “try it out” to send a request. You’ll need to:
- Add 5 headlines (or any string really) to the body.
- Set a key (any word with no repeating characters)
- Set a setting (any word with exactly 5 characters)
- Set a hat (word with less than 26 characters, more than 1 - 7 to 12 is probably ideal)
At the moment, I have very lazily put the api-docs into a serverless lambda rather than serving it properly via S3. I’ll have to spend some time this month to try getting SAM working with serving S3 documents - don’t imagine it will be that hard.
Update
Managed to get swagger “try it out” feature working. Issue was that the API was missing an OPTIONS endpoint. Added, this along with the following headers:
Allow
- list of comma separated allowed http methods. In this case, POST and OPTIONS.Access-Control-Allow-Headers
- list of comma separated headers. Or just ”*“.Access-Control-Allow-Origin
- usual CORs header.
I’ve set this up in the template file so that OPTIONS requests go to the same
lambda, but then just checked “httpMethod” in the RequestHandler
to determine
what to return.