Refactor ticket structure to match UicBarcodeHeader ASN.1 schema hierarchy - #24
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 containslevel2SignedData(withlevel1Dataandlevel2Datanested inside) instead of flat properties likesecurity,railTickets, anddynamicDataRenamed and reorganized types:
SecurityInfo→Level1Data(now includesdataSequencearray)RailTicketData→UicRailTicketDataDataBlock→DataSequenceEntryandLevel2Data(context-specific)TransportDocumentEntry→TransportDocumentDatawith CHOICE structure (ticket: { key, value })Level2SignedDatawrapper typeInline decoded content: FCB rail ticket data and Level 2 dynamic content are now decoded inline on
dataSequence[i].decodedandlevel2Data.decodedrespectively, rather than being extracted to top-level propertiesUpdated 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()tooidDisplay()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
UicBarcodeTicket→level2SignedData→level1Data+level2Data{ key: string; value: Record<string, unknown> }to properly represent ASN.1 CHOICE typeshttps://claude.ai/code/session_01CDLUDCca1pu9NViXjLV5bE