Struct ockam::Contact [−][src]
Contact is an abstraction responsible for storing user’s public data (mainly - public keys).
It is designed to share users’ public keys in cryptographically verifiable way.
Public keys together with metadata are organised into verifiable events chain exactly like crate::Profile
.
There are two ways to get Contact:
- From another user (in this case Contact will be cryptographically verified)
- Generate one from user’s own
crate::Profile
Public keys from Contact can be used for many purposes, e.g. running key exchange, or signing&encrypting data.
Examples
Creating Contact
from crate::Profile
let vault = Arc::new(Mutex::new(SoftwareVault::default())); let mut alice = Profile::create(None, vault)?; let truck_key_attributes = KeyAttributes::new( "Truck management".to_string(), ); alice.create_key(truck_key_attributes.clone(), None)?; let alice_contact = alice.to_contact(); let public_key = alice.get_public_key(&truck_key_attributes)?;
Sending Contact over the network
// Send this over the network let alice_contact_binary = alice.serialize_to_contact()?;
Implementations
impl Contact
[src]
pub fn identifier(&self) -> &ProfileIdentifier
[src]
Return unique identifier, which equals to crate::Profile
’s identifier
pub fn change_events(&self) -> &[ProfileChangeEvent]ⓘ
[src]
Return change history chain
impl Contact
[src]
pub fn new(
identifier: ProfileIdentifier,
change_events: Vec<ProfileChangeEvent>
) -> Self
[src]
identifier: ProfileIdentifier,
change_events: Vec<ProfileChangeEvent>
) -> Self
impl Contact
[src]
pub fn verify(&self, vault: &mut dyn ProfileVault) -> Result<()>
[src]
Verify cryptographically whole event chain. Also verify sequence correctness
pub fn verify_and_update(
&mut self,
change_events: Vec<ProfileChangeEvent>,
vault: &mut dyn ProfileVault
) -> Result<()>
[src]
&mut self,
change_events: Vec<ProfileChangeEvent>,
vault: &mut dyn ProfileVault
) -> Result<()>
Update Contact
by using new change events
impl Contact
[src]
pub fn get_profile_update_public_key(&self) -> Result<PublicKey>
[src]
Get crate::Profile
Update PublicKey
pub fn get_public_key(
&self,
key_attributes: &KeyAttributes
) -> Result<PublicKey>
[src]
&self,
key_attributes: &KeyAttributes
) -> Result<PublicKey>
Get PublicKey
. Key is uniquely identified by label in KeyAttributes
pub fn get_last_event_id(&self) -> Result<EventIdentifier>
[src]
Get EventIdentifier
of the last known event
Trait Implementations
impl Clone for Contact
[src]
impl Debug for Contact
[src]
impl<'de> Deserialize<'de> for Contact
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Contact
[src]
Auto Trait Implementations
impl RefUnwindSafe for Contact
impl Send for Contact
impl Sync for Contact
impl Unpin for Contact
impl UnwindSafe for Contact
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Message for T where
T: Serialize + DeserializeOwned + Send + 'static,
[src]
T: Serialize + DeserializeOwned + Send + 'static,
pub fn encode(&self) -> Result<Vec<u8, Global>, Error>
[src]
pub fn decode(e: &Vec<u8, Global>) -> Result<Self, Error>
[src]
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,