Add comprehensive ticket validation with controlTicket function - #25
Merged
Conversation
Add comprehensive ticket validation with 13 checks (decode, header, security info, L1/L2 signatures, expiry, specimen, activated, issuing detail, transport document, Intercode extension, dynamic data, dynamic content freshness). The controlTicket() function returns a ControlResult with individual CheckResult entries and an overall valid flag. Website additions: - New Control tab with same input methods as Decode (fixtures, file, camera) - Clear valid/invalid status banner with error and warning counts - Ticket holder names and birthdates display - All 13 validation checks shown grouped by status - FIPS public key trust option for RICS 9999, key id 0 - "Control" button added to both Decode and Encode pages https://claude.ai/code/session_01E6k4nTRriYRsm3eAbyv4gd
Update controlTicket() and tests to use the new decoded output structure where ticket data follows the UicBarcodeHeader ASN.1 schema: - ticket.security -> ticket.level2SignedData.level1Data - ticket.railTickets[i] -> dataSequence[i].decoded - ticket.dynamicData/dynamicContentData -> level2Data.decoded - ticket.level2DataBlock -> level2SignedData.level2Data - headerVersion inferred from format string (U1->1, U2->2) - transportDocument ticketType -> ticket.key Add accessor helpers (firstRailTicket, fdc1Data, intercodeDynamic) to cleanly navigate the nested schema hierarchy. https://claude.ai/code/session_01E6k4nTRriYRsm3eAbyv4gd
chtitux
force-pushed
the
claude/implement-control-page-YhcgA
branch
from
February 15, 2026 20:12
0e49bdc to
aa7f72b
Compare
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 introduces a complete ticket validation system for dosipas tickets, including a new
controlTicket()function that performs comprehensive validation checks, a web UI component for ticket control, and supporting infrastructure.Key Changes
Core Validation (
src/control.ts)New
controlTicket()function: Decodes a ticket once and runs 13 focused validation checks covering:Check result aggregation: Each check returns a
CheckResultwith name, pass/fail status, severity level (error/warning/info), and optional message. Overall validity is determined by whether all error-severity checks pass.Flexible options:
ControlOptionssupports custom reference time, Level 1 key provider callback, and expected Intercode network ID validation.Type Definitions (
src/types.ts)ControlOptions,CheckResult, andControlResultinterfacesLevel1KeyProviderinterface for async key retrievalTesting (
tests/control.test.ts)Web UI Components
ControlTab.tsx: New tab component featuring:useTicketControl.ts: React hook for async ticket control with:App Integration
App.tsxto add Control tab navigation#control&hex=...URL hash support for sharing control resultsExports
controlTicketfrom mainsrc/index.tsNotable Implementation Details
https://claude.ai/code/session_01E6k4nTRriYRsm3eAbyv4gd