Skip to main content

1. Overview

This document defines the technical implementation details for the offline NFC wallet system.

The system enables a Web NFC-based wallet that stores balance, session state, and transaction logs on an NTAG215/216 NFC card. All security-critical state lives on the card itself, allowing the frontend to validate and operate fully offline while the backend provides session grants, policy, and reconciliation when connectivity is available.

Key qualities

  • Offline-first card operations: The terminal can complete read and write transactions without backend access. The card carries all the state needed for local validation.
  • Multi-frontend support: A single backend service is shared between station, gate, terminal, and member-view frontends.
  • Tamper-evident on-card state: Cryptographic binding of balance, counter, logs, and metadata means any unauthorized modification is detectable on read.
  • Bounded financial risk: Hard balance caps and per-transaction limits reduce exposure from lost, cloned, or compromised cards.
  • Atomic writes: The A/B buffer strategy ensures the card is never left in a partially written state.

System boundary

This spec covers:

  • NFC card layout, cryptographic model, and validation logic.
  • Frontend browser app built with TanStack Start and Web NFC / Web Crypto APIs.
  • Backend Nitro service for session grants, policy, and reconciliation.
  • Terminal workflows and offline operational rules.

Out of scope:

  • Physical card manufacturing, printing, or personalization.
  • Payment network settlement or third-party tokenization.
  • Government ID integration or biometric binding.

Document map

SectionTopic
2System architecture and actor roles
3Card binary layout and field definitions
4Cryptographic algorithms and key derivation
5Tamper detection conditions and validation flow
6Card state machine and session lifecycle
7A/B buffer write strategy and failure recovery
8Backend and frontend interface contracts
9Financial limits and risk controls
10Implementation notes and platform guidance
11Deployment, maintenance, and card lifecycle
12Key hierarchy and session grant structure
13Role-specific app models and permission boundaries
14Transaction log format and chain integrity
15Status codes and block/unblock rules
16Infrastructure stack and deployment pattern
17Time handling, validation assumptions, and scope limits