Skip to content

Commit

Permalink
Merge pull request #21 from jayaganeshk/main
Browse files Browse the repository at this point in the history
update TLV length calc
  • Loading branch information
wes4m committed Dec 4, 2022
2 parents 6e5cce7 + d1944bb commit 427e688
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/zatca/qr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export const generateQR = ({invoice_xml, digital_signature, public_key, certific
const TLV = (tags: any[]): Buffer => {
const tlv_tags: Buffer[] = []
tags.forEach((tag, i) => {
const current_tlv_value: Buffer = Buffer.from([i+1, tag.length, ...Buffer.from(tag)]);
const tagValueBuffer: Buffer = Buffer.from(tag);
const current_tlv_value: Buffer = Buffer.from([i+1, tagValueBuffer.byteLength, ...tagValueBuffer]);
tlv_tags.push(current_tlv_value)
});
return Buffer.concat(tlv_tags);
Expand Down

0 comments on commit 427e688

Please sign in to comment.