public class Keys
extends java.lang.Object
| Constructor and Description |
|---|
Keys() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
addKey(java.lang.String accountName)
addKey method creates a new key in the keystore using the default passphrase
(harmony-one) and the automatically generated mnemonics.
|
static java.lang.String |
addKey(java.lang.String accountName,
java.lang.String passphrase)
addKey method creates a new key in the keystore using the automatically
generated mnemonics.
|
static java.lang.String |
addKey(java.lang.String accountName,
java.lang.String passphrase,
java.lang.String mnemonic)
addKey method creates a new key in the local keystore, but requires
mnemonics.
|
static void |
cleanKeyStore()
cleanKeyStore method clears the local keystore.
|
static java.lang.String |
exportKeyStoreFromAccountName(java.lang.String accountName)
Export the keystore file contents using the provided account name and default
passphrase (harmony-one)
|
static java.lang.String |
exportKeyStoreFromAccountName(java.lang.String accountName,
java.lang.String passphrase)
Export the keystore file contents using the provided account name and
passpharase.
|
static java.lang.String |
exportKeyStoreFromAddress(java.lang.String oneAddress)
Export the keystore file contents using the Harmony one address and default
passphrase.
|
static java.lang.String |
exportKeyStoreFromAddress(java.lang.String oneAddress,
java.lang.String passphrase)
Export the keystore file contents using the Harmony one address and provided
passphrase.
|
static java.lang.String |
exportPrivateKeyFromAccountName(java.lang.String accountName)
Export the secp256k1 private key using the provided account name and default
passphrase.
|
static java.lang.String |
exportPrivateKeyFromAccountName(java.lang.String accountName,
java.lang.String passphrase)
Export the secp256k1 private key using the provided account name and
passphrase.
|
static java.lang.String |
exportPrivateKeyFromAddress(java.lang.String oneAddress)
Export the secp256k1 private key using the provided Harmony one address.
|
static java.lang.String |
exportPrivateKeyFromAddress(java.lang.String oneAddress,
java.lang.String passphrase)
Export the secp256k1 private key using the provided Harmony one address and
passphrase.
|
static java.lang.String |
getKeysLocation()
getKeysLocation method helps with getting the local keystore location where
the keys are stored.
|
static java.lang.String |
importKeyStore(java.lang.String keyFilePath,
java.lang.String accountName)
importKeyStore method imports an existing keystore key using the provides
path and account name, but using the default passphrase (harmony-one).
|
static java.lang.String |
importKeyStore(java.lang.String keyFilePath,
java.lang.String accountName,
java.lang.String passphrase)
importKeyStore method imports an existing keystore key using the provided
path, account name, and passphrase.
|
static java.lang.String |
importPrivateKey(java.lang.String secp256k1PRV,
java.lang.String accountName)
Import an existing keystore key (only accept secp256k1 private keys) and uses
the default passphrase.
|
static java.lang.String |
importPrivateKey(java.lang.String secp256k1PRV,
java.lang.String accountName,
java.lang.String passphrase)
Import an existing keystore key (only accept secp256k1 private keys), account
name, and passphrase
|
static java.util.Map<java.lang.String,java.lang.String> |
listAccounts() |
static boolean |
setAccountName(java.lang.String oneAddress,
java.lang.String accountName)
setAccountName method helps with changing the account name of an already
existing account
|
public static java.lang.String addKey(java.lang.String accountName,
java.lang.String passphrase,
java.lang.String mnemonic)
throws org.web3j.crypto.CipherException,
java.lang.IllegalArgumentException,
java.io.IOException
accountName - passphrase - mnemonic - org.web3j.crypto.CipherExceptionjava.lang.IllegalArgumentExceptionjava.io.IOExceptionpublic static java.lang.String addKey(java.lang.String accountName,
java.lang.String passphrase)
throws org.web3j.crypto.CipherException,
java.lang.IllegalArgumentException,
java.io.IOException
accountName - passphrase - org.web3j.crypto.CipherExceptionjava.lang.IllegalArgumentExceptionjava.io.IOExceptionpublic static java.lang.String addKey(java.lang.String accountName)
throws org.web3j.crypto.CipherException,
java.lang.IllegalArgumentException,
java.io.IOException
accountName - org.web3j.crypto.CipherExceptionjava.lang.IllegalArgumentExceptionjava.io.IOExceptionpublic static java.lang.String importKeyStore(java.lang.String keyFilePath,
java.lang.String accountName)
throws org.web3j.crypto.CipherException,
java.lang.IllegalArgumentException,
java.io.IOException
keyFilePath - absolute path to key store fileaccountName - org.web3j.crypto.CipherExceptionjava.lang.IllegalArgumentExceptionjava.io.IOExceptionpublic static java.lang.String importKeyStore(java.lang.String keyFilePath,
java.lang.String accountName,
java.lang.String passphrase)
throws org.web3j.crypto.CipherException,
java.lang.IllegalArgumentException,
java.io.IOException
keyFilePath - accountName - passphrase - org.web3j.crypto.CipherExceptionjava.lang.IllegalArgumentExceptionjava.io.IOExceptionpublic static java.lang.String importPrivateKey(java.lang.String secp256k1PRV,
java.lang.String accountName,
java.lang.String passphrase)
throws org.web3j.crypto.CipherException,
java.lang.IllegalArgumentException,
java.io.IOException
secp256k1PRV - accountName - passphrase - org.web3j.crypto.CipherExceptionjava.lang.IllegalArgumentExceptionjava.io.IOExceptionpublic static java.lang.String importPrivateKey(java.lang.String secp256k1PRV,
java.lang.String accountName)
throws org.web3j.crypto.CipherException,
java.lang.IllegalArgumentException,
java.io.IOException
secp256k1PRV - accountName - org.web3j.crypto.CipherExceptionjava.lang.IllegalArgumentExceptionjava.io.IOExceptionpublic static java.lang.String exportPrivateKeyFromAddress(java.lang.String oneAddress,
java.lang.String passphrase)
throws org.web3j.crypto.CipherException,
com.fasterxml.jackson.core.JsonParseException,
com.fasterxml.jackson.databind.JsonMappingException,
java.io.IOException
oneAddress - passphrase - org.web3j.crypto.CipherExceptionjava.io.IOExceptioncom.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonParseExceptionpublic static java.lang.String exportPrivateKeyFromAddress(java.lang.String oneAddress)
throws com.fasterxml.jackson.core.JsonParseException,
com.fasterxml.jackson.databind.JsonMappingException,
org.web3j.crypto.CipherException,
java.io.IOException
oneAddress - java.io.IOExceptionorg.web3j.crypto.CipherExceptioncom.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonParseExceptionpublic static java.lang.String exportPrivateKeyFromAccountName(java.lang.String accountName,
java.lang.String passphrase)
throws org.web3j.crypto.CipherException,
com.fasterxml.jackson.core.JsonParseException,
com.fasterxml.jackson.databind.JsonMappingException,
java.io.IOException
accountName - passphrase - org.web3j.crypto.CipherExceptionjava.io.IOExceptioncom.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonParseExceptionpublic static java.lang.String exportPrivateKeyFromAccountName(java.lang.String accountName)
throws com.fasterxml.jackson.core.JsonParseException,
com.fasterxml.jackson.databind.JsonMappingException,
org.web3j.crypto.CipherException,
java.io.IOException
accountName - java.io.IOExceptionorg.web3j.crypto.CipherExceptioncom.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonParseExceptionpublic static java.lang.String exportKeyStoreFromAddress(java.lang.String oneAddress,
java.lang.String passphrase)
throws com.fasterxml.jackson.core.JsonParseException,
com.fasterxml.jackson.databind.JsonMappingException,
java.io.IOException,
org.web3j.crypto.CipherException
oneAddress - passphrase - java.io.IOExceptioncom.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonParseExceptionorg.web3j.crypto.CipherExceptionpublic static java.lang.String exportKeyStoreFromAddress(java.lang.String oneAddress)
throws com.fasterxml.jackson.core.JsonParseException,
com.fasterxml.jackson.databind.JsonMappingException,
java.io.IOException,
org.web3j.crypto.CipherException
oneAddress - org.web3j.crypto.CipherExceptionjava.io.IOExceptioncom.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonParseExceptionpublic static java.lang.String exportKeyStoreFromAccountName(java.lang.String accountName,
java.lang.String passphrase)
throws com.fasterxml.jackson.core.JsonParseException,
com.fasterxml.jackson.databind.JsonMappingException,
java.io.IOException,
org.web3j.crypto.CipherException
accountName - passphrase - java.io.IOExceptioncom.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonParseExceptionorg.web3j.crypto.CipherExceptionpublic static java.lang.String exportKeyStoreFromAccountName(java.lang.String accountName)
throws com.fasterxml.jackson.core.JsonParseException,
com.fasterxml.jackson.databind.JsonMappingException,
java.io.IOException,
org.web3j.crypto.CipherException
oneAddress - org.web3j.crypto.CipherExceptionjava.io.IOExceptioncom.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonParseExceptionpublic static java.util.Map<java.lang.String,java.lang.String> listAccounts()
public static java.lang.String getKeysLocation()
public static boolean setAccountName(java.lang.String oneAddress,
java.lang.String accountName)
oneAddress - accountName - public static void cleanKeyStore()
throws java.io.IOException
java.io.IOException