public TypedKey getKey(@Nullable String passphrase) throws BadPassphraseException { switch (keyType) { case WIF: return getFromWifKey(); case BIP38: return decryptBip38(passphrase); case MINI: return getFromMiniKey(); default: throw new RuntimeException("Unknown key format."); // Should not happen } }