Interface WalletExtension


public interface WalletExtension

An object implementing this interface can be added to a Wallet and provide arbitrary byte arrays that will be serialized alongside the wallet. Extensions can be mandatory, in which case applications that don't know how to read the given data will refuse to load the wallet at all. Extensions identify themselves with a string ID that should use a Java-style reverse DNS identifier to avoid being mixed up with other kinds of extension. To use an extension, add an object that implements this interface to the wallet using Wallet.addExtension(WalletExtension) before you load it (to read existing data) and ensure it's present when the wallet is save (to write the data).

Note that extensions are singletons - you cannot add two objects that provide the same ID to the same wallet.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deserializeWalletExtension(Wallet containingWallet, byte[] data)
    Loads the contents of this object from the wallet.
    Returns a Java package/class style name used to disambiguate this extension from others.
    boolean
    If this returns true, the mandatory flag is set when the wallet is serialized and attempts to load it without the extension being in the wallet will throw an exception.
    byte[]
    Returns bytes that will be saved in the wallet.
  • Method Details

    • getWalletExtensionID

      String getWalletExtensionID()
      Returns a Java package/class style name used to disambiguate this extension from others.
    • isWalletExtensionMandatory

      boolean isWalletExtensionMandatory()
      If this returns true, the mandatory flag is set when the wallet is serialized and attempts to load it without the extension being in the wallet will throw an exception. This method should not change its result during the objects lifetime.
    • serializeWalletExtension

      byte[] serializeWalletExtension()
      Returns bytes that will be saved in the wallet.
    • deserializeWalletExtension

      void deserializeWalletExtension(Wallet containingWallet, byte[] data) throws Exception
      Loads the contents of this object from the wallet.
      Throws:
      Exception