MultiBit HDTHE TECHNICAL RECOVERY LIBRARYmail@keychainx.io ↗

MultiBit HD / Technical library

INDEPENDENT KEYCHAINX RESOURCE

WalletSummary: metadata and encrypted credentials

Holds wallet identity, human notes, wallet type and encrypted credential or backup-key fields. Its values connect wallet management with restoration features. Avoid publishing real serialized summaries or debug output merely because some fields are encrypted.

By KeychainX · 20 September 2026 · Source revision 24a12b199a01

Source inspection only. Historical Java code; not executed or security-audited for this publication.

mbhd-core/src/main/java/org/multibit/hd/core/dto/WalletSummary.java

View the exact upstream file · Read raw source · License notices

SHA-256: fdc46893c85716667ee1c041c3758235317fb09b826f66558799c0960e20b897

1package org.multibit.hd.core.dto;23import com.fasterxml.jackson.annotation.JsonIgnore;4import com.google.common.base.Preconditions;5import org.bitcoinj.core.Wallet;6import org.multibit.hd.core.managers.WalletManager;78import javax.annotation.Nullable;9import java.io.File;10import java.util.Arrays;1112/**13 * <p>Value object to provide the following to application:</p>14 * <ul>15 * <li>Access to optional Bitcoinj Wallet and mandatory WalletId</li>16 * <li>Provision of a name and notes for identifying a wallet</li>17 * </ul>18 *19 * <p>A wallet summary can be built from a wallet root and an appropriate YAML file</p>20 *21 * @since 0.0.1 22 */23public class WalletSummary {2425  @JsonIgnore26  private Wallet wallet;2728  @JsonIgnore29  private WalletId walletId;3031  @JsonIgnore32  private File walletFile;3334  @JsonIgnore35  private WalletPassword walletPassword;3637  /**38   * This field is dominated by WalletTypeExtension stored in the Wallet itself.39   * Used mainly so that you do not have to decrypt the wallet to see the walletType40   */41  private WalletType walletType = WalletType.UNKNOWN;4243  private String name;4445  private String notes;4647  /**48   * The wallet credentials, encrypted with an AES key derived from the wallet seed49   */50  private byte[] encryptedPassword;5152  /**53   * The backup AES key, encrypted with an AES key derived from the wallet credentials54   */55  private byte[] encryptedBackupKey;56  /**57   * The random IV used to encrypt Password and BackupKey58   */59  private byte[] initializationVector;6061  /**62   * Default constructor for Jackson63   */64  public WalletSummary() {65  }6667  /**68   * <p>Standard constructor</p>69   *70   * @param walletId The wallet ID71   * @param wallet   The Bitcoinj wallet72   */73  public WalletSummary(WalletId walletId, @Nullable Wallet wallet) {7475    Preconditions.checkNotNull(walletId, "'walletId' must be present");7677    this.wallet = wallet;78    this.walletId = walletId;79  }8081  /**82   * @return The Bitcoinj wallet associated with this summary (can be null)83   */84  public Wallet getWallet() {85    return wallet;86  }8788  public void setWallet(Wallet wallet) {89    this.wallet = wallet;90  }9192  /**93   * @return The wallet ID94   */95  public WalletId getWalletId() {96    return walletId;97  }9899  public void setWalletId(WalletId walletId) {100    Preconditions.checkNotNull(walletId, "'walletId' must be present");101    this.walletId = walletId;102  }103104  /**105   * @return The wallet credentials106   */107  public WalletPassword getWalletPassword() {108    return walletPassword;109  }110111  /**112   * Set the wallet password. This is the wallet password tagged with the walletId it belongs to.113   * @param walletPassword the wallet id + password combination114   */115  public void setWalletPassword(WalletPassword walletPassword) {116    Preconditions.checkArgument(walletPassword.getWalletId().equals(walletId), "The walletPassword is not the password for this wallet");117    this.walletPassword = walletPassword;118  }119120  /**121   * @return The short wallet name (e.g. "ACME Ltd")122   */123  public String getName() {124    return name;125  }126127  public void setName(String name) {128    this.name = name;129  }130131  /**132   * @return The longer notes (e.g. "The ACME Ltd business wallet")133   */134  public String getNotes() {135    return notes;136  }137138  public void setNotes(String notes) {139    this.notes = notes;140  }141142  /**143   * Get the encrypted wallet credentials (which is padded)144   * - use WalletManager#unpadPasswordBytes to unpad145   * @return encrypted, padded wallet credentials146   */147  public byte[] getEncryptedPassword() {148    return Arrays.copyOf(encryptedPassword, encryptedPassword.length);149  }150151  public void setEncryptedPassword(byte[] encryptedPassword) {152    this.encryptedPassword = Arrays.copyOf(encryptedPassword, encryptedPassword.length);153  }154  public byte[] getInitializationVector() {155    return Arrays.copyOf(initializationVector, initializationVector.length);156  }157158  public void setInitializationVector(byte[] initializationVector) {159    this.initializationVector = Arrays.copyOf(initializationVector, initializationVector.length);160  }161  public byte[] getEncryptedBackupKey() {162    return Arrays.copyOf(encryptedBackupKey, encryptedBackupKey.length);163  }164165  public void setEncryptedBackupKey(byte[] encryptedBackupKey) {166    this.encryptedBackupKey = Arrays.copyOf(encryptedBackupKey, encryptedBackupKey.length);167  }168169  /**170   * Report the wallet type specified in the WalletTypeExtension in the wallet171   * @return WalletType the wallet type, as specified by the WalletTypeExtension172   */173  public WalletType getWalletType() {174    // Use the wallet type if it is available175    if (wallet != null) {176      return WalletManager.getWalletType(wallet);177    } else {178      // Use the local walletType if that is all there is179      return walletType;180    }181   }182183  public void setWalletType(WalletType walletType) {184     this.walletType = walletType;185   }186187  public File getWalletFile() {188    return walletFile;189  }190191  public void setWalletFile(File walletFile) {192    this.walletFile = walletFile;193  }194195196  @Override197  public String toString() {198    return "WalletSummary{" +199            "wallet=" + wallet +200            ", walletId=" + walletId +201            ", walletPassword=" +walletPassword +202            ", walletFile=" +walletFile +203            ", walletType=" +walletType +204            ", credentials=***" +205            ", name='" + name + '\'' +206            ", notes='" + notes + '\'' +207            ", encryptedPassword=" + Arrays.toString(encryptedPassword) +208            ", encryptedBackupKey=" + Arrays.toString(encryptedBackupKey) +209            ", initializationVector=" + Arrays.toString(initializationVector) +210            '}';211  }212}

Read in context

Holds wallet identity, human notes, wallet type and encrypted credential or backup-key fields. Its values connect wallet management with restoration features. Avoid publishing real serialized summaries or debug output merely because some fields are encrypted.

Compare the callers, dependency versions and corresponding tests. The pinned file is one part of a larger application. Do not execute write, prune or migration routines against your only copy of a wallet.

Sources at the reviewed revision