Skip to content

Commit

Permalink
respond to review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed May 4, 2021
1 parent f65ec4a commit 8370d7d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions rust/protocol/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
// SPDX-License-Identifier: AGPL-3.0-only
//

//! Where to send a [sealed_sender] message to.
//! A normalized representation of an individual Signal client instance.
// These are used in docstrings.
#[allow(unused_imports)]
use crate::sealed_sender::{self, UnidentifiedSenderMessageContent};
#[cfg(doc)]
use crate::{
sealed_sender::{self, UnidentifiedSenderMessageContent},
SignalMessage,
};

use std::fmt;

Expand All @@ -17,7 +20,7 @@ use std::fmt;
/// Used in [ProtocolAddress].
pub type DeviceId = u32;

/// The target of an [UnidentifiedSenderMessageContent].
/// Represents a unique Signal client instance as `(<user ID>, <device ID>)` pair.
#[derive(Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)]
pub struct ProtocolAddress {
name: String,
Expand All @@ -37,7 +40,7 @@ impl ProtocolAddress {

/// A unique identifier for the target user.
///
/// In the Signal app, this is currently a phone number.
/// In the Signal app, this is usually a UUID, although that may change in the future.
#[inline]
pub fn name(&self) -> &str {
&self.name
Expand All @@ -47,9 +50,8 @@ impl ProtocolAddress {
///
/// For example, if a user has set up Signal on both their phone and laptop, any
/// [UnidentifiedSenderMessageContent] sent to the user will only go to a single
/// device. Handling this is part of the [Sesame] algorithm.
///
/// [Sesame]: https://signal.org/docs/specifications/sesame/#assumptions
/// device. A single [SignalMessage] goes to a particular device, so when a user sends a message
/// to another user at all, they're actually sending a message to *every* device.
#[inline]
pub fn device_id(&self) -> DeviceId {
self.device_id
Expand Down

0 comments on commit 8370d7d

Please sign in to comment.