use of org.whispersystems.signalservice.api.crypto.EnvelopeContent in project Signal-Android by WhisperSystems.
the class SignalServiceMessageSender method sendSenderKeyDistributionMessage.
/**
* Sends the provided {@link SenderKeyDistributionMessage} to the specified recipients.
*/
public List<SendMessageResult> sendSenderKeyDistributionMessage(DistributionId distributionId, List<SignalServiceAddress> recipients, List<Optional<UnidentifiedAccessPair>> unidentifiedAccess, SenderKeyDistributionMessage message, byte[] groupId) throws IOException {
ByteString distributionBytes = ByteString.copyFrom(message.serialize());
Content content = Content.newBuilder().setSenderKeyDistributionMessage(distributionBytes).build();
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, ContentHint.IMPLICIT, Optional.of(groupId));
long timestamp = System.currentTimeMillis();
Log.d(TAG, "[" + timestamp + "] Sending SKDM to " + recipients.size() + " recipients for DistributionId " + distributionId);
return sendMessage(recipients, getTargetUnidentifiedAccess(unidentifiedAccess), timestamp, envelopeContent, false, null, null);
}
use of org.whispersystems.signalservice.api.crypto.EnvelopeContent in project Signal-Android by WhisperSystems.
the class SignalServiceMessageSender method sendNullMessage.
public SendMessageResult sendNullMessage(SignalServiceAddress address, Optional<UnidentifiedAccessPair> unidentifiedAccess) throws UntrustedIdentityException, IOException {
byte[] nullMessageBody = DataMessage.newBuilder().setBody(Base64.encodeBytes(Util.getRandomLengthBytes(140))).build().toByteArray();
NullMessage nullMessage = NullMessage.newBuilder().setPadding(ByteString.copyFrom(nullMessageBody)).build();
Content content = Content.newBuilder().setNullMessage(nullMessage).build();
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, ContentHint.IMPLICIT, Optional.absent());
return sendMessage(address, getTargetUnidentifiedAccess(unidentifiedAccess), System.currentTimeMillis(), envelopeContent, false, null);
}
use of org.whispersystems.signalservice.api.crypto.EnvelopeContent in project Signal-Android by WhisperSystems.
the class SignalServiceMessageSender method sendRetryReceipt.
/**
* Send a retry receipt for a bad-encrypted envelope.
*/
public void sendRetryReceipt(SignalServiceAddress recipient, Optional<UnidentifiedAccessPair> unidentifiedAccess, Optional<byte[]> groupId, DecryptionErrorMessage errorMessage) throws IOException, UntrustedIdentityException {
PlaintextContent content = new PlaintextContent(errorMessage);
EnvelopeContent envelopeContent = EnvelopeContent.plaintext(content, groupId);
sendMessage(recipient, getTargetUnidentifiedAccess(unidentifiedAccess), System.currentTimeMillis(), envelopeContent, false, null);
}
use of org.whispersystems.signalservice.api.crypto.EnvelopeContent in project Signal-Android by signalapp.
the class SignalServiceMessageSender method sendTyping.
public void sendTyping(List<SignalServiceAddress> recipients, List<Optional<UnidentifiedAccessPair>> unidentifiedAccess, SignalServiceTypingMessage message, CancelationSignal cancelationSignal) throws IOException {
Content content = createTypingContent(message);
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, ContentHint.IMPLICIT, Optional.absent());
sendMessage(recipients, getTargetUnidentifiedAccess(unidentifiedAccess), message.getTimestamp(), envelopeContent, true, null, cancelationSignal);
}
use of org.whispersystems.signalservice.api.crypto.EnvelopeContent in project Signal-Android by signalapp.
the class SignalServiceMessageSender method sendCallMessage.
/**
* Send a call setup message to a single recipient.
*
* @param recipient The message's destination.
* @param message The call message.
* @throws IOException
*/
public void sendCallMessage(SignalServiceAddress recipient, Optional<UnidentifiedAccessPair> unidentifiedAccess, SignalServiceCallMessage message) throws IOException, UntrustedIdentityException {
Content content = createCallContent(message);
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, ContentHint.DEFAULT, Optional.absent());
sendMessage(recipient, getTargetUnidentifiedAccess(unidentifiedAccess), System.currentTimeMillis(), envelopeContent, false, null);
}
Aggregations