Trait ic_agent::Identity

source ·
pub trait Identity: Send + Sync {
    // Required methods
    fn sender(&self) -> Result<Principal, String>;
    fn sign(&self, content: &EnvelopeContent) -> Result<Signature, String>;
}
Expand description

An Identity takes a request id and returns the Signature. It knows or represents the Principal of the sender.

Agents are assigned a single Identity object, but there can be multiple identities used.

Required Methods§

source

fn sender(&self) -> Result<Principal, String>

Returns a sender, ie. the Principal ID that is used to sign a request.

Only one sender can be used per request.

source

fn sign(&self, content: &EnvelopeContent) -> Result<Signature, String>

Sign a request ID derived from a content map.

Implementors should call content.to_request_id().signable() for the actual bytes that need to be signed.

Implementors§