Skip to main content

nyxa-audit

Append-only compliance audit log for Nyxa — immutable AuditRecord rows for auth events, grants, denials, and membership changes, with a retention window and JSON export. No update/delete API exists on records by design.

Features

  • app.audit service — an AuditLogger bound by AuditProvider; writes into an audit_logs table (id, action, actor, resource, meta, created_at).
  • Auto-migration — the provider creates audit_logs at boot when missing (sqlite-friendly schema via app.db.schema()).
  • Immutable records — record() appends and returns a frozen AuditRecord dataclass; nothing can mutate or delete rows through the API.
  • Retention + export — export(since=…) reads records newer than audit.retention_days (default 90) as immutable records ordered by id — ready for JSON-lines compliance tooling.
  • Plugin auto-discovery — registered via the nyxa.plugins entry point; no manual provider wiring.

Install

nyxa add nyxa-audit

Requires a configured database connection — the logger writes through app.db.

Usage

record = await app.audit.record(
    "gate.denied",
    actor="user:2",
    resource="post:9",
    meta={"action": "edit"},
)

records = await app.audit.export()  # last 90 days
records = await app.audit.export(since=yesterday)  # explicit window

Public API

  • AuditLogger (nyxa_audit.logger, re-exported at package level) — AuditLogger(app); await logger.record(action, *, actor="system", resource=None, meta=None) -> AuditRecord, await logger.export(*, since=None) -> Sequence[AuditRecord], logger.retention_days -> int.
  • AuditRecord (nyxa_audit.logger) — frozen dataclass: id, action, actor, resource, meta, created_at (UTC).
  • AuditProvider (nyxa_audit.provider) — binds app.audit, contributes the audit config namespace, and creates audit_logs on boot.

Configuration

config/audit.py:

config = {
    "retention_days": 90,  # export window lower bound, in days
}

Testing

Use a sqlite-backed test app — the provider creates the table on boot:

audit = app.audit
await audit.record("auth.signed_in", actor="user:1")
exported = await audit.export()
assert exported[-1].action == "auth.signed_in"

License

MIT

Metadata

Release files for nyxa-audit 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nyxa-audit 0.0.1
File Size Uploaded Provenance Actions
nyxa_audit-0.0.1.tar.gz 6.1 kB Without provenance Details for nyxa_audit-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nyxa-audit 0.0.1
File Interpreter ABI Platform Actions
nyxa_audit-0.0.1-py3-none-any.whl Python 3 none any Details for nyxa_audit-0.0.1-py3-none-any.whl

Total release size: 12.3 kB

Release files / nyxa_audit-0.0.1.tar.gz

Download URL nyxa_audit-0.0.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
55fb403ea652b244435a449656a60b8ee03547194b2c067953dcbdd4c636d5cd
BLAKE2b-256 checksum
How to use checksums
24923dc539220e501c22de2e518195fa8f1f0903be917b7296d65d2741b6a78a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / nyxa_audit-0.0.1-py3-none-any.whl

Download URL nyxa_audit-0.0.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c15a35e704eb6778c8816b685b0c9657673546861c6d225cdcd25c5e60deaef
BLAKE2b-256 checksum
How to use checksums
d8d81efbd90bee14c9c4ef6644c15d2ba283bb86a24c2b66b4af71194d58ad5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for nyxa-audit 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page