All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.google.security.cryptauth.lib.securegcm.Ukey2ClientInit.kt Maven / Gradle / Ivy

// Code generated by Wire protocol buffer compiler, do not edit.
// Source: securegcm.Ukey2ClientInit in ukey.proto
package com.google.security.cryptauth.lib.securegcm

import com.squareup.wire.FieldEncoding
import com.squareup.wire.Message
import com.squareup.wire.ProtoAdapter
import com.squareup.wire.ProtoReader
import com.squareup.wire.ProtoWriter
import com.squareup.wire.ReverseProtoWriter
import com.squareup.wire.Syntax
import com.squareup.wire.Syntax.PROTO_2
import com.squareup.wire.WireField
import com.squareup.wire.`internal`.immutableCopyOf
import com.squareup.wire.`internal`.redactElements
import com.squareup.wire.`internal`.sanitize
import kotlin.Any
import kotlin.AssertionError
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.DeprecationLevel
import kotlin.Int
import kotlin.Long
import kotlin.Nothing
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
import okio.ByteString

public class Ukey2ClientInit(
  /**
   * highest supported version for rollback
   */
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#INT32",
  )
  public val version: Int? = null,
  /**
   * protection
   * random bytes for replay/reuse protection
   */
  @field:WireField(
    tag = 2,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
  )
  public val random: ByteString? = null,
  cipher_commitments: List = emptyList(),
  /**
   * Next protocol that the client wants to speak.
   */
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
  )
  public val next_protocol: String? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  @field:WireField(
    tag = 3,
    adapter =
        "com.google.security.cryptauth.lib.securegcm.Ukey2ClientInit${'$'}CipherCommitment#ADAPTER",
    label = WireField.Label.REPEATED,
  )
  public val cipher_commitments: List = immutableCopyOf("cipher_commitments",
      cipher_commitments)

  @Deprecated(
    message = "Shouldn't be used in Kotlin",
    level = DeprecationLevel.HIDDEN,
  )
  public override fun newBuilder(): Nothing = throw
      AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is Ukey2ClientInit) return false
    if (unknownFields != other.unknownFields) return false
    if (version != other.version) return false
    if (random != other.random) return false
    if (cipher_commitments != other.cipher_commitments) return false
    if (next_protocol != other.next_protocol) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + (version?.hashCode() ?: 0)
      result = result * 37 + (random?.hashCode() ?: 0)
      result = result * 37 + cipher_commitments.hashCode()
      result = result * 37 + (next_protocol?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    if (version != null) result += """version=$version"""
    if (random != null) result += """random=$random"""
    if (cipher_commitments.isNotEmpty()) result += """cipher_commitments=$cipher_commitments"""
    if (next_protocol != null) result += """next_protocol=${sanitize(next_protocol)}"""
    return result.joinToString(prefix = "Ukey2ClientInit{", separator = ", ", postfix = "}")
  }

  public fun copy(
    version: Int? = this.version,
    random: ByteString? = this.random,
    cipher_commitments: List = this.cipher_commitments,
    next_protocol: String? = this.next_protocol,
    unknownFields: ByteString = this.unknownFields,
  ): Ukey2ClientInit = Ukey2ClientInit(version, random, cipher_commitments, next_protocol,
      unknownFields)

  public companion object {
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      Ukey2ClientInit::class, 
      "type.googleapis.com/securegcm.Ukey2ClientInit", 
      PROTO_2, 
      null, 
      "ukey.proto"
    ) {
      public override fun encodedSize(`value`: Ukey2ClientInit): Int {
        var size = value.unknownFields.size
        size += ProtoAdapter.INT32.encodedSizeWithTag(1, value.version)
        size += ProtoAdapter.BYTES.encodedSizeWithTag(2, value.random)
        size += CipherCommitment.ADAPTER.asRepeated().encodedSizeWithTag(3,
            value.cipher_commitments)
        size += ProtoAdapter.STRING.encodedSizeWithTag(4, value.next_protocol)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: Ukey2ClientInit): Unit {
        ProtoAdapter.INT32.encodeWithTag(writer, 1, value.version)
        ProtoAdapter.BYTES.encodeWithTag(writer, 2, value.random)
        CipherCommitment.ADAPTER.asRepeated().encodeWithTag(writer, 3, value.cipher_commitments)
        ProtoAdapter.STRING.encodeWithTag(writer, 4, value.next_protocol)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: Ukey2ClientInit): Unit {
        writer.writeBytes(value.unknownFields)
        ProtoAdapter.STRING.encodeWithTag(writer, 4, value.next_protocol)
        CipherCommitment.ADAPTER.asRepeated().encodeWithTag(writer, 3, value.cipher_commitments)
        ProtoAdapter.BYTES.encodeWithTag(writer, 2, value.random)
        ProtoAdapter.INT32.encodeWithTag(writer, 1, value.version)
      }

      public override fun decode(reader: ProtoReader): Ukey2ClientInit {
        var version: Int? = null
        var random: ByteString? = null
        val cipher_commitments = mutableListOf()
        var next_protocol: String? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> version = ProtoAdapter.INT32.decode(reader)
            2 -> random = ProtoAdapter.BYTES.decode(reader)
            3 -> cipher_commitments.add(CipherCommitment.ADAPTER.decode(reader))
            4 -> next_protocol = ProtoAdapter.STRING.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return Ukey2ClientInit(
          version = version,
          random = random,
          cipher_commitments = cipher_commitments,
          next_protocol = next_protocol,
          unknownFields = unknownFields
        )
      }

      public override fun redact(`value`: Ukey2ClientInit): Ukey2ClientInit = value.copy(
        cipher_commitments = value.cipher_commitments.redactElements(CipherCommitment.ADAPTER),
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }

  /**
   * One commitment (hash of ClientFinished containing public key) per supported
   * cipher
   */
  public class CipherCommitment(
    @field:WireField(
      tag = 1,
      adapter = "com.google.security.cryptauth.lib.securegcm.Ukey2HandshakeCipher#ADAPTER",
    )
    public val handshake_cipher: Ukey2HandshakeCipher? = null,
    @field:WireField(
      tag = 2,
      adapter = "com.squareup.wire.ProtoAdapter#BYTES",
    )
    public val commitment: ByteString? = null,
    unknownFields: ByteString = ByteString.EMPTY,
  ) : Message(ADAPTER, unknownFields) {
    @Deprecated(
      message = "Shouldn't be used in Kotlin",
      level = DeprecationLevel.HIDDEN,
    )
    public override fun newBuilder(): Nothing = throw
        AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")

    public override fun equals(other: Any?): Boolean {
      if (other === this) return true
      if (other !is CipherCommitment) return false
      if (unknownFields != other.unknownFields) return false
      if (handshake_cipher != other.handshake_cipher) return false
      if (commitment != other.commitment) return false
      return true
    }

    public override fun hashCode(): Int {
      var result = super.hashCode
      if (result == 0) {
        result = unknownFields.hashCode()
        result = result * 37 + (handshake_cipher?.hashCode() ?: 0)
        result = result * 37 + (commitment?.hashCode() ?: 0)
        super.hashCode = result
      }
      return result
    }

    public override fun toString(): String {
      val result = mutableListOf()
      if (handshake_cipher != null) result += """handshake_cipher=$handshake_cipher"""
      if (commitment != null) result += """commitment=$commitment"""
      return result.joinToString(prefix = "CipherCommitment{", separator = ", ", postfix = "}")
    }

    public fun copy(
      handshake_cipher: Ukey2HandshakeCipher? = this.handshake_cipher,
      commitment: ByteString? = this.commitment,
      unknownFields: ByteString = this.unknownFields,
    ): CipherCommitment = CipherCommitment(handshake_cipher, commitment, unknownFields)

    public companion object {
      public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
        FieldEncoding.LENGTH_DELIMITED, 
        CipherCommitment::class, 
        "type.googleapis.com/securegcm.Ukey2ClientInit.CipherCommitment", 
        PROTO_2, 
        null, 
        "ukey.proto"
      ) {
        public override fun encodedSize(`value`: CipherCommitment): Int {
          var size = value.unknownFields.size
          size += Ukey2HandshakeCipher.ADAPTER.encodedSizeWithTag(1, value.handshake_cipher)
          size += ProtoAdapter.BYTES.encodedSizeWithTag(2, value.commitment)
          return size
        }

        public override fun encode(writer: ProtoWriter, `value`: CipherCommitment): Unit {
          Ukey2HandshakeCipher.ADAPTER.encodeWithTag(writer, 1, value.handshake_cipher)
          ProtoAdapter.BYTES.encodeWithTag(writer, 2, value.commitment)
          writer.writeBytes(value.unknownFields)
        }

        public override fun encode(writer: ReverseProtoWriter, `value`: CipherCommitment): Unit {
          writer.writeBytes(value.unknownFields)
          ProtoAdapter.BYTES.encodeWithTag(writer, 2, value.commitment)
          Ukey2HandshakeCipher.ADAPTER.encodeWithTag(writer, 1, value.handshake_cipher)
        }

        public override fun decode(reader: ProtoReader): CipherCommitment {
          var handshake_cipher: Ukey2HandshakeCipher? = null
          var commitment: ByteString? = null
          val unknownFields = reader.forEachTag { tag ->
            when (tag) {
              1 -> try {
                handshake_cipher = Ukey2HandshakeCipher.ADAPTER.decode(reader)
              } catch (e: ProtoAdapter.EnumConstantNotFoundException) {
                reader.addUnknownField(tag, FieldEncoding.VARINT, e.value.toLong())
              }
              2 -> commitment = ProtoAdapter.BYTES.decode(reader)
              else -> reader.readUnknownField(tag)
            }
          }
          return CipherCommitment(
            handshake_cipher = handshake_cipher,
            commitment = commitment,
            unknownFields = unknownFields
          )
        }

        public override fun redact(`value`: CipherCommitment): CipherCommitment = value.copy(
          unknownFields = ByteString.EMPTY
        )
      }

      private const val serialVersionUID: Long = 0L
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy