Hi Lorenzo,
Thanks for your post. I was trying your code using the string contained in my UE QR CODE but when I used decodeAllSync I got the following error : [ERR_ENCODING_INVALID_ENCODED_DATA]: The encoded data was not valid for encoding utf-8
Any idea of what could have went wrong ?
Have you decoded data from Base45 format and have you decompressed it using zlib before using cbor?
I've decoded your QR
{ "v": [ { "ci": "urn:uvci:....", "co": "FR", "dn": 2, "dt": "2021-07-01", "is": "CNAM", "ma": "...", "mp": "...", "sd": 2, "tg": "840539006", "vp": "...." } ], "dob": "1980-...", "nam": { "fn": "GR....", "gn": "LUD...", "fnt": "GR...", "gnt": "LUD..." }, "ver": "1.3.0" }
PS: I suggest you to remove your data from the post above as anyone can decode it
Oh yes thank you. (gonna remove the QR data)
Here's my code
const greenpassJpeg = fs.readFileSync('qrcodelgr.jpg'); const greenpassImageData = jpeg.decode(greenpassJpeg, {useTArray: true}); const decodedGreenpass = jsQR (greenpassImageData.data, greenpassImageData.width, greenpassImageData.height); console.log('pass decode'); console.log(decodedGreenpass.data); const greenpassBody = decodedGreenpass.data.substr(4);
const decodedData = base45.decode(greenpassBody);
console.log('Post B45 decode'); console.log(decodedData);
const output = pako.deflate(decodedData); console.log('apres zlib'); console.log(output); const results = cbor.decodeAllSync(output); consol.log('apres decodeallsync'); [headers1, headers2, cbor_data, signature] = results [0] .value;
const greenpassData = cbor.decodeAllSync(cbor_data);
console.log (JSON.stringify(greenpassData[0].get(-260).get (1), null, 2));
you are using pako.deflate(decodedData) instead of const output = pako.inflate(decodedData);
pako.deflate(decodedData)
const output = pako.inflate(decodedData);
oh yes . Sorry and once again thank you so much
with the upload
And the image :-) Thank you so much again
Hi Igrauser, Are you abe to help me in to create a valid gren pass from an existing valid one?? Thanks
Igrauser can you help me with that?
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Lorenzo,
Thanks for your post.
I was trying your code using the string contained in my UE QR CODE but when I used decodeAllSync I got the following error :
[ERR_ENCODING_INVALID_ENCODED_DATA]: The encoded data was not valid for encoding utf-8
Any idea of what could have went wrong ?
Have you decoded data from Base45 format and have you decompressed it using zlib before using cbor?
I've decoded your QR
PS: I suggest you to remove your data from the post above as anyone can decode it
Oh yes thank you. (gonna remove the QR data)
Here's my code
const greenpassJpeg = fs.readFileSync('qrcodelgr.jpg');
const greenpassImageData = jpeg.decode(greenpassJpeg, {useTArray: true});
const decodedGreenpass = jsQR (greenpassImageData.data, greenpassImageData.width, greenpassImageData.height);
console.log('pass decode');
console.log(decodedGreenpass.data);
const greenpassBody = decodedGreenpass.data.substr(4);
const decodedData = base45.decode(greenpassBody);
console.log('Post B45 decode');
console.log(decodedData);
const output = pako.deflate(decodedData);
console.log('apres zlib');
console.log(output);
const results = cbor.decodeAllSync(output);
consol.log('apres decodeallsync');
[headers1, headers2, cbor_data, signature] = results [0] .value;
const greenpassData = cbor.decodeAllSync(cbor_data);
console.log (JSON.stringify(greenpassData[0].get(-260).get (1), null, 2));
you are using
pako.deflate(decodedData)instead ofconst output = pako.inflate(decodedData);oh yes . Sorry and once again thank you so much
with the upload
And the image :-)
Thank you so much again
Hi Igrauser, Are you abe to help me in to create a valid gren pass from an existing valid one??
Thanks
Igrauser can you help me with that?