A KeyBag is simply an object that can map public keys, their 160-bit hashes and script hashes to ECKey and RedeemData objects.
| 26 | * and {@link RedeemData} objects. |
| 27 | */ |
| 28 | public interface KeyBag { |
| 29 | /** |
| 30 | * Locates a keypair from the keychain given the hash of the public key, and (optionally) by usage for a specific |
| 31 | * script type. This is needed when finding out which key we need to use to redeem a transaction output. |
| 32 | * |
| 33 | * @param pubKeyHash |
| 34 | * hash of the keypair to look for |
| 35 | * @param scriptType |
| 36 | * only look for given usage (currently {@link ScriptType#P2PKH} or |
| 37 | * {@link ScriptType#P2WPKH}) or {@code null} if we don't care |
| 38 | * @return found key or null if no such key was found. |
| 39 | */ |
| 40 | @Nullable |
| 41 | ECKey findKeyFromPubKeyHash(byte[] pubKeyHash, @Nullable ScriptType scriptType); |
| 42 | |
| 43 | /** |
| 44 | * Locates a keypair from the keychain given the raw public key bytes. |
| 45 | * |
| 46 | * @return ECKey or null if no such key was found. |
| 47 | */ |
| 48 | @Nullable |
| 49 | ECKey findKeyFromPubKey(byte[] pubKey); |
| 50 | |
| 51 | /** |
| 52 | * Locates a redeem data (redeem script and keys) from the keychain given the hash of the script. |
| 53 | * This is needed when finding out which key and script we need to use to locally sign a P2SH transaction input. |
| 54 | * It is assumed that wallet should not have more than one private key for a single P2SH tx for security reasons. |
| 55 | * |
| 56 | * Returns RedeemData object or null if no such data was found. |
| 57 | */ |
| 58 | @Nullable |
| 59 | RedeemData findRedeemDataFromScriptHash(byte[] scriptHash); |
| 60 | |
| 61 | } |
no outgoing calls
no test coverage detected