Table of Contents

Class Sender

Namespace
Signal.Domain.Messaging
Assembly
Signal.Domain.dll

The originator of a received envelope.

public sealed record Sender : IEquatable<Sender>
Inheritance
Sender
Implements
Inherited Members

Remarks

Signal users may hide their phone number, so Number and Uuid are both optional; envelopes are only created when at least one of them is known.

Constructors

Sender(PhoneNumber?, Guid?, string?, int)

The originator of a received envelope.

public Sender(PhoneNumber? Number, Guid? Uuid, string? Name, int Device = 1)

Parameters

Number PhoneNumber?

The sender's phone number, if visible.

Uuid Guid?

The sender's account identifier (ACI), if known.

Name string

The sender's profile name, if known.

Device int

The sending device id (1 = primary device).

Remarks

Signal users may hide their phone number, so Number and Uuid are both optional; envelopes are only created when at least one of them is known.

Properties

Device

The sending device id (1 = primary device).

public int Device { get; init; }

Property Value

int

Identifier

The best available identifier: the phone number, otherwise the UUID.

public string Identifier { get; }

Property Value

string

Exceptions

SignalDomainException

Neither a phone number nor a UUID is known.

Name

The sender's profile name, if known.

public string? Name { get; init; }

Property Value

string

Number

The sender's phone number, if visible.

public PhoneNumber? Number { get; init; }

Property Value

PhoneNumber?

Uuid

The sender's account identifier (ACI), if known.

public Guid? Uuid { get; init; }

Property Value

Guid?

Methods

Matches(string)

Whether identifier identifies this sender.

public bool Matches(string identifier)

Parameters

identifier string

A phone number in any format accepted by TryParse(string?, out PhoneNumber), or a UUID.

Returns

bool

true if the phone number or UUID matches.

ToRecipient()

Addresses this sender directly (by phone number if known, otherwise by UUID).

public Recipient ToRecipient()

Returns

Recipient

A recipient for direct replies.

Exceptions

SignalDomainException

Neither a phone number nor a UUID is known.

ToString()

Formats the sender for logs, e.g. Alice (+4915112345678).

public override string ToString()

Returns

string

The display form of the sender.