public class SingleKeyring extends AbstractKeyring
Constructor and Description |
---|
SingleKeyring(java.lang.String address,
PrivateKey key)
Creates a SingleKeyring instance.
|
Modifier and Type | Method and Description |
---|---|
AbstractKeyring |
copy()
Returns a copied SingleKeyring instance.
|
KeyStore |
encrypt(java.lang.String password,
KeyStoreOption options)
Encrypts a keyring and returns a KeyStore.(according to KeyStore V4)
|
KeyStore |
encryptV3(java.lang.String password)
Encrypts a keyring and returns a KeyStore.(according to KeyStore V3)
This function automatically operates SCRYPT KDF Function
|
KeyStore |
encryptV3(java.lang.String password,
KeyStoreOption options)
Encrypts a keyring and returns a KeyStore.(according to KeyStore V3)
|
PrivateKey |
getKey()
Getter function for key
|
PrivateKey |
getKeyByRole(int role)
returns keys by role.
|
java.lang.String |
getKlaytnWalletKey()
Returns a KlaytnWalletKey format
|
java.lang.String |
getPublicKey()
Return a public key strings.
|
java.lang.String |
getPublicKey(boolean compressed)
Return a public key strings.
|
boolean |
isDecoupled()
Returns true if keyring has decoupled key.
|
java.util.List<SignatureData> |
sign(java.lang.String txHash,
int chainId,
int role)
Signs a transaction hash with all keys in specific role group and return signature list.
|
SignatureData |
sign(java.lang.String txHash,
int chainId,
int role,
int index)
Signs a transaction hash with key in specific role group and return signature.
|
MessageSigned |
signMessage(java.lang.String message,
int role)
Signs a hashed data with all key in specific role group and return MessageSigned instance.
|
MessageSigned |
signMessage(java.lang.String message,
int role,
int index)
Signs a hashed data with key in specific role group and return MessageSigned instance.
|
Account |
toAccount()
Returns an instance of Account
|
encrypt, getAddress, sign, sign
public SingleKeyring(java.lang.String address, PrivateKey key)
address
- The address of keyring.key
- The key to use in SingleKeyring.public java.util.List<SignatureData> sign(java.lang.String txHash, int chainId, int role)
sign
in class AbstractKeyring
txHash
- The hash of transaction.chainId
- The chainId specific to the network.role
- A number indicating the role of the key.public SignatureData sign(java.lang.String txHash, int chainId, int role, int index)
sign
in class AbstractKeyring
txHash
- The hash of transaction.chainId
- The chainId specific to the network.role
- A number indicating the role of the key.index
- The index of the key to be used in the specific role group.public MessageSigned signMessage(java.lang.String message, int role)
signMessage
in class AbstractKeyring
message
- The data string to signrole
- A number indicating the role of the keypublic MessageSigned signMessage(java.lang.String message, int role, int index)
signMessage
in class AbstractKeyring
message
- The data string to signrole
- A number indicating the role of the keyindex
- The index of the key to be used in the specific role grouppublic java.lang.String getKlaytnWalletKey()
getKlaytnWalletKey
in class AbstractKeyring
public KeyStore encrypt(java.lang.String password, KeyStoreOption options) throws org.web3j.crypto.CipherException
encrypt
in class AbstractKeyring
password
- The password to be used for encryption. The encrypted in KeyStore can be decrypted with this password.options
- The options to use when encrypt a keyring.org.web3j.crypto.CipherException
public KeyStore encryptV3(java.lang.String password) throws org.web3j.crypto.CipherException
encryptV3
in class AbstractKeyring
password
- The password to be used for encryption. The encrypted in KeyStore can be decrypted with this password.org.web3j.crypto.CipherException
public KeyStore encryptV3(java.lang.String password, KeyStoreOption options) throws org.web3j.crypto.CipherException
encryptV3
in class AbstractKeyring
password
- The password to be used for encryption. The encrypted in KeyStore can be decrypted with this password.options
- The options to use when encrypt a keyring.org.web3j.crypto.CipherException
public boolean isDecoupled()
isDecoupled
in class AbstractKeyring
public AbstractKeyring copy()
copy
in class AbstractKeyring
public Account toAccount()
public java.lang.String getPublicKey()
It returns a public key as a uncompressed format.
public java.lang.String getPublicKey(boolean compressed)
compressed
- Whether in compressed format or not.public PrivateKey getKeyByRole(int role)
role
- A number indicating the role of the key. You can use `AccountRoleBased.RoleGroup`.public PrivateKey getKey()