Trait penumbra_custody::threshold::Terminal
source · pub trait Terminal {
// Required methods
fn confirm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 SigningRequest
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn explain<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn broadcast<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn next_response<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A trait abstracting over the kind of terminal interface we expect.
This is mainly used to accommodate the kind of interaction we have with the CLI interface, but it can also be plugged in with more general backends.
Required Methods§
sourcefn confirm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 SigningRequest
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn confirm_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 SigningRequest
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Have a user confirm that they want to sign this transaction or other data (e.g. validator definition, validator vote).
In an actual terminal, this should display the data to be signed in a human readable form, and then get feedback from the user.
sourcefn explain<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn explain<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Push an explanatory message to the terminal.
This message has no relation to the actual protocol, it just allows explaining what subsequent data means, and what the user needs to do.
Backends can replace this with a no-op.
sourcefn broadcast<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn broadcast<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Broadcast a message to other users.
sourcefn next_response<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next_response<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Wait for a response from some other user, it doesn’t matter which.
This function should not return None spuriously, when it does, it should continue to return None until a message is broadcast.