@Test(timeout = 3000) public void testCreateIdentity() { Identity.createIdentity("xyz", SampleKey.PASSWORD, SampleKey.PASSWORD_HINT, Network.TESTNET, Metadata.NONE); Identity identity = Identity.getCurrentIdentity(); Assert.assertNotNull("Should has identifier", identity.getIdentifier()); Assert.assertNotNull("Should has ipfs id", identity.getIpfsId()); Assert.assertEquals("Should has two wallet", 2, identity.getWallets().size()); Wallet ethereumWallet = identity.getWallets().get(0); Assert.assertEquals("First Wallet should be ethereum wallet", ChainType.ETHEREUM, ethereumWallet.getMetadata().getChainType()); Wallet bitcoinWallet = identity.getWallets().get(1); Assert.assertEquals("Second Wallet should be Bitcoin wallet", ChainType.BITCOIN, bitcoinWallet.getMetadata().getChainType()); Assert.assertFalse("Bitcoin wallet should be in testnet", bitcoinWallet.getMetadata().isMainNet()); identity.deleteIdentity(SampleKey.PASSWORD); }
public static Identity createIdentity(String name, String password, String passwordHit, String network, String segWit) { List<String> mnemonicCodes = MnemonicUtil.randomMnemonicCodes(); Metadata metadata = new Metadata(); metadata.setName(name); metadata.setPasswordHint(passwordHit); metadata.setSource(Metadata.FROM_NEW_IDENTITY); metadata.setNetwork(network); metadata.setSegWit(segWit); Identity identity = new Identity(metadata, mnemonicCodes, password); currentIdentity = identity; return identity; }
Identity { public static Identity createIdentity(String name, String password, String passwordHit, String network, String segWit) { List<String> mnemonicCodes = MnemonicUtil.randomMnemonicCodes(); Metadata metadata = new Metadata(); metadata.setName(name); metadata.setPasswordHint(passwordHit); metadata.setSource(Metadata.FROM_NEW_IDENTITY); metadata.setNetwork(network); metadata.setSegWit(segWit); Identity identity = new Identity(metadata, mnemonicCodes, password); currentIdentity = identity; return identity; } }
Identity { public static Identity createIdentity(String name, String password, String passwordHit, String network, String segWit) { List<String> mnemonicCodes = MnemonicUtil.randomMnemonicCodes(); Metadata metadata = new Metadata(); metadata.setName(name); metadata.setPasswordHint(passwordHit); metadata.setSource(Metadata.FROM_NEW_IDENTITY); metadata.setNetwork(network); metadata.setSegWit(segWit); Identity identity = new Identity(metadata, mnemonicCodes, password); currentIdentity = identity; return identity; } private  Identity(IdentityKeystore keystore); private  Identity(Metadata metadata, List<String> mnemonicCodes, String password); }
Identity { public static Identity createIdentity(String name, String password, String passwordHit, String network, String segWit) { List<String> mnemonicCodes = MnemonicUtil.randomMnemonicCodes(); Metadata metadata = new Metadata(); metadata.setName(name); metadata.setPasswordHint(passwordHit); metadata.setSource(Metadata.FROM_NEW_IDENTITY); metadata.setNetwork(network); metadata.setSegWit(segWit); Identity identity = new Identity(metadata, mnemonicCodes, password); currentIdentity = identity; return identity; } private  Identity(IdentityKeystore keystore); private  Identity(Metadata metadata, List<String> mnemonicCodes, String password); String getIdentifier(); String getIpfsId(); List<Wallet> getWallets(); Metadata getMetadata(); static Identity getCurrentIdentity(); static Identity createIdentity(String name, String password, String passwordHit, String network, String segWit); static Identity recoverIdentity(String mnemonic, String name, String password,
                                         String passwordHit, String network, String segWit); void deleteIdentity(String password); String exportIdentity(String password); void addWallet(Wallet wallet); List<Wallet> deriveWallets(List<String> chainTypes, String password); String encryptDataToIPFS(String originData); String decryptDataFromIPFS(String encryptedData); String signAuthenticationMessage(int accessTime, String deviceToken, String password); }
Identity { public static Identity createIdentity(String name, String password, String passwordHit, String network, String segWit) { List<String> mnemonicCodes = MnemonicUtil.randomMnemonicCodes(); Metadata metadata = new Metadata(); metadata.setName(name); metadata.setPasswordHint(passwordHit); metadata.setSource(Metadata.FROM_NEW_IDENTITY); metadata.setNetwork(network); metadata.setSegWit(segWit); Identity identity = new Identity(metadata, mnemonicCodes, password); currentIdentity = identity; return identity; } private  Identity(IdentityKeystore keystore); private  Identity(Metadata metadata, List<String> mnemonicCodes, String password); String getIdentifier(); String getIpfsId(); List<Wallet> getWallets(); Metadata getMetadata(); static Identity getCurrentIdentity(); static Identity createIdentity(String name, String password, String passwordHit, String network, String segWit); static Identity recoverIdentity(String mnemonic, String name, String password,
                                         String passwordHit, String network, String segWit); void deleteIdentity(String password); String exportIdentity(String password); void addWallet(Wallet wallet); List<Wallet> deriveWallets(List<String> chainTypes, String password); String encryptDataToIPFS(String originData); String decryptDataFromIPFS(String encryptedData); String signAuthenticationMessage(int accessTime, String deviceToken, String password); static Identity currentIdentity; static final String TAG; }