Skip to content

Commit

Permalink
add getECPrviateKey method
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungBaeJeon committed Sep 4, 2020
1 parent ba8cdd1 commit 2d7ebf7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/java/com/metadium/did/crypto/MetadiumKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.math.BigInteger;
import java.security.InvalidAlgorithmParameterException;
import java.security.SignatureException;
import java.security.interfaces.ECPrivateKey;

import org.web3j.crypto.ECKeyPair;
import org.web3j.crypto.Keys;
Expand Down Expand Up @@ -53,4 +54,8 @@ public BigInteger getPublicKey() {
public BigInteger getPrivateKey() {
return ecKeyPair.getPrivateKey();
}

public ECPrivateKey getECPrivateKey() {
return ECKeyUtils.toECPrivateKey(ecKeyPair.getPrivateKey(), "secp256k1");
}
}
2 changes: 1 addition & 1 deletion src/test/java/com/metadium/did/DidTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class DidTest {

@Test
public void testCRUD() throws DidException, InvalidAlgorithmParameterException, ParseException {
MetaDelegator delegator = new MetaDelegator("https://testdelegator.metadium.com", "https://api.metadium.com/dev");
MetaDelegator delegator = new MetaDelegator("https://testdelegator.metadium.com", "https://testdelegator.metadium.com");

// Create did
MetadiumWallet wallet = MetadiumWallet.createDid(delegator);
Expand Down

0 comments on commit 2d7ebf7

Please sign in to comment.