Open kumavis opened 5 years ago
obviously theres parameterization in the QR code that is flexible and not specified in the scope, but great for testing. especially if you provide the private key / seed phrase used to generate the example data.
I'll do some (minor) tweaks to the spec, split the particulars for each protocol (Eth, Substrate). Adding examples is a really good idea.
I second the need for examples. Apparently IOS has some trouble reading native binary encoded QR (https://stackoverflow.com/questions/32429480/read-binary-qr-code-with-avfoundation).
@xardass We've run into similar issues on mobile, but solved them now. Once you get the BarcodeRawData
you can extract the binary data with some processing. The main catch is that the QR code payload is offset by 4 bits, the JS code in the link is working on a hexencoded string we get in React Native, which makes things a bit clearer (since one hex character is 4 bits), but you can do the same with raw byte buffers. The structure is, in order:
0100
if encoding is binary. (this is what causes the offset).0000
.ec
and 11
bytes to pad the QR code to capacity it needs to fill up a square.Once you strip the tail padding, the indicator and the terminator you are left with one or two bytes for length, and the payload. It's then easy to match the length to the remainder of the buffer and strip the length prefix (or error if neither matches). This is not a complete decoding process for all QR code encodings, but it is sufficient for this use case.
Please include some QR codes as a reference, so its clear what the expected result is