Proje: Okul B2B App · Hub: Okul B2B App — Conventions
Güvenlik ve Depolama Katmanı
Depolama Katmanları
| Katman | Teknoloji | Kullanım |
|---|---|---|
SecureStorage (utils/) | expo-secure-store + AES (crypto-js) | Token, kullanıcı verisi |
AsyncStorage | @react-native-async-storage | Onboarding, seçili firma ID, privacy consent |
| In-memory | useState, static class | Auth token (API client cache) |
SecureStorage Anahtarları (SECURE_KEYS)
USER_TOKEN: 'user_token' // JWT access token
REFRESH_TOKEN: 'refresh_token' // Refresh token (varsa)
USER_DATA: 'user_data' // Kullanıcı objesinin JSON'ı
BIOMETRIC_ENABLED: 'biometric_enabled'
APP_LOCK_ENABLED: 'app_lock_enabled'
ENCRYPTION_KEY: 'encryption_key' // AES anahtarı (SecureStore'da saklanır)Şifreleme
Veriler expo-secure-store’a kaydedilmeden önce CryptoJS.AES.encrypt ile şifrelenir. Şifreleme anahtarı expo-crypto.randomUUID() ile üretilir ve yine SecureStore’da saklanır.
Gizlilik (KVKK/GDPR)
utils/PrivacyManager.ts ile consent yönetimi:
- Consent sürümü:
'1.0' - Storage key:
@okulcomtr:privacy_consent - Analytics, functional ve marketing için ayrı consent
- B2B app olduğundan
c26a3cfcommit’i ile analytics varsayılan olarak aktif (consent verilmemişse bile)
Logger
utils/Logger.ts singleton:
- Log level:
EXPO_PUBLIC_LOG_LEVELenv variable - Production’da:
errorlevel (sadece gerçek hatalar) - Development’ta:
debuglevel
import { logger } from '@/utils/Logger';
logger.info('Message', data);
logger.error('Error', error);
logger.logWarning('Warning', data); // aliasAsyncStorage Keyler
| Key | Değer |
|---|---|
hasLaunched | 'true' — onboarding gösterildi mi |
selectedCompanyId | Seçili firma ID’si (string) |
@okulcomtr:privacy_consent | KVKK consent JSON |
Related
- auth-akisi — token saklama akışı
- api-client-pattern — token kullanımı