crypto: Bump the olm-rs version
This commit is contained in:
parent
725fd817c2
commit
96e26651bc
4 changed files with 15 additions and 15 deletions
|
@ -24,7 +24,7 @@ matrix-qrcode = { version = "0.1.0", path = "../matrix_qrcode" }
|
|||
matrix-sdk-common = { version = "0.3.0", path = "../matrix_sdk_common" }
|
||||
ruma = { version = "0.3.0", features = ["client-api-c", "unstable-pre-spec"] }
|
||||
|
||||
olm-rs = { version = "1.0.1", features = ["serde"] }
|
||||
olm-rs = { version = "2.0", features = ["serde"] }
|
||||
getrandom = "0.2.3"
|
||||
serde = { version = "1.0.126", features = ["derive", "rc"] }
|
||||
serde_json = "1.0.64"
|
||||
|
|
|
@ -249,7 +249,7 @@ impl OutboundGroupSession {
|
|||
pub(crate) async fn encrypt_helper(&self, plaintext: String) -> String {
|
||||
let session = self.inner.lock().await;
|
||||
self.message_count.fetch_add(1, Ordering::SeqCst);
|
||||
session.encrypt(plaintext)
|
||||
session.encrypt(&plaintext)
|
||||
}
|
||||
|
||||
/// Encrypt a room message for the given room.
|
||||
|
|
|
@ -108,13 +108,6 @@ pub struct PickledSelfSigning {
|
|||
public_key: CrossSigningKey,
|
||||
}
|
||||
|
||||
impl Signature {
|
||||
#[cfg(test)]
|
||||
pub fn as_str(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl PickledSigning {
|
||||
pub fn as_str(&self) -> &str {
|
||||
&self.0
|
||||
|
@ -288,6 +281,12 @@ pub struct PickledSignings {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct Signature(String);
|
||||
|
||||
impl std::fmt::Display for Signature {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
self.0.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PickledSigning(String);
|
||||
|
||||
|
@ -298,7 +297,7 @@ impl Signing {
|
|||
}
|
||||
|
||||
pub fn from_seed(seed: Vec<u8>) -> Self {
|
||||
let inner = OlmPkSigning::new(seed.clone()).expect("Unable to create pk signing object");
|
||||
let inner = OlmPkSigning::new(&seed).expect("Unable to create pk signing object");
|
||||
let public_key = PublicSigningKey(inner.public_key().into());
|
||||
|
||||
Signing {
|
||||
|
@ -366,7 +365,7 @@ impl Signing {
|
|||
signature: &Signature,
|
||||
) -> Result<bool, OlmUtilityError> {
|
||||
let utility = OlmUtility::new();
|
||||
utility.ed25519_verify(self.public_key.as_str(), message, signature.as_str())
|
||||
utility.ed25519_verify(self.public_key.as_str(), message, signature.to_string())
|
||||
}
|
||||
|
||||
pub async fn sign_json(&self, mut json: Value) -> Result<Signature, SignatureError> {
|
||||
|
|
|
@ -75,7 +75,8 @@ impl Utility {
|
|||
signature.get(key_id.to_string()).ok_or(SignatureError::NoSignatureFound)?;
|
||||
let signature = signature.as_str().ok_or(SignatureError::NoSignatureFound)?;
|
||||
|
||||
let ret = match self.inner.ed25519_verify(signing_key, &canonical_json, signature) {
|
||||
let ret =
|
||||
match self.inner.ed25519_verify(signing_key, &canonical_json, signature.to_owned()) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err(SignatureError::VerificationError),
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue