Skip to content

feat: support wallet password file for unattended operation - #127

Open
NetteEddy wants to merge 2 commits into
EpicCash:masterfrom
NetteEddy:feature/password-file
Open

NetteEddy wants to merge 2 commits into
EpicCash:masterfrom
NetteEddy:feature/password-file

Conversation

@NetteEddy

Copy link
Copy Markdown

Description

The wallet currently requires either an interactive password prompt or the
--pass command-line option. This makes unattended operation difficult, while
--pass exposes the wallet password through the process command line.

This change adds support for the EPIC_WALLET_PASSWORD_FILE environment
variable. When set, the wallet reads the password from the referenced file.

Password selection priority is:

  1. --pass
  2. EPIC_WALLET_PASSWORD_FILE
  3. Interactive password prompt

Trailing CR/LF characters are removed from the password file so that files
ending with a normal newline can be used without modifying the password.

Existing interactive behavior remains unchanged.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Chore (miscellaneous changes e.g. modifying .gitignore)
  • Build (Affect build components like build tool, ci pipeline, dependencies, project version)
  • Docs (documentation update)

How Has This Been Tested?

  • cargo test --release password_from_file -- --nocapture
  • cargo build --release
  • Tested epic-wallet listen -m http -n with the password supplied through EPIC_WALLET_PASSWORD_FILE

Relevant notes

The existing --pass option keeps precedence over the environment variable.
If EPIC_WALLET_PASSWORD_FILE is not set, the wallet continues to use the
existing interactive password prompt.

@who-biz

who-biz commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR. will review later - we are very busy atm

Appreciate concise PR, and the tests.

@blacktyger

Copy link
Copy Markdown
Contributor

Blocking issue: parse_init_args calls prompt_password_confirm() and never looks at
the variable, and prompt_password_stdout turns a read error into "". So
EPIC_WALLET_PASSWORD_FILE=… epic-wallet init with no TTY prints "completed
successfully", prints a recovery phrase, and creates a wallet that opens with an empty
password. I confirmed the wallet then opens with an empty password and not with the
file's contents. The empty-password behaviour pre-dates this PR, but #127 is what makes
an operator run init unattended in the first place. Honour the variable in init and
change_password, and fail instead of defaulting to "".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants