This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 735
/
step4.java
30 lines (24 loc) · 1.56 KB
/
step4.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
System.out.println("\n13. Reading new Verkey from wallet\n");
String trustAnchorVerkeyFromWallet = Did.keyForLocalDid(walletHandle, trustAnchorDID).get();
System.out.println("\n14. Building GET_NYM request to get Trust Anchor from Verkey\n");
String getNymRequest = buildGetNymRequest(trustAnchorDID, trustAnchorDID).get();
System.out.println("GET_NYM request:\n" + getNymRequest);
System.out.println("\n15. Sending GET_NYM request to ledger\n");
String getNymResponse = submitRequest(pool, getNymRequest).get();
System.out.println("GET_NYM response:\n" + getNymResponse);
System.out.println("\n16. Comparing Trust Anchor verkeys\n");
System.out.println("Written by Steward: " + trustAnchorDID);
System.out.println("Current from wallet: " + trustAnchorVerkeyFromWallet);
String responseData = new JSONObject(getNymResponse).getJSONObject("result").getString("data");
String trustAnchorVerkeyFromLedger = new JSONObject(responseData).getString("verkey");
System.out.println("Current from ledger: " + trustAnchorVerkeyFromLedger);
boolean match = !trustAnchorDID.equals(trustAnchorVerkeyFromWallet) && trustAnchorVerkeyFromWallet.equals(trustAnchorVerkeyFromLedger);
System.out.println("Matching: " + match);
// Do some cleanup.
System.out.println("\n17. Close and delete wallet\n");
walletHandle.closeWallet().get();
Wallet.deleteWallet(walletName, null).get();
System.out.println("\n18. Close pool\n");
pool.closePoolLedger().get();
System.out.println("\n19. Delete pool ledger config\n");
Pool.deletePoolLedgerConfig(poolName).get();