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

signrpc.MuSig2SessionRequest.scala Maven / Gradle / Ivy

The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package signrpc

/** @param keyLoc
  *  
  *  The key locator that identifies which key to use for signing.
  * @param allSignerPubkeys
  *  
  *  A list of all public keys (serialized in 32-byte x-only format for v0.4.0
  *  and 33-byte compressed format for v1.0.0rc2!) participating in the signing
  *  session. The list will always be sorted lexicographically internally. This
  *  must include the local key which is described by the above key_loc.
  * @param otherSignerPublicNonces
  *  
  *  An optional list of all public nonces of other signing participants that
  *  might already be known.
  * @param tweaks
  *  
  *  A series of optional generic tweaks to be applied to the the aggregated
  *  public key.
  * @param taprootTweak
  *  
  *  An optional taproot specific tweak that must be specified if the MuSig2
  *  combined key will be used as the main taproot key of a taproot output
  *  on-chain.
  * @param version
  *  
  *  The mandatory version of the MuSig2 BIP draft to use. This is necessary to
  *  differentiate between the changes that were made to the BIP while this
  *  experimental RPC was already released. Some of those changes affect how the
  *  combined key and nonces are created.
  * @param pregeneratedLocalNonce
  *  
  *  A set of pre generated secret local nonces to use in the musig2 session.
  *  This field is optional. This can be useful for protocols that need to send
  *  nonces ahead of time before the set of signer keys are known. This value
  *  MUST be 97 bytes and be the concatenation of two CSPRNG generated 32 byte
  *  values and local public key used for signing as specified in the key_loc
  *  field.
  */
@SerialVersionUID(0L)
final case class MuSig2SessionRequest(
    keyLoc: _root_.scala.Option[signrpc.KeyLocator] = _root_.scala.None,
    allSignerPubkeys: _root_.scala.Seq[_root_.com.google.protobuf.ByteString] = _root_.scala.Seq.empty,
    otherSignerPublicNonces: _root_.scala.Seq[_root_.com.google.protobuf.ByteString] = _root_.scala.Seq.empty,
    tweaks: _root_.scala.Seq[signrpc.TweakDesc] = _root_.scala.Seq.empty,
    taprootTweak: _root_.scala.Option[signrpc.TaprootTweakDesc] = _root_.scala.None,
    version: signrpc.MuSig2Version = signrpc.MuSig2Version.MUSIG2_VERSION_UNDEFINED,
    pregeneratedLocalNonce: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MuSig2SessionRequest] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (keyLoc.isDefined) {
        val __value = keyLoc.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      allSignerPubkeys.foreach { __item =>
        val __value = __item
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value)
      }
      otherSignerPublicNonces.foreach { __item =>
        val __value = __item
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(3, __value)
      }
      tweaks.foreach { __item =>
        val __value = __item
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      }
      if (taprootTweak.isDefined) {
        val __value = taprootTweak.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = version.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(6, __value)
        }
      };
      
      {
        val __value = pregeneratedLocalNonce
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(7, __value)
        }
      };
      __size += unknownFields.serializedSize
      __size
    }
    override def serializedSize: _root_.scala.Int = {
      var __size = __serializedSizeMemoized
      if (__size == 0) {
        __size = __computeSerializedSize() + 1
        __serializedSizeMemoized = __size
      }
      __size - 1
      
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      keyLoc.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      allSignerPubkeys.foreach { __v =>
        val __m = __v
        _output__.writeBytes(2, __m)
      };
      otherSignerPublicNonces.foreach { __v =>
        val __m = __v
        _output__.writeBytes(3, __m)
      };
      tweaks.foreach { __v =>
        val __m = __v
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      taprootTweak.foreach { __v =>
        val __m = __v
        _output__.writeTag(5, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = version.value
        if (__v != 0) {
          _output__.writeEnum(6, __v)
        }
      };
      {
        val __v = pregeneratedLocalNonce
        if (!__v.isEmpty) {
          _output__.writeBytes(7, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def getKeyLoc: signrpc.KeyLocator = keyLoc.getOrElse(signrpc.KeyLocator.defaultInstance)
    def clearKeyLoc: MuSig2SessionRequest = copy(keyLoc = _root_.scala.None)
    def withKeyLoc(__v: signrpc.KeyLocator): MuSig2SessionRequest = copy(keyLoc = Option(__v))
    def clearAllSignerPubkeys = copy(allSignerPubkeys = _root_.scala.Seq.empty)
    def addAllSignerPubkeys(__vs: _root_.com.google.protobuf.ByteString *): MuSig2SessionRequest = addAllAllSignerPubkeys(__vs)
    def addAllAllSignerPubkeys(__vs: Iterable[_root_.com.google.protobuf.ByteString]): MuSig2SessionRequest = copy(allSignerPubkeys = allSignerPubkeys ++ __vs)
    def withAllSignerPubkeys(__v: _root_.scala.Seq[_root_.com.google.protobuf.ByteString]): MuSig2SessionRequest = copy(allSignerPubkeys = __v)
    def clearOtherSignerPublicNonces = copy(otherSignerPublicNonces = _root_.scala.Seq.empty)
    def addOtherSignerPublicNonces(__vs: _root_.com.google.protobuf.ByteString *): MuSig2SessionRequest = addAllOtherSignerPublicNonces(__vs)
    def addAllOtherSignerPublicNonces(__vs: Iterable[_root_.com.google.protobuf.ByteString]): MuSig2SessionRequest = copy(otherSignerPublicNonces = otherSignerPublicNonces ++ __vs)
    def withOtherSignerPublicNonces(__v: _root_.scala.Seq[_root_.com.google.protobuf.ByteString]): MuSig2SessionRequest = copy(otherSignerPublicNonces = __v)
    def clearTweaks = copy(tweaks = _root_.scala.Seq.empty)
    def addTweaks(__vs: signrpc.TweakDesc *): MuSig2SessionRequest = addAllTweaks(__vs)
    def addAllTweaks(__vs: Iterable[signrpc.TweakDesc]): MuSig2SessionRequest = copy(tweaks = tweaks ++ __vs)
    def withTweaks(__v: _root_.scala.Seq[signrpc.TweakDesc]): MuSig2SessionRequest = copy(tweaks = __v)
    def getTaprootTweak: signrpc.TaprootTweakDesc = taprootTweak.getOrElse(signrpc.TaprootTweakDesc.defaultInstance)
    def clearTaprootTweak: MuSig2SessionRequest = copy(taprootTweak = _root_.scala.None)
    def withTaprootTweak(__v: signrpc.TaprootTweakDesc): MuSig2SessionRequest = copy(taprootTweak = Option(__v))
    def withVersion(__v: signrpc.MuSig2Version): MuSig2SessionRequest = copy(version = __v)
    def withPregeneratedLocalNonce(__v: _root_.com.google.protobuf.ByteString): MuSig2SessionRequest = copy(pregeneratedLocalNonce = __v)
    def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
    def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => keyLoc.orNull
        case 2 => allSignerPubkeys
        case 3 => otherSignerPublicNonces
        case 4 => tweaks
        case 5 => taprootTweak.orNull
        case 6 => {
          val __t = version.javaValueDescriptor
          if (__t.getNumber() != 0) __t else null
        }
        case 7 => {
          val __t = pregeneratedLocalNonce
          if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null
        }
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => keyLoc.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => _root_.scalapb.descriptors.PRepeated(allSignerPubkeys.iterator.map(_root_.scalapb.descriptors.PByteString(_)).toVector)
        case 3 => _root_.scalapb.descriptors.PRepeated(otherSignerPublicNonces.iterator.map(_root_.scalapb.descriptors.PByteString(_)).toVector)
        case 4 => _root_.scalapb.descriptors.PRepeated(tweaks.iterator.map(_.toPMessage).toVector)
        case 5 => taprootTweak.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 6 => _root_.scalapb.descriptors.PEnum(version.scalaValueDescriptor)
        case 7 => _root_.scalapb.descriptors.PByteString(pregeneratedLocalNonce)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: signrpc.MuSig2SessionRequest.type = signrpc.MuSig2SessionRequest
    // @@protoc_insertion_point(GeneratedMessage[signrpc.MuSig2SessionRequest])
}

object MuSig2SessionRequest extends scalapb.GeneratedMessageCompanion[signrpc.MuSig2SessionRequest] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[signrpc.MuSig2SessionRequest] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): signrpc.MuSig2SessionRequest = {
    var __keyLoc: _root_.scala.Option[signrpc.KeyLocator] = _root_.scala.None
    val __allSignerPubkeys: _root_.scala.collection.immutable.VectorBuilder[_root_.com.google.protobuf.ByteString] = new _root_.scala.collection.immutable.VectorBuilder[_root_.com.google.protobuf.ByteString]
    val __otherSignerPublicNonces: _root_.scala.collection.immutable.VectorBuilder[_root_.com.google.protobuf.ByteString] = new _root_.scala.collection.immutable.VectorBuilder[_root_.com.google.protobuf.ByteString]
    val __tweaks: _root_.scala.collection.immutable.VectorBuilder[signrpc.TweakDesc] = new _root_.scala.collection.immutable.VectorBuilder[signrpc.TweakDesc]
    var __taprootTweak: _root_.scala.Option[signrpc.TaprootTweakDesc] = _root_.scala.None
    var __version: signrpc.MuSig2Version = signrpc.MuSig2Version.MUSIG2_VERSION_UNDEFINED
    var __pregeneratedLocalNonce: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __keyLoc = Option(__keyLoc.fold(_root_.scalapb.LiteParser.readMessage[signrpc.KeyLocator](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 18 =>
          __allSignerPubkeys += _input__.readBytes()
        case 26 =>
          __otherSignerPublicNonces += _input__.readBytes()
        case 34 =>
          __tweaks += _root_.scalapb.LiteParser.readMessage[signrpc.TweakDesc](_input__)
        case 42 =>
          __taprootTweak = Option(__taprootTweak.fold(_root_.scalapb.LiteParser.readMessage[signrpc.TaprootTweakDesc](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 48 =>
          __version = signrpc.MuSig2Version.fromValue(_input__.readEnum())
        case 58 =>
          __pregeneratedLocalNonce = _input__.readBytes()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    signrpc.MuSig2SessionRequest(
        keyLoc = __keyLoc,
        allSignerPubkeys = __allSignerPubkeys.result(),
        otherSignerPublicNonces = __otherSignerPublicNonces.result(),
        tweaks = __tweaks.result(),
        taprootTweak = __taprootTweak,
        version = __version,
        pregeneratedLocalNonce = __pregeneratedLocalNonce,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[signrpc.MuSig2SessionRequest] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
      signrpc.MuSig2SessionRequest(
        keyLoc = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[signrpc.KeyLocator]]),
        allSignerPubkeys = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Seq[_root_.com.google.protobuf.ByteString]]).getOrElse(_root_.scala.Seq.empty),
        otherSignerPublicNonces = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[_root_.com.google.protobuf.ByteString]]).getOrElse(_root_.scala.Seq.empty),
        tweaks = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Seq[signrpc.TweakDesc]]).getOrElse(_root_.scala.Seq.empty),
        taprootTweak = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[signrpc.TaprootTweakDesc]]),
        version = signrpc.MuSig2Version.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(signrpc.MuSig2Version.MUSIG2_VERSION_UNDEFINED.scalaValueDescriptor).number),
        pregeneratedLocalNonce = __fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = SignerProto.javaDescriptor.getMessageTypes().get(18)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = SignerProto.scalaDescriptor.messages(18)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = signrpc.KeyLocator
      case 4 => __out = signrpc.TweakDesc
      case 5 => __out = signrpc.TaprootTweakDesc
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = {
    (__fieldNumber: @_root_.scala.unchecked) match {
      case 6 => signrpc.MuSig2Version
    }
  }
  lazy val defaultInstance = signrpc.MuSig2SessionRequest(
    keyLoc = _root_.scala.None,
    allSignerPubkeys = _root_.scala.Seq.empty,
    otherSignerPublicNonces = _root_.scala.Seq.empty,
    tweaks = _root_.scala.Seq.empty,
    taprootTweak = _root_.scala.None,
    version = signrpc.MuSig2Version.MUSIG2_VERSION_UNDEFINED,
    pregeneratedLocalNonce = _root_.com.google.protobuf.ByteString.EMPTY
  )
  implicit class MuSig2SessionRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, signrpc.MuSig2SessionRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, signrpc.MuSig2SessionRequest](_l) {
    def keyLoc: _root_.scalapb.lenses.Lens[UpperPB, signrpc.KeyLocator] = field(_.getKeyLoc)((c_, f_) => c_.copy(keyLoc = Option(f_)))
    def optionalKeyLoc: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[signrpc.KeyLocator]] = field(_.keyLoc)((c_, f_) => c_.copy(keyLoc = f_))
    def allSignerPubkeys: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.com.google.protobuf.ByteString]] = field(_.allSignerPubkeys)((c_, f_) => c_.copy(allSignerPubkeys = f_))
    def otherSignerPublicNonces: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.com.google.protobuf.ByteString]] = field(_.otherSignerPublicNonces)((c_, f_) => c_.copy(otherSignerPublicNonces = f_))
    def tweaks: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[signrpc.TweakDesc]] = field(_.tweaks)((c_, f_) => c_.copy(tweaks = f_))
    def taprootTweak: _root_.scalapb.lenses.Lens[UpperPB, signrpc.TaprootTweakDesc] = field(_.getTaprootTweak)((c_, f_) => c_.copy(taprootTweak = Option(f_)))
    def optionalTaprootTweak: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[signrpc.TaprootTweakDesc]] = field(_.taprootTweak)((c_, f_) => c_.copy(taprootTweak = f_))
    def version: _root_.scalapb.lenses.Lens[UpperPB, signrpc.MuSig2Version] = field(_.version)((c_, f_) => c_.copy(version = f_))
    def pregeneratedLocalNonce: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.pregeneratedLocalNonce)((c_, f_) => c_.copy(pregeneratedLocalNonce = f_))
  }
  final val KEY_LOC_FIELD_NUMBER = 1
  final val ALL_SIGNER_PUBKEYS_FIELD_NUMBER = 2
  final val OTHER_SIGNER_PUBLIC_NONCES_FIELD_NUMBER = 3
  final val TWEAKS_FIELD_NUMBER = 4
  final val TAPROOT_TWEAK_FIELD_NUMBER = 5
  final val VERSION_FIELD_NUMBER = 6
  final val PREGENERATED_LOCAL_NONCE_FIELD_NUMBER = 7
  def of(
    keyLoc: _root_.scala.Option[signrpc.KeyLocator],
    allSignerPubkeys: _root_.scala.Seq[_root_.com.google.protobuf.ByteString],
    otherSignerPublicNonces: _root_.scala.Seq[_root_.com.google.protobuf.ByteString],
    tweaks: _root_.scala.Seq[signrpc.TweakDesc],
    taprootTweak: _root_.scala.Option[signrpc.TaprootTweakDesc],
    version: signrpc.MuSig2Version,
    pregeneratedLocalNonce: _root_.com.google.protobuf.ByteString
  ): _root_.signrpc.MuSig2SessionRequest = _root_.signrpc.MuSig2SessionRequest(
    keyLoc,
    allSignerPubkeys,
    otherSignerPublicNonces,
    tweaks,
    taprootTweak,
    version,
    pregeneratedLocalNonce
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[signrpc.MuSig2SessionRequest])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy