trusted_time 2.0.1
trusted_time: ^2.0.1 copied to clipboard
Tamper-proof network time for Flutter. Anchored to hardware monotonic clocks with optional NTS (RFC 8915) to prevent system-time manipulation and network-level spoofing.
Changelog #
2.0.1 #
Fixed #
- Dependency Resolution: Loosened constraints for
web,http, andtimezoneto resolve pub.dev analyzer conflicts. - Documentation: Enhanced dartdocs for public symbols to improve pub.dev score.
2.0.0 #
Added #
- Probabilistic Trust Modeling: Introduced
ConfidenceLevel(Low, Medium, High) andconfidenceScorewith exponential decay to model temporal uncertainty over time. - Self-Healing Consensus Engine:
- Adaptive Thresholds: Dynamic sample filtering based on 3x median uncertainty.
- Exponential Source Cooldown: Failure-count based blacklisting ($2^{failureCount}$ min) to isolate consistently unreliable authorities.
- Consensus Stability Guard: Incremental processing now requires $N=2$ (or $N=3$ under high variance) consecutive matching intervals before early-exit.
- NTS (RFC 8915) Authenticated Time: Pure-Dart implementation of Network Time Security for tamper-proof NTP synchronization (Cryptographic Preview).
- Enterprise Observability:
- Introduced
SyncMetricsfor machine-readable telemetry (latency, uncertainty, diversity, depth). - Added structured Confidence Breakdown for deep-field debugging of trust establishment.
- Introduced
- Strict Security Intent API: New
TrustedTime.getTime({bool requireSecure})for fail-fast cryptographic guarantees. - Capability Discovery: Added
supportsSecureTimeto allow graceful application fallback when NTS is unavailable. - Robust Desktop Support: Verified native implementations for macOS, Windows, and Linux, ensuring consistent monotonic clock behavior across all six Flutter platforms.
- Intelligent Background Sync: Scheduler-backed synchronization on mobile (WorkManager for Android, BGTaskScheduler for iOS) with safe
Timer-based fallbacks for desktop.
Changed #
- Domain Refactor: Split
TimeSampleintoTimeInterval(pure mathematical primitive) andTimeSample(enriched telemetry wrapper). - Integrity Feedback Loop: Anomaly detection now triggers immediate state purge (cache invalidation) and high-priority synchronization.
- Hardened Consensus: Strictly enforced group-diversity requirements to mitigate median-poisoning and correlated failures.
- Architecture Decisions: Published comprehensive ADRs (0001-0004) covering monotonic strategy, Marzullo consensus, NTS implementation, and background sync.
- Unified Darwin Layout: Migrated iOS and macOS native implementations to a shared SwiftPM-ready directory for perfect pub.dev compliance.
Fixed #
- Marzullo Engine Correctness:
- Fixed tie-breaking to use closed-interval semantics (depth counting).
- Corrected
participantCountto report unique source IDs instead of raw overlap depth. - Implemented 1ms uncertainty floor to prevent downstream calculation errors.
- Platform Hardening:
- Windows: Migrated to
GetTickCount64and subclassedWM_TIMECHANGEfor robust integrity monitoring. - Linux: Switched to
CLOCK_BOOTTIMEandtimerfdto correctly track time during system suspend. - Thread Safety: Re-affirmed and enforced main-thread dispatching for all Darwin platform event channels.
- Windows: Migrated to
1.2.1 #
Critical enhancements
- iOS/macOS: Enhanced channel initialization avoiding naming mismatch
- Android: Optimized
BroadcastReceiverlifecycle to efficiently detach - Android: Upgraded
BackgroundSyncWorkerto perform HTTPS connectivity check SyncClock.elapsedSinceAnchorMs()upgraded to use DartStopwatch(monotonic) instead of wall-clock delta- Linux: Implemented proper
get_platform_version()parsing to resolve implicit logic - Example integration test upgraded to effectively await
TrustedTime.initialize()
High-priority enhancements
- iOS BGTask handler upgraded to perform HTTPS HEAD check (parity with Android worker)
- iOS BGTask closure stabilized to capture dynamic interval value
- Windows native test enhanced building with explicit constructor
- Example widget test stabilized to match actual app UI
Engine improvements
- Serialized sync via
Completerintroduced to prevent concurrent_performSync()calls - Integrity events (
systemClockJumped,deviceRebooted) configured to invalidate trust and optimally trigger resync - Automatic retry engine introduced with configurable delay on sync failure
- Background sync optimally enabled on both warm-restore and cold-start paths
dispose()architecture enhanced to clearSyncClockstatic state, preventing cross-test leakageinitialize()short-circuits engine init immediately when test mock is activetimezoneChangedstreamlined as an intentional non-resync event (UTC is timezone-independent)- All
debugPrintcalls optimized and guarded bykDebugModefor release builds
Algorithm & sources optimizations
- Marzullo tie-breaking upgraded: lower endpoints prioritize over upper at equal times
bestEndintelligently resets when finding new maximum overlap depthHttpsSource: Implemented robust HEAD→GET fallback architecture on 405 or missing Date header- Comprehensive HTTP date parser expanded (RFC 7231 + RFC 850 formats)
- NTP source optimized via conditional imports (
dart:ioguard) for deep web compatibility TrustedTimeConfig.operator==andhashCodestabilized to comprehensively includeadditionalSources
Platform native architecture
- Android: Migrated
RECEIVER_NOT_EXPORTEDflags properly for API 33+ implicit-intent receivers - Android: Deprecated and removed unused
SharedPreferenceswrites from background worker - Android: Standardized
build.gradlestructure alongsideAndroidManifest.xml - iOS:
BGTaskScheduler.registerinitialization restricted optimally to run once viabgRegisteredflag - iOS:
Info.plistproperly documentsBGTaskSchedulerPermittedIdentifiersrequirement tracking - Windows: Deprecated legacy
"trusted_time"method channel registration safely - Linux: Deprecated legacy
"trusted_time"method channel registration safely - Web: Registered
MethodChannelhandlers gracefully for monotonic and background channels
Cleanup & Standardization
- Deprecated 7 dead platform abstraction files
- Streamlined bundle, removing
plugin_platform_interfacedependency - Reverted misleading
Package.swiftSPM target for CocoaPods plugin standard - Stripped committed
test_results.txtandlogcat_full.txtlogs fully prioritizing Git cleanliness - Renamed
sync_engine_test.dart→models_test.dartto logically match content - Broadened SDK constraints scaling accessibility:
sdk: >=3.4.0,flutter: >=3.19.0
Validation Pipeline Enhancement
- Scaled 54 total tests across 9 test files (up from 8 tests originally)
- Instated
TrustedTimeEstimatetests (isReasonable, toString) - Instated
IntegrityMonitortests (reboot detection, multiple attach, double dispose) - Instated
TrustedTimeConfigequality tests coveringadditionalSources - Instated
SyncClock.reset()verification structure - Adjusted timing bounds dynamically in SyncClock tests for CI reliability scaling
CI & Documentation
- CI workflow modernized to deeply analyze example app alongside plugin
SECURITY.mdvalidation tables strictly updatedCHANGELOG.mdproperly reflects comprehensive audit validations
1.2.0 #
Major stability and accuracy update with desktop support.
- Added integrity monitoring (
Stream<IntegrityEvent>) - Added offline time via
nowEstimated() - Added testing override support
- Improved timezone reliability (IANA-based)
- Added Windows & Linux observers
Fixes & improvements
- Safer storage behavior
- Correct config usage (NTP/HTTPS)
- Windows & Linux stability fixes
- SDK updates
Breaking
UnknownTimezoneExceptionreplaces generic errors
1.0.5 #
- iOS/macOS: Implemented proper Swift Package Manager (SPM) support following Flutter 3.24+ standards.
- Chore: Removed obsolete lint rules from
analysis_options.yamlfor Dart 3.x compatibility.
1.0.4 #
- Web: Full WASM compatibility by removing
dart:iodependencies and implementing conditional imports.
1.0.3 #
- Fix workflows: formatting and release check (fa4e61a)
- Format env block in release workflow (35168a2)
- Add automated release workflows and iOS packaging (68949cd)
1.0.1 #
- Chore: Implemented a fully automated release and publishing workflow using GitHub Actions.
- Fix: Added full platform support for Web, Windows, macOS, and Linux.
1.0.0 #
- Initial High-Integrity Release: Production-ready engine for tamper-proof UTC time.
- Marzullo Consensus: Multi-source quorum resolution from Tier-1 NTP and HTTPS providers.
- Temporal Baseline: Hardware-anchored monotonic timeline ensuring zero-drift consistency.
- Full Jitter Backoff: Industry-standard retry strategy for high-resiliency cloud connectivity.
- Zero-Alloc Performance: Memory-optimized internal stack with <1μs synchronous retrieval.