Skip to main content

with_consent

Function with_consent 

Source
pub async fn with_consent<F, Fut, T>(
    submit: F,
) -> Result<Result<T, ConsentOutcome>, VtaError>
where F: Fn() -> Fut, Fut: Future<Output = Result<T, VtaError>>,
Expand description

Run submit, and if the VTA defers it for consent, wait for the approval and run it again.

submit MUST produce a byte-identical request each time it is called. The grant is bound to a digest of the payload, so a request that differs on retry — a regenerated nonce, a re-read timestamp — will not match the approval and will raise a second, unanswerable question instead.

Returns Ok(Ok(value)) when the task ran, Ok(Err(outcome)) when the wait ended without it running, and Err for any non-consent failure.