Initialize a new AuditChain for a mission. Creates the chain header and writes the genesis IDENTITY entry. Call this when a mission enters the CREATED state.
(
request: AuditChainInitRequest,
db: Annotated[AsyncSession, Depends(get_db)],
)
| 667 | description="Create a new AuditChain and write the genesis IDENTITY entry.", |
| 668 | ) |
| 669 | async def initialize_chain( |
| 670 | request: AuditChainInitRequest, |
| 671 | db: Annotated[AsyncSession, Depends(get_db)], |
| 672 | ) -> dict: |
| 673 | """ |
| 674 | Initialize a new AuditChain for a mission. |
| 675 | |
| 676 | Creates the chain header and writes the genesis IDENTITY entry. |
| 677 | Call this when a mission enters the CREATED state. |
| 678 | """ |
| 679 | svc = AuditChainService() |
| 680 | chain_id = await svc.initialize( |
| 681 | db, |
| 682 | mission_id=request.mission_id, |
| 683 | agent_id=request.agent_id, |
| 684 | ) |
| 685 | return {"chain_id": chain_id, "message": "AuditChain initialized"} |
| 686 | |
| 687 | |
| 688 | @_audit.post( |
nothing calls this directly
no test coverage detected