Skip to content

Commit 63648d5

Browse files
author
Nicolas Tallar
committed
Signature validation tool: fix scalastyle and scalafmt
1 parent 6e76301 commit 63648d5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/main/scala/io/iohk/ethereum/crypto/SignatureValidator.scala

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import io.iohk.ethereum.utils.ByteStringUtils
88

99
import scala.util.{Failure, Success, Try}
1010

11+
// scalastyle:off regex
1112
object SignatureValidator extends App with SecureRandomBuilder with JsonMethodsImplicits {
1213

1314
args match {
@@ -19,16 +20,21 @@ object SignatureValidator extends App with SecureRandomBuilder with JsonMethodsI
1920
signature.flatMap(_.publicKey(msg))
2021
} match {
2122
case Failure(exception) =>
22-
System.err.println(s"Can't recover public key from signature [$sig] and msg [$msgHash]: ERROR: ${exception.getMessage}")
23+
System.err.println(
24+
s"Can't recover public key from signature [$sig] and msg [$msgHash]: ERROR: ${exception.getMessage}"
25+
)
2326
sys.exit(1)
2427
case Success(recoveredPk) =>
2528
val publicKey = ByteStringUtils.string2hash(pk)
2629
recoveredPk match {
2730
case Some(pk) =>
28-
if(pk == publicKey) {
29-
System.err.println(s"Recovered public key [${ByteStringUtils.hash2string(pk)}] is the same as given one")
31+
if (pk == publicKey) {
32+
System.err.println(
33+
s"Recovered public key [${ByteStringUtils.hash2string(pk)}] is the same as given one"
34+
)
3035
} else {
31-
System.err.println(s"Recovered public key [${ByteStringUtils.hash2string(pk)}] is different than given [${ByteStringUtils.hash2string(publicKey)}]")
36+
System.err.println(s"Recovered public key [${ByteStringUtils
37+
.hash2string(pk)}] is different than given [${ByteStringUtils.hash2string(publicKey)}]")
3238
sys.exit(1)
3339
}
3440
case None =>
@@ -43,7 +49,9 @@ object SignatureValidator extends App with SecureRandomBuilder with JsonMethodsI
4349
val hashStr = ByteStringUtils.hash2string(ByteString(hash))
4450
val signature = ECDSASignature.sign(hash, keyPair)
4551
val sigStr = ByteStringUtils.hash2string(signature.toBytes)
46-
System.err.println(s"Bad Input. Example usage: [signature-validator publicKey signature message_hash]. Example: [signature-validator $pkStr $sigStr $hashStr]")
52+
System.err.println(
53+
s"Bad Input. Example usage: [signature-validator publicKey signature message_hash]. Example: [signature-validator $pkStr $sigStr $hashStr]"
54+
)
4755
sys.exit(1)
4856
}
4957
}

0 commit comments

Comments
 (0)