|
1 | | -# Welcome to your Expo app 👋 |
2 | | - |
3 | 1 | # Ding Payments — Mobile Client MVP |
4 | 2 |
|
5 | | -This repository contains the core React Native application built with Expo Router and the Soroban Smart Contract SDK for the Ding Payments network. |
| 3 | +Peer-to-peer contactless (NFC) payments on Stellar with a self-custodial wallet and passkey authentication. |
6 | 4 |
|
7 | | -## 🛠 Prerequisites |
| 5 | +## Prerequisites |
8 | 6 |
|
9 | | -- **Node.js**: v18 or later |
10 | | -- **Package Manager**: `npm` |
11 | | -- **Development Target**: Physical iOS or Android device (required for NFC, passkeys, and SecureStore biometrics); simulator/emulator for UI-only work |
| 7 | +- **Node.js** v20+ |
| 8 | +- **npm** |
| 9 | +- **Xcode** (iOS) or **Android Studio** (Android) |
| 10 | +- Physical NFC devices for end-to-end NFC validation |
12 | 11 |
|
13 | | -> ⚠️ Native Framework Limitation: This application leverages advanced hardware integrations including NFC capabilities and Passkey WebAuthn modules. These features cannot execute inside standard Expo Go. You must use an Expo Development Build (EAS Development Build) to validate NFC, passkeys, and SecureStore functionality on physical devices. |
| 12 | +> **Expo Go is not supported.** NFC, passkeys, and SecureStore require a **development build** (`npx expo run:ios` or `npx expo run:android`, or EAS dev build). |
14 | 13 |
|
15 | | -## 🚀 Local Development Setup |
| 14 | +## Setup |
16 | 15 |
|
17 | | -1. **Clone the Repository & Fetch Dependencies** |
| 16 | +1. Clone and install dependencies: |
18 | 17 |
|
19 | 18 | ```bash |
20 | 19 | npm install |
| 20 | + cp .env.example .env |
21 | 21 | ``` |
22 | 22 |
|
23 | | -2. **Build requirements for native features** |
24 | | - - NFC and passkey research require an Expo development build or custom native runtime. |
| 23 | +2. Build requirements for native features: |
| 24 | + |
25 | 25 | - Run `npx expo prebuild` and `npx expo run:android` / `npx expo run:ios` for device validation. |
26 | 26 | - Use `npm run dev-client` to launch a dev-client session after native dependencies are installed. |
27 | 27 |
|
28 | 28 | ## EAS Development Build |
29 | 29 |
|
30 | | -1. **Install and authenticate EAS CLI** |
| 30 | +1. Install and authenticate EAS CLI: |
31 | 31 |
|
32 | 32 | ```bash |
33 | 33 | npm install -g eas-cli |
34 | 34 | eas login |
35 | 35 | ``` |
36 | 36 |
|
37 | | - On first setup, link the project with `eas init`. Build profiles live in `eas.json` (`development`, `preview`, `production`). |
38 | | - |
39 | | -2. **Create a development build** |
| 37 | +2. Create a development build: |
40 | 38 |
|
41 | 39 | ```bash |
42 | 40 | npm run dev:build:android |
43 | 41 | # or |
44 | 42 | npm run dev:build:ios |
45 | 43 | ``` |
46 | 44 |
|
47 | | - Install the resulting build on a **physical device** (`.apk` on Android; iOS via internal distribution or TestFlight). |
48 | | - |
49 | | -3. **Start the dev client** |
| 45 | +3. Start the dev client: |
50 | 46 |
|
51 | 47 | ```bash |
52 | 48 | npm run dev-client |
53 | 49 | ``` |
54 | 50 |
|
55 | | - This runs `expo start --dev-client` and connects the installed development build to Metro. |
56 | | - |
57 | | -4. **Native rebuild required** |
58 | | - Rebuild and reinstall the development build after changes to: |
59 | | - - `app.config.ts` plugins, permissions, or entitlements |
60 | | - - native dependencies (for example `expo-dev-client`, `expo-secure-store`, `react-native-nfc-manager`, `react-native-passkey`) |
61 | | - |
62 | | - JavaScript-only changes do not require a native rebuild. |
63 | | - |
64 | | -5. **Expo Go limitations** |
65 | | - Do not use Expo Go to validate NFC, passkeys, or SecureStore with biometric authentication. These flows require a development build with `expo-dev-client`. |
| 51 | +4. **Native rebuild required** after changes to `app.config.ts` plugins, permissions, or native dependencies (`expo-dev-client`, `expo-secure-store`, `react-native-nfc-manager`, `react-native-passkey`). |
66 | 52 |
|
67 | | -6. **Simulator vs physical device** |
| 53 | +## Quality checks (CI) |
68 | 54 |
|
69 | | - | Feature | Simulator / emulator | Physical device | |
70 | | - | ------------------------ | -------------------- | --------------- | |
71 | | - | General UI / routing | Yes | Yes | |
72 | | - | NFC | No | Yes (required) | |
73 | | - | Passkeys | Limited / unreliable | Yes (required) | |
74 | | - | SecureStore + biometrics | Limited | Yes (required) | |
75 | | - |
76 | | - Use a physical device for native capability smoke tests, including the `/c05` spike page. |
77 | | - |
78 | | -## ✅ Quality checks (CI) |
79 | | - |
80 | | -CI (`.github/workflows/ci-client.yml`) runs the exact same npm scripts you run locally, so a green local run means a green pipeline. Run all three before opening a PR: |
| 55 | +Run before opening a PR: |
81 | 56 |
|
82 | 57 | ```bash |
83 | | -npm run build # tsc --noEmit — type-checks the project |
84 | | -npm run lint # expo lint (ESLint flat config + Prettier rules) |
85 | | -npm run format # prettier --write . — auto-formats the repo |
| 58 | +npm run build |
| 59 | +npm run lint |
| 60 | +npm run test |
| 61 | +npm run format:check |
86 | 62 | ``` |
87 | 63 |
|
88 | | -Helper scripts: |
89 | | - |
90 | | -| Script | Purpose | |
91 | | -| ------------------------------------- | ---------------------------------------------- | |
92 | | -| `npm run build` / `npm run typecheck` | TypeScript type-check (`tsc --noEmit`) | |
93 | | -| `npm run lint` | Report lint problems (`expo lint`) | |
94 | | -| `npm run lint:fix` | Auto-fix lint problems | |
95 | | -| `npm run format` | Format all files with Prettier | |
96 | | -| `npm run format:check` | Verify formatting without writing (used by CI) | |
97 | | - |
98 | | -Tooling config lives at the repo root: [`eslint.config.mjs`](eslint.config.mjs) (Expo flat config + Prettier) and [`.prettierrc`](.prettierrc) (`singleQuote`, `trailingComma: es5`). Editors with the ESLint and Prettier extensions pick these up automatically. |
99 | | - |
100 | 64 | ## C05 Spike documentation |
101 | 65 |
|
102 | 66 | - Passkey ADR: [`docs/adr-passkey-library.md`](docs/adr-passkey-library.md) |
103 | 67 | - Stellar ADR: [`docs/adr-stellar-sdk.md`](docs/adr-stellar-sdk.md) |
104 | 68 | - NFC ADR: [`docs/adr-nfc-library.md`](docs/adr-nfc-library.md) |
105 | 69 | - Spike PoC page: open `/c05` in the app after starting the dev-client. |
106 | 70 |
|
107 | | -This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app). |
108 | | - |
109 | | -## Get started |
| 71 | +## NFC development (C10) |
110 | 72 |
|
111 | | -1. Install dependencies |
| 73 | +The NFC core stack lives under `src/features/nfc/`: |
112 | 74 |
|
113 | | - ```bash |
114 | | - npm install |
115 | | - ``` |
116 | | - |
117 | | -2. Start the app |
118 | | - |
119 | | - ```bash |
120 | | - npx expo start |
121 | | - ``` |
| 75 | +| Module | Purpose | |
| 76 | +| ---------------------------------------- | ----------------------------------------------------- | |
| 77 | +| `services/NfcService.*` | Native abstraction (support checks, sessions) | |
| 78 | +| `schemas/paymentRequest.ts` | Zod schema for `payment_request.v1` payloads | |
| 79 | +| `services/NfcPayloadCodec.ts` | Compact JSON encode/decode with size guard | |
| 80 | +| `services/NfcWriter.ts` / `NfcReader.ts` | Writer (receiver) and reader (payer) sessions | |
| 81 | +| `state/nfcSessionStore.ts` | Session state machine + `nfcActive` lock coordination | |
| 82 | +| `services/nfc-spike.ts` | Manual PoC helpers for device verification | |
122 | 83 |
|
123 | | - For NFC, passkeys, and SecureStore testing, use `npm run dev-client` (`expo start --dev-client`) with an installed development build—not Expo Go. |
124 | | - |
125 | | -In the output, you'll find options to open the app in a |
126 | | - |
127 | | -- [development build](https://docs.expo.dev/develop/development-builds/introduction/) |
128 | | -- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/) |
129 | | -- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/) |
130 | | -- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo |
131 | | - |
132 | | -You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction). |
133 | | - |
134 | | -## Get a fresh project |
135 | | - |
136 | | -When you're ready, run: |
| 84 | +### Rebuild after native NFC changes |
137 | 85 |
|
138 | 86 | ```bash |
139 | | -npm run reset-project |
| 87 | +npx expo prebuild --clean |
| 88 | +npx expo run:ios |
| 89 | +# or |
| 90 | +npx expo run:android |
140 | 91 | ``` |
141 | 92 |
|
142 | | -This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing. |
| 93 | +### Smoke test on device |
| 94 | + |
| 95 | +```typescript |
| 96 | +import { nfcSpikeCheckSupport } from '@/features/nfc/services/nfc-spike'; |
143 | 97 |
|
144 | | -### Other setup steps |
| 98 | +const { supported, enabled } = await nfcSpikeCheckSupport(); |
| 99 | +``` |
145 | 100 |
|
146 | | -- To set up ESLint for linting, run `npx expo lint`, or follow our guide on ["Using ESLint and Prettier"](https://docs.expo.dev/guides/using-eslint/) |
147 | | -- If you'd like to set up unit testing, follow our guide on ["Unit Testing with Jest"](https://docs.expo.dev/develop/unit-testing/) |
148 | | -- Learn more about the TypeScript setup in this template in our guide on ["Using TypeScript"](https://docs.expo.dev/guides/typescript/) |
| 101 | +See [docs/adr-nfc-library.md](docs/adr-nfc-library.md) for platform constraints and payload limits (880 bytes max). |
149 | 102 |
|
150 | | -## Learn more |
| 103 | +## Scripts |
151 | 104 |
|
152 | | -To learn more about developing your project with Expo, look at the following resources: |
| 105 | +| Command | Description | |
| 106 | +| ------------------------------------- | -------------------------- | |
| 107 | +| `npm start` | Start Expo dev server | |
| 108 | +| `npm run dev-client` | Start Expo with dev-client | |
| 109 | +| `npm run build` / `npm run typecheck` | TypeScript check | |
| 110 | +| `npm test` | Run unit tests | |
| 111 | +| `npm run lint` | ESLint via Expo | |
| 112 | +| `npm run format:check` | Prettier check (CI) | |
153 | 113 |
|
154 | | -- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides). |
155 | | -- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web. |
| 114 | +## Documentation |
156 | 115 |
|
157 | | -## Join the community |
| 116 | +- [Product flows & system definition](docs/ding-payments.md) |
| 117 | +- [Client MVP build plan](docs/build-plan-client-mvp.md) |
| 118 | +- [NFC library ADR](docs/adr-nfc-library.md) |
158 | 119 |
|
159 | | -Join our community of developers creating universal apps. |
| 120 | +## License |
160 | 121 |
|
161 | | -- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute. |
162 | | -- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions. |
| 122 | +MIT |
0 commit comments