docs: public void encrypt(KeyCrypter keyCrypter, KeyParameter aesKey) {
          checkNotNull(keyCrypter);
          checkNotNull(aesKey);
          checkState((chains != null && !chains.isEmpty()) || basic.numKeys() != 0, "can't encrypt entirely empty wallet");
  
          BasicKeyChain newBasic = basic.toEncrypted(keyCrypter, aesKey);
          List<DeterministicKeyChain> newChains = new ArrayList<>();
          if (chains != null) {
              for (DeterministicKeyChain chain : chains)
                  newChains.add(chain.toEncrypted(keyCrypter, aesKey));
          }
  
          // Code below this point must be exception safe.
          this.keyCrypter = keyCrypter;
          this.basic = newBasic;
          if (chains != null) {
              this.chains.clear();
              this.chains.addAll(newChains);
          }
      }