mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Update proto schema.
This commit is contained in:
parent
4a26952f51
commit
79375e20b2
|
@ -33,3 +33,13 @@ message BackupSnapshot {
|
|||
|
||||
repeated BackupEntity entity = 1;
|
||||
}
|
||||
|
||||
message DeviceName {
|
||||
// @required
|
||||
optional bytes ephemeralPublic = 1;
|
||||
// @required
|
||||
optional bytes syntheticIv = 2;
|
||||
// @required
|
||||
optional bytes ciphertext = 3;
|
||||
}
|
||||
|
||||
|
|
|
@ -132,6 +132,50 @@ struct IOSProtos_BackupSnapshot {
|
|||
init() {}
|
||||
}
|
||||
|
||||
struct IOSProtos_DeviceName {
|
||||
// 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 ephemeralPublic: Data {
|
||||
get {return _ephemeralPublic ?? SwiftProtobuf.Internal.emptyData}
|
||||
set {_ephemeralPublic = newValue}
|
||||
}
|
||||
/// Returns true if `ephemeralPublic` has been explicitly set.
|
||||
var hasEphemeralPublic: Bool {return self._ephemeralPublic != nil}
|
||||
/// Clears the value of `ephemeralPublic`. Subsequent reads from it will return its default value.
|
||||
mutating func clearEphemeralPublic() {self._ephemeralPublic = nil}
|
||||
|
||||
/// @required
|
||||
var syntheticIv: Data {
|
||||
get {return _syntheticIv ?? SwiftProtobuf.Internal.emptyData}
|
||||
set {_syntheticIv = newValue}
|
||||
}
|
||||
/// Returns true if `syntheticIv` has been explicitly set.
|
||||
var hasSyntheticIv: Bool {return self._syntheticIv != nil}
|
||||
/// Clears the value of `syntheticIv`. Subsequent reads from it will return its default value.
|
||||
mutating func clearSyntheticIv() {self._syntheticIv = nil}
|
||||
|
||||
/// @required
|
||||
var ciphertext: Data {
|
||||
get {return _ciphertext ?? SwiftProtobuf.Internal.emptyData}
|
||||
set {_ciphertext = newValue}
|
||||
}
|
||||
/// Returns true if `ciphertext` has been explicitly set.
|
||||
var hasCiphertext: Bool {return self._ciphertext != nil}
|
||||
/// Clears the value of `ciphertext`. Subsequent reads from it will return its default value.
|
||||
mutating func clearCiphertext() {self._ciphertext = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _ephemeralPublic: Data? = nil
|
||||
fileprivate var _syntheticIv: Data? = nil
|
||||
fileprivate var _ciphertext: Data? = nil
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "IOSProtos"
|
||||
|
@ -222,3 +266,44 @@ extension IOSProtos_BackupSnapshot.BackupEntity.TypeEnum: SwiftProtobuf._ProtoNa
|
|||
5: .same(proto: "MISC"),
|
||||
]
|
||||
}
|
||||
|
||||
extension IOSProtos_DeviceName: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".DeviceName"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "ephemeralPublic"),
|
||||
2: .same(proto: "syntheticIv"),
|
||||
3: .same(proto: "ciphertext"),
|
||||
]
|
||||
|
||||
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._ephemeralPublic)
|
||||
case 2: try decoder.decodeSingularBytesField(value: &self._syntheticIv)
|
||||
case 3: try decoder.decodeSingularBytesField(value: &self._ciphertext)
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._ephemeralPublic {
|
||||
try visitor.visitSingularBytesField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if let v = self._syntheticIv {
|
||||
try visitor.visitSingularBytesField(value: v, fieldNumber: 2)
|
||||
}
|
||||
if let v = self._ciphertext {
|
||||
try visitor.visitSingularBytesField(value: v, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: IOSProtos_DeviceName, rhs: IOSProtos_DeviceName) -> Bool {
|
||||
if lhs._ephemeralPublic != rhs._ephemeralPublic {return false}
|
||||
if lhs._syntheticIv != rhs._syntheticIv {return false}
|
||||
if lhs._ciphertext != rhs._ciphertext {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,3 +280,130 @@ extension SignalIOSProtoBackupSnapshot.SignalIOSProtoBackupSnapshotBuilder {
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MARK: - SignalIOSProtoDeviceName
|
||||
|
||||
@objc public class SignalIOSProtoDeviceName: NSObject {
|
||||
|
||||
// MARK: - SignalIOSProtoDeviceNameBuilder
|
||||
|
||||
@objc public class func builder(ephemeralPublic: Data, syntheticIv: Data, ciphertext: Data) -> SignalIOSProtoDeviceNameBuilder {
|
||||
return SignalIOSProtoDeviceNameBuilder(ephemeralPublic: ephemeralPublic, syntheticIv: syntheticIv, ciphertext: ciphertext)
|
||||
}
|
||||
|
||||
// asBuilder() constructs a builder that reflects the proto's contents.
|
||||
@objc public func asBuilder() -> SignalIOSProtoDeviceNameBuilder {
|
||||
let builder = SignalIOSProtoDeviceNameBuilder(ephemeralPublic: ephemeralPublic, syntheticIv: syntheticIv, ciphertext: ciphertext)
|
||||
return builder
|
||||
}
|
||||
|
||||
@objc public class SignalIOSProtoDeviceNameBuilder: NSObject {
|
||||
|
||||
private var proto = IOSProtos_DeviceName()
|
||||
|
||||
@objc fileprivate override init() {}
|
||||
|
||||
@objc fileprivate init(ephemeralPublic: Data, syntheticIv: Data, ciphertext: Data) {
|
||||
super.init()
|
||||
|
||||
setEphemeralPublic(ephemeralPublic)
|
||||
setSyntheticIv(syntheticIv)
|
||||
setCiphertext(ciphertext)
|
||||
}
|
||||
|
||||
@objc public func setEphemeralPublic(_ valueParam: Data) {
|
||||
proto.ephemeralPublic = valueParam
|
||||
}
|
||||
|
||||
@objc public func setSyntheticIv(_ valueParam: Data) {
|
||||
proto.syntheticIv = valueParam
|
||||
}
|
||||
|
||||
@objc public func setCiphertext(_ valueParam: Data) {
|
||||
proto.ciphertext = valueParam
|
||||
}
|
||||
|
||||
@objc public func build() throws -> SignalIOSProtoDeviceName {
|
||||
return try SignalIOSProtoDeviceName.parseProto(proto)
|
||||
}
|
||||
|
||||
@objc public func buildSerializedData() throws -> Data {
|
||||
return try SignalIOSProtoDeviceName.parseProto(proto).serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let proto: IOSProtos_DeviceName
|
||||
|
||||
@objc public let ephemeralPublic: Data
|
||||
|
||||
@objc public let syntheticIv: Data
|
||||
|
||||
@objc public let ciphertext: Data
|
||||
|
||||
private init(proto: IOSProtos_DeviceName,
|
||||
ephemeralPublic: Data,
|
||||
syntheticIv: Data,
|
||||
ciphertext: Data) {
|
||||
self.proto = proto
|
||||
self.ephemeralPublic = ephemeralPublic
|
||||
self.syntheticIv = syntheticIv
|
||||
self.ciphertext = ciphertext
|
||||
}
|
||||
|
||||
@objc
|
||||
public func serializedData() throws -> Data {
|
||||
return try self.proto.serializedData()
|
||||
}
|
||||
|
||||
@objc public class func parseData(_ serializedData: Data) throws -> SignalIOSProtoDeviceName {
|
||||
let proto = try IOSProtos_DeviceName(serializedData: serializedData)
|
||||
return try parseProto(proto)
|
||||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: IOSProtos_DeviceName) throws -> SignalIOSProtoDeviceName {
|
||||
guard proto.hasEphemeralPublic else {
|
||||
throw SignalIOSProtoError.invalidProtobuf(description: "\(logTag) missing required field: ephemeralPublic")
|
||||
}
|
||||
let ephemeralPublic = proto.ephemeralPublic
|
||||
|
||||
guard proto.hasSyntheticIv else {
|
||||
throw SignalIOSProtoError.invalidProtobuf(description: "\(logTag) missing required field: syntheticIv")
|
||||
}
|
||||
let syntheticIv = proto.syntheticIv
|
||||
|
||||
guard proto.hasCiphertext else {
|
||||
throw SignalIOSProtoError.invalidProtobuf(description: "\(logTag) missing required field: ciphertext")
|
||||
}
|
||||
let ciphertext = proto.ciphertext
|
||||
|
||||
// MARK: - Begin Validation Logic for SignalIOSProtoDeviceName -
|
||||
|
||||
// MARK: - End Validation Logic for SignalIOSProtoDeviceName -
|
||||
|
||||
let result = SignalIOSProtoDeviceName(proto: proto,
|
||||
ephemeralPublic: ephemeralPublic,
|
||||
syntheticIv: syntheticIv,
|
||||
ciphertext: ciphertext)
|
||||
return result
|
||||
}
|
||||
|
||||
@objc public override var debugDescription: String {
|
||||
return "\(proto)"
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
extension SignalIOSProtoDeviceName {
|
||||
@objc public func serializedDataIgnoringErrors() -> Data? {
|
||||
return try! self.serializedData()
|
||||
}
|
||||
}
|
||||
|
||||
extension SignalIOSProtoDeviceName.SignalIOSProtoDeviceNameBuilder {
|
||||
@objc public func buildIgnoringErrors() -> SignalIOSProtoDeviceName? {
|
||||
return try! self.build()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue