atp-sdk
Version:
Official TypeScript SDK for Agent Trust Protocolâ„¢ - Build secure, verifiable, and trustworthy applications with decentralized identity, verifiable credentials, payment protocols (AP2/ACP), and robust access control
125 lines • 3.31 kB
JavaScript
import { BaseClient } from './base.js';
export class AuditClient extends BaseClient {
constructor(config) {
super(config, 'audit');
}
/**
* Log an audit event
*/
async logEvent(request) {
return this.post('/audit/log', request);
}
/**
* Get audit event by ID
*/
async getEvent(eventId) {
return this.get(`/audit/event/${encodeURIComponent(eventId)}`);
}
/**
* Query audit events with filters
*/
async queryEvents(query) {
return this.get('/audit/events', { params: query });
}
/**
* Verify audit chain integrity
*/
async verifyIntegrity() {
return this.get('/audit/integrity');
}
/**
* Get audit statistics
*/
async getStats(params) {
return this.get('/audit/stats', { params });
}
/**
* Get events from IPFS
*/
async getEventFromIPFS(ipfsHash) {
return this.get(`/audit/ipfs/${encodeURIComponent(ipfsHash)}`);
}
// Advanced Audit Features
/**
* Get audit trail for a specific resource
*/
async getResourceAuditTrail(resource, params) {
return this.get(`/audit/resource/${encodeURIComponent(resource)}`, { params });
}
/**
* Get audit trail for a specific actor
*/
async getActorAuditTrail(actor, params) {
return this.get(`/audit/actor/${encodeURIComponent(actor)}`, { params });
}
/**
* Search audit events with advanced filters
*/
async searchEvents(params) {
return this.post('/audit/search', params);
}
// Blockchain Integration
/**
* Get blockchain anchor for an event
*/
async getBlockchainAnchor(eventId) {
return this.get(`/audit/blockchain/anchor/${encodeURIComponent(eventId)}`);
}
/**
* Verify blockchain anchor
*/
async verifyBlockchainAnchor(anchor) {
return this.post('/audit/blockchain/verify', { anchor });
}
/**
* Get blockchain statistics
*/
async getBlockchainStats() {
return this.get('/audit/blockchain/stats');
}
// Compliance and Reporting
/**
* Generate compliance report
*/
async generateComplianceReport(params) {
return this.post('/audit/compliance/report', params);
}
/**
* Export audit data
*/
async exportAuditData(params) {
return this.post('/audit/export', params);
}
/**
* Get export status
*/
async getExportStatus(exportId) {
return this.get(`/audit/export/${encodeURIComponent(exportId)}/status`);
}
// Real-time Monitoring
/**
* Get recent audit events (live feed)
*/
async getRecentEvents(params) {
return this.get('/audit/recent', { params });
}
/**
* Get audit event notifications
*/
async getNotifications(params) {
return this.get('/audit/notifications', { params });
}
/**
* Acknowledge notification
*/
async acknowledgeNotification(notificationId) {
return this.post(`/audit/notifications/${encodeURIComponent(notificationId)}/acknowledge`);
}
/**
* Check service health
*/
async getHealth() {
return this.get('/health');
}
}
//# sourceMappingURL=audit.js.map