GroupOperations

Struct GroupOperations 

Source
pub struct GroupOperations {
    pub group_secret_params: GroupSecretParams,
}

Fields§

§group_secret_params: GroupSecretParams

Implementations§

Source§

impl GroupOperations

Source

pub fn encrypt_title<R: Rng + CryptoRng>( &self, title: &str, rng: &mut R, ) -> Vec<u8>

Source

pub fn encrypt_description<R: Rng + CryptoRng>( &self, description: Option<&str>, rng: &mut R, ) -> Vec<u8>

Source

pub fn encrypt_disappearing_messages_timer<R: Rng + CryptoRng>( &self, timer: Option<&Timer>, rng: &mut R, ) -> Vec<u8>

Source

pub fn new(group_secret_params: GroupSecretParams) -> Self

Source

pub fn decrypt_group(&self, group: Group) -> Result<Group, GroupDecodingError>

Source

pub fn decrypt_group_change( &self, group_change: GroupChange, ) -> Result<GroupChanges, GroupDecodingError>

Source

pub fn decrypt_avatar(&self, ciphertext: &[u8]) -> Option<Vec<u8>>

Source

pub fn build_add_member_action( &self, aci: Aci, profile_key: ProfileKey, role: Role, ) -> Result<AddMemberAction, GroupDecodingError>

Build an AddMemberAction for a GroupChange.

§Role Parameter

The role parameter is accepted for API consistency, but note that Signal-Android only ever adds members with Role::Default. Adding a member with Role::Administrator is an illegal operation that the server will reject. Promotion to administrator requires a separate ModifyMemberRoleAction after the member has been added.

See Signal-Android’s GroupsV2Operations.GroupOperations.createModifyGroupMembershipChange() which hardcodes Member.Role newMemberRole = Member.Role.DEFAULT.

Source

pub fn build_remove_member_action( &self, aci: Aci, ) -> Result<DeleteMemberAction, GroupDecodingError>

Build a DeleteMemberAction for a GroupChange

Source

pub fn build_remove_pending_member_action( &self, invitee: ServiceId, ) -> Result<DeleteMemberPendingProfileKeyAction, GroupDecodingError>

Build a DeletePendingMemberAction to retract an outstanding invitation.

Used when a pending member (invite not yet accepted) is to be removed. The invitee may be ACI or PNI — whichever service ID was used when the invite was originally created. The Signal server stores and matches on the encrypted user_id field of PendingMember, which may be either kind of ServiceId.

Source

pub fn create_member_presentation( &self, server_public_params: &ServerPublicParams, credential: &ExpiringProfileKeyCredential, ) -> Vec<u8>

Create a presentation from a credential for adding a member to a group.

This creates a ZK proof (ExpiringProfileKeyCredentialPresentation) that the Signal server can verify to validate the member’s identity and profile key.

Source

pub fn encrypt_group_with_credentials<R: Rng + CryptoRng>( &self, title: &str, description: Option<&str>, disappearing_messages_timer: Option<&Timer>, access_control: Option<&AccessControl>, self_credential: &ExpiringProfileKeyCredential, member_candidates: &[GroupMemberCandidate], server_public_params: &ServerPublicParams, avatar_url: String, rng: &mut R, ) -> Result<Group, GroupDecodingError>

Encrypt a group for creation, using credentials for member presentations.

This method properly populates the presentation field for members with credentials, which is required by the Signal server for group creation.

Members with credentials get added with presentations (full members). Members without credentials get added as pending invites.

§Arguments
  • title - The group title
  • description - Optional group description
  • disappearing_messages_timer - Optional disappearing messages timer
  • access_control - Optional access control settings
  • self_credential - The creator’s own credential (required)
  • avatar_url - The group avatar URL
  • member_candidates - Other members to add, with optional credentials
  • server_public_params - Server public params for creating presentations
  • rng - Random number generator
Source

pub fn build_add_member_action_with_credential( &self, credential: &ExpiringProfileKeyCredential, role: Role, server_public_params: &ServerPublicParams, ) -> AddMemberAction

Build an AddMemberAction with a credential presentation for a GroupChange.

This is used when adding members to an existing group with proper ZK proofs.

§Role Parameter

The role parameter is accepted for API consistency, but note that Signal-Android only ever adds members with Role::Default. Adding a member with Role::Administrator is an illegal operation that the server will reject. Promotion to administrator requires a separate ModifyMemberRoleAction after the member has been added.

Source

pub fn build_add_pending_member_action( &self, invitee: ServiceId, added_by_aci: Aci, role: Role, ) -> Result<AddMemberPendingProfileKeyAction, GroupDecodingError>

Build an AddPendingMemberAction to invite a member without their profile key.

This adds the member as a pending invite. They will receive a group invite notification and must accept to become a full member. No profile key is needed.

The invitee may be either an ACI or a PNI. When only a PNI is known (e.g. the invitee has ACI disclosure disabled in CDSI), passing ServiceId::Pni allows the pending-invite path to proceed without an ACI. The Signal server stores whichever service ID is provided in the encrypted user_id field of the PendingMember proto. The added_by_aci must always be an ACI.

§Role Parameter

The role parameter is accepted for API consistency, but note that Signal-Android only ever adds pending members with Role::Default.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Classify for T

§

type Classified = T

§

fn classify(self) -> T

§

impl<T> Declassify for T

§

type Declassified = T

§

fn declassify(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more