maciejhirsz / uos

Universal Offline Signatures
52 stars 5 forks source link

Binary or String? #3

Closed kumavis closed 5 years ago

kumavis commented 5 years ago

At the top the spec declares

For data density and simplicity this standard will only use the native Binary QR encoding.

And below (eg from Introduction) it declares

scheme MUST be valid ASCII, beginning with a letter and followed by any number of letters, numbers, the period . character, the plus + character, or the hyphen - character. address MUST be valid UTF-8, appropriate for a given network.

The then the result is given as a string

I'm likely misunderstanding but it seems inconsistent. having #2 and the hex of the result would help clarify

maciejhirsz commented 5 years ago

That's kind of specific to keeping things compatible with URI spec and ERCs mentioned. It's only done for addresses so not being most optimal here is tolerable.

UTF-8 is the encoding we use to express strings as binary. US-ASCII (note to self: I need to specify the kind of ASCII we are using) is a subset of UTF-8, so not breaking anything if you treat the whole thing as UTF-8, the restriction is mostly to keep it compatible with URI spec which expects ASCII. The QR format has to be binary as there is no other QR format that can accurately represent UTF-8, or even ASCII for that matter (as the alphanumeric QR codes lack lower case letters and some special characters).

kumavis commented 5 years ago

I think I understand your thinking here, but #2 would help substantially :+1: