Skip to content

Store authentication keys in RawClassicSector#211

Merged
codebutler merged 4 commits intomasterfrom
feat/classic-store-auth-keys
Feb 15, 2026
Merged

Store authentication keys in RawClassicSector#211
codebutler merged 4 commits intomasterfrom
feat/classic-store-auth-keys

Conversation

@codebutler
Copy link
Owner

Summary

Adds keyA and keyB fields to RawClassicSector to align with Metrodroid's ClassicSectorRaw implementation. These fields store which keys successfully authenticated each sector during card reading.

This is part of the card module alignment effort (Item 5C).

Changes

  • Added keyA and keyB nullable ByteArray fields to RawClassicSector with @Contextual serialization annotation
  • Updated factory methods (createData, createInvalid, createUnauthorized) to accept optional key parameters
  • Refactored ClassicCardReader authentication logic to track successful keys and pass them to RawClassicSector

Metrodroid Reference

metrodroid/src/commonMain/kotlin/au/id/micolous/metrodroid/card/classic/ClassicSectorRaw.kt lines 29-34

Test Plan

  • Verified build compiles: ./gradlew :card:classic:compileKotlinJvm
  • Manual testing: Read a Classic card and verify keys are stored in the raw data

🤖 Generated with Claude Code

codebutler and others added 3 commits February 15, 2026 02:11
Fixes #191

The old FareBot CEPASProtocol manually built APDU commands but omitted
the Le (expected response length) byte, causing cards to reject with
6D00 (instruction not supported). Replaced with Metrodroid's approach
that delegates to ISO7816Protocol.sendRequest() for proper APDU framing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add keyA and keyB fields to RawClassicSector to match Metrodroid's ClassicSectorRaw implementation. Track which keys successfully authenticated each sector during card reading and store them in the raw sector data.

Changes:
- Add keyA/keyB nullable ByteArray fields to RawClassicSector with @contextual serialization
- Update factory methods (createData, createInvalid, createUnauthorized) to accept optional key parameters
- Refactor ClassicCardReader to track successful authentication keys and pass them to RawClassicSector

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codebutler codebutler force-pushed the feat/classic-store-auth-keys branch from b781941 to 6f0b019 Compare February 15, 2026 07:11
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codebutler codebutler merged commit 549da32 into master Feb 15, 2026
2 checks passed
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.

1 participant