pub struct InfoAwareIdentity<I: Identity> { /* private fields */ }Expand description
An identity wrapper that attaches canister-certified sender information to every request.
The inner identity’s public key must be a canister signature key (OID 1.3.6.1.4.1.56387.1.2).
sig must be a canister signature over \x0Eic-sender-info || info using that same key.
Implementations§
Source§impl<I: Identity> InfoAwareIdentity<I>
impl<I: Identity> InfoAwareIdentity<I>
Sourcepub fn new(
inner: I,
info: Vec<u8>,
sig: Vec<u8>,
) -> Result<Self, DelegationError>
pub fn new( inner: I, info: Vec<u8>, sig: Vec<u8>, ) -> Result<Self, DelegationError>
Wraps inner and attaches info/sig as certified sender information.
Verifies the canister signature against the IC mainnet root key.
inner must have a canister signature public key.
Sourcepub fn new_with_root_key(
inner: I,
info: Vec<u8>,
sig: Vec<u8>,
root_key: &[u8],
) -> Result<Self, DelegationError>
pub fn new_with_root_key( inner: I, info: Vec<u8>, sig: Vec<u8>, root_key: &[u8], ) -> Result<Self, DelegationError>
Like new, but verifies against a custom root key (e.g. local replica or testnet).
Sourcepub fn new_unchecked(
inner: I,
info: Vec<u8>,
sig: Vec<u8>,
) -> Result<Self, DelegationError>
pub fn new_unchecked( inner: I, info: Vec<u8>, sig: Vec<u8>, ) -> Result<Self, DelegationError>
Like new, but skips cryptographic verification of the canister signature.
The replica will still reject an invalid signature. The signer principal is still parsed from the inner identity’s public key.
Trait Implementations§
Source§impl<I: Identity> Identity for InfoAwareIdentity<I>
impl<I: Identity> Identity for InfoAwareIdentity<I>
Source§fn sender(&self) -> Result<Principal, String>
fn sender(&self) -> Result<Principal, String>
Returns a sender, ie. the Principal ID that is used to sign a request. Read more
Source§fn sign(&self, content: &EnvelopeContent) -> Result<Signature, String>
fn sign(&self, content: &EnvelopeContent) -> Result<Signature, String>
Sign a request ID derived from a content map. Read more
Source§fn sign_delegation(&self, content: &Delegation) -> Result<Signature, String>
fn sign_delegation(&self, content: &Delegation) -> Result<Signature, String>
Source§fn sign_arbitrary(&self, content: &[u8]) -> Result<Signature, String>
fn sign_arbitrary(&self, content: &[u8]) -> Result<Signature, String>
Sign arbitrary bytes. Read more
Source§fn delegation_chain(&self) -> Vec<SignedDelegation>
fn delegation_chain(&self) -> Vec<SignedDelegation>
A list of signed delegations connecting
sender
to public_key, and in that order.Source§fn sender_info(&self) -> Option<SenderInfo>
fn sender_info(&self) -> Option<SenderInfo>
Returns canister-certified sender information to include in the request envelope, or
None. Read moreAuto Trait Implementations§
impl<I> Freeze for InfoAwareIdentity<I>where
I: Freeze,
impl<I> RefUnwindSafe for InfoAwareIdentity<I>where
I: RefUnwindSafe,
impl<I> Send for InfoAwareIdentity<I>
impl<I> Sync for InfoAwareIdentity<I>
impl<I> Unpin for InfoAwareIdentity<I>where
I: Unpin,
impl<I> UnsafeUnpin for InfoAwareIdentity<I>where
I: UnsafeUnpin,
impl<I> UnwindSafe for InfoAwareIdentity<I>where
I: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more