Skip to content

Conversation

@raphaelrobert
Copy link
Contributor

No description provided.

Copy link
Contributor

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The general approach looks good but we need a) benchmarks to show that this is actually better than before, and b) more tests (especially for all the encode and decode functions). Also see comments inline.

image

for _ in 0..n {
match d.u8()? {
0 => uniq!("IdentityKey::public_key", public_key, PublicKey::decode(d)?),
0 => uniq!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This macro really sholdn't exist ☹️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but that would require refactoring on a larger scale because it is not specific to this PR.

match version {
1 => Ok(IdentityKeyPair {
version,
secret_key: to_field!(secret_key_v1_option, "IdentityKeyPair::secret_key_v2"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, another macro that needs to go 😬

}

pub fn signed(ident: &IdentityKeyPair, key: &PreKey) -> PreKeyBundle {
let ratchet_key = key.key_pair.public_key.clone();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need cloning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DHPublicKey doesn't implement Copy because it depends on GroupElement

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I guess my main question was why this key needs to be copied. That implies that it is changed in some way, which is not really what we want. The clone should probably happen further down when the key is copied to the PreKeyBundle. Not crucial though, also nothing you actually touched 😉

// DHPublicKey ////////////////////////////////////////////////////////////////

#[derive(PartialEq, Eq, Debug, Clone)]
pub struct DHPublicKey {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't a type be sufficient here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I wanted to keep the symmetry with the other keys

@CLAassistant
Copy link

CLAassistant commented Jan 13, 2022

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants