-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support Message Id format for Aleo. #689
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be implemented like the other message ids, particularly with a regex. This is not very safe to use the aleo_types crate to do the parsing. For instance, what if that crate allows different representations of the same transaction id? like upper vs lowercase, 0x vs not, etc. What if it does not allow that today, but does in the future? This part of the code is very sensitive and needs to be extremely secure.
@cjcobb23 thanks for the review. Please let me know if further changes are needed. |
} | ||
|
||
const PATTERN: &str = | ||
"^(at1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{58})-(au1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{58})$"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these symbols so scrambled? Can we put them in alphanumeric order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can put the in alphanumeric order if you prefer it.
The order follows the order of "Bech32"
https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
I have copied the table here for reference:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
---|---|---|---|---|---|---|---|---|
+0 | q | p | z | r | y | 9 | x | 8 |
+8 | g | f | 2 | t | v | d | w | 0 |
+16 | s | 3 | j | n | 5 | 4 | k | h |
+24 | c | e | 6 | m | u | a | 7 | l |
Just let me know how you prefer it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to make the pattern as readable as possible, otherwise regex is easy to get wrong. You could also consider using ranges to make it more obvious which letters are skipped. I think [02-9ac-hj-np-z]
works, but please double-check
Description
Support
MessageIdFormat
for Aleo