Skip to main content

compliance_core 0.1.0-beta.1 copy "compliance_core: ^0.1.0-beta.1" to clipboard
compliance_core: ^0.1.0-beta.1 copied to clipboard

Shared building blocks for Compliance Kit packages - audit trail interface, audit events and common exception types. Pure Dart.

example/compliance_core_example.dart

// ignore_for_file: avoid_print

import 'package:compliance_core/compliance_core.dart';

Future<void> main() async {
  final trail = InMemoryAuditTrail(maxEvents: 1000);

  final subscription = trail.events.listen(
    (event) => print('audit: ${event.type} from ${event.source}'),
  );

  // Record what happened, never who it happened to.
  await trail.record(
    AuditEvent(
      type: 'consent_granted',
      source: 'example_app',
      metadata: const {'purpose': 'analytics', 'policy_version': 3},
    ),
  );

  try {
    AuditEvent(
      type: 'profile_updated',
      source: 'example_app',
      // Nested objects are rejected so they cannot be dumped by accident.
      metadata: const {
        'user': {'email': 'jane.doe@example.com'},
      },
    );
  } on InvalidAuditEventException catch (e) {
    print('rejected: ${e.message}');
  }

  for (final event in trail.history) {
    print(event.toJson());
  }

  await subscription.cancel();
  await trail.dispose();
}
0
likes
160
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Shared building blocks for Compliance Kit packages - audit trail interface, audit events and common exception types. Pure Dart.

Repository (GitHub)
View/report issues
Contributing

Topics

#privacy #security #compliance #audit #gdpr

License

MIT (license)

More

Packages that depend on compliance_core