Browse Source

Update Session protocol closed groups logic

pull/325/head
Niels Andriesse 2 years ago committed by nielsandriesse
parent
commit
da503b0df1
  1. 44
      SessionMessagingKit/Database/Storage+ClosedGroups.swift
  2. 210
      SessionMessagingKit/Messages/Control Messages/ClosedGroupUpdateV2.swift
  3. 462
      SessionMessagingKit/Protos/Generated/SNProto.swift
  4. 364
      SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift
  5. 62
      SessionMessagingKit/Protos/SessionProtos.proto
  6. 21
      SessionMessagingKit/Sending & Receiving/MessageReceiver+Decryption.swift
  7. 136
      SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift
  8. 33
      SessionMessagingKit/Sending & Receiving/MessageReceiver.swift
  9. 161
      SessionMessagingKit/Sending & Receiving/MessageSender+ClosedGroups.swift
  10. 4
      SessionMessagingKit/Sending & Receiving/MessageSender+Encryption.swift
  11. 10
      SessionMessagingKit/Sending & Receiving/MessageSender.swift
  12. 4
      Signal.xcodeproj/project.pbxproj

44
SessionMessagingKit/Database/Storage+ClosedGroups.swift

@ -2,6 +2,47 @@ import SessionProtocolKit
extension Storage {
// MARK: - V2
private static func getClosedGroupEncryptionKeyPairCollection(for groupPublicKey: String) -> String {
return "SNClosedGroupEncryptionKeyPairCollection-\(groupPublicKey)"
}
private static let closedGroupPublicKeyCollection = "SNClosedGroupPublicKeyCollection"
public func getClosedGroupEncryptionKeyPairs(for groupPublicKey: String) -> [ECKeyPair] {
let collection = Storage.getClosedGroupEncryptionKeyPairCollection(for: groupPublicKey)
var timestampsAndKeyPairs: [(timestamp: Double, keyPair: ECKeyPair)] = []
Storage.read { transaction in
transaction.enumerateKeysAndObjects(inCollection: collection) { key, object, _ in
guard let timestamp = Double(key), let keyPair = object as? ECKeyPair else { return }
timestampsAndKeyPairs.append((timestamp, keyPair))
}
}
return timestampsAndKeyPairs.sorted { $0.timestamp < $1.timestamp }.map { $0.keyPair }
}
public func getLatestClosedGroupEncryptionKeyPair(for groupPublicKey: String) -> ECKeyPair? {
return getClosedGroupEncryptionKeyPairs(for: groupPublicKey).last
}
public func addClosedGroupEncryptionKeyPair(_ keyPair: ECKeyPair, for groupPublicKey: String, using transaction: Any) {
let collection = Storage.getClosedGroupEncryptionKeyPairCollection(for: groupPublicKey)
let timestamp = String(Date().timeIntervalSince1970)
(transaction as! YapDatabaseReadWriteTransaction).setObject(keyPair, forKey: timestamp, inCollection: collection)
}
public func removeAllClosedGroupEncryptionKeyPairs(for groupPublicKey: String, using transaction: Any) {
let collection = Storage.getClosedGroupEncryptionKeyPairCollection(for: groupPublicKey)
(transaction as! YapDatabaseReadWriteTransaction).removeAllObjects(inCollection: collection)
}
public func addClosedGroupPublicKey(_ groupPublicKey: String, using transaction: Any) {
(transaction as! YapDatabaseReadWriteTransaction).setObject(groupPublicKey, forKey: groupPublicKey, inCollection: Storage.closedGroupPublicKeyCollection)
}
// MARK: - Ratchets
private static func getClosedGroupRatchetCollection(_ collection: ClosedGroupRatchetCollectionType, for groupPublicKey: String) -> String {
@ -76,7 +117,8 @@ extension Storage {
public func getUserClosedGroupPublicKeys() -> Set<String> {
var result: Set<String> = []
Storage.read { transaction in
result = Set(transaction.allKeys(inCollection: Storage.closedGroupPrivateKeyCollection))
result = result.union(Set(transaction.allKeys(inCollection: Storage.closedGroupPublicKeyCollection)))
result = result.union(Set(transaction.allKeys(inCollection: Storage.closedGroupPrivateKeyCollection)))
}
return result
}

210
SessionMessagingKit/Messages/Control Messages/ClosedGroupUpdateV2.swift

@ -0,0 +1,210 @@
import SessionProtocolKit
import SessionUtilitiesKit
public final class ClosedGroupUpdateV2 : ControlMessage {
public var kind: Kind?
// MARK: Kind
public enum Kind : CustomStringConvertible {
case new(publicKey: Data, name: String, encryptionKeyPair: ECKeyPair, members: [Data], admins: [Data])
case update(name: String, members: [Data])
case encryptionKeyPair([KeyPairWrapper]) // The new encryption key pair encrypted for each member individually
public var description: String {
switch self {
case .new: return "new"
case .update: return "update"
case .encryptionKeyPair: return "encryptionKeyPair"
}
}
}
// MARK: Key Pair Wrapper
@objc(SNKeyPairWrapper)
public final class KeyPairWrapper : NSObject, NSCoding { // NSObject/NSCoding conformance is needed for YapDatabase compatibility
public var publicKey: String?
public var encryptedKeyPair: Data?
public var isValid: Bool { publicKey != nil && encryptedKeyPair != nil }
public init(publicKey: String, encryptedKeyPair: Data) {
self.publicKey = publicKey
self.encryptedKeyPair = encryptedKeyPair
}
public required init?(coder: NSCoder) {
if let publicKey = coder.decodeObject(forKey: "publicKey") as! String? { self.publicKey = publicKey }
if let encryptedKeyPair = coder.decodeObject(forKey: "encryptedKeyPair") as! Data? { self.encryptedKeyPair = encryptedKeyPair }
}
public func encode(with coder: NSCoder) {
coder.encode(publicKey, forKey: "publicKey")
coder.encode(encryptedKeyPair, forKey: "encryptedKeyPair")
}
public static func fromProto(_ proto: SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper) -> KeyPairWrapper? {
return KeyPairWrapper(publicKey: proto.publicKey.toHexString(), encryptedKeyPair: proto.encryptedKeyPair)
}
public func toProto() -> SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper? {
guard let publicKey = publicKey, let encryptedKeyPair = encryptedKeyPair else { return nil }
let result = SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper.builder(publicKey: Data(hex: publicKey), encryptedKeyPair: encryptedKeyPair)
do {
return try result.build()
} catch {
SNLog("Couldn't construct key pair wrapper proto from: \(self).")
return nil
}
}
}
// MARK: Initialization
public override init() { super.init() }
internal init(kind: Kind) {
super.init()
self.kind = kind
}
// MARK: Validation
public override var isValid: Bool {
guard super.isValid, let kind = kind else { return false }
switch kind {
case .new(let publicKey, let name, let encryptionKeyPair, let members, let admins):
return !publicKey.isEmpty && !name.isEmpty && !encryptionKeyPair.publicKey.isEmpty
&& !encryptionKeyPair.privateKey.isEmpty && !members.isEmpty && !admins.isEmpty
case .update(let name, let members):
return !name.isEmpty && !members.isEmpty
case .encryptionKeyPair: return true
}
}
// MARK: Coding
public required init?(coder: NSCoder) {
super.init(coder: coder)
guard let rawKind = coder.decodeObject(forKey: "kind") as? String else { return nil }
switch rawKind {
case "new":
guard let publicKey = coder.decodeObject(forKey: "publicKey") as? Data,
let name = coder.decodeObject(forKey: "name") as? String,
let encryptionKeyPair = coder.decodeObject(forKey: "encryptionKeyPair") as? ECKeyPair,
let members = coder.decodeObject(forKey: "members") as? [Data],
let admins = coder.decodeObject(forKey: "admins") as? [Data] else { return nil }
self.kind = .new(publicKey: publicKey, name: name, encryptionKeyPair: encryptionKeyPair, members: members, admins: admins)
case "update":
guard let name = coder.decodeObject(forKey: "name") as? String,
let members = coder.decodeObject(forKey: "members") as? [Data] else { return nil }
self.kind = .update(name: name, members: members)
case "encryptionKeyPair":
guard let wrappers = coder.decodeObject(forKey: "wrappers") as? [KeyPairWrapper] else { return nil }
self.kind = .encryptionKeyPair(wrappers)
default: return nil
}
}
public override func encode(with coder: NSCoder) {
super.encode(with: coder)
guard let kind = kind else { return }
switch kind {
case .new(let publicKey, let name, let encryptionKeyPair, let members, let admins):
coder.encode("new", forKey: "kind")
coder.encode(publicKey, forKey: "publicKey")
coder.encode(name, forKey: "name")
coder.encode(encryptionKeyPair, forKey: "encryptionKeyPair")
coder.encode(members, forKey: "members")
coder.encode(admins, forKey: "admins")
case .update(let name, let members):
coder.encode("update", forKey: "kind")
coder.encode(name, forKey: "name")
coder.encode(members, forKey: "members")
case .encryptionKeyPair(let wrappers):
coder.encode("encryptionKeyPair", forKey: "kind")
coder.encode(wrappers, forKey: "wrappers")
}
}
// MARK: Proto Conversion
public override class func fromProto(_ proto: SNProtoContent) -> ClosedGroupUpdateV2? {
guard let closedGroupUpdateProto = proto.dataMessage?.closedGroupUpdateV2 else { return nil }
let kind: Kind
switch closedGroupUpdateProto.type {
case .new:
guard let publicKey = closedGroupUpdateProto.publicKey, let name = closedGroupUpdateProto.name,
let encryptionKeyPairAsProto = closedGroupUpdateProto.encryptionKeyPair else { return nil }
do {
let encryptionKeyPair = try ECKeyPair(publicKeyData: encryptionKeyPairAsProto.publicKey, privateKeyData: encryptionKeyPairAsProto.privateKey)
kind = .new(publicKey: publicKey, name: name, encryptionKeyPair: encryptionKeyPair,
members: closedGroupUpdateProto.members, admins: closedGroupUpdateProto.admins)
} catch {
SNLog("Couldn't parse key pair.")
return nil
}
case .update:
guard let name = closedGroupUpdateProto.name else { return nil }
kind = .update(name: name, members: closedGroupUpdateProto.members)
case .encryptionKeyPair:
let wrappers = closedGroupUpdateProto.wrappers.compactMap { KeyPairWrapper.fromProto($0) }
kind = .encryptionKeyPair(wrappers)
}
return ClosedGroupUpdateV2(kind: kind)
}
public override func toProto(using transaction: YapDatabaseReadWriteTransaction) -> SNProtoContent? {
guard let kind = kind else {
SNLog("Couldn't construct closed group update proto from: \(self).")
return nil
}
do {
let closedGroupUpdate: SNProtoDataMessageClosedGroupUpdateV2.SNProtoDataMessageClosedGroupUpdateV2Builder
switch kind {
case .new(let publicKey, let name, let encryptionKeyPair, let members, let admins):
closedGroupUpdate = SNProtoDataMessageClosedGroupUpdateV2.builder(type: .new)
closedGroupUpdate.setPublicKey(publicKey)
closedGroupUpdate.setName(name)
let encryptionKeyPairAsProto = SNProtoDataMessageClosedGroupUpdateV2KeyPair.builder(publicKey: encryptionKeyPair.publicKey, privateKey: encryptionKeyPair.privateKey)
do {
closedGroupUpdate.setEncryptionKeyPair(try encryptionKeyPairAsProto.build())
} catch {
SNLog("Couldn't construct closed group update proto from: \(self).")
return nil
}
closedGroupUpdate.setMembers(members)
closedGroupUpdate.setAdmins(admins)
case .update(let name, let members):
closedGroupUpdate = SNProtoDataMessageClosedGroupUpdateV2.builder(type: .update)
closedGroupUpdate.setName(name)
closedGroupUpdate.setMembers(members)
case .encryptionKeyPair(let wrappers):
closedGroupUpdate = SNProtoDataMessageClosedGroupUpdateV2.builder(type: .encryptionKeyPair)
closedGroupUpdate.setWrappers(wrappers.compactMap { $0.toProto() })
}
let contentProto = SNProtoContent.builder()
let dataMessageProto = SNProtoDataMessage.builder()
dataMessageProto.setClosedGroupUpdateV2(try closedGroupUpdate.build())
// Group context
try setGroupContextIfNeeded(on: dataMessageProto, using: transaction)
// Expiration timer
// TODO: We * want * expiration timer updates to be explicit. But currently Android will disable the expiration timer for a conversation
// if it receives a message without the current expiration timer value attached to it...
var expiration: UInt32 = 0
if let disappearingMessagesConfiguration = OWSDisappearingMessagesConfiguration.fetch(uniqueId: threadID!, transaction: transaction) {
expiration = disappearingMessagesConfiguration.isEnabled ? disappearingMessagesConfiguration.durationSeconds : 0
}
dataMessageProto.setExpireTimer(expiration)
contentProto.setDataMessage(try dataMessageProto.build())
return try contentProto.build()
} catch {
SNLog("Couldn't construct closed group update proto from: \(self).")
return nil
}
}
// MARK: Description
public override var description: String {
"""
ClosedGroupUpdate(
kind: \(kind?.description ?? "null")
)
"""
}
}

462
SessionMessagingKit/Protos/Generated/SNProto.swift

@ -3399,6 +3399,451 @@ extension SNProtoDataMessageLokiProfile.SNProtoDataMessageLokiProfileBuilder {
#endif
// MARK: - SNProtoDataMessageClosedGroupUpdateV2KeyPair
@objc public class SNProtoDataMessageClosedGroupUpdateV2KeyPair: NSObject {
// MARK: - SNProtoDataMessageClosedGroupUpdateV2KeyPairBuilder
@objc public class func builder(publicKey: Data, privateKey: Data) -> SNProtoDataMessageClosedGroupUpdateV2KeyPairBuilder {
return SNProtoDataMessageClosedGroupUpdateV2KeyPairBuilder(publicKey: publicKey, privateKey: privateKey)
}
// asBuilder() constructs a builder that reflects the proto's contents.
@objc public func asBuilder() -> SNProtoDataMessageClosedGroupUpdateV2KeyPairBuilder {
let builder = SNProtoDataMessageClosedGroupUpdateV2KeyPairBuilder(publicKey: publicKey, privateKey: privateKey)
return builder
}
@objc public class SNProtoDataMessageClosedGroupUpdateV2KeyPairBuilder: NSObject {
private var proto = SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair()
@objc fileprivate override init() {}
@objc fileprivate init(publicKey: Data, privateKey: Data) {
super.init()
setPublicKey(publicKey)
setPrivateKey(privateKey)
}
@objc public func setPublicKey(_ valueParam: Data) {
proto.publicKey = valueParam
}
@objc public func setPrivateKey(_ valueParam: Data) {
proto.privateKey = valueParam
}
@objc public func build() throws -> SNProtoDataMessageClosedGroupUpdateV2KeyPair {
return try SNProtoDataMessageClosedGroupUpdateV2KeyPair.parseProto(proto)
}
@objc public func buildSerializedData() throws -> Data {
return try SNProtoDataMessageClosedGroupUpdateV2KeyPair.parseProto(proto).serializedData()
}
}
fileprivate let proto: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair
@objc public let publicKey: Data
@objc public let privateKey: Data
private init(proto: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair,
publicKey: Data,
privateKey: Data) {
self.proto = proto
self.publicKey = publicKey
self.privateKey = privateKey
}
@objc
public func serializedData() throws -> Data {
return try self.proto.serializedData()
}
@objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageClosedGroupUpdateV2KeyPair {
let proto = try SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair(serializedData: serializedData)
return try parseProto(proto)
}
fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair) throws -> SNProtoDataMessageClosedGroupUpdateV2KeyPair {
guard proto.hasPublicKey else {
throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: publicKey")
}
let publicKey = proto.publicKey
guard proto.hasPrivateKey else {
throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: privateKey")
}
let privateKey = proto.privateKey
// MARK: - Begin Validation Logic for SNProtoDataMessageClosedGroupUpdateV2KeyPair -
// MARK: - End Validation Logic for SNProtoDataMessageClosedGroupUpdateV2KeyPair -
let result = SNProtoDataMessageClosedGroupUpdateV2KeyPair(proto: proto,
publicKey: publicKey,
privateKey: privateKey)
return result
}
@objc public override var debugDescription: String {
return "\(proto)"
}
}
#if DEBUG
extension SNProtoDataMessageClosedGroupUpdateV2KeyPair {
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
}
extension SNProtoDataMessageClosedGroupUpdateV2KeyPair.SNProtoDataMessageClosedGroupUpdateV2KeyPairBuilder {
@objc public func buildIgnoringErrors() -> SNProtoDataMessageClosedGroupUpdateV2KeyPair? {
return try! self.build()
}
}
#endif
// MARK: - SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper
@objc public class SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper: NSObject {
// MARK: - SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapperBuilder
@objc public class func builder(publicKey: Data, encryptedKeyPair: Data) -> SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapperBuilder {
return SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapperBuilder(publicKey: publicKey, encryptedKeyPair: encryptedKeyPair)
}
// asBuilder() constructs a builder that reflects the proto's contents.
@objc public func asBuilder() -> SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapperBuilder {
let builder = SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapperBuilder(publicKey: publicKey, encryptedKeyPair: encryptedKeyPair)
return builder
}
@objc public class SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapperBuilder: NSObject {
private var proto = SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPairWrapper()
@objc fileprivate override init() {}
@objc fileprivate init(publicKey: Data, encryptedKeyPair: Data) {
super.init()
setPublicKey(publicKey)
setEncryptedKeyPair(encryptedKeyPair)
}
@objc public func setPublicKey(_ valueParam: Data) {
proto.publicKey = valueParam
}
@objc public func setEncryptedKeyPair(_ valueParam: Data) {
proto.encryptedKeyPair = valueParam
}
@objc public func build() throws -> SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper {
return try SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper.parseProto(proto)
}
@objc public func buildSerializedData() throws -> Data {
return try SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper.parseProto(proto).serializedData()
}
}
fileprivate let proto: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPairWrapper
@objc public let publicKey: Data
@objc public let encryptedKeyPair: Data
private init(proto: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPairWrapper,
publicKey: Data,
encryptedKeyPair: Data) {
self.proto = proto
self.publicKey = publicKey
self.encryptedKeyPair = encryptedKeyPair
}
@objc
public func serializedData() throws -> Data {
return try self.proto.serializedData()
}
@objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper {
let proto = try SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPairWrapper(serializedData: serializedData)
return try parseProto(proto)
}
fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPairWrapper) throws -> SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper {
guard proto.hasPublicKey else {
throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: publicKey")
}
let publicKey = proto.publicKey
guard proto.hasEncryptedKeyPair else {
throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: encryptedKeyPair")
}
let encryptedKeyPair = proto.encryptedKeyPair
// MARK: - Begin Validation Logic for SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper -
// MARK: - End Validation Logic for SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper -
let result = SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper(proto: proto,
publicKey: publicKey,
encryptedKeyPair: encryptedKeyPair)
return result
}
@objc public override var debugDescription: String {
return "\(proto)"
}
}
#if DEBUG
extension SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper {
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
}
extension SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper.SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapperBuilder {
@objc public func buildIgnoringErrors() -> SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper? {
return try! self.build()
}
}
#endif
// MARK: - SNProtoDataMessageClosedGroupUpdateV2
@objc public class SNProtoDataMessageClosedGroupUpdateV2: NSObject {
// MARK: - SNProtoDataMessageClosedGroupUpdateV2Type
@objc public enum SNProtoDataMessageClosedGroupUpdateV2Type: Int32 {
case new = 1
case update = 2
case encryptionKeyPair = 3
}
private class func SNProtoDataMessageClosedGroupUpdateV2TypeWrap(_ value: SessionProtos_DataMessage.ClosedGroupUpdateV2.TypeEnum) -> SNProtoDataMessageClosedGroupUpdateV2Type {
switch value {
case .new: return .new
case .update: return .update
case .encryptionKeyPair: return .encryptionKeyPair
}
}
private class func SNProtoDataMessageClosedGroupUpdateV2TypeUnwrap(_ value: SNProtoDataMessageClosedGroupUpdateV2Type) -> SessionProtos_DataMessage.ClosedGroupUpdateV2.TypeEnum {
switch value {
case .new: return .new
case .update: return .update
case .encryptionKeyPair: return .encryptionKeyPair
}
}
// MARK: - SNProtoDataMessageClosedGroupUpdateV2Builder
@objc public class func builder(type: SNProtoDataMessageClosedGroupUpdateV2Type) -> SNProtoDataMessageClosedGroupUpdateV2Builder {
return SNProtoDataMessageClosedGroupUpdateV2Builder(type: type)
}
// asBuilder() constructs a builder that reflects the proto's contents.
@objc public func asBuilder() -> SNProtoDataMessageClosedGroupUpdateV2Builder {
let builder = SNProtoDataMessageClosedGroupUpdateV2Builder(type: type)
if let _value = publicKey {
builder.setPublicKey(_value)
}
if let _value = name {
builder.setName(_value)
}
if let _value = encryptionKeyPair {
builder.setEncryptionKeyPair(_value)
}
builder.setMembers(members)
builder.setAdmins(admins)
builder.setWrappers(wrappers)
return builder
}
@objc public class SNProtoDataMessageClosedGroupUpdateV2Builder: NSObject {
private var proto = SessionProtos_DataMessage.ClosedGroupUpdateV2()
@objc fileprivate override init() {}
@objc fileprivate init(type: SNProtoDataMessageClosedGroupUpdateV2Type) {
super.init()
setType(type)
}
@objc public func setType(_ valueParam: SNProtoDataMessageClosedGroupUpdateV2Type) {
proto.type = SNProtoDataMessageClosedGroupUpdateV2TypeUnwrap(valueParam)
}
@objc public func setPublicKey(_ valueParam: Data) {
proto.publicKey = valueParam
}
@objc public func setName(_ valueParam: String) {
proto.name = valueParam
}
@objc public func setEncryptionKeyPair(_ valueParam: SNProtoDataMessageClosedGroupUpdateV2KeyPair) {
proto.encryptionKeyPair = valueParam.proto
}
@objc public func addMembers(_ valueParam: Data) {
var items = proto.members
items.append(valueParam)
proto.members = items
}
@objc public func setMembers(_ wrappedItems: [Data]) {
proto.members = wrappedItems
}
@objc public func addAdmins(_ valueParam: Data) {
var items = proto.admins
items.append(valueParam)
proto.admins = items
}
@objc public func setAdmins(_ wrappedItems: [Data]) {
proto.admins = wrappedItems
}
@objc public func addWrappers(_ valueParam: SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper) {
var items = proto.wrappers
items.append(valueParam.proto)
proto.wrappers = items
}
@objc public func setWrappers(_ wrappedItems: [SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper]) {
proto.wrappers = wrappedItems.map { $0.proto }
}
@objc public func build() throws -> SNProtoDataMessageClosedGroupUpdateV2 {
return try SNProtoDataMessageClosedGroupUpdateV2.parseProto(proto)
}
@objc public func buildSerializedData() throws -> Data {
return try SNProtoDataMessageClosedGroupUpdateV2.parseProto(proto).serializedData()
}
}
fileprivate let proto: SessionProtos_DataMessage.ClosedGroupUpdateV2
@objc public let type: SNProtoDataMessageClosedGroupUpdateV2Type
@objc public let encryptionKeyPair: SNProtoDataMessageClosedGroupUpdateV2KeyPair?
@objc public let wrappers: [SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper]
@objc public var publicKey: Data? {
guard proto.hasPublicKey else {
return nil
}
return proto.publicKey
}
@objc public var hasPublicKey: Bool {
return proto.hasPublicKey
}
@objc public var name: String? {
guard proto.hasName else {
return nil
}
return proto.name
}
@objc public var hasName: Bool {
return proto.hasName
}
@objc public var members: [Data] {
return proto.members
}
@objc public var admins: [Data] {
return proto.admins
}
private init(proto: SessionProtos_DataMessage.ClosedGroupUpdateV2,
type: SNProtoDataMessageClosedGroupUpdateV2Type,
encryptionKeyPair: SNProtoDataMessageClosedGroupUpdateV2KeyPair?,
wrappers: [SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper]) {
self.proto = proto
self.type = type
self.encryptionKeyPair = encryptionKeyPair
self.wrappers = wrappers
}
@objc
public func serializedData() throws -> Data {
return try self.proto.serializedData()
}
@objc public class func parseData(_ serializedData: Data) throws -> SNProtoDataMessageClosedGroupUpdateV2 {
let proto = try SessionProtos_DataMessage.ClosedGroupUpdateV2(serializedData: serializedData)
return try parseProto(proto)
}
fileprivate class func parseProto(_ proto: SessionProtos_DataMessage.ClosedGroupUpdateV2) throws -> SNProtoDataMessageClosedGroupUpdateV2 {
guard proto.hasType else {
throw SNProtoError.invalidProtobuf(description: "\(logTag) missing required field: type")
}
let type = SNProtoDataMessageClosedGroupUpdateV2TypeWrap(proto.type)
var encryptionKeyPair: SNProtoDataMessageClosedGroupUpdateV2KeyPair? = nil
if proto.hasEncryptionKeyPair {
encryptionKeyPair = try SNProtoDataMessageClosedGroupUpdateV2KeyPair.parseProto(proto.encryptionKeyPair)
}
var wrappers: [SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper] = []
wrappers = try proto.wrappers.map { try SNProtoDataMessageClosedGroupUpdateV2KeyPairWrapper.parseProto($0) }
// MARK: - Begin Validation Logic for SNProtoDataMessageClosedGroupUpdateV2 -
// MARK: - End Validation Logic for SNProtoDataMessageClosedGroupUpdateV2 -
let result = SNProtoDataMessageClosedGroupUpdateV2(proto: proto,
type: type,
encryptionKeyPair: encryptionKeyPair,
wrappers: wrappers)
return result
}
@objc public override var debugDescription: String {
return "\(proto)"
}
}
#if DEBUG
extension SNProtoDataMessageClosedGroupUpdateV2 {
@objc public func serializedDataIgnoringErrors() -> Data? {
return try! self.serializedData()
}
}
extension SNProtoDataMessageClosedGroupUpdateV2.SNProtoDataMessageClosedGroupUpdateV2Builder {
@objc public func buildIgnoringErrors() -> SNProtoDataMessageClosedGroupUpdateV2? {
return try! self.build()
}
}
#endif
// MARK: - SNProtoDataMessageClosedGroupUpdateSenderKey
@objc public class SNProtoDataMessageClosedGroupUpdateSenderKey: NSObject {
@ -3818,6 +4263,9 @@ extension SNProtoDataMessageClosedGroupUpdate.SNProtoDataMessageClosedGroupUpdat
if let _value = closedGroupUpdate {
builder.setClosedGroupUpdate(_value)
}
if let _value = closedGroupUpdateV2 {
builder.setClosedGroupUpdateV2(_value)
}
if let _value = publicChatInfo {
builder.setPublicChatInfo(_value)
}
@ -3896,6 +4344,10 @@ extension SNProtoDataMessageClosedGroupUpdate.SNProtoDataMessageClosedGroupUpdat
proto.closedGroupUpdate = valueParam.proto
}
@objc public func setClosedGroupUpdateV2(_ valueParam: SNProtoDataMessageClosedGroupUpdateV2) {
proto.closedGroupUpdateV2 = valueParam.proto
}
@objc public func setPublicChatInfo(_ valueParam: SNProtoPublicChatInfo) {
proto.publicChatInfo = valueParam.proto
}
@ -3925,6 +4377,8 @@ extension SNProtoDataMessageClosedGroupUpdate.SNProtoDataMessageClosedGroupUpdat
@objc public let closedGroupUpdate: SNProtoDataMessageClosedGroupUpdate?
@objc public let closedGroupUpdateV2: SNProtoDataMessageClosedGroupUpdateV2?
@objc public let publicChatInfo: SNProtoPublicChatInfo?
@objc public var body: String? {
@ -3976,6 +4430,7 @@ extension SNProtoDataMessageClosedGroupUpdate.SNProtoDataMessageClosedGroupUpdat
preview: [SNProtoDataMessagePreview],
profile: SNProtoDataMessageLokiProfile?,
closedGroupUpdate: SNProtoDataMessageClosedGroupUpdate?,
closedGroupUpdateV2: SNProtoDataMessageClosedGroupUpdateV2?,
publicChatInfo: SNProtoPublicChatInfo?) {
self.proto = proto
self.attachments = attachments
@ -3985,6 +4440,7 @@ extension SNProtoDataMessageClosedGroupUpdate.SNProtoDataMessageClosedGroupUpdat
self.preview = preview
self.profile = profile
self.closedGroupUpdate = closedGroupUpdate
self.closedGroupUpdateV2 = closedGroupUpdateV2
self.publicChatInfo = publicChatInfo
}
@ -4028,6 +4484,11 @@ extension SNProtoDataMessageClosedGroupUpdate.SNProtoDataMessageClosedGroupUpdat
closedGroupUpdate = try SNProtoDataMessageClosedGroupUpdate.parseProto(proto.closedGroupUpdate)
}
var closedGroupUpdateV2: SNProtoDataMessageClosedGroupUpdateV2? = nil
if proto.hasClosedGroupUpdateV2 {
closedGroupUpdateV2 = try SNProtoDataMessageClosedGroupUpdateV2.parseProto(proto.closedGroupUpdateV2)
}
var publicChatInfo: SNProtoPublicChatInfo? = nil
if proto.hasPublicChatInfo {
publicChatInfo = try SNProtoPublicChatInfo.parseProto(proto.publicChatInfo)
@ -4045,6 +4506,7 @@ extension SNProtoDataMessageClosedGroupUpdate.SNProtoDataMessageClosedGroupUpdat
preview: preview,
profile: profile,
closedGroupUpdate: closedGroupUpdate,
closedGroupUpdateV2: closedGroupUpdateV2,
publicChatInfo: publicChatInfo)
return result
}

364
SessionMessagingKit/Protos/Generated/SessionProtos.pb.swift

@ -856,6 +856,16 @@ struct SessionProtos_DataMessage {
/// Clears the value of `closedGroupUpdate`. Subsequent reads from it will return its default value.
mutating func clearClosedGroupUpdate() {self._closedGroupUpdate = nil}
/// Loki
var closedGroupUpdateV2: SessionProtos_DataMessage.ClosedGroupUpdateV2 {
get {return _closedGroupUpdateV2 ?? SessionProtos_DataMessage.ClosedGroupUpdateV2()}
set {_closedGroupUpdateV2 = newValue}
}
/// Returns true if `closedGroupUpdateV2` has been explicitly set.
var hasClosedGroupUpdateV2: Bool {return self._closedGroupUpdateV2 != nil}
/// Clears the value of `closedGroupUpdateV2`. Subsequent reads from it will return its default value.
mutating func clearClosedGroupUpdateV2() {self._closedGroupUpdateV2 = nil}
/// Loki: Internal public chat info
var publicChatInfo: SessionProtos_PublicChatInfo {
get {return _publicChatInfo ?? SessionProtos_PublicChatInfo()}
@ -1518,7 +1528,165 @@ struct SessionProtos_DataMessage {
fileprivate var _profilePicture: String? = nil
}
/// Loki
struct ClosedGroupUpdateV2 {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// @required
var type: SessionProtos_DataMessage.ClosedGroupUpdateV2.TypeEnum {
get {return _type ?? .new}
set {_type = newValue}
}
/// Returns true if `type` has been explicitly set.
var hasType: Bool {return self._type != nil}
/// Clears the value of `type`. Subsequent reads from it will return its default value.
mutating func clearType() {self._type = nil}
var publicKey: Data {
get {return _publicKey ?? SwiftProtobuf.Internal.emptyData}
set {_publicKey = newValue}
}
/// Returns true if `publicKey` has been explicitly set.
var hasPublicKey: Bool {return self._publicKey != nil}
/// Clears the value of `publicKey`. Subsequent reads from it will return its default value.
mutating func clearPublicKey() {self._publicKey = nil}
var name: String {
get {return _name ?? String()}
set {_name = newValue}
}
/// Returns true if `name` has been explicitly set.
var hasName: Bool {return self._name != nil}
/// Clears the value of `name`. Subsequent reads from it will return its default value.
mutating func clearName() {self._name = nil}
var encryptionKeyPair: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair {
get {return _encryptionKeyPair ?? SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair()}
set {_encryptionKeyPair = newValue}
}
/// Returns true if `encryptionKeyPair` has been explicitly set.
var hasEncryptionKeyPair: Bool {return self._encryptionKeyPair != nil}
/// Clears the value of `encryptionKeyPair`. Subsequent reads from it will return its default value.
mutating func clearEncryptionKeyPair() {self._encryptionKeyPair = nil}
var members: [Data] = []
var admins: [Data] = []
var wrappers: [SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPairWrapper] = []
var unknownFields = SwiftProtobuf.UnknownStorage()
enum TypeEnum: SwiftProtobuf.Enum {
typealias RawValue = Int
/// publicKey, name, encryptionKeyPair, members, admins
case new // = 1
/// name, members
case update // = 2
/// wrappers
case encryptionKeyPair // = 3
init() {
self = .new
}
init?(rawValue: Int) {
switch rawValue {
case 1: self = .new
case 2: self = .update
case 3: self = .encryptionKeyPair
default: return nil
}
}
var rawValue: Int {
switch self {
case .new: return 1
case .update: return 2
case .encryptionKeyPair: return 3
}
}
}
struct KeyPair {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// @required
var publicKey: Data {
get {return _publicKey ?? SwiftProtobuf.Internal.emptyData}
set {_publicKey = newValue}
}
/// Returns true if `publicKey` has been explicitly set.
var hasPublicKey: Bool {return self._publicKey != nil}
/// Clears the value of `publicKey`. Subsequent reads from it will return its default value.
mutating func clearPublicKey() {self._publicKey = nil}
/// @required
var privateKey: Data {
get {return _privateKey ?? SwiftProtobuf.Internal.emptyData}
set {_privateKey = newValue}
}
/// Returns true if `privateKey` has been explicitly set.
var hasPrivateKey: Bool {return self._privateKey != nil}
/// Clears the value of `privateKey`. Subsequent reads from it will return its default value.
mutating func clearPrivateKey() {self._privateKey = nil}
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
fileprivate var _publicKey: Data? = nil
fileprivate var _privateKey: Data? = nil
}
struct KeyPairWrapper {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
/// @required
var publicKey: Data {
get {return _publicKey ?? SwiftProtobuf.Internal.emptyData}
set {_publicKey = newValue}
}
/// Returns true if `publicKey` has been explicitly set.
var hasPublicKey: Bool {return self._publicKey != nil}
/// Clears the value of `publicKey`. Subsequent reads from it will return its default value.
mutating func clearPublicKey() {self._publicKey = nil}
/// @required
var encryptedKeyPair: Data {
get {return _encryptedKeyPair ?? SwiftProtobuf.Internal.emptyData}
set {_encryptedKeyPair = newValue}
}
/// Returns true if `encryptedKeyPair` has been explicitly set.
var hasEncryptedKeyPair: Bool {return self._encryptedKeyPair != nil}
/// Clears the value of `encryptedKeyPair`. Subsequent reads from it will return its default value.
mutating func clearEncryptedKeyPair() {self._encryptedKeyPair = nil}
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
fileprivate var _publicKey: Data? = nil
fileprivate var _encryptedKeyPair: Data? = nil
}
init() {}
fileprivate var _type: SessionProtos_DataMessage.ClosedGroupUpdateV2.TypeEnum? = nil
fileprivate var _publicKey: Data? = nil
fileprivate var _name: String? = nil
fileprivate var _encryptionKeyPair: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair? = nil
}
struct ClosedGroupUpdate {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@ -1673,6 +1841,7 @@ struct SessionProtos_DataMessage {
fileprivate var _quote: SessionProtos_DataMessage.Quote? = nil
fileprivate var _profile: SessionProtos_DataMessage.LokiProfile? = nil
fileprivate var _closedGroupUpdate: SessionProtos_DataMessage.ClosedGroupUpdate? = nil
fileprivate var _closedGroupUpdateV2: SessionProtos_DataMessage.ClosedGroupUpdateV2? = nil
fileprivate var _publicChatInfo: SessionProtos_PublicChatInfo? = nil
}
@ -1698,6 +1867,10 @@ extension SessionProtos_DataMessage.Contact.PostalAddress.TypeEnum: CaseIterable
// Support synthesized by the compiler.
}
extension SessionProtos_DataMessage.ClosedGroupUpdateV2.TypeEnum: CaseIterable {
// Support synthesized by the compiler.
}
extension SessionProtos_DataMessage.ClosedGroupUpdate.TypeEnum: CaseIterable {
// Support synthesized by the compiler.
}
@ -3027,6 +3200,12 @@ extension SessionProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
103: .same(proto: "lokiDeviceLinkMessage"),
]
public var isInitialized: Bool {
if let v = self._dataMessage, !v.isInitialized {return false}
if let v = self._syncMessage, !v.isInitialized {return false}
return true
}
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
@ -3481,9 +3660,15 @@ extension SessionProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa
10: .same(proto: "preview"),
101: .same(proto: "profile"),
103: .same(proto: "closedGroupUpdate"),
104: .same(proto: "closedGroupUpdateV2"),
999: .same(proto: "publicChatInfo"),
]
public var isInitialized: Bool {
if let v = self._closedGroupUpdateV2, !v.isInitialized {return false}
return true
}
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
@ -3499,6 +3684,7 @@ extension SessionProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa
case 10: try decoder.decodeRepeatedMessageField(value: &self.preview)
case 101: try decoder.decodeSingularMessageField(value: &self._profile)
case 103: try decoder.decodeSingularMessageField(value: &self._closedGroupUpdate)
case 104: try decoder.decodeSingularMessageField(value: &self._closedGroupUpdateV2)
case 999: try decoder.decodeSingularMessageField(value: &self._publicChatInfo)
default: break
}
@ -3542,6 +3728,9 @@ extension SessionProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa
if let v = self._closedGroupUpdate {
try visitor.visitSingularMessageField(value: v, fieldNumber: 103)
}
if let v = self._closedGroupUpdateV2 {
try visitor.visitSingularMessageField(value: v, fieldNumber: 104)
}
if let v = self._publicChatInfo {
try visitor.visitSingularMessageField(value: v, fieldNumber: 999)
}
@ -3561,6 +3750,7 @@ extension SessionProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf._Messa
if lhs.preview != rhs.preview {return false}
if lhs._profile != rhs._profile {return false}
if lhs._closedGroupUpdate != rhs._closedGroupUpdate {return false}
if lhs._closedGroupUpdateV2 != rhs._closedGroupUpdateV2 {return false}
if lhs._publicChatInfo != rhs._publicChatInfo {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
@ -4090,6 +4280,168 @@ extension SessionProtos_DataMessage.LokiProfile: SwiftProtobuf.Message, SwiftPro
}
}
extension SessionProtos_DataMessage.ClosedGroupUpdateV2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = SessionProtos_DataMessage.protoMessageName + ".ClosedGroupUpdateV2"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "type"),
2: .same(proto: "publicKey"),
3: .same(proto: "name"),
4: .same(proto: "encryptionKeyPair"),
5: .same(proto: "members"),
6: .same(proto: "admins"),
7: .same(proto: "wrappers"),
]
public var isInitialized: Bool {
if self._type == nil {return false}
if let v = self._encryptionKeyPair, !v.isInitialized {return false}
if !SwiftProtobuf.Internal.areAllInitialized(self.wrappers) {return false}
return true
}
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularEnumField(value: &self._type)
case 2: try decoder.decodeSingularBytesField(value: &self._publicKey)
case 3: try decoder.decodeSingularStringField(value: &self._name)
case 4: try decoder.decodeSingularMessageField(value: &self._encryptionKeyPair)
case 5: try decoder.decodeRepeatedBytesField(value: &self.members)
case 6: try decoder.decodeRepeatedBytesField(value: &self.admins)
case 7: try decoder.decodeRepeatedMessageField(value: &self.wrappers)
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._type {
try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
}
if let v = self._publicKey {
try visitor.visitSingularBytesField(value: v, fieldNumber: 2)
}
if let v = self._name {
try visitor.visitSingularStringField(value: v, fieldNumber: 3)
}
if let v = self._encryptionKeyPair {
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
}
if !self.members.isEmpty {
try visitor.visitRepeatedBytesField(value: self.members, fieldNumber: 5)
}
if !self.admins.isEmpty {
try visitor.visitRepeatedBytesField(value: self.admins, fieldNumber: 6)
}
if !self.wrappers.isEmpty {
try visitor.visitRepeatedMessageField(value: self.wrappers, fieldNumber: 7)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: SessionProtos_DataMessage.ClosedGroupUpdateV2, rhs: SessionProtos_DataMessage.ClosedGroupUpdateV2) -> Bool {
if lhs._type != rhs._type {return false}
if lhs._publicKey != rhs._publicKey {return false}
if lhs._name != rhs._name {return false}
if lhs._encryptionKeyPair != rhs._encryptionKeyPair {return false}
if lhs.members != rhs.members {return false}
if lhs.admins != rhs.admins {return false}
if lhs.wrappers != rhs.wrappers {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension SessionProtos_DataMessage.ClosedGroupUpdateV2.TypeEnum: SwiftProtobuf._ProtoNameProviding {
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "NEW"),
2: .same(proto: "UPDATE"),
3: .same(proto: "ENCRYPTION_KEY_PAIR"),
]
}
extension SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = SessionProtos_DataMessage.ClosedGroupUpdateV2.protoMessageName + ".KeyPair"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "publicKey"),
2: .same(proto: "privateKey"),
]
public var isInitialized: Bool {
if self._publicKey == nil {return false}
if self._privateKey == nil {return false}
return true
}
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularBytesField(value: &self._publicKey)
case 2: try decoder.decodeSingularBytesField(value: &self._privateKey)
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._publicKey {
try visitor.visitSingularBytesField(value: v, fieldNumber: 1)
}
if let v = self._privateKey {
try visitor.visitSingularBytesField(value: v, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair, rhs: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPair) -> Bool {
if lhs._publicKey != rhs._publicKey {return false}
if lhs._privateKey != rhs._privateKey {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPairWrapper: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = SessionProtos_DataMessage.ClosedGroupUpdateV2.protoMessageName + ".KeyPairWrapper"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "publicKey"),
2: .same(proto: "encryptedKeyPair"),
]
public var isInitialized: Bool {
if self._publicKey == nil {return false}
if self._encryptedKeyPair == nil {return false}
return true
}
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularBytesField(value: &self._publicKey)
case 2: try decoder.decodeSingularBytesField(value: &self._encryptedKeyPair)
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._publicKey {
try visitor.visitSingularBytesField(value: v, fieldNumber: 1)
}
if let v = self._encryptedKeyPair {
try visitor.visitSingularBytesField(value: v, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPairWrapper, rhs: SessionProtos_DataMessage.ClosedGroupUpdateV2.KeyPairWrapper) -> Bool {
if