Skip to content

feat(#79): persist passport audit log per agent - #186

Open
Peolite001 wants to merge 1 commit into
Bitcoindefi:mainfrom
Peolite001:feat/79-passport-audit-log
Open

feat(#79): persist passport audit log per agent#186
Peolite001 wants to merge 1 commit into
Bitcoindefi:mainfrom
Peolite001:feat/79-passport-audit-log

Conversation

@Peolite001

@Peolite001 Peolite001 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements per-agent passport audit logging. All issue, authorize, revoke, expired, and batch_verified events are now persisted to .data/passport-audit.jsonl (JSONL, append-only, capped at 1000 events). A new GET /api/protocol/passport/audit?agentId=&limit=50 endpoint returns the last N events for a given agent, newest-first.

Checklist

  • Security: No private keys or sensitive data exposed. ZK circuit logic remains sound.
  • Tests: New/modified logic is covered by tests (npm test passes).
  • Scope: Changes are within the scope of the issue/feature.
  • Documentation: Updated README or other docs if necessary.

Related Issues

Closes #79

Files Changed

File Action
lib/passport/audit-log.ts Rewrite — new per-agent audit schema + JSONL persistence
lib/passport/passport.ts Modify — add authorizePassportSpend, hook appendAuditEvent
app/api/protocol/passport/audit/route.ts Create — GET audit endpoint
app/api/protocol/passport/authorize/route.ts Create — POST authorize spend
app/api/protocol/passport/revoke/route.ts Create — POST revoke
app/api/protocol/passport/batch-verify/route.ts Create — POST batch verify
lib/passport/audit-log.test.ts Create — unit tests

- Add PassportAuditEvent schema (issued | authorized | revoked | expired | batch_verified)
- Persist to .data/passport-audit.jsonl (append-only, capped at 1000)
- Hook appendAuditEvent into issuePassport, authorizePassportSpend, revokePassport, verifyPassportBatch
- Add GET /api/protocol/passport/audit?agentId=&limit=50 route
- Add authorize and revoke API routes
- Add unit tests: issue -> authorize -> revoke -> audit list shows 3 events in order
@Peolite001

Copy link
Copy Markdown
Contributor Author

pls merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passport audit log: persist all authorize/revoke/issue events per agent with timestamps

1 participant