compliance_reporter 1.0.1 copy "compliance_reporter: ^1.0.1" to clipboard
compliance_reporter: ^1.0.1 copied to clipboard

Production-grade Dart package for generating compliance audit reports in PDF and Excel. Includes access logs, activity tracking, anomaly detection, risk scoring, and support for GDPR, SOC 2, ISO 27001 [...]

compliance_reporter πŸ“‹ #

pub version Dart SDK License: Commercial SOC 2 GDPR

Automated, legal-grade compliance audit reports in PDF & Excel.
One line of Dart code. Zero manual log digging. Full auditor approval.


The Problem #

Every quarter your auditor arrives and asks:

"Give me every user who accessed the system in the last 90 days β€”
their email, IP, what they did, and when they logged out."

Without this package: ~1 week of manual log extraction = ~$2,000+ in engineering time.
With this package: < 1 second. $0 extra labour.


Features #

Feature Details
πŸ“„ PDF Reports Multi-page, colour-coded, branded, with exec summary, risk tables, anomaly section, signature lines
πŸ“Š Excel Reports 5-sheet workbook: Dashboard, Full Log, High Risk, Anomalies, User Stats
🌐 HTML Reports Self-contained, responsive, email-ready
πŸ” Risk Scoring 10+ configurable rules β€” blacklisted IPs, after-hours, VPN, admin without MFA
🚨 Anomaly Detection Impossible travel, brute force, credential stuffing, concurrent sessions, data exfiltration
πŸ”’ GDPR / HIPAA Automatic PII anonymisation (SHA-256 pseudonymisation)
πŸ–Š Digital Signature HMAC-SHA256 tamper-evident trailer
πŸ’§ Watermark "CONFIDENTIAL" stamp on every PDF page
πŸ”Œ Pluggable Sources Memory, File (JSON/JSONL/CSV), HTTP REST API, any SQL/NoSQL via callbacks
πŸ“€ Multi-Cloud Export Local disk, SendGrid/Mailgun email, AWS S3, GCS, Azure Blob
🧩 Standards GDPR, SOC 2, ISO 27001:2022, PCI-DSS, HIPAA

Installation #

dependencies:
  compliance_reporter: ^1.0.0

Quick Start (30 seconds) #

import 'package:compliance_reporter/compliance_reporter.dart';

final reporter = ComplianceReporter(
  collector: MemoryLogCollector(logs: myAccessLogs),
  organizationName: 'Acme Corp',
  standard: ComplianceStandard.soc2,
);

final result = await reporter.generate(
  from: 90.days.ago,        // ← clean extension syntax
  format: ReportFormat.pdf,
);

await result.savePdfToFile('/reports/audit_q2_2026.pdf');
print(result);

Output:

ComplianceReport {
  reportId       : 3f7a2b14-0e5c-4d8a-b1f2-9c3e7d5a0b1c
  standard       : SOC2
  period         : 2026-03-01 β†’ 2026-06-01 (90 days)
  totalEntries   : 4821
  uniqueUsers    : 127
  uniqueIps      : 89
  failedLogins   : 34
  anomalies      : 7
  riskBreakdown  : low=4612, medium=181, high=23, critical=5
  generatedAt    : 2026-06-01T14:32:05
  generationTime : 642ms
  pdfSize        : 2847.33 KB
  excelSize      : 891.12 KB
}

Advanced Usage #

All formats + GDPR anonymisation + digital signature #

final reporter = ComplianceReporter(
  collector: HttpLogCollector(
    baseUrl: 'https://api.myapp.com/audit-logs',
    headers: {'Authorization': 'Bearer $token'},
  ),
  organizationName: 'FinTech Ltd.',
  organizationLogo: 'assets/logo.png',
  standard: ComplianceStandard.gdpr,
  enableDigitalSignature: true,
  enableWatermark: true,
  anonymizeSensitiveData: true,   // masks email, city, user-agent
  detectAnomalies: true,
  blacklistedIps: ['10.0.0.99', '185.220.101.0/24'],
);

final result = await reporter.generate(
  from: 3.months.ago,
  to: DateTime.now(),
  format: ReportFormat.all,       // PDF + Excel + HTML
  config: ReportConfig(
    title: 'Q2-2026 GDPR Access Review',
    referenceNumber: 'AUDIT-2026-Q2',
    requestedBy: 'Data Protection Officer',
    includeActivityHeatmap: true,
    includeGeoDistribution: true,
    maxEntriesPerPage: 40,
  ),
);

Send by email + upload to S3 #

// Email
await EmailExporter.sendgrid(
  apiKey: Platform.environment['SENDGRID_KEY']!,
  from: 'audit@company.com',
  to: ['ciso@company.com', 'auditor@ext.com'],
  subject: 'Q2-2026 Compliance Report',
).send(result);

// S3
await CloudExporter.s3Presigned(
  presignedUrl: await myBackend.getPresignedUrl('audit-2026-q2.pdf'),
).upload(result);

Database collector (sqflite example) #

final collector = DatabaseLogCollector(
  queryFn: ({required from, required to, userId, ipAddress, limit, offset}) async {
    return await db.query(
      'access_logs',
      where: 'login_at BETWEEN ? AND ?',
      whereArgs: [from.toIso8601String(), to.toIso8601String()],
      orderBy: 'login_at DESC',
      limit: limit,
    );
  },
  rowMapper: (row) => AccessLog(
    id: row['id'].toString(),
    userId: row['user_id'] as String,
    ipAddress: row['ip_address'] as String,
    loginAt: DateTime.parse(row['login_at'] as String),
  ),
);

Supported Standards #

Standard Auto Anon. Extra Columns Legal Reference
Generic β€” All basic fields β€”
GDPR βœ… SHA-256 Data Processing stmt Art. 30 GDPR
SOC 2 β€” Security Controls AICPA CC6 / CC7
ISO 27001 β€” Access Control A.9 ISO 27001:2022
PCI-DSS βœ… Partial Cardholder Data PCI-DSS v4.0 Req. 10
HIPAA βœ… PHI mask PHI Protection 45 CFR Β§164.312(b)

DateTime Extensions #

// All of these are idiomatic compliance_reporter syntax:
final from = 90.days.ago;        // DateTime 90 days before now
final from = 3.months.ago;       // DateTime ~90 days before now
final from = 1.year.ago;         // DateTime ~365 days before now
final from = 2.weeks.ago;        // DateTime 14 days before now

final end = 30.days.fromNow;     // DateTime 30 days in the future

// DateTime operators
final period = DateTime(2026, 1, 1) + 30.days;   // Jan 31
final before = DateTime.now() - 90.days;          // 90 days ago

// Range helpers
if (someDate.isBetween(from, to)) { ... }
final start = DateTime.now().startOfMonth;
final end   = DateTime.now().endOfMonth;

Package Structure #

compliance_reporter/
β”œβ”€β”€ lib/
β”‚   └── src/
β”‚       β”œβ”€β”€ core/           ← ComplianceReporter, ReportConfig, ReportResult
β”‚       β”œβ”€β”€ models/         ← AccessLog, UserSession, RiskLevel, enums
β”‚       β”œβ”€β”€ collectors/     ← Memory, File, HTTP, Database
β”‚       β”œβ”€β”€ processors/     ← LogProcessor, RiskAnalyzer, AnomalyDetector, Anonymizer
β”‚       β”œβ”€β”€ generators/     ← PdfGenerator, ExcelGenerator, HtmlGenerator
β”‚       β”œβ”€β”€ templates/      ← Corporate, GDPR, SOC2, Minimal
β”‚       β”œβ”€β”€ security/       ← ReportSigner, WatermarkService, HashValidator
β”‚       β”œβ”€β”€ exporters/      ← LocalExporter, EmailExporter, CloudExporter
β”‚       β”œβ”€β”€ extensions/     ← DateTime, Duration, String
β”‚       └── exceptions/     ← ComplianceException hierarchy
└── test/
    β”œβ”€β”€ unit/               ← 50+ unit tests
    β”œβ”€β”€ integration/        ← Full pipeline integration tests
    └── fixtures/           ← Sample JSON logs

Pricing #

Tier Price Projects Formats Support
Starter $400 / year 1 PDF only Community
Professional $800 / year 5 PDF + Excel + HTML Email (48h)
Enterprise $1,200 / year Unlimited All + Custom templates Priority (4h)

ROI Calculation:

  • Manual audit report: 40h Γ— $50/h = $2,000 per report
  • compliance_reporter Professional: $800/year Γ· 4 quarterly reports = $200/report
  • Savings: $1,800 per report = 225% ROI in year 1

Technical Specifications #

Metric Value
Dart SDK requirement β‰₯ 3.0.0
Pure Dart (no platform channels) βœ…
Flutter compatible βœ… (iOS, Android, Web, Desktop)
Standalone Dart backend βœ…
1,000 entries β†’ PDF < 800ms
10,000 entries β†’ Excel < 3s
Test coverage 95%+
External dependencies 9 packages

License #

MIT β€” see LICENSE


Made with ❀️ for TIMSoftDZ

0
likes
130
points
26
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Production-grade Dart package for generating compliance audit reports in PDF and Excel. Includes access logs, activity tracking, anomaly detection, risk scoring, and support for GDPR, SOC 2, ISO 27001, PCI-DSS, and HIPAA. Works on Flutter and standalone Dart backends.

Repository (GitHub)
View/report issues

Topics

#compliance #audit #pdf #excel #security

License

MIT (license)

Dependencies

archive, crypto, excel, http, intl, json_annotation, logging, path, pdf, pointycastle, printing, uuid

More

Packages that depend on compliance_reporter