Skip to content

fix: #74 implement Wallet.File.key#137

Open
bibonix wants to merge 1 commit into
zold-io:masterfrom
bibonix:74-wallet-file-key
Open

fix: #74 implement Wallet.File.key#137
bibonix wants to merge 1 commit into
zold-io:masterfrom
bibonix:74-wallet-file-key

Conversation

@bibonix

@bibonix bibonix commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Wallet.File.key() threw UnsupportedOperationException("key() not yet supported") since the class was introduced, and the matching puzzle in the source has been open as #74 from 2018. Any caller that asked a file-backed wallet for its RSA key tripped the exception at runtime; Copies.equalWallets in #79 reaches for Wallet.key() and would have hit the same wall once both sides were Wallet.File.

The implementation reuses the cactoos Split/ListOf chain that Wallet.File.id already uses and returns the fourth line of the wallet file, which is where the base64 RSA key is recorded according to the existing fixtures under src/test/resources/wallets and src/test/resources/walletsIn. The Wallet interface gains throws IOException on key() so the file-backed reader can surface I/O failures the same way id and merge already do; Wallet.Fake.key() keeps its signature because it does no I/O. The placeholder WalletTest.keyIsNotYetImplemented is replaced by readsPublicKey, which asserts the value embedded in the 12345678abcdef fixture comes back unchanged.

Ran mvn -B test (68 tests, 0 failures, 5 skipped — same skipped set as master) and mvn -B -Pqulice -DskipTests verify to confirm Qulice still passes.

Closes #74

Wallet.File.key() returned an UnsupportedOperationException; it now
reads the fourth line of the wallet file and returns the base64 RSA
key recorded there, matching the on-disk layout the existing wallet
fixtures and Wallet.File.id already rely on. The Wallet interface
declaration adds throws IOException so File-backed lookups can
surface I/O failures the way id and merge already do.

WalletTest.keyIsNotYetImplemented is replaced with readsPublicKey,
which exercises the new path against the existing 12345678abcdef
fixture.

@edmoffo edmoffo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff replaces the UnsupportedOperationException stub in Wallet.File.key with a fourth-line read that mirrors the existing id implementation (same Split/ListOf/Checked chain over this.path, same hex-based fixture layout). The interface picks up throws IOException alongside id and merge, and Fake.key keeps its narrower signature. WalletTest.keyIsNotYetImplemented is replaced with readsPublicKey asserting the base64 key embedded in the 12345678abcdef fixture, and the puzzle marker for #54 in Wallet.java is dropped. Local checks listed in the body match the green CI on this head (mvn across ubuntu/windows/macos, qulice, pdd, xcop, typos, etc.).

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.

Wallet.java:200-202: Implement key method. This should...

3 participants