Skip to content

Drop the DERIVE_*_REQ_PRESS opcodes; press_required is now ignored - #4

Open
0c-coder wants to merge 2 commits into
heroku-deployfrom
fix/drop-req-press-opcodes
Open

Drop the DERIVE_*_REQ_PRESS opcodes; press_required is now ignored#4
0c-coder wants to merge 2 commits into
heroku-deployfrom
fix/drop-req-press-opcodes

Conversation

@0c-coder

Copy link
Copy Markdown
Owner

Pairs with 0c-coder/libraries branch fix/derived-xwing-spec-keygen, which removes
derive opcodes 3 and 4 — sending either now returns
CTAP2_ERR_EXTENSION_NOT_SUPPORTED, so these must merge together.

press_required stays in the public API signature but is ignored; presence is decided by
the device (public key never prompts, shared secret always does). The suffix had also
become a second key domain, which is why vault.js was fetching its public key in one
domain and running its ECDH in the other.

Still outstanding in this repo, not in this PR: derived X-Wing decapsulation must move to
the chunked OKDECRYPT route the new firmware expects.

🤖 Generated with Claude Code

https://claude.ai/code/session_0159zPxi7DCuucC1ZcqYBB8W

Firmware removed opcodes 3 and 4 and burned the numbers, so sending either now
returns CTAP2_ERR_EXTENSION_NOT_SUPPORTED. Always send 1 or 2.

press_required is kept in the public API signature so existing callers still
parse, but it no longer does anything. Presence is decided by the device from
what is being asked for: a public-key derivation never prompts, a shared-secret
derivation always does, with no setting to disable it.

The suffix had also become a second key domain - the firmware set
additional_data[0] = 1 for it, which changes the HKDF salt - so the same label
produced two different keys depending on an opcode named after touches. That is
how vault.js came to fetch its public key with press_required=false and run its
ECDH with press_required=true: its comment explains the choice purely in terms
of when a touch is needed, so whoever wrote it did not know the two calls were
using different keys. It worked only because both sides were deterministic.
One label now means one key.

Derived secrets change as a result. Vault entries and anything else derived
through the REQ_PRESS path will not reproduce. Pre-release, no migration.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011sMEydE1HrJTCPkJ25RLRY
src/lib/history.js could never have run. It calls

    ok.derive_public_key("onlykey-gun", function (error, historyPubkey) {...})

with two arguments against a four-argument signature
(additional_d, keytype, press_required, cb), so `keytype` receives the callback
function, `press_required` and `cb` are undefined, and nothing is ever called
back. Its only reference was plugins-devel.js - it is not in plugins.js, so it
never shipped in a production bundle either.

Found while auditing callers of the derive API for the REQ_PRESS opcode
removal: it was the only other caller, and it turned out not to be one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011sMEydE1HrJTCPkJ25RLRY
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.

2 participants