Class CryptoJDK.XPub
java.lang.Object
com.barbantfintech.tools.common.cryptojdk.CryptoJDK.XPub
- Enclosing class:
CryptoJDK
Facilitates operations involving extended public keys (xPub), including the generation and validation of xPubs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
generate
(@NonNull Network network, @NonNull AddressType addrType, @NonNull String mnemonic) Generates an extended public key (xPub) based on the provided network, address type, and mnemonic phrase.static String
generate
(@NonNull Network network, @NonNull AddressType addrType, @NonNull String mnemonic, String passphrase) Generates an extended public key (xPub) based on the provided network, address type, mnemonic phrase, and an optional passphrase.static boolean
Validates an extended public key (xPub) to ensure its correctness and usability.
-
Constructor Details
-
Method Details
-
generate
public static String generate(@NonNull @NonNull Network network, @NonNull @NonNull AddressType addrType, @NonNull @NonNull String mnemonic) throws CryptoJDKException Generates an extended public key (xPub) based on the provided network, address type, and mnemonic phrase.- Parameters:
network
- The blockchain network for which the xPub is generated (e.g., Bitcoin, Ethereum).addrType
- The type of address (e.g., Legacy, SegWit) to generate the xPub for.mnemonic
- The mnemonic phrase used to derive the xPub.- Returns:
- A String representing the extended public key.
- Throws:
CryptoJDKException
- if any of the method parameters are invalid or if the internal validation of the generated xPub fails.
-
generate
public static String generate(@NonNull @NonNull Network network, @NonNull @NonNull AddressType addrType, @NonNull @NonNull String mnemonic, String passphrase) throws CryptoJDKException Generates an extended public key (xPub) based on the provided network, address type, mnemonic phrase, and an optional passphrase.- Parameters:
network
- The blockchain network for which the xPub is generated (e.g., Bitcoin, Ethereum).addrType
- The type of address (e.g., Legacy, SegWit) to generate the xPub for.mnemonic
- The mnemonic phrase used to derive the xPub.passphrase
- An optional passphrase to further randomize the generated xPub.- Returns:
- A String representing the extended public key.
- Throws:
CryptoJDKException
- if any of the method parameters are invalid or if the internal validation of the generated xPub fails.
-
validate
Validates an extended public key (xPub) to ensure its correctness and usability.- Parameters:
xPub
- The extended public key to be validated.- Returns:
true
if the xPub is valid, otherwisefalse
.
-