crypto: Expose the pickling methods for the account.
parent
708a8b1b06
commit
00138f7ae5
|
@ -15,6 +15,8 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use olm_rs::account::{IdentityKeys, OlmAccount, OneTimeKeys};
|
use olm_rs::account::{IdentityKeys, OlmAccount, OneTimeKeys};
|
||||||
|
use olm_rs::errors::OlmAccountError;
|
||||||
|
use olm_rs::PicklingMode;
|
||||||
|
|
||||||
pub struct Account {
|
pub struct Account {
|
||||||
inner: OlmAccount,
|
inner: OlmAccount,
|
||||||
|
@ -82,6 +84,25 @@ impl Account {
|
||||||
pub fn sign(&self, string: &str) -> String {
|
pub fn sign(&self, string: &str) -> String {
|
||||||
self.inner.sign(string)
|
self.inner.sign(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn pickle(&self, pickling_mode: PicklingMode) -> String {
|
||||||
|
self.inner.pickle(pickling_mode)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_pickle(
|
||||||
|
pickle: String,
|
||||||
|
pickling_mode: PicklingMode,
|
||||||
|
shared: bool,
|
||||||
|
) -> Result<Self, OlmAccountError> {
|
||||||
|
let acc = OlmAccount::unpickle(pickle, pickling_mode)?;
|
||||||
|
Ok(Account { inner: acc, shared })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialEq for Account {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.identity_keys() == other.identity_keys()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in New Issue