348 lines
13 KiB
Swift
348 lines
13 KiB
Swift
//
|
|
// Copyright 2025 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
// DO NOT EDIT.
|
|
// swift-format-ignore-file
|
|
// swiftlint:disable all
|
|
//
|
|
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
|
// Source: Registration.proto
|
|
//
|
|
// For information on using the generated types, please see the documentation:
|
|
// https://github.com/apple/swift-protobuf/
|
|
|
|
//
|
|
// Copyright 2025 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import Foundation
|
|
import SwiftProtobuf
|
|
|
|
// If the compiler emits an error on this type, it is because this file
|
|
// was generated by a version of the `protoc` Swift plug-in that is
|
|
// incompatible with the version of SwiftProtobuf to which you are linking.
|
|
// Please ensure that you are building against the same version of the API
|
|
// that was used to generate this file.
|
|
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
|
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
|
typealias Version = _2
|
|
}
|
|
|
|
struct RegistrationProtos_RegistrationProvisionEnvelope: @unchecked Sendable {
|
|
// 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.
|
|
|
|
var publicKey: Data = Data()
|
|
|
|
/// Encrypted RegistrationProvisionMessage
|
|
var body: Data = Data()
|
|
|
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
|
|
|
init() {}
|
|
}
|
|
|
|
struct RegistrationProtos_RegistrationProvisionMessage: @unchecked Sendable {
|
|
// 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.
|
|
|
|
var e164: String = String()
|
|
|
|
var aci: Data = Data()
|
|
|
|
var accountEntropyPool: String = String()
|
|
|
|
var pin: String = String()
|
|
|
|
var platform: RegistrationProtos_RegistrationProvisionMessage.Platform = .android
|
|
|
|
var backupTimestampMs: UInt64 = 0
|
|
|
|
var tier: RegistrationProtos_RegistrationProvisionMessage.Tier {
|
|
get {return _tier ?? .free}
|
|
set {_tier = newValue}
|
|
}
|
|
/// Returns true if `tier` has been explicitly set.
|
|
var hasTier: Bool {return self._tier != nil}
|
|
/// Clears the value of `tier`. Subsequent reads from it will return its default value.
|
|
mutating func clearTier() {self._tier = nil}
|
|
|
|
var backupSizeBytes: UInt64 = 0
|
|
|
|
var restoreMethodToken: String = String()
|
|
|
|
var aciIdentityKeyPublic: Data = Data()
|
|
|
|
var aciIdentityKeyPrivate: Data = Data()
|
|
|
|
var pniIdentityKeyPublic: Data = Data()
|
|
|
|
var pniIdentityKeyPrivate: Data = Data()
|
|
|
|
var backupVersion: UInt64 = 0
|
|
|
|
var lastBackupForwardSecrecyToken: Data = Data()
|
|
|
|
var nextBackupSecretData: Data = Data()
|
|
|
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
|
|
|
enum Platform: SwiftProtobuf.Enum, Swift.CaseIterable {
|
|
typealias RawValue = Int
|
|
case android // = 0
|
|
case ios // = 1
|
|
case UNRECOGNIZED(Int)
|
|
|
|
init() {
|
|
self = .android
|
|
}
|
|
|
|
init?(rawValue: Int) {
|
|
switch rawValue {
|
|
case 0: self = .android
|
|
case 1: self = .ios
|
|
default: self = .UNRECOGNIZED(rawValue)
|
|
}
|
|
}
|
|
|
|
var rawValue: Int {
|
|
switch self {
|
|
case .android: return 0
|
|
case .ios: return 1
|
|
case .UNRECOGNIZED(let i): return i
|
|
}
|
|
}
|
|
|
|
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
|
static let allCases: [RegistrationProtos_RegistrationProvisionMessage.Platform] = [
|
|
.android,
|
|
.ios,
|
|
]
|
|
|
|
}
|
|
|
|
enum Tier: SwiftProtobuf.Enum, Swift.CaseIterable {
|
|
typealias RawValue = Int
|
|
case free // = 0
|
|
case paid // = 1
|
|
case UNRECOGNIZED(Int)
|
|
|
|
init() {
|
|
self = .free
|
|
}
|
|
|
|
init?(rawValue: Int) {
|
|
switch rawValue {
|
|
case 0: self = .free
|
|
case 1: self = .paid
|
|
default: self = .UNRECOGNIZED(rawValue)
|
|
}
|
|
}
|
|
|
|
var rawValue: Int {
|
|
switch self {
|
|
case .free: return 0
|
|
case .paid: return 1
|
|
case .UNRECOGNIZED(let i): return i
|
|
}
|
|
}
|
|
|
|
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
|
static let allCases: [RegistrationProtos_RegistrationProvisionMessage.Tier] = [
|
|
.free,
|
|
.paid,
|
|
]
|
|
|
|
}
|
|
|
|
init() {}
|
|
|
|
fileprivate var _tier: RegistrationProtos_RegistrationProvisionMessage.Tier? = nil
|
|
}
|
|
|
|
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
|
|
|
fileprivate let _protobuf_package = "RegistrationProtos"
|
|
|
|
extension RegistrationProtos_RegistrationProvisionEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
|
static let protoMessageName: String = _protobuf_package + ".RegistrationProvisionEnvelope"
|
|
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
|
1: .same(proto: "publicKey"),
|
|
2: .same(proto: "body"),
|
|
]
|
|
|
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
|
// The use of inline closures is to circumvent an issue where the compiler
|
|
// allocates stack space for every case branch when no optimizations are
|
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
|
switch fieldNumber {
|
|
case 1: try { try decoder.decodeSingularBytesField(value: &self.publicKey) }()
|
|
case 2: try { try decoder.decodeSingularBytesField(value: &self.body) }()
|
|
default: break
|
|
}
|
|
}
|
|
}
|
|
|
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
|
if !self.publicKey.isEmpty {
|
|
try visitor.visitSingularBytesField(value: self.publicKey, fieldNumber: 1)
|
|
}
|
|
if !self.body.isEmpty {
|
|
try visitor.visitSingularBytesField(value: self.body, fieldNumber: 2)
|
|
}
|
|
try unknownFields.traverse(visitor: &visitor)
|
|
}
|
|
|
|
static func ==(lhs: RegistrationProtos_RegistrationProvisionEnvelope, rhs: RegistrationProtos_RegistrationProvisionEnvelope) -> Bool {
|
|
if lhs.publicKey != rhs.publicKey {return false}
|
|
if lhs.body != rhs.body {return false}
|
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
|
return true
|
|
}
|
|
}
|
|
|
|
extension RegistrationProtos_RegistrationProvisionMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
|
static let protoMessageName: String = _protobuf_package + ".RegistrationProvisionMessage"
|
|
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
|
1: .same(proto: "e164"),
|
|
2: .same(proto: "aci"),
|
|
3: .same(proto: "accountEntropyPool"),
|
|
4: .same(proto: "pin"),
|
|
5: .same(proto: "platform"),
|
|
6: .same(proto: "backupTimestampMs"),
|
|
7: .same(proto: "tier"),
|
|
8: .same(proto: "backupSizeBytes"),
|
|
9: .same(proto: "restoreMethodToken"),
|
|
10: .same(proto: "aciIdentityKeyPublic"),
|
|
11: .same(proto: "aciIdentityKeyPrivate"),
|
|
12: .same(proto: "pniIdentityKeyPublic"),
|
|
13: .same(proto: "pniIdentityKeyPrivate"),
|
|
14: .same(proto: "backupVersion"),
|
|
15: .same(proto: "lastBackupForwardSecrecyToken"),
|
|
16: .same(proto: "nextBackupSecretData"),
|
|
]
|
|
|
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
|
// The use of inline closures is to circumvent an issue where the compiler
|
|
// allocates stack space for every case branch when no optimizations are
|
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
|
switch fieldNumber {
|
|
case 1: try { try decoder.decodeSingularStringField(value: &self.e164) }()
|
|
case 2: try { try decoder.decodeSingularBytesField(value: &self.aci) }()
|
|
case 3: try { try decoder.decodeSingularStringField(value: &self.accountEntropyPool) }()
|
|
case 4: try { try decoder.decodeSingularStringField(value: &self.pin) }()
|
|
case 5: try { try decoder.decodeSingularEnumField(value: &self.platform) }()
|
|
case 6: try { try decoder.decodeSingularUInt64Field(value: &self.backupTimestampMs) }()
|
|
case 7: try { try decoder.decodeSingularEnumField(value: &self._tier) }()
|
|
case 8: try { try decoder.decodeSingularUInt64Field(value: &self.backupSizeBytes) }()
|
|
case 9: try { try decoder.decodeSingularStringField(value: &self.restoreMethodToken) }()
|
|
case 10: try { try decoder.decodeSingularBytesField(value: &self.aciIdentityKeyPublic) }()
|
|
case 11: try { try decoder.decodeSingularBytesField(value: &self.aciIdentityKeyPrivate) }()
|
|
case 12: try { try decoder.decodeSingularBytesField(value: &self.pniIdentityKeyPublic) }()
|
|
case 13: try { try decoder.decodeSingularBytesField(value: &self.pniIdentityKeyPrivate) }()
|
|
case 14: try { try decoder.decodeSingularUInt64Field(value: &self.backupVersion) }()
|
|
case 15: try { try decoder.decodeSingularBytesField(value: &self.lastBackupForwardSecrecyToken) }()
|
|
case 16: try { try decoder.decodeSingularBytesField(value: &self.nextBackupSecretData) }()
|
|
default: break
|
|
}
|
|
}
|
|
}
|
|
|
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
|
// The use of inline closures is to circumvent an issue where the compiler
|
|
// allocates stack space for every if/case branch local when no optimizations
|
|
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
|
// https://github.com/apple/swift-protobuf/issues/1182
|
|
if !self.e164.isEmpty {
|
|
try visitor.visitSingularStringField(value: self.e164, fieldNumber: 1)
|
|
}
|
|
if !self.aci.isEmpty {
|
|
try visitor.visitSingularBytesField(value: self.aci, fieldNumber: 2)
|
|
}
|
|
if !self.accountEntropyPool.isEmpty {
|
|
try visitor.visitSingularStringField(value: self.accountEntropyPool, fieldNumber: 3)
|
|
}
|
|
if !self.pin.isEmpty {
|
|
try visitor.visitSingularStringField(value: self.pin, fieldNumber: 4)
|
|
}
|
|
if self.platform != .android {
|
|
try visitor.visitSingularEnumField(value: self.platform, fieldNumber: 5)
|
|
}
|
|
if self.backupTimestampMs != 0 {
|
|
try visitor.visitSingularUInt64Field(value: self.backupTimestampMs, fieldNumber: 6)
|
|
}
|
|
try { if let v = self._tier {
|
|
try visitor.visitSingularEnumField(value: v, fieldNumber: 7)
|
|
} }()
|
|
if self.backupSizeBytes != 0 {
|
|
try visitor.visitSingularUInt64Field(value: self.backupSizeBytes, fieldNumber: 8)
|
|
}
|
|
if !self.restoreMethodToken.isEmpty {
|
|
try visitor.visitSingularStringField(value: self.restoreMethodToken, fieldNumber: 9)
|
|
}
|
|
if !self.aciIdentityKeyPublic.isEmpty {
|
|
try visitor.visitSingularBytesField(value: self.aciIdentityKeyPublic, fieldNumber: 10)
|
|
}
|
|
if !self.aciIdentityKeyPrivate.isEmpty {
|
|
try visitor.visitSingularBytesField(value: self.aciIdentityKeyPrivate, fieldNumber: 11)
|
|
}
|
|
if !self.pniIdentityKeyPublic.isEmpty {
|
|
try visitor.visitSingularBytesField(value: self.pniIdentityKeyPublic, fieldNumber: 12)
|
|
}
|
|
if !self.pniIdentityKeyPrivate.isEmpty {
|
|
try visitor.visitSingularBytesField(value: self.pniIdentityKeyPrivate, fieldNumber: 13)
|
|
}
|
|
if self.backupVersion != 0 {
|
|
try visitor.visitSingularUInt64Field(value: self.backupVersion, fieldNumber: 14)
|
|
}
|
|
if !self.lastBackupForwardSecrecyToken.isEmpty {
|
|
try visitor.visitSingularBytesField(value: self.lastBackupForwardSecrecyToken, fieldNumber: 15)
|
|
}
|
|
if !self.nextBackupSecretData.isEmpty {
|
|
try visitor.visitSingularBytesField(value: self.nextBackupSecretData, fieldNumber: 16)
|
|
}
|
|
try unknownFields.traverse(visitor: &visitor)
|
|
}
|
|
|
|
static func ==(lhs: RegistrationProtos_RegistrationProvisionMessage, rhs: RegistrationProtos_RegistrationProvisionMessage) -> Bool {
|
|
if lhs.e164 != rhs.e164 {return false}
|
|
if lhs.aci != rhs.aci {return false}
|
|
if lhs.accountEntropyPool != rhs.accountEntropyPool {return false}
|
|
if lhs.pin != rhs.pin {return false}
|
|
if lhs.platform != rhs.platform {return false}
|
|
if lhs.backupTimestampMs != rhs.backupTimestampMs {return false}
|
|
if lhs._tier != rhs._tier {return false}
|
|
if lhs.backupSizeBytes != rhs.backupSizeBytes {return false}
|
|
if lhs.restoreMethodToken != rhs.restoreMethodToken {return false}
|
|
if lhs.aciIdentityKeyPublic != rhs.aciIdentityKeyPublic {return false}
|
|
if lhs.aciIdentityKeyPrivate != rhs.aciIdentityKeyPrivate {return false}
|
|
if lhs.pniIdentityKeyPublic != rhs.pniIdentityKeyPublic {return false}
|
|
if lhs.pniIdentityKeyPrivate != rhs.pniIdentityKeyPrivate {return false}
|
|
if lhs.backupVersion != rhs.backupVersion {return false}
|
|
if lhs.lastBackupForwardSecrecyToken != rhs.lastBackupForwardSecrecyToken {return false}
|
|
if lhs.nextBackupSecretData != rhs.nextBackupSecretData {return false}
|
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
|
return true
|
|
}
|
|
}
|
|
|
|
extension RegistrationProtos_RegistrationProvisionMessage.Platform: SwiftProtobuf._ProtoNameProviding {
|
|
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
|
0: .same(proto: "ANDROID"),
|
|
1: .same(proto: "IOS"),
|
|
]
|
|
}
|
|
|
|
extension RegistrationProtos_RegistrationProvisionMessage.Tier: SwiftProtobuf._ProtoNameProviding {
|
|
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
|
0: .same(proto: "FREE"),
|
|
1: .same(proto: "PAID"),
|
|
]
|
|
}
|