whisperfish / libsignal-service-rs

A Rust version of the libsignal-service-java library for communicating with Signal servers.
https://whisperfish.github.io/libsignal-service-rs/libsignal_service
GNU Affero General Public License v3.0
69 stars 32 forks source link

Add AccountManager::linked_devices #300

Closed Schmiddiii closed 5 months ago

Schmiddiii commented 6 months ago

This adds the functionality of decrypting DeviceInfo::name with the aci private key.

I'm unsure how much about this should live in libsignal-service-rs and how much in presage. Feel free to suggest moving things around if needed.

See also https://github.com/whisperfish/presage/pull/193.

rubdos commented 6 months ago

I would say this should live in the account-manager, next to the encrypt method, and it should probably take an IdentityKeyPair to be slightly more type safe. Moving it into account-manager allows you to implement some round-trip tests too!

Moreover, then we can add a method in the account manager to retrieve devices, and execute the decryption in there. We probably want to provide the AciIdentityStore to such a method.

Schmiddiii commented 6 months ago

I have moved the functionality to AccountManager as wanted and added AccountManager::linked_devices.

I did not do round-trip tests, as all they would check is serialization/deserialization of DeviceName works (which is not something to really check) and encrypt_device_name/decrypt_device_name to be inverse, which is already checked by tests.

rubdos commented 5 months ago

LGTM