Update protos
This commit is contained in:
parent
eb0f83f91d
commit
2e75408ffa
|
@ -141,7 +141,7 @@ extension ConfigurationMessage {
|
||||||
public static func fromProto(_ proto: SNProtoConfigurationMessageClosedGroup) -> ClosedGroup? {
|
public static func fromProto(_ proto: SNProtoConfigurationMessageClosedGroup) -> ClosedGroup? {
|
||||||
guard let publicKey = proto.publicKey?.toHexString(),
|
guard let publicKey = proto.publicKey?.toHexString(),
|
||||||
let name = proto.name,
|
let name = proto.name,
|
||||||
let encryptionKeyPairAsProto = proto.encryptionKeyPair else { return nil }
|
let encryptionKeyPairAsProto = proto.x25519 else { return nil }
|
||||||
let encryptionKeyPair: ECKeyPair
|
let encryptionKeyPair: ECKeyPair
|
||||||
do {
|
do {
|
||||||
encryptionKeyPair = try ECKeyPair(publicKeyData: encryptionKeyPairAsProto.publicKey, privateKeyData: encryptionKeyPairAsProto.privateKey)
|
encryptionKeyPair = try ECKeyPair(publicKeyData: encryptionKeyPairAsProto.publicKey, privateKeyData: encryptionKeyPairAsProto.privateKey)
|
||||||
|
@ -164,7 +164,7 @@ extension ConfigurationMessage {
|
||||||
result.setName(name)
|
result.setName(name)
|
||||||
do {
|
do {
|
||||||
let encryptionKeyPairAsProto = try SNProtoKeyPair.builder(publicKey: encryptionKeyPair.publicKey, privateKey: encryptionKeyPair.privateKey).build()
|
let encryptionKeyPairAsProto = try SNProtoKeyPair.builder(publicKey: encryptionKeyPair.publicKey, privateKey: encryptionKeyPair.privateKey).build()
|
||||||
result.setEncryptionKeyPair(encryptionKeyPairAsProto)
|
result.setX25519(encryptionKeyPairAsProto)
|
||||||
} catch {
|
} catch {
|
||||||
SNLog("Couldn't construct closed group proto from: \(self).")
|
SNLog("Couldn't construct closed group proto from: \(self).")
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -2129,14 +2129,17 @@ extension SNProtoDataMessage.SNProtoDataMessageBuilder {
|
||||||
if let _value = name {
|
if let _value = name {
|
||||||
builder.setName(_value)
|
builder.setName(_value)
|
||||||
}
|
}
|
||||||
if let _value = encryptionKeyPair {
|
if let _value = x25519 {
|
||||||
builder.setEncryptionKeyPair(_value)
|
builder.setX25519(_value)
|
||||||
}
|
}
|
||||||
builder.setMembers(members)
|
builder.setMembers(members)
|
||||||
builder.setAdmins(admins)
|
builder.setAdmins(admins)
|
||||||
if hasExpirationTimer {
|
if hasExpirationTimer {
|
||||||
builder.setExpirationTimer(expirationTimer)
|
builder.setExpirationTimer(expirationTimer)
|
||||||
}
|
}
|
||||||
|
if let _value = ed25519 {
|
||||||
|
builder.setEd25519(_value)
|
||||||
|
}
|
||||||
return builder
|
return builder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2154,8 +2157,8 @@ extension SNProtoDataMessage.SNProtoDataMessageBuilder {
|
||||||
proto.name = valueParam
|
proto.name = valueParam
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func setEncryptionKeyPair(_ valueParam: SNProtoKeyPair) {
|
@objc public func setX25519(_ valueParam: SNProtoKeyPair) {
|
||||||
proto.encryptionKeyPair = valueParam.proto
|
proto.x25519 = valueParam.proto
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func addMembers(_ valueParam: Data) {
|
@objc public func addMembers(_ valueParam: Data) {
|
||||||
|
@ -2182,6 +2185,10 @@ extension SNProtoDataMessage.SNProtoDataMessageBuilder {
|
||||||
proto.expirationTimer = valueParam
|
proto.expirationTimer = valueParam
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc public func setEd25519(_ valueParam: SNProtoKeyPair) {
|
||||||
|
proto.ed25519 = valueParam.proto
|
||||||
|
}
|
||||||
|
|
||||||
@objc public func build() throws -> SNProtoConfigurationMessageClosedGroup {
|
@objc public func build() throws -> SNProtoConfigurationMessageClosedGroup {
|
||||||
return try SNProtoConfigurationMessageClosedGroup.parseProto(proto)
|
return try SNProtoConfigurationMessageClosedGroup.parseProto(proto)
|
||||||
}
|
}
|
||||||
|
@ -2193,7 +2200,9 @@ extension SNProtoDataMessage.SNProtoDataMessageBuilder {
|
||||||
|
|
||||||
fileprivate let proto: SessionProtos_ConfigurationMessage.ClosedGroup
|
fileprivate let proto: SessionProtos_ConfigurationMessage.ClosedGroup
|
||||||
|
|
||||||
@objc public let encryptionKeyPair: SNProtoKeyPair?
|
@objc public let x25519: SNProtoKeyPair?
|
||||||
|
|
||||||
|
@objc public let ed25519: SNProtoKeyPair?
|
||||||
|
|
||||||
@objc public var publicKey: Data? {
|
@objc public var publicKey: Data? {
|
||||||
guard proto.hasPublicKey else {
|
guard proto.hasPublicKey else {
|
||||||
|
@ -2231,9 +2240,11 @@ extension SNProtoDataMessage.SNProtoDataMessageBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private init(proto: SessionProtos_ConfigurationMessage.ClosedGroup,
|
private init(proto: SessionProtos_ConfigurationMessage.ClosedGroup,
|
||||||
encryptionKeyPair: SNProtoKeyPair?) {
|
x25519: SNProtoKeyPair?,
|
||||||
|
ed25519: SNProtoKeyPair?) {
|
||||||
self.proto = proto
|
self.proto = proto
|
||||||
self.encryptionKeyPair = encryptionKeyPair
|
self.x25519 = x25519
|
||||||
|
self.ed25519 = ed25519
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
|
@ -2247,9 +2258,14 @@ extension SNProtoDataMessage.SNProtoDataMessageBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate class func parseProto(_ proto: SessionProtos_ConfigurationMessage.ClosedGroup) throws -> SNProtoConfigurationMessageClosedGroup {
|
fileprivate class func parseProto(_ proto: SessionProtos_ConfigurationMessage.ClosedGroup) throws -> SNProtoConfigurationMessageClosedGroup {
|
||||||
var encryptionKeyPair: SNProtoKeyPair? = nil
|
var x25519: SNProtoKeyPair? = nil
|
||||||
if proto.hasEncryptionKeyPair {
|
if proto.hasX25519 {
|
||||||
encryptionKeyPair = try SNProtoKeyPair.parseProto(proto.encryptionKeyPair)
|
x25519 = try SNProtoKeyPair.parseProto(proto.x25519)
|
||||||
|
}
|
||||||
|
|
||||||
|
var ed25519: SNProtoKeyPair? = nil
|
||||||
|
if proto.hasEd25519 {
|
||||||
|
ed25519 = try SNProtoKeyPair.parseProto(proto.ed25519)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Begin Validation Logic for SNProtoConfigurationMessageClosedGroup -
|
// MARK: - Begin Validation Logic for SNProtoConfigurationMessageClosedGroup -
|
||||||
|
@ -2257,7 +2273,8 @@ extension SNProtoDataMessage.SNProtoDataMessageBuilder {
|
||||||
// MARK: - End Validation Logic for SNProtoConfigurationMessageClosedGroup -
|
// MARK: - End Validation Logic for SNProtoConfigurationMessageClosedGroup -
|
||||||
|
|
||||||
let result = SNProtoConfigurationMessageClosedGroup(proto: proto,
|
let result = SNProtoConfigurationMessageClosedGroup(proto: proto,
|
||||||
encryptionKeyPair: encryptionKeyPair)
|
x25519: x25519,
|
||||||
|
ed25519: ed25519)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -979,14 +979,14 @@ struct SessionProtos_ConfigurationMessage {
|
||||||
/// Clears the value of `name`. Subsequent reads from it will return its default value.
|
/// Clears the value of `name`. Subsequent reads from it will return its default value.
|
||||||
mutating func clearName() {self._name = nil}
|
mutating func clearName() {self._name = nil}
|
||||||
|
|
||||||
var encryptionKeyPair: SessionProtos_KeyPair {
|
var x25519: SessionProtos_KeyPair {
|
||||||
get {return _encryptionKeyPair ?? SessionProtos_KeyPair()}
|
get {return _x25519 ?? SessionProtos_KeyPair()}
|
||||||
set {_encryptionKeyPair = newValue}
|
set {_x25519 = newValue}
|
||||||
}
|
}
|
||||||
/// Returns true if `encryptionKeyPair` has been explicitly set.
|
/// Returns true if `x25519` has been explicitly set.
|
||||||
var hasEncryptionKeyPair: Bool {return self._encryptionKeyPair != nil}
|
var hasX25519: Bool {return self._x25519 != nil}
|
||||||
/// Clears the value of `encryptionKeyPair`. Subsequent reads from it will return its default value.
|
/// Clears the value of `x25519`. Subsequent reads from it will return its default value.
|
||||||
mutating func clearEncryptionKeyPair() {self._encryptionKeyPair = nil}
|
mutating func clearX25519() {self._x25519 = nil}
|
||||||
|
|
||||||
var members: [Data] = []
|
var members: [Data] = []
|
||||||
|
|
||||||
|
@ -1001,14 +1001,24 @@ struct SessionProtos_ConfigurationMessage {
|
||||||
/// Clears the value of `expirationTimer`. Subsequent reads from it will return its default value.
|
/// Clears the value of `expirationTimer`. Subsequent reads from it will return its default value.
|
||||||
mutating func clearExpirationTimer() {self._expirationTimer = nil}
|
mutating func clearExpirationTimer() {self._expirationTimer = nil}
|
||||||
|
|
||||||
|
var ed25519: SessionProtos_KeyPair {
|
||||||
|
get {return _ed25519 ?? SessionProtos_KeyPair()}
|
||||||
|
set {_ed25519 = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `ed25519` has been explicitly set.
|
||||||
|
var hasEd25519: Bool {return self._ed25519 != nil}
|
||||||
|
/// Clears the value of `ed25519`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearEd25519() {self._ed25519 = nil}
|
||||||
|
|
||||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
init() {}
|
init() {}
|
||||||
|
|
||||||
fileprivate var _publicKey: Data? = nil
|
fileprivate var _publicKey: Data? = nil
|
||||||
fileprivate var _name: String? = nil
|
fileprivate var _name: String? = nil
|
||||||
fileprivate var _encryptionKeyPair: SessionProtos_KeyPair? = nil
|
fileprivate var _x25519: SessionProtos_KeyPair? = nil
|
||||||
fileprivate var _expirationTimer: UInt32? = nil
|
fileprivate var _expirationTimer: UInt32? = nil
|
||||||
|
fileprivate var _ed25519: SessionProtos_KeyPair? = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Contact {
|
struct Contact {
|
||||||
|
@ -2335,14 +2345,16 @@ extension SessionProtos_ConfigurationMessage.ClosedGroup: SwiftProtobuf.Message,
|
||||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||||
1: .same(proto: "publicKey"),
|
1: .same(proto: "publicKey"),
|
||||||
2: .same(proto: "name"),
|
2: .same(proto: "name"),
|
||||||
3: .same(proto: "encryptionKeyPair"),
|
3: .same(proto: "x25519"),
|
||||||
4: .same(proto: "members"),
|
4: .same(proto: "members"),
|
||||||
5: .same(proto: "admins"),
|
5: .same(proto: "admins"),
|
||||||
6: .same(proto: "expirationTimer"),
|
6: .same(proto: "expirationTimer"),
|
||||||
|
7: .same(proto: "ed25519"),
|
||||||
]
|
]
|
||||||
|
|
||||||
public var isInitialized: Bool {
|
public var isInitialized: Bool {
|
||||||
if let v = self._encryptionKeyPair, !v.isInitialized {return false}
|
if let v = self._x25519, !v.isInitialized {return false}
|
||||||
|
if let v = self._ed25519, !v.isInitialized {return false}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2354,10 +2366,11 @@ extension SessionProtos_ConfigurationMessage.ClosedGroup: SwiftProtobuf.Message,
|
||||||
switch fieldNumber {
|
switch fieldNumber {
|
||||||
case 1: try { try decoder.decodeSingularBytesField(value: &self._publicKey) }()
|
case 1: try { try decoder.decodeSingularBytesField(value: &self._publicKey) }()
|
||||||
case 2: try { try decoder.decodeSingularStringField(value: &self._name) }()
|
case 2: try { try decoder.decodeSingularStringField(value: &self._name) }()
|
||||||
case 3: try { try decoder.decodeSingularMessageField(value: &self._encryptionKeyPair) }()
|
case 3: try { try decoder.decodeSingularMessageField(value: &self._x25519) }()
|
||||||
case 4: try { try decoder.decodeRepeatedBytesField(value: &self.members) }()
|
case 4: try { try decoder.decodeRepeatedBytesField(value: &self.members) }()
|
||||||
case 5: try { try decoder.decodeRepeatedBytesField(value: &self.admins) }()
|
case 5: try { try decoder.decodeRepeatedBytesField(value: &self.admins) }()
|
||||||
case 6: try { try decoder.decodeSingularUInt32Field(value: &self._expirationTimer) }()
|
case 6: try { try decoder.decodeSingularUInt32Field(value: &self._expirationTimer) }()
|
||||||
|
case 7: try { try decoder.decodeSingularMessageField(value: &self._ed25519) }()
|
||||||
default: break
|
default: break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2370,7 +2383,7 @@ extension SessionProtos_ConfigurationMessage.ClosedGroup: SwiftProtobuf.Message,
|
||||||
if let v = self._name {
|
if let v = self._name {
|
||||||
try visitor.visitSingularStringField(value: v, fieldNumber: 2)
|
try visitor.visitSingularStringField(value: v, fieldNumber: 2)
|
||||||
}
|
}
|
||||||
if let v = self._encryptionKeyPair {
|
if let v = self._x25519 {
|
||||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||||
}
|
}
|
||||||
if !self.members.isEmpty {
|
if !self.members.isEmpty {
|
||||||
|
@ -2382,16 +2395,20 @@ extension SessionProtos_ConfigurationMessage.ClosedGroup: SwiftProtobuf.Message,
|
||||||
if let v = self._expirationTimer {
|
if let v = self._expirationTimer {
|
||||||
try visitor.visitSingularUInt32Field(value: v, fieldNumber: 6)
|
try visitor.visitSingularUInt32Field(value: v, fieldNumber: 6)
|
||||||
}
|
}
|
||||||
|
if let v = self._ed25519 {
|
||||||
|
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||||
|
}
|
||||||
try unknownFields.traverse(visitor: &visitor)
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func ==(lhs: SessionProtos_ConfigurationMessage.ClosedGroup, rhs: SessionProtos_ConfigurationMessage.ClosedGroup) -> Bool {
|
static func ==(lhs: SessionProtos_ConfigurationMessage.ClosedGroup, rhs: SessionProtos_ConfigurationMessage.ClosedGroup) -> Bool {
|
||||||
if lhs._publicKey != rhs._publicKey {return false}
|
if lhs._publicKey != rhs._publicKey {return false}
|
||||||
if lhs._name != rhs._name {return false}
|
if lhs._name != rhs._name {return false}
|
||||||
if lhs._encryptionKeyPair != rhs._encryptionKeyPair {return false}
|
if lhs._x25519 != rhs._x25519 {return false}
|
||||||
if lhs.members != rhs.members {return false}
|
if lhs.members != rhs.members {return false}
|
||||||
if lhs.admins != rhs.admins {return false}
|
if lhs.admins != rhs.admins {return false}
|
||||||
if lhs._expirationTimer != rhs._expirationTimer {return false}
|
if lhs._expirationTimer != rhs._expirationTimer {return false}
|
||||||
|
if lhs._ed25519 != rhs._ed25519 {return false}
|
||||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,10 +160,11 @@ message ConfigurationMessage {
|
||||||
message ClosedGroup {
|
message ClosedGroup {
|
||||||
optional bytes publicKey = 1;
|
optional bytes publicKey = 1;
|
||||||
optional string name = 2;
|
optional string name = 2;
|
||||||
optional KeyPair encryptionKeyPair = 3;
|
optional KeyPair x25519 = 3;
|
||||||
repeated bytes members = 4;
|
repeated bytes members = 4;
|
||||||
repeated bytes admins = 5;
|
repeated bytes admins = 5;
|
||||||
optional uint32 expirationTimer = 6;
|
optional uint32 expirationTimer = 6;
|
||||||
|
optional KeyPair ed25519 = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Contact {
|
message Contact {
|
||||||
|
|
Loading…
Reference in New Issue