Not legal advice
dpdpkit is software that helps you implement obligations under India's Digital Personal Data Protection Act, 2023 and the DPDP Rules, 2025. It does not provide legal advice and does not guarantee compliance.
Storage¶
repository
¶
Storage interface. Each adapter implements Repository with its ORM.
Rules for implementers:
- Only the models in
dpdpkit.modelscross this boundary — never ORM rows. - Ledger and audit tables are append-only.
append_*must raiseSequenceConflictwhen(tenant_id, seq)already exists. - Datetimes must round-trip with microsecond precision; naive values are read back as UTC.
transaction()groups an audit entry with the state change it describes.
Repository
¶
Bases: Protocol
latest_consent_event
¶
latest_consent_event(tenant_id: str, principal: str, purpose: str) -> ConsentEvent | None
list_consent_events
¶
list_consent_events(tenant_id: str, *, principal: str | None = None, after_seq: int = 0, limit: int | None = None) -> list[ConsentEvent]
list_audit
¶
list_audit(tenant_id: str, *, subject_id: str | None = None, after_seq: int = 0, limit: int | None = None) -> list[AuditEntry]
list_requests
¶
list_requests(tenant_id: str, *, principal: str | None = None, statuses: Collection[RequestStatus] | None = None) -> list[RightsRequest]
list_schedules
¶
list_schedules(tenant_id: str, *, principal: str | None = None, statuses: Collection[ScheduleStatus] | None = None) -> list[ErasureSchedule]
InMemoryRepository
¶
InMemoryRepository()
Thread-safe in-memory repository for tests, examples and scripts. Not durable.
latest_consent_event
¶
latest_consent_event(tenant_id: str, principal: str, purpose: str) -> ConsentEvent | None
list_consent_events
¶
list_consent_events(tenant_id: str, *, principal: str | None = None, after_seq: int = 0, limit: int | None = None) -> list[ConsentEvent]
list_audit
¶
list_audit(tenant_id: str, *, subject_id: str | None = None, after_seq: int = 0, limit: int | None = None) -> list[AuditEntry]
list_requests
¶
list_requests(tenant_id: str, *, principal: str | None = None, statuses: Collection[RequestStatus] | None = None) -> list[RightsRequest]
list_schedules
¶
list_schedules(tenant_id: str, *, principal: str | None = None, statuses: Collection[ScheduleStatus] | None = None) -> list[ErasureSchedule]