recover gets the plaintext of the committed document and the account state, what the owner signs, how the SDK checks the reply, and when the plaintext is not available.
The chain holds only the salted hash of the document. The plaintext lives in the engine, encrypted on the way in and on the way out. recover is the one public way to read it back.
Preconditions
- The signer is a signer of the account: an owner of the Safe, or the ERC20Allow address itself.
- The client config has
siweDomain, or the code runs in a browser wherewindow.location.hostgives the domain. - The call can reach the Anafi API. Today, the Anafi API hosts answer CORS only for
https://app.ana.fi.
Sequence
Steps
1
Sign in
recover({ aa, eoa }) builds an EIP-4361 message with these fields and asks the wallet to sign it with signMessage (a sign-in message prompt):The message has no
Expiration Time and no Resources. The engine accepts a recover sign-in only when its Resources list is empty, so a sign-in for another purpose cannot read the state.2
Send the sealed request
The SDK reads
AnafiRegistry.engineEncKey() and encrypts { aa, siwe_message, signature } to the engine. It keeps the key that opens the reply. It sends POST /api/wallets/{aa}/recover with { "sealed": ... }. See Sealed requests and Confidential channel.3
Check the reply
The reply is sealed to this request. The SDK opens it and reads
{ state, engine_sig }. Then it:- reads
AnafiRegistry.engineSigKey(); - checks that
engine_sigrecovers to that key overkeccak256(nonce ‖ state), with the state in a fixed JSON form. The nonce of this request is inside the digest, so a reply to an earlier request does not pass; - checks the shape of
state.tenant.
state as RecoveredUserState. A failed check throws.What can refuse
The recovered state
Parked reasons
A parked account starts again when a new commit is admitted. The row and its history stay.Trust the plaintext only after a chain check
The engine signature proves that the engine wrote the reply. It does not prove that the reply is current. Before you showdsl.yaml as the live document:
- Read
readDslCommitment(aa). - Compare its
hashwithdsl.commitment. You can also computedslCommitment(salt, yaml)when you hold the salt. The reply does not carry the salt. - When they differ, the engine has not processed the latest commit yet, or it does not hold that text.
When the plaintext is not available
To tell the second case from the third, use the synced height of the engine:
- Read the identity on chain and note the block
Bof that read. - Call
readEngineSyncedHeight(). It makes one unauthenticated GET to the Anafi API’s status endpoint, with no wallet prompt. It returns the last block that the engine has processed, ornullwhen the height is not known. - When the height is below
B, the engine has not reached the commit. Wait and read again. Do not ask the owner to sign in a loop. - When the height is at or above
B, callrecover. When the reply still does not hold the committed document, the engine does not hold its text.