poetapp / frost-api

Po.et's API Layer
https://api.poetnetwork.net
MIT License
24 stars 5 forks source link

Tokens: Include Account ID #920

Closed lautarodragan closed 5 years ago

lautarodragan commented 5 years ago

Note: JWTs are in base 64, UUIDs in base 16 (hex). Converting the bytes of the uuid to base 16 and then to base 64 is a waste of space, network and processor. Can we store the byte buffer directly in the JWT, so it's converted straight from raw bytes to base 64?

Example:

const canonicalUuid = '77162fd8-48da-40c4-9bb9-d658a19d1e24'
const heavy = Buffer.from(canonicalUuid)
const light = Buffer.from(canonicalUuid.replace(/-/g, ''), 'hex')
heavy.length // 36
light.length // 16
heavy.toString('base64')
// 'NzcxNjJmZDgtNDhkYS00MGM0LTliYjktZDY1OGExOWQxZTI0'
light.toString('base64')
// 'dxYv2EjaQMSbudZYoZ0eJA=='
heavy.toString('base64').length // 48
light.toString('base64').length // 24
lautarodragan commented 5 years ago

Actually can't be done, no more efficient way to store data in a JWT than a string :(

poet-ci commented 5 years ago

:tada: This issue has been resolved in version 1.31.6 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: