Trait penumbra_custody::CustodyClient

source ·
pub trait CustodyClient {
    // Required method
    fn authorize(
        &mut self,
        request: AuthorizeRequest
    ) -> Pin<Box<dyn Future<Output = Result<AuthorizeResponse>> + Send + 'static>>;
}
Expand description

A well-typed wrapper around the GRPC custody protocol that uses Rust domain types rather than proto types.

The custody protocol is used by a wallet client to request authorization for a transaction they’ve constructed.

Modeling transaction authorization as an asynchronous RPC call encourages software to be written in a way that has a compatible data flow with a “soft HSM”, threshold signing, a hardware wallet, etc.

The custody protocol does not trust the client to authorize spends, so custody requests must contain sufficient information for the custodian to understand the transaction and determine whether or not it should be authorized.

This trait is a wrapper around the proto-generated CustodyServiceClient that serves two goals:

  1. It works on domain types rather than proto-generated types, avoiding conversions;
  2. It’s easier to write as a trait bound than the CustodyServiceClient, which requires complex bounds on its inner type to enforce that it is a tower Service

Required Methods§

source

fn authorize( &mut self, request: AuthorizeRequest ) -> Pin<Box<dyn Future<Output = Result<AuthorizeResponse>> + Send + 'static>>

Requests authorization of the transaction with the given description.

Implementations on Foreign Types§

source§

impl<T> CustodyClient for CustodyServiceClient<T>
where T: GrpcService<BoxBody> + Send + Clone + 'static, T::ResponseBody: Body<Data = Bytes> + Send + 'static, T::Future: Send + 'static, T::Error: Into<StdError>, <T::ResponseBody as Body>::Error: Into<StdError> + Send,

source§

fn authorize( &mut self, request: AuthorizeRequest ) -> Pin<Box<dyn Future<Output = Result<AuthorizeResponse>> + Send + 'static>>

Implementors§