-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat: generate 144-bit group IDs #5986
Conversation
src/tools.rs
Outdated
/// IDs generated by this function are 66 bit wide and are returned as 11 base64 characters. | ||
/// The generated ID should be short but unique: | ||
/// - short, because it used in Message-ID and Chat-Group-ID headers and in QR codes | ||
/// - unique as two IDs generated on two devices should not be the same. However, collisions are not world-wide but only by the few contacts. |
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.
The second sentence is a bit hard to understand. Probably it's meant that we don't protect from collisions globally, but only at account and chat scale.
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.
Yes, makes no sense, I think I will remove it.
@@ -961,7 +957,6 @@ DKIM Results: Passed=true"; | |||
#[test] | |||
fn test_create_outgoing_rfc724_mid() { | |||
let mid = create_outgoing_rfc724_mid(); | |||
assert!(mid.starts_with("Mr.")); |
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.
Maybe check the length at least?
Instead of generating 72 random bits and reducing them to 66 bits of Base64 characters, generate 144 bits (18 bytes) which is exactly 24 Base64 characters. This should still be accepted by existing Delta Chat clients which expect group ID to be between 11 and 32 characters. Message-ID creation is also simplified to not have `Mr.` prefix and dot in between two IDs. Now it is a single ID followed by `@localhost`. Some outdated documentation comments are removed, e.g. group messages don't start with `Gr.` already.
7fadd33
to
8357662
Compare
Instead of generating 72 random bits
and reducing them to 66 bits of Base64 characters, generate 144 bits (18 bytes)
which is exactly 24 Base64 characters.
This should still be accepted by existing
Delta Chat clients which expect group ID
to be between 11 and 32 characters.
Message-ID creation is also simplified
to not have
Mr.
prefixand dot in between two IDs.
Now it is a single ID followed by
@localhost
.Some outdated documentation comments
are removed, e.g. group messages
don't start with
Gr.
already.