Skip to content

Commit

Permalink
renaming vars in private calendar calls
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed May 29, 2018
1 parent 5f837c2 commit 0beffb1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ target/
.DS_Store
settings.xml
deploy.sh
signature.key
signature.wif
key.wif
/.settings/
/.classpath
/.project
1 change: 1 addition & 0 deletions key.wif
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api.eternitywall.com = KwT2r9sL4DeP4UBCmyh1uChRmcDS43d3yjPRoPgFJhmDtSm2DfkM
18 changes: 9 additions & 9 deletions src/test/java/com/eternitywall/TestCalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public void TestSingle() throws Exception {
@Test
public void TestPrivate() throws Exception {
byte[] digest = Utils.randBytes(32);
Path path = Paths.get("signature.key");
Path path = Paths.get("key.wif");
if(!Files.exists(path)){
assertTrue(true);
return;
}

Properties properties = new Properties();
properties.load(new FileInputStream("signature.key"));
properties.load(new FileInputStream("key.wif"));
HashMap<String,String> privateUrls = new HashMap<>();
for(String key : properties.stringPropertyNames()) {
String value = properties.getProperty(key);
Expand All @@ -61,15 +61,15 @@ public void TestPrivate() throws Exception {

for(Map.Entry<String, String> entry : privateUrls.entrySet()) {
String calendarUrl = "https://"+entry.getKey();
String signature = entry.getValue();
String wifKey = entry.getValue();

Calendar calendar = new Calendar(calendarUrl);
ECKey key;
try {
BigInteger privKey = new BigInteger(signature);
BigInteger privKey = new BigInteger(wifKey);
key = ECKey.fromPrivate(privKey);
}catch (Exception e){
DumpedPrivateKey dumpedPrivateKey = new DumpedPrivateKey(NetworkParameters.prodNet(), signature);
DumpedPrivateKey dumpedPrivateKey = new DumpedPrivateKey(NetworkParameters.prodNet(), wifKey);
key = dumpedPrivateKey.getKey();
}
calendar.setKey(key);
Expand All @@ -83,14 +83,14 @@ public void TestPrivate() throws Exception {
@Test
public void TestPrivateWif() throws Exception {
byte[] digest = Utils.randBytes(32);
Path path = Paths.get("signature.wif");
Path path = Paths.get("key.wif");
if(!Files.exists(path)){
assertTrue(true);
return;
}

Properties properties = new Properties();
properties.load(new FileInputStream("signature.wif"));
properties.load(new FileInputStream("key.wif"));
HashMap<String,String> privateUrls = new HashMap<>();
for(String key : properties.stringPropertyNames()) {
String value = properties.getProperty(key);
Expand All @@ -100,11 +100,11 @@ public void TestPrivateWif() throws Exception {

for(Map.Entry<String, String> entry : privateUrls.entrySet()) {
String calendarUrl = "https://"+entry.getKey();
String signature = entry.getValue();
String wifKey = entry.getValue();

Calendar calendar = new Calendar(calendarUrl);
ECKey key;
DumpedPrivateKey dumpedPrivateKey = new DumpedPrivateKey(NetworkParameters.prodNet(), signature);
DumpedPrivateKey dumpedPrivateKey = new DumpedPrivateKey(NetworkParameters.prodNet(), wifKey);
key = dumpedPrivateKey.getKey();
calendar.setKey(key);
Timestamp timestamp = calendar.submit(digest);
Expand Down

0 comments on commit 0beffb1

Please sign in to comment.