Files
imeai-aKode/akode-rs/user-verification
andrea.difonzo 7c1c6dfa8d Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
  nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 12:37:52 +01:00
..

Native hardware test

tests/hardware.rs exercises the macOS provider with a real persisted Secure Enclave key: create and reload it, verify a signature, cancel an authentication request, and sign a new challenge with the same key. It is ignored by default.

Run on a physical Touch ID Mac with fingerprints enrolled and the lid open. Use an existing isolated development app with a valid provisioning profile and Keychain Sharing entitlements, plus its Apple Development signing identity. The test does not use a Wallet account or submit a purchase. Run only one copy at a time; it reserves the codex-user-verification-hardware-test key namespace and removes that namespace's key before and after the test.

From the repository root, set TEMPLATE_APP to that signed development .app and SIGNING_IDENTITY to its signing identity, then run in Bash. Signing the runner is insufficient: the test executable itself needs the profile and entitlements.

set -euo pipefail
: "${TEMPLATE_APP:?Set the path to the isolated signed development app}"
: "${SIGNING_IDENTITY:?Set its Apple Development identity}"
run_dir=$(mktemp -d)
app="$run_dir/HardwareTest.app"
(cd akode-rs && cargo build --locked -p akode-user-verification --test hardware \
  --message-format=json) > "$run_dir/build.jsonl"
binary=$(jq -r 'select(.reason == "compiler-artifact" and .target.name == "hardware" and .executable != null) | .executable' "$run_dir/build.jsonl")
mkdir -p "$app/Contents/MacOS"
cp "$binary" "$app/Contents/MacOS/hardware"
cp "$TEMPLATE_APP/Contents/Info.plist" "$app/Contents/Info.plist"
cp "$TEMPLATE_APP/Contents/embedded.provisionprofile" "$app/Contents/embedded.provisionprofile"
/usr/libexec/PlistBuddy -c 'Set :CFBundleExecutable hardware' "$app/Contents/Info.plist"
codesign -d --xml --entitlements - "$TEMPLATE_APP" > "$run_dir/entitlements.plist"
codesign --force --options runtime --entitlements "$run_dir/entitlements.plist" \
  --sign "$SIGNING_IDENTITY" "$app"
codesign --verify --strict "$app"
echo "Test bundle: $app"
"$app/Contents/MacOS/hardware" --ignored --exact \
  persisted_key_signing_cancellation_and_retry --nocapture --test-threads=1

Use Touch ID for the first prompt, then remove your finger. Leave the cancellation prompt untouched and observe that it appears and closes on its own. Authenticate the retry signing prompt once. Passing assertions verify both signatures, the cancellation result, and key removal; confirming visible prompt dismissal is the operator's part of the test. An early interruption fails the test rather than counting as cancellation.

If cancellation has not returned ten seconds after it is issued, the watchdog exits with a failure instead of hanging. After a forced exit, stop any remaining test process and remove the reserved key with the same signed bundle:

AKODE_HARDWARE_TEST_CLEANUP=1 "$app/Contents/MacOS/hardware" --ignored --exact \
  persisted_key_signing_cancellation_and_retry --nocapture --test-threads=1

This test covers the native provider. It does not exercise app-server routing, UI state, closed-lid recovery, or hosted Wallet completion.