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

signrpc.SignMessageReq.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 msg
  *  
  *  The message to be signed. When using REST, this field must be encoded as
  *  base64.
  * @param keyLoc
  *   The key locator that identifies which key to use for signing.
  * @param doubleHash
  *   Double-SHA256 hash instead of just the default single round.
  * @param compactSig
  *  
  *  Use the compact (pubkey recoverable) format instead of the raw lnwire
  *  format. This option cannot be used with Schnorr signatures.
  * @param schnorrSig
  *  
  *  Use Schnorr signature. This option cannot be used with compact format.
  * @param schnorrSigTapTweak
  *  
  *  The optional Taproot tweak bytes to apply to the private key before creating
  *  a Schnorr signature. The private key is tweaked as described in BIP-341:
  *  privKey + h_tapTweak(internalKey || tapTweak)
  */
@SerialVersionUID(0L)
final case class SignMessageReq(
    msg: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
    keyLoc: _root_.scala.Option[signrpc.KeyLocator] = _root_.scala.None,
    doubleHash: _root_.scala.Boolean = false,
    compactSig: _root_.scala.Boolean = false,
    schnorrSig: _root_.scala.Boolean = false,
    schnorrSigTapTweak: _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[SignMessageReq] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = msg
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(1, __value)
        }
      };
      if (keyLoc.isDefined) {
        val __value = keyLoc.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = doubleHash
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(3, __value)
        }
      };
      
      {
        val __value = compactSig
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(4, __value)
        }
      };
      
      {
        val __value = schnorrSig
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(5, __value)
        }
      };
      
      {
        val __value = schnorrSigTapTweak
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(6, __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 = {
      {
        val __v = msg
        if (!__v.isEmpty) {
          _output__.writeBytes(1, __v)
        }
      };
      keyLoc.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = doubleHash
        if (__v != false) {
          _output__.writeBool(3, __v)
        }
      };
      {
        val __v = compactSig
        if (__v != false) {
          _output__.writeBool(4, __v)
        }
      };
      {
        val __v = schnorrSig
        if (__v != false) {
          _output__.writeBool(5, __v)
        }
      };
      {
        val __v = schnorrSigTapTweak
        if (!__v.isEmpty) {
          _output__.writeBytes(6, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withMsg(__v: _root_.com.google.protobuf.ByteString): SignMessageReq = copy(msg = __v)
    def getKeyLoc: signrpc.KeyLocator = keyLoc.getOrElse(signrpc.KeyLocator.defaultInstance)
    def clearKeyLoc: SignMessageReq = copy(keyLoc = _root_.scala.None)
    def withKeyLoc(__v: signrpc.KeyLocator): SignMessageReq = copy(keyLoc = Option(__v))
    def withDoubleHash(__v: _root_.scala.Boolean): SignMessageReq = copy(doubleHash = __v)
    def withCompactSig(__v: _root_.scala.Boolean): SignMessageReq = copy(compactSig = __v)
    def withSchnorrSig(__v: _root_.scala.Boolean): SignMessageReq = copy(schnorrSig = __v)
    def withSchnorrSigTapTweak(__v: _root_.com.google.protobuf.ByteString): SignMessageReq = copy(schnorrSigTapTweak = __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 => {
          val __t = msg
          if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null
        }
        case 2 => keyLoc.orNull
        case 3 => {
          val __t = doubleHash
          if (__t != false) __t else null
        }
        case 4 => {
          val __t = compactSig
          if (__t != false) __t else null
        }
        case 5 => {
          val __t = schnorrSig
          if (__t != false) __t else null
        }
        case 6 => {
          val __t = schnorrSigTapTweak
          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 => _root_.scalapb.descriptors.PByteString(msg)
        case 2 => keyLoc.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => _root_.scalapb.descriptors.PBoolean(doubleHash)
        case 4 => _root_.scalapb.descriptors.PBoolean(compactSig)
        case 5 => _root_.scalapb.descriptors.PBoolean(schnorrSig)
        case 6 => _root_.scalapb.descriptors.PByteString(schnorrSigTapTweak)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: signrpc.SignMessageReq.type = signrpc.SignMessageReq
    // @@protoc_insertion_point(GeneratedMessage[signrpc.SignMessageReq])
}

object SignMessageReq extends scalapb.GeneratedMessageCompanion[signrpc.SignMessageReq] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[signrpc.SignMessageReq] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): signrpc.SignMessageReq = {
    var __msg: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
    var __keyLoc: _root_.scala.Option[signrpc.KeyLocator] = _root_.scala.None
    var __doubleHash: _root_.scala.Boolean = false
    var __compactSig: _root_.scala.Boolean = false
    var __schnorrSig: _root_.scala.Boolean = false
    var __schnorrSigTapTweak: _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 =>
          __msg = _input__.readBytes()
        case 18 =>
          __keyLoc = Option(__keyLoc.fold(_root_.scalapb.LiteParser.readMessage[signrpc.KeyLocator](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 24 =>
          __doubleHash = _input__.readBool()
        case 32 =>
          __compactSig = _input__.readBool()
        case 40 =>
          __schnorrSig = _input__.readBool()
        case 50 =>
          __schnorrSigTapTweak = _input__.readBytes()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    signrpc.SignMessageReq(
        msg = __msg,
        keyLoc = __keyLoc,
        doubleHash = __doubleHash,
        compactSig = __compactSig,
        schnorrSig = __schnorrSig,
        schnorrSigTapTweak = __schnorrSigTapTweak,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[signrpc.SignMessageReq] = _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.SignMessageReq(
        msg = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY),
        keyLoc = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[signrpc.KeyLocator]]),
        doubleHash = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Boolean]).getOrElse(false),
        compactSig = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Boolean]).getOrElse(false),
        schnorrSig = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Boolean]).getOrElse(false),
        schnorrSigTapTweak = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).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(8)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = SignerProto.scalaDescriptor.messages(8)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = signrpc.KeyLocator
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = signrpc.SignMessageReq(
    msg = _root_.com.google.protobuf.ByteString.EMPTY,
    keyLoc = _root_.scala.None,
    doubleHash = false,
    compactSig = false,
    schnorrSig = false,
    schnorrSigTapTweak = _root_.com.google.protobuf.ByteString.EMPTY
  )
  implicit class SignMessageReqLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, signrpc.SignMessageReq]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, signrpc.SignMessageReq](_l) {
    def msg: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.msg)((c_, f_) => c_.copy(msg = f_))
    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 doubleHash: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.doubleHash)((c_, f_) => c_.copy(doubleHash = f_))
    def compactSig: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.compactSig)((c_, f_) => c_.copy(compactSig = f_))
    def schnorrSig: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.schnorrSig)((c_, f_) => c_.copy(schnorrSig = f_))
    def schnorrSigTapTweak: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.schnorrSigTapTweak)((c_, f_) => c_.copy(schnorrSigTapTweak = f_))
  }
  final val MSG_FIELD_NUMBER = 1
  final val KEY_LOC_FIELD_NUMBER = 2
  final val DOUBLE_HASH_FIELD_NUMBER = 3
  final val COMPACT_SIG_FIELD_NUMBER = 4
  final val SCHNORR_SIG_FIELD_NUMBER = 5
  final val SCHNORR_SIG_TAP_TWEAK_FIELD_NUMBER = 6
  def of(
    msg: _root_.com.google.protobuf.ByteString,
    keyLoc: _root_.scala.Option[signrpc.KeyLocator],
    doubleHash: _root_.scala.Boolean,
    compactSig: _root_.scala.Boolean,
    schnorrSig: _root_.scala.Boolean,
    schnorrSigTapTweak: _root_.com.google.protobuf.ByteString
  ): _root_.signrpc.SignMessageReq = _root_.signrpc.SignMessageReq(
    msg,
    keyLoc,
    doubleHash,
    compactSig,
    schnorrSig,
    schnorrSigTapTweak
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[signrpc.SignMessageReq])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy