mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-25 09:28:01 +01:00
Refactor direct connect delivery pipeline and message store.
1) Make message store contents more memory efficient. 2) Make notification pipeline simpler and more memory efficient. 3) Don't b64 encode websocket message bodies. // FREEBIE
This commit is contained in:
@@ -41,7 +41,8 @@ public class EncryptedOutgoingMessage {
|
||||
private static final int MAC_KEY_SIZE = 20;
|
||||
private static final int MAC_SIZE = 10;
|
||||
|
||||
private final String serialized;
|
||||
private final byte[] serialized;
|
||||
private final String serializedAndEncoded;
|
||||
|
||||
public EncryptedOutgoingMessage(OutgoingMessageSignal outgoingMessage,
|
||||
String signalingKey)
|
||||
@@ -50,12 +51,16 @@ public class EncryptedOutgoingMessage {
|
||||
byte[] plaintext = outgoingMessage.toByteArray();
|
||||
SecretKeySpec cipherKey = getCipherKey (signalingKey);
|
||||
SecretKeySpec macKey = getMacKey(signalingKey);
|
||||
byte[] ciphertext = getCiphertext(plaintext, cipherKey, macKey);
|
||||
|
||||
this.serialized = Base64.encodeBytes(ciphertext);
|
||||
this.serialized = getCiphertext(plaintext, cipherKey, macKey);
|
||||
this.serializedAndEncoded = Base64.encodeBytes(this.serialized);
|
||||
}
|
||||
|
||||
public String serialize() {
|
||||
public String toEncodedString() {
|
||||
return serializedAndEncoded;
|
||||
}
|
||||
|
||||
public byte[] toByteArray() {
|
||||
return serialized;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user