Skip to content

Conversation

@conradludgate
Copy link
Collaborator

@conradludgate conradludgate commented Aug 2, 2023

I realised yesterday that PASETO payloads need to be encoded with JSON. If we want to support decrypting on non-rust platforms, we should be spec compliant for PASETO to make it easier.

https://github.com/paseto-standard/paseto-spec/blob/master/docs/02-Implementation-Guide/01-Payload-Processing.md#payload-processing

All PASETO payloads must be a JSON-encoded object represented as a UTF-8 encoded string. The topmost JSON object should be an object, map, or associative array (select appropriate for your language), not a flat array or list.

Unfortunately, rusty-paseto doesn't enforce this behaviour, so I only noticed now :(

2 solutions:

  1. Hacky (this one)

Just wrap the messagepack blob in base64 and then stuff it in a json object.

  1. Might be slightly better

Don't use messagepack at all, use only JSON.

Meh 🤷


This will break existing records stored

@vercel
Copy link

vercel bot commented Aug 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
atuin-docs ✅ Ready (Inspect) Visit Preview Aug 2, 2023 9:43pm

@ellie ellie enabled auto-merge (squash) August 2, 2023 21:45
@ellie ellie merged commit af14366 into main Aug 2, 2023
@ellie ellie deleted the json-records branch August 2, 2023 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants