Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encode paseto payloads as json #1146

Merged
merged 1 commit into from Aug 2, 2023
Merged

encode paseto payloads as json #1146

merged 1 commit into from Aug 2, 2023

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
10 checks passed
@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.

None yet

2 participants