https://github.com/jamesgober/dotnet-audit-kit
Audit trail library for .NET 8. Immutable entries with SHA-256 hash chaining for tamper detection. Non-blocking dispatch to multiple sinks.
https://github.com/jamesgober/dotnet-audit-kit
audit-log compliance csharp dotnet hash-chain jg-dnet nuget soc2
Last synced: 9 days ago
JSON representation
Audit trail library for .NET 8. Immutable entries with SHA-256 hash chaining for tamper detection. Non-blocking dispatch to multiple sinks.
- Host: GitHub
- URL: https://github.com/jamesgober/dotnet-audit-kit
- Owner: jamesgober
- License: apache-2.0
- Created: 2026-03-04T00:42:04.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2026-03-05T02:54:46.000Z (4 months ago)
- Last Synced: 2026-04-07T00:10:05.979Z (3 months ago)
- Topics: audit-log, compliance, csharp, dotnet, hash-chain, jg-dnet, nuget, soc2
- Language: C#
- Size: 2.1 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# dotnet-audit-kit
[](https://www.nuget.org/packages/JG.AuditKit)
[](https://www.nuget.org/packages/JG.AuditKit)
[](./LICENSE)
[](https://github.com/jamesgober/dotnet-audit-kit/actions)
---
Immutable audit logging for .NET 8 applications. Record who did what, when, where, and why with tamper-evident hash chains, filter pipelines, and non-blocking sink dispatch.
## Features
- Immutable `AuditEntry` model
- SHA-256 hash chaining with configurable seed
- Built-in sinks: `ConsoleSink`, `FileSink`, `InMemorySink`
- Pluggable `IAuditSink` and `IAuditFilter`
- Async `Channel` dispatch pipeline that keeps request paths non-blocking
- Sink failure isolation (one sink failure does not stop other sinks)
- Hash chain verification API
- DI extensions: `AddAuditKit`, `AddAuditSink`, `AddAuditFilter`
## Installation
```bash
dotnet add package JG.AuditKit
```
## Quick Start
```csharp
using JG.AuditKit;
using JG.AuditKit.Abstractions;
using JG.AuditKit.Sinks;
builder.Services
.AddAuditKit(options =>
{
options.DefaultSinkTypes.Clear();
options.AddDefaultSink();
options.EnableHashChaining = true;
options.HashSeed = "my-seed";
options.FileSink.Path = "audit.jsonl";
options.FileSink.RollDaily = true;
})
.AddAuditFilter();
// ...
var auditLog = app.Services.GetRequiredService();
await auditLog.WriteAsync(new AuditEntry(
actor: "user:42",
action: "write.order",
resource: "orders/1001",
timestamp: DateTimeOffset.UtcNow,
correlationId: "corr-123",
metadata: new Dictionary
{
["ip"] = "10.0.0.10",
["reason"] = "user-update"
}));
```
## Documentation
- [API Reference](./docs/API.md)
## License
Licensed under the Apache License 2.0. See [LICENSE](./LICENSE) for details.
---
**Ready to get started?** Install via NuGet and check out the [API reference](./docs/API.md).