Class CryptoJDK.XPub

java.lang.Object
com.barbantfintech.tools.common.cryptojdk.CryptoJDK.XPub
Enclosing class:
CryptoJDK

public static class CryptoJDK.XPub extends Object
Facilitates operations involving extended public keys (xPub), including the generation and validation of xPubs.
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
     
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    static 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
    validate(@NonNull Network network, @NonNull String xPub)
    Validates an extended public key (xPub) to ensure its correctness and usability.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details Link icon

    • XPub Link icon

      public XPub()
  • Method Details Link icon

    • generate Link icon

      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 Link icon

      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 Link icon

      public static boolean validate(@NonNull @NonNull Network network, @NonNull @NonNull String xPub)
      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, otherwise false.