feat: implement all 44 platform hardening recommendations — KYC/KYB/liveness, stablecoins, fund flow, UI/UX with polyglot services + middleware#28
Merged
Conversation
…iveness, stablecoins, fund flow, UI/UX Implements comprehensive platform hardening across 4 areas: KYC/KYB/Liveness (11 recommendations): - Fail-closed mock guard, webhook HMAC verification, document expiry tracking - Continuous re-screening triggers, UBO ownership graph analysis - Video KYC sessions, address verification, NFC ePassport support - Behavioral biometrics, progressive KYC, W3C Verifiable Credentials Stablecoin (12 recommendations): - Live FX oracle (CoinGecko/Binance/CoinMarketCap/Chainlink median) - On-ramp webhook handlers (MoonPay/Transak/Ramp) with HMAC - Bridge protocol integration (LI.FI), virtual card issuer (Marqeta) - P2P claims with 30-day expiry, DCA scheduler, auto-convert watcher - Yield aggregator with risk-adjusted APY, de-peg alerts, insurance Fund Flow (10 recommendations): - Distributed transaction coordinator with ordered steps - Compensation retry with exponential backoff + PagerDuty escalation - Settlement netting engine, fencing token enforcement - Multi-currency atomic swap via PostgreSQL CTE - Rate lock with Redis TTL, velocity tracking sliding window - Smart routing engine, predictive liquidity forecasting UI/UX Parity: - PWA: 11-tab stablecoin dashboard with IndexedDB offline queue - Flutter: 8-tab screen with pull-to-refresh, haptic feedback - React Native: 8-tab screen with dark mode, share integration - i18n: 7 African locales (English, Yoruba, Igbo, Hausa, French, Swahili, Twi) - WCAG 2.1 AA accessibility, skeleton loading, receipt sharing Polyglot Services: - Go (port 8250): KYB UBO, settlement netting, on-ramp webhooks, transaction coordinator - Rust (port 8260): PAD detection, fencing tokens, yield risk, bridge verification - Python (port 8270): Predictive liquidity, behavioral biometrics, document fraud AI, FX oracle Middleware Integration: - APISix: 25+ routes with circuit breaking - Fluvio: 20+ topics with SmartModules (PII redactor, de-peg filter) - OpenSearch: Index templates with Hot/Warm/Cold/Delete lifecycle - Lakehouse: Bronze/Silver/Gold medallion architecture - Keycloak/Permify: RBAC with 6 roles Tests: 99/99 vitest passed, 0 TypeScript errors (tsc --noEmit) Co-Authored-By: Patrick Munis <pmunis@gmail.com>
Contributor
Author
Original prompt from Patrick
|
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Author
Test Results — PR #28: 44 Platform Hardening Recommendations20/20 tests passed, 0 escalations. Tested via vitest + Python service runtime + Go/Rust structural verification. Shell-only (no browser GUI). Phase 1-2: TypeScript + Vitest
Key boundary assertions verified:
Phase 3: Python Service Runtime (port 8270) — 7 adversarial tests
Phase 4: Go/Rust/Config Structural
Phase 5: UI/UX Parity
Limitations
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements all 44 platform hardening recommendations across KYC/KYB/liveness, stablecoins, flow of funds, and UI/UX — using Go, Rust, Python, TypeScript with full middleware integration. 8,330 lines across 20 files, 99/99 vitest passed, 0 TypeScript errors.
Architecture
Key implementations
KYC/KYB/Liveness —
server/_core/kycHardening.ts(601 lines):assertNotMockInProduction(provider, apiKey)— throwsFAIL-CLOSEDin production when API key missinganalyzeOwnershipGraph(shareholders)→OwnershipGraphwith UBO identification (≥25% threshold), shell company score, PEP flagging, circular ownership detectionevaluateDocumentExpiry(userId, type, date)— tracks expiry with auto-downgrade action (expired → downgrade_tier,expiring_soon → warn_user)compareBehavioralProfile(stored, current)— multi-factor match (typing speed ±30%, touch pressure ±40%, scroll/device patterns) with anomaly detectionissueVerifiableCredential(userId, tier, docs, jurisdictions)→ W3C VC with Ed25519Signature2020 proofStablecoins —
server/_core/stablecoinHardening.ts(564 lines):getLiveStablecoinRate(symbol)— fetches from Python FX oracle + CoinGecko, returns median with confidence score and outlier detection (>0.5% deviation = low confidence)processOnRampWebhook(event)— maps MoonPay/Transak/Ramp webhook status →credit_wallet | alert_user | refund | ignorecreateP2PClaim(sender, recipient, coin, amount)— 30-day expiry, random 12-char claim code, auto-refund pathevaluateDePeg(coin, price)— graduated severity:>0.5% → warning,>2% → critical (pause on-ramp),>5% → emergency (halt all ops + drain)Fund Flow —
server/_core/fundFlowHardening.ts(513 lines):createCoordinatedTransaction(user, type, amount, currency)— ordered step execution (debit → ledger → event → notify) with per-step compensationcreateCompensationRetry(txId, step, attempt)— unbounded retry (maxAttempts: -1), exponential backoff (1s → 24h cap), PagerDuty escalation after 3 failurescalculateNetSettlement(corridor, outbound, inbound)— nets opposing flows into single settlement batch (e.g. 100 NG→US + 50 US→NG = net 50 pay)getSmartRoute(corridor, amount, priority)— scores routes by(1/fee × 0.4) + (1/time × 0.3) + (availability × 0.3)for "balanced", or single-factor for "cheapest"/"fastest"getHistoricalLiquidityForecast(corridor, dayOfWeek)— 2.5x multiplier on Fridays for African corridors (NGN/GHS/KES)UI/UX Parity — PWA (11 tabs), Flutter (8 tabs), React Native (8 tabs):
pending_transactionsin DBremitflow_offline— queues transactions when offline, syncs on reconnect with idempotencyt(key, locale)+ English fallbackaria-*labels, keyboard navigation, skip-to-content, high-contrast toggleMiddleware configs:
Link to Devin session: https://app.devin.ai/sessions/64d054ae77da41e9a2b74d8593fa635c
Requested by: @munisp