use of org.whispersystems.signalservice.api.crypto.EnvelopeContent in project Signal-Android by signalapp.
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 sendReceipt.
/**
* Send a read receipt for a received message.
*
* @param recipient The sender of the received message you're acknowledging.
* @param message The read receipt to deliver.
*/
public SendMessageResult sendReceipt(SignalServiceAddress recipient, Optional<UnidentifiedAccessPair> unidentifiedAccess, SignalServiceReceiptMessage message) throws IOException, UntrustedIdentityException {
Content content = createReceiptContent(message);
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, ContentHint.IMPLICIT, Optional.absent());
return sendMessage(recipient, getTargetUnidentifiedAccess(unidentifiedAccess), message.getWhen(), envelopeContent, false, null);
}
use of org.whispersystems.signalservice.api.crypto.EnvelopeContent in project Signal-Android by signalapp.
the class SignalServiceMessageSender method sendTyping.
/**
* Send a typing indicator.
*
* @param recipient The destination
* @param message The typing indicator to deliver
*/
public void sendTyping(SignalServiceAddress recipient, Optional<UnidentifiedAccessPair> unidentifiedAccess, SignalServiceTypingMessage message) throws IOException, UntrustedIdentityException {
Content content = createTypingContent(message);
EnvelopeContent envelopeContent = EnvelopeContent.encrypted(content, ContentHint.IMPLICIT, Optional.absent());
sendMessage(recipient, getTargetUnidentifiedAccess(unidentifiedAccess), message.getTimestamp(), envelopeContent, true, null);
}
use of org.whispersystems.signalservice.api.crypto.EnvelopeContent in project Signal-Android by signalapp.
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 signalapp.
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);
}
Aggregations