5f3fb1543b677587c46f026bf3cf8b06e10bc845
Device Code
A tiny, fully offline Flutter app for one owner. Type a MAC address, get the 8‑digit device code for a date (today by default), copy it.
- iOS uses Cupertino widgets, Android uses Material 3 — chosen automatically from the running platform.
- No network, no backend: the shared secret is embedded in
lib/secret.darton purpose (must equalDEVICE_CODEin the backend'sApiGateway/appsettings.json).
Algorithm
Exact port of the backend's DeviceController.GetDeviceCode
(lib/device_code.dart):
raw = mac + yyyyMMdd + secret (UTF‑8, MAC hashed exactly as typed)
hash = SHA‑256(raw)
value = first 4 bytes of hash as big‑endian uint32
code = (value % 100000000) zero‑padded to 8 digits
The MAC field mirrors the existing web page: input is reduced to 12 hex digits,
lowercased and joined in pairs with : (e.g. 742584C0024A →
74:25:84:c0:02:4a). Generation is enabled only when 12 hex digits are present.
Develop
flutter pub get
flutter analyze
flutter test # 20 backend reference vectors + formatting + widget tests
Android
flutter build apk --release
# -> build/app/outputs/flutter-apk/app-release.apk
iOS (requires macOS + Xcode)
flutter doctor # Xcode + CocoaPods must be green
flutter devices # find your iPhone / simulator id
flutter run -d <device-id> # debug run (generates Podfile, runs pod install)
flutter build ios --release # release build, then open ios/Runner.xcworkspace to archive
flutter build ipa --release # or: archive directly for TestFlight / App Store
Signing: open ios/Runner.xcworkspace once in Xcode, select the Runner
target → Signing & Capabilities, and pick your team. For a personal device
without a paid account, a free Apple ID team works for 7‑day sideloading.
Preview either look on any host
flutter run -d chrome --dart-define=PLATFORM_OVERRIDE=ios # Cupertino
flutter run -d chrome --dart-define=PLATFORM_OVERRIDE=android # Material 3
Languages
Dart
96.6%
Swift
2.7%
Kotlin
0.5%
Objective-C
0.2%