public class MultipleKeyring extends AbstractKeyring
Constructor and Description |
---|
MultipleKeyring(java.lang.String address,
PrivateKey[] keys)
Creates a MultipleKeyring instance.
|
Modifier and Type | Method and Description |
---|---|
AbstractKeyring |
copy()
Returns a copied MultipleKeyring 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.
|
PrivateKey[] |
getKeys()
Getter function of keys
|
java.lang.String[] |
getPublicKey()
Returns a public key strings.
|
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(WeightedMultiSigOptions options)
Returns an instance of Account
|
encrypt, encryptV3, encryptV3, getAddress, getKlaytnWalletKey, isDecoupled, sign, sign
public MultipleKeyring(java.lang.String address, PrivateKey[] keys)
address
- The address of keyring.keys
- The keys to use in MultipleKeyring.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.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 Account toAccount()
public Account toAccount(WeightedMultiSigOptions options)
options
- The options that includes 'threshold' and 'weight'. This is only necessary when keyring use multiple private keys.public PrivateKey[] getKeys()