mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Merge pull request #423 from hjubb/multi_device_sync_proto
Multi device sync proto definitions and compiled code with compile fixes
This commit is contained in:
commit
e4a1de24f5
@ -174,7 +174,7 @@ class ClosedGroupUpdateMessageSendJobV2 private constructor(parameters: Paramete
|
||||
closedGroupUpdate.type = SignalServiceProtos.ClosedGroupUpdateV2.Type.NEW
|
||||
closedGroupUpdate.publicKey = ByteString.copyFrom(kind.publicKey)
|
||||
closedGroupUpdate.name = kind.name
|
||||
val encryptionKeyPair = SignalServiceProtos.ClosedGroupUpdateV2.KeyPair.newBuilder()
|
||||
val encryptionKeyPair = SignalServiceProtos.KeyPair.newBuilder()
|
||||
encryptionKeyPair.publicKey = ByteString.copyFrom(kind.encryptionKeyPair.publicKey.serialize().removing05PrefixIfNeeded())
|
||||
encryptionKeyPair.privateKey = ByteString.copyFrom(kind.encryptionKeyPair.privateKey.serialize())
|
||||
closedGroupUpdate.encryptionKeyPair = encryptionKeyPair.build()
|
||||
|
@ -360,7 +360,7 @@ object ClosedGroupsProtocolV2 {
|
||||
// Generate the new encryption key pair
|
||||
val newKeyPair = Curve.generateKeyPair()
|
||||
// Distribute it
|
||||
val proto = SignalServiceProtos.ClosedGroupUpdateV2.KeyPair.newBuilder()
|
||||
val proto = SignalServiceProtos.KeyPair.newBuilder()
|
||||
proto.publicKey = ByteString.copyFrom(newKeyPair.publicKey.serialize().removing05PrefixIfNeeded())
|
||||
proto.privateKey = ByteString.copyFrom(newKeyPair.privateKey.serialize())
|
||||
val plaintext = proto.build().toByteArray()
|
||||
@ -677,7 +677,7 @@ object ClosedGroupsProtocolV2 {
|
||||
val encryptedKeyPair = wrapper.encryptedKeyPair.toByteArray()
|
||||
val plaintext = SessionProtocolImpl(context).decrypt(encryptedKeyPair, userKeyPair).first
|
||||
// Parse it
|
||||
val proto = SignalServiceProtos.ClosedGroupUpdateV2.KeyPair.parseFrom(plaintext)
|
||||
val proto = SignalServiceProtos.KeyPair.parseFrom(plaintext)
|
||||
val keyPair = ECKeyPair(DjbECPublicKey(proto.publicKey.toByteArray().removing05PrefixIfNeeded()), DjbECPrivateKey(proto.privateKey.toByteArray()))
|
||||
// Store it
|
||||
apiDB.addClosedGroupEncryptionKeyPair(keyPair, groupPublicKey)
|
||||
|
@ -118,7 +118,7 @@ class ClosedGroupControlMessage() : ControlMessage() {
|
||||
closedGroupUpdate.type = SignalServiceProtos.ClosedGroupUpdateV2.Type.NEW
|
||||
closedGroupUpdate.publicKey = kind.publicKey
|
||||
closedGroupUpdate.name = kind.name
|
||||
val encryptionKeyPairAsProto = SignalServiceProtos.ClosedGroupUpdateV2.KeyPair.newBuilder()
|
||||
val encryptionKeyPairAsProto = SignalServiceProtos.KeyPair.newBuilder()
|
||||
encryptionKeyPairAsProto.publicKey = ByteString.copyFrom(kind.encryptionKeyPair.publicKey.serialize())
|
||||
encryptionKeyPairAsProto.privateKey = ByteString.copyFrom(kind.encryptionKeyPair.privateKey.serialize())
|
||||
|
||||
|
@ -36,11 +36,12 @@ message Envelope {
|
||||
|
||||
message Content {
|
||||
optional DataMessage dataMessage = 1;
|
||||
optional SyncMessage syncMessage = 2;
|
||||
optional SyncMessage syncMessage = 2 [deprecated=true];
|
||||
optional CallMessage callMessage = 3;
|
||||
optional NullMessage nullMessage = 4;
|
||||
optional ReceiptMessage receiptMessage = 5;
|
||||
optional TypingMessage typingMessage = 6;
|
||||
optional ConfigurationMessage configurationMessage = 7;
|
||||
optional PreKeyBundleMessage preKeyBundleMessage = 101; // Loki
|
||||
optional DeviceLinkMessage deviceLinkMessage = 103; // Loki
|
||||
}
|
||||
@ -217,6 +218,7 @@ message DataMessage {
|
||||
optional LokiUserProfile profile = 101; // Loki - The profile of the current user
|
||||
optional ClosedGroupUpdate closedGroupUpdate = 103; // Loki
|
||||
optional ClosedGroupUpdateV2 closedGroupUpdateV2 = 104;
|
||||
optional string syncTarget = 105;
|
||||
}
|
||||
|
||||
message LokiUserProfile {
|
||||
@ -236,13 +238,6 @@ message ClosedGroupUpdateV2 {
|
||||
MEMBER_LEFT = 7;
|
||||
}
|
||||
|
||||
message KeyPair {
|
||||
// @required
|
||||
required bytes publicKey = 1;
|
||||
// @required
|
||||
required bytes privateKey = 2;
|
||||
}
|
||||
|
||||
message KeyPairWrapper {
|
||||
// @required
|
||||
required bytes publicKey = 1; // The public key of the user the key pair is meant for
|
||||
@ -260,6 +255,13 @@ message ClosedGroupUpdateV2 {
|
||||
repeated KeyPairWrapper wrappers = 7;
|
||||
}
|
||||
|
||||
message KeyPair {
|
||||
// @required
|
||||
required bytes publicKey = 1;
|
||||
// @required
|
||||
required bytes privateKey = 2;
|
||||
}
|
||||
|
||||
message ClosedGroupUpdate {
|
||||
|
||||
enum Type {
|
||||
@ -314,6 +316,20 @@ message TypingMessage {
|
||||
optional bytes groupId = 3;
|
||||
}
|
||||
|
||||
message ConfigurationMessage {
|
||||
|
||||
message ClosedGroup {
|
||||
optional bytes publicKey = 1;
|
||||
optional string name = 2;
|
||||
optional KeyPair encryptionKeyPair = 3;
|
||||
repeated bytes members = 4;
|
||||
repeated bytes admins = 5;
|
||||
}
|
||||
|
||||
repeated ClosedGroup closedGroups = 1;
|
||||
repeated string openGroups = 2;
|
||||
}
|
||||
|
||||
message Verified {
|
||||
enum State {
|
||||
DEFAULT = 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user