Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

79
Views
Base45 encoding

I recently have taken up interest in qr codes and first learned of base45 encoding and CBOR. I have a code snippet below, what I am wondering is if there is a way to actually reverse so that you could write a json object or change the name and convert it back to how it originally looks.

const base45 = require('base45')
const cbor = require('cbor')
const fs = require('fs')
const jpeg = require('jpeg-js')
const jsQR = require('jsqr')
const pako = require('pako')

// decode the qr code

const greenpassJpeg = fs.readFileSync(__dirname + '/real-qr.jpg')
const greenpassImageData = jpeg.decode(greenpassJpeg, { useTArray: true })

const decodedGreenpass = jsQR(greenpassImageData.data, greenpassImageData.width, greenpassImageData.height)
const greenpassBody = decodedGreenpass.data.substr(4)

const decodedData = base45.decode(greenpassBody)
const output = pako.inflate(decodedData)

const results = cbor.decodeAllSync(output);
[headers1, headers2, cbor_data, signature] = results[0].value

const greenpassData = cbor.decodeAllSync(cbor_data)
const greenpassJson = JSON.stringify(greenpassData[0].get(-260).get (1), null, 2)
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!