View Javadoc
1   package com.syntifi.near.api.model.key;
2   
3   import com.syntifi.crypto.key.AbstractPrivateKey;
4   import com.syntifi.crypto.key.AbstractPublicKey;
5   import org.junit.jupiter.api.BeforeAll;
6   
7   import java.io.IOException;
8   
9   import static com.syntifi.near.api.json.JsonHelper.OBJECT_MAPPER;
10  import static com.syntifi.near.api.json.JsonHelper.loadJsonFromResourceFile;
11  
12  public abstract class AbstractKeyTest {
13      protected static Wallet aliceWallet;
14      protected static Wallet bobWallet;
15  
16      protected static PrivateKey aliceNearPrivateKey;
17      protected static PublicKey aliceNearPublicKey;
18      protected static AbstractPrivateKey alicePrivateKey;
19      protected static AbstractPublicKey alicePublicKey;
20  
21      protected static PrivateKey bobNearPrivateKey;
22      protected static PublicKey bobNearPublicKey;
23      protected static AbstractPrivateKey bobPrivateKey;
24      protected static AbstractPublicKey bobPublicKey;
25  
26      @BeforeAll
27      static void loadKeys() throws IOException {
28          aliceWallet = OBJECT_MAPPER.readValue(loadJsonFromResourceFile("testnet-wallets/alice.json"), Wallet.class);
29          bobWallet = OBJECT_MAPPER.readValue(loadJsonFromResourceFile("testnet-wallets/bob.json"), Wallet.class);
30  
31          aliceNearPrivateKey = aliceWallet.getPrivateKey();
32          aliceNearPublicKey = aliceWallet.getPublicKey();
33          alicePrivateKey = aliceNearPrivateKey.getPrivateKey();
34          alicePublicKey = aliceNearPublicKey.getPublicKey();
35  
36          bobNearPrivateKey = bobWallet.getPrivateKey();
37          bobNearPublicKey = bobWallet.getPublicKey();
38          bobPrivateKey = bobNearPrivateKey.getPrivateKey();
39          bobPublicKey = bobNearPublicKey.getPublicKey();
40      }
41  }