Skip to content

Commit

Permalink
Refactor ArtifactSignature to use asHex method to return signature
Browse files Browse the repository at this point in the history
 -- Remove SignatureFormatter functional interface
 -- Update SignerForIdentifier
  • Loading branch information
usmansaleem committed Nov 21, 2024
1 parent 96b1a22 commit 159ed01
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
package tech.pegasys.web3signer.signing;

public interface ArtifactSignature {
public interface ArtifactSignature<T> {

/**
* Returns the type of key used to sign the artifact
Expand All @@ -27,4 +27,11 @@ public interface ArtifactSignature {
* @return the signature data in hex format
*/
String asHex();

/**
* Returns the signature data
*
* @return the signature data
*/
T getSignatureData();
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ public interface ArtifactSignerProvider extends Closeable {
* @param consensusPubKey the identifier of the consensus signer
* @return Map of Key Type (BLS, SECP256K1) and corresponding proxy identifiers
*/
default Map<KeyType, Set<String>> getProxyIdentifiers(final String consensusPubKey) {
throw new UnsupportedOperationException("Proxy signers are not supported by this provider");
}
Map<KeyType, Set<String>> getProxyIdentifiers(final String consensusPubKey);

/**
* Add a new signer to the signer provider.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import tech.pegasys.teku.bls.BLSSignature;

public class BlsArtifactSignature implements ArtifactSignature {
public class BlsArtifactSignature implements ArtifactSignature<BLSSignature> {
private final BLSSignature blsSignature;

public BlsArtifactSignature(final BLSSignature blsSignature) {
Expand All @@ -26,6 +26,7 @@ public KeyType getType() {
return KeyType.BLS;
}

@Override
public BLSSignature getSignatureData() {
return blsSignature;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.tuweni.bytes.Bytes32;
import org.web3j.utils.Numeric;

public class SecpArtifactSignature implements ArtifactSignature {
public class SecpArtifactSignature implements ArtifactSignature<Signature> {
private final Signature signature;

public SecpArtifactSignature(final Signature signature) {
Expand All @@ -31,6 +31,7 @@ public KeyType getType() {
return KeyType.SECP256K1;
}

@Override
public Signature getSignatureData() {
return signature;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import tech.pegasys.web3signer.signing.ArtifactSigner;
import tech.pegasys.web3signer.signing.ArtifactSignerProvider;
import tech.pegasys.web3signer.signing.KeyType;

import java.util.HashMap;
import java.util.Map;
Expand Down

0 comments on commit 159ed01

Please sign in to comment.