Skip to content

Refactor ticket structure to match UicBarcodeHeader ASN.1 schema hierarchy - #24

Merged
chtitux merged 1 commit into
mainfrom
claude/parse-certificate-data-jiZzg
Feb 15, 2026
Merged

Refactor ticket structure to match UicBarcodeHeader ASN.1 schema hierarchy#24
chtitux merged 1 commit into
mainfrom
claude/parse-certificate-data-jiZzg

Conversation

@chtitux

@chtitux chtitux commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR restructures the decoded ticket object to directly follow the UicBarcodeHeader ASN.1 schema hierarchy, replacing the flattened structure with a nested one that preserves the original schema relationships. This improves type safety, clarity, and maintainability.

Key Changes

  • Restructured UicBarcodeTicket: Now contains level2SignedData (with level1Data and level2Data nested inside) instead of flat properties like security, railTickets, and dynamicData

  • Renamed and reorganized types:

    • SecurityInfoLevel1Data (now includes dataSequence array)
    • RailTicketDataUicRailTicketData
    • DataBlockDataSequenceEntry and Level2Data (context-specific)
    • TransportDocumentEntryTransportDocumentData with CHOICE structure (ticket: { key, value })
    • Added Level2SignedData wrapper type
  • Inline decoded content: FCB rail ticket data and Level 2 dynamic content are now decoded inline on dataSequence[i].decoded and level2Data.decoded respectively, rather than being extracted to top-level properties

  • Updated UI labels: Changed field labels in TicketView from human-readable format (e.g., "Provider", "Issuing Detail") to camelCase property names (e.g., "securityProviderNum", "issuingDetail") for consistency with the schema

  • Enhanced OID display: Renamed oidName() to oidDisplay() and improved formatting to show both OID and name (e.g., "1.2.840.10045.3.1.7 (EC P-256)")

  • Updated all consumers: Modified decoder, tests, and conversion utilities to navigate the new nested structure

Implementation Details

  • The schema hierarchy is now preserved: UicBarcodeTicketlevel2SignedDatalevel1Data + level2Data
  • Transport documents now use a CHOICE pattern with { key: string; value: Record<string, unknown> } to properly represent ASN.1 CHOICE types
  • Decoded content is optional on data blocks, allowing graceful handling of decoding failures
  • All existing functionality is preserved; this is purely a structural reorganization

https://claude.ai/code/session_01CDLUDCca1pu9NViXjLV5bE

The decoded UicBarcodeTicket now follows the exact UicBarcodeHeader ASN.1
schema structure (format → level2SignedData → level1Data/level1Signature/
level2Data → level2Signature) instead of the previous flattened convenience
wrapper with invented names like 'security', 'railTickets', 'headerVersion'.

Key changes:
- Decoded output uses schema field names and hierarchy throughout
- FCB data available via dataSequence[i].decoded (UicRailTicketData)
- Level 2 dynamic data available via level2Data.decoded
- Transport documents preserve CHOICE format {key, value} from codec
- Extension data preserved as raw + decoded intercodeIssuing alongside
- Website UI labels now use exact ASN.1 field names
- Website Raw JSON reflects the schema-matching structure
- All 52 tests updated and passing

https://claude.ai/code/session_01CDLUDCca1pu9NViXjLV5bE
@chtitux
chtitux merged commit 9aa8636 into main Feb 15, 2026
4 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.

2 participants