AuditConfig class
Enterprise — Tamper-proof location audit trail configuration.
When enabled, every persisted location record is hashed with SHA-256 and chained to the previous record's hash — creating a blockchain-like chain of custody that cryptographically proves no records were inserted, deleted, or modified.
How It Works
- Each location record produces a canonical string from its key fields (lat, lng, timestamp, accuracy, speed, heading, altitude, odometer, uuid, isMoving).
- The canonical string is prepended with the previous record's hash and fed into SHA-256.
- The resulting hash is stored alongside the location in the database.
- The first record in the chain uses a genesis hash derived from a device-specific identifier.
Verification
Call Tracelet.verifyAuditTrail() to walk the entire chain and verify every link. If any record has been inserted, deleted, or modified, the chain breaks at the tampered record.
Use Cases
- Delivery proof: Prove a driver was at a location at a specific time.
- Employee tracking compliance: Tamper-proof attendance trails.
- Insurance claims: Verifiable location evidence.
- Regulatory audits: Chain-of-custody for HIPAA, SOX, GDPR.
- Legal evidence: Cryptographic proof of data integrity.
HTTP Sync
When audit trail is enabled, HTTP sync payloads automatically include
audit_hash, audit_previous_hash, and audit_chain_index fields,
enabling server-side verification.
Config(
audit: AuditConfig(
enabled: true,
hashAlgorithm: HashAlgorithm.sha256,
),
)
See the Audit Trail Guide for full details.
- Annotations
Constructors
- AuditConfig({bool enabled = false, HashAlgorithm hashAlgorithm = HashAlgorithm.sha256, bool includeExtrasInHash = false})
-
Creates a new AuditConfig.
const
-
AuditConfig.fromMap(Map<
String, Object?> map) -
Creates an AuditConfig from a map.
factory
Properties
- enabled → bool
-
Whether the tamper-proof audit trail is enabled.
final
- hashAlgorithm → HashAlgorithm
-
The hash algorithm used for the audit chain.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- includeExtrasInHash → bool
-
Whether to include the
extrasmap in the hash computation.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, Object?> - Serializes to a map.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override