panva / paseto

PASETO (Platform-Agnostic SEcurity TOkens) for Node.js with no dependencies
MIT License
428 stars 26 forks source link

feat: allow arbitrary payloads #15

Closed lhchavez closed 3 years ago

lhchavez commented 3 years ago

The reference PHP implementation[1] allows "to store arbitrary binary data in a PASETO, by invoking the Protocol classes directly". This change adds support for the V1.{sign,encrypt}/V2.sign functions to be able to receive Buffers as the payload. It also adds a new option ({ buffer: true }) to the V1.{verify,decrypt}/V2.verify functions so that they return a Buffer instead of a parsed token, for symmetry.

1: https://github.com/paragonie/paseto/tree/master/docs/02-PHP-Library#using-the-protocol-directly

panva commented 3 years ago

@lhchavez sorry for the intrusion, I've decided to drop v2.local support to avoid the massive libsodium dependency. Can you take that into consideration and rebase this PR?

lhchavez commented 3 years ago

@lhchavez sorry for the intrusion, I've decided to drop v2.local support to avoid the massive libsodium dependency. Can you take that into consideration and rebase this PR?

whew! not using that, so a bullet was dodged!

sure thing gimme a few minutes

lhchavez commented 3 years ago

@lhchavez sorry for the intrusion, I've decided to drop v2.local support to avoid the massive libsodium dependency. Can you take that into consideration and rebase this PR?

whew! not using that, so a bullet was dodged!

sure thing gimme a few minutes

done!