You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All business logic lives in common/src/commonMain/kotlin/:
Core Detection Engine
File
Purpose
LOC
PhishingEngine.kt
Main analysis orchestrator (suspend + blocking APIs)
~400
HeuristicsEngine.kt
25+ security heuristics
~400
BrandDetector.kt
Static brand impersonation detection (60+ brands)
~500
DynamicBrandDiscovery.kt
Pattern-based brand detection for unknown brands
~280
BrandDatabase.kt
500+ brand patterns
~600
SecurityConstants.kt
Centralized thresholds and weights
~380
Ensemble ML Model
File
Purpose
LOC
EnsembleModel.kt
3-model ensemble (LR + GB + Rules)
~380
LogisticRegressionModel.kt
On-device ML classifier
~400
FeatureExtractor.kt
URL feature extraction (15 features)
~300
Data Layer
File
Purpose
LOC
HistoryRepository.kt
Scan history CRUD
~200
MehrGuardDatabase.sq
SQLDelight schema
~50
Shared UI Components
File
Purpose
LOC
SharedResultCard.kt
Compose MP result card (iOS + Desktop + Android)
~200
ThreatRadar.kt
Radar visualization component
~150
SharedTextGenerator.kt
Centralized verdict/explanation text
~300
LocalizationKeys.kt
~80 localization keys
~200
Models & Utilities
File
Purpose
LOC
RiskAssessment.kt
Analysis result data class
~100
UrlParser.kt
URL parsing utilities
~200
AdversarialDefense.kt
Obfuscation detection
~350
📱 Platform-Specific Code
What's Platform-Specific
Component
Android
iOS
Desktop
Web
UI Framework
Jetpack Compose
SwiftUI
Compose Desktop
HTML/JS
QR Scanner
ML Kit
AVFoundation
ZXing
jsQR
Database Driver
Android SQLite
Native SQLite
JVM SQLite
IndexedDB
Camera Access
CameraX
AVCaptureSession
Webcam API
getUserMedia
Haptic Feedback
Vibrator
UIImpactFeedback
N/A
N/A
expect/actual Declarations
Located in common/src/commonMain/kotlin/com/mehrguard/platform/:
// Database driver - different SQLite implementation per platformexpectclassDatabaseDriverFactory {
funcreateDriver(): SqlDriver
}
// Platform info - OS detectionexpectclassPlatformInfo {
val name:Stringval isDebug:Boolean
}
// QR Scanner abstractionexpectclassQrScanner {
suspendfunstartScanning(): Flow<String>
funstopScanning()
}
// Time utilityexpectfungetCurrentTimeMillis(): Long