public class RoleBasedKeyring extends AbstractKeyring
Constructor and Description |
---|
RoleBasedKeyring(java.lang.String address,
java.util.List<PrivateKey[]> keys)
Creates a RoleBasedKeyring.
|
Modifier and Type | Method and Description |
---|---|
AbstractKeyring |
copy()
Returns a copied RoleBasedKeyring instance.
|
KeyStore |
encrypt(java.lang.String password,
KeyStoreOption options)
Encrypts a keyring and returns a KeyStore.(according to KeyStore V4)
|
PrivateKey[] |
getKeyByRole(int role)
Returns keys by role.
|
java.util.List<PrivateKey[]> |
getKeys()
Getter function of keys
|
java.util.List<java.lang.String[]> |
getPublicKey()
Returns a public key strings.
|
java.util.List<java.lang.String[]> |
getPublicKey(boolean compressed)
Returns a public key strings.
|
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
|
Account |
toAccount(java.util.List<WeightedMultiSigOptions> options)
Returns an instance of Account
|
encrypt, encryptV3, encryptV3, getAddress, getKlaytnWalletKey, isDecoupled, sign, sign
public RoleBasedKeyring(java.lang.String address, java.util.List<PrivateKey[]> keys)
address
- The address of keyring.keys
- The keys to use in RoleBasedKeyring.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 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 AbstractKeyring copy()
copy
in class AbstractKeyring
public java.util.List<java.lang.String[]> getPublicKey()
It returns a public key as a uncompressed format.
public java.util.List<java.lang.String[]> getPublicKey(boolean compressed)
public PrivateKey[] getKeyByRole(int role)
role
- A number indicating the role of the key. You can use `AccountRoleBased.RoleGroup`.public Account toAccount()
public Account toAccount(java.util.List<WeightedMultiSigOptions> options)
options
- The option List that includes 'threshold' and 'weight'. This is only necessary when keyring use multiple private keys.public java.util.List<PrivateKey[]> getKeys()