mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
fix: compile errors from moving keypair out of ClosedGroupsProtocolV2
This commit is contained in:
parent
99175ad69b
commit
ba5431b806
@ -174,7 +174,7 @@ class ClosedGroupUpdateMessageSendJobV2 private constructor(parameters: Paramete
|
|||||||
closedGroupUpdate.type = SignalServiceProtos.ClosedGroupUpdateV2.Type.NEW
|
closedGroupUpdate.type = SignalServiceProtos.ClosedGroupUpdateV2.Type.NEW
|
||||||
closedGroupUpdate.publicKey = ByteString.copyFrom(kind.publicKey)
|
closedGroupUpdate.publicKey = ByteString.copyFrom(kind.publicKey)
|
||||||
closedGroupUpdate.name = kind.name
|
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.publicKey = ByteString.copyFrom(kind.encryptionKeyPair.publicKey.serialize().removing05PrefixIfNeeded())
|
||||||
encryptionKeyPair.privateKey = ByteString.copyFrom(kind.encryptionKeyPair.privateKey.serialize())
|
encryptionKeyPair.privateKey = ByteString.copyFrom(kind.encryptionKeyPair.privateKey.serialize())
|
||||||
closedGroupUpdate.encryptionKeyPair = encryptionKeyPair.build()
|
closedGroupUpdate.encryptionKeyPair = encryptionKeyPair.build()
|
||||||
|
@ -360,7 +360,7 @@ object ClosedGroupsProtocolV2 {
|
|||||||
// Generate the new encryption key pair
|
// Generate the new encryption key pair
|
||||||
val newKeyPair = Curve.generateKeyPair()
|
val newKeyPair = Curve.generateKeyPair()
|
||||||
// Distribute it
|
// Distribute it
|
||||||
val proto = SignalServiceProtos.ClosedGroupUpdateV2.KeyPair.newBuilder()
|
val proto = SignalServiceProtos.KeyPair.newBuilder()
|
||||||
proto.publicKey = ByteString.copyFrom(newKeyPair.publicKey.serialize().removing05PrefixIfNeeded())
|
proto.publicKey = ByteString.copyFrom(newKeyPair.publicKey.serialize().removing05PrefixIfNeeded())
|
||||||
proto.privateKey = ByteString.copyFrom(newKeyPair.privateKey.serialize())
|
proto.privateKey = ByteString.copyFrom(newKeyPair.privateKey.serialize())
|
||||||
val plaintext = proto.build().toByteArray()
|
val plaintext = proto.build().toByteArray()
|
||||||
@ -677,7 +677,7 @@ object ClosedGroupsProtocolV2 {
|
|||||||
val encryptedKeyPair = wrapper.encryptedKeyPair.toByteArray()
|
val encryptedKeyPair = wrapper.encryptedKeyPair.toByteArray()
|
||||||
val plaintext = SessionProtocolImpl(context).decrypt(encryptedKeyPair, userKeyPair).first
|
val plaintext = SessionProtocolImpl(context).decrypt(encryptedKeyPair, userKeyPair).first
|
||||||
// Parse it
|
// 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()))
|
val keyPair = ECKeyPair(DjbECPublicKey(proto.publicKey.toByteArray().removing05PrefixIfNeeded()), DjbECPrivateKey(proto.privateKey.toByteArray()))
|
||||||
// Store it
|
// Store it
|
||||||
apiDB.addClosedGroupEncryptionKeyPair(keyPair, groupPublicKey)
|
apiDB.addClosedGroupEncryptionKeyPair(keyPair, groupPublicKey)
|
||||||
|
@ -118,7 +118,7 @@ class ClosedGroupControlMessage() : ControlMessage() {
|
|||||||
closedGroupUpdate.type = SignalServiceProtos.ClosedGroupUpdateV2.Type.NEW
|
closedGroupUpdate.type = SignalServiceProtos.ClosedGroupUpdateV2.Type.NEW
|
||||||
closedGroupUpdate.publicKey = kind.publicKey
|
closedGroupUpdate.publicKey = kind.publicKey
|
||||||
closedGroupUpdate.name = kind.name
|
closedGroupUpdate.name = kind.name
|
||||||
val encryptionKeyPairAsProto = SignalServiceProtos.ClosedGroupUpdateV2.KeyPair.newBuilder()
|
val encryptionKeyPairAsProto = SignalServiceProtos.KeyPair.newBuilder()
|
||||||
encryptionKeyPairAsProto.publicKey = ByteString.copyFrom(kind.encryptionKeyPair.publicKey.serialize())
|
encryptionKeyPairAsProto.publicKey = ByteString.copyFrom(kind.encryptionKeyPair.publicKey.serialize())
|
||||||
encryptionKeyPairAsProto.privateKey = ByteString.copyFrom(kind.encryptionKeyPair.privateKey.serialize())
|
encryptionKeyPairAsProto.privateKey = ByteString.copyFrom(kind.encryptionKeyPair.privateKey.serialize())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user