Skip to content

Commit

Permalink
Log errors in sr25519 utils (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
ablax authored Dec 15, 2023
1 parent 35bbc1a commit b4fde01
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/limechain/utils/Sr25519Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
import io.emeraldpay.polkaj.schnorrkel.Schnorrkel;
import io.emeraldpay.polkaj.schnorrkel.SchnorrkelException;
import lombok.experimental.UtilityClass;
import lombok.extern.java.Log;
import org.web3j.crypto.MnemonicUtils;

import java.util.logging.Level;

@UtilityClass
@Log
public class Sr25519Utils {

/**
Expand Down Expand Up @@ -57,6 +61,7 @@ public static byte[] signMessage(final byte[] publicKey, final byte[] privateKey
try {
return Schnorrkel.getInstance().sign(message, keyPair);
} catch (SchnorrkelException e) {
log.log(Level.WARNING, e.getMessage(), e);
return null;
}
}
Expand All @@ -72,6 +77,7 @@ public static boolean verifySignature(final VerifySignature signature) {
Schnorrkel.PublicKey publicKey = new Schnorrkel.PublicKey(signature.getPublicKeyData());
return schnorrkel.verify(signature.getSignatureData(), signature.getMessageData(), publicKey);
} catch (SchnorrkelException e) {
log.log(Level.WARNING, e.getMessage(), e);
return false;
}
}
Expand Down

0 comments on commit b4fde01

Please sign in to comment.