Ping Mechanism
The ping() function is a core feature of the Zaphenath contract. It keeps data private by updating the lastPing timestamp and thereby delaying the timeout.
๐งญ Purpose
Zaphenath allows data to be accessed only after the owner has been inactive for a certain period. This inactivity is measured as:
block.timestamp - lastPing > timeout
By calling ping(), the owner or an authorized custodian can reset this timer.
๐ Function Signature
function ping(bytes32 keyId, address owner) external;
โ Who Can Ping?
- Owner: Always allowed
- Custodians: Only if
canPingwas set totrueby the owner
๐ Use Cases
- Keep private data hidden as long as the user is "active"
- Allow a trusted custodian to maintain activity on behalf of a user
- Ensure data is only released if truly inactive or incapacitated
โ ๏ธ Behavior
- If a user fails to call
ping()andtimeoutexpires, data becomes readable by Readers and Writers - Repeated
ping()calls extend the private window indefinitely
๐งช Testing Scenarios
- Owner calls
ping()โ should updatelastPing - Custodian without ping permission โ call reverts
- Custodian with ping permission โ call succeeds
- No
ping()and time advances โreadKey()becomes accessible
โก๏ธ Continue to Key Lifecycle