Skip to content

Commit

Permalink
Merge branch 'secret-sharing'
Browse files Browse the repository at this point in the history
  • Loading branch information
poljar committed Aug 13, 2021
2 parents 96e2665 + 9bae87b commit 6234089
Show file tree
Hide file tree
Showing 32 changed files with 2,417 additions and 870 deletions.
8 changes: 8 additions & 0 deletions matrix_sdk/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2120,6 +2120,14 @@ impl Client {
.unwrap();
}
}
OutgoingRequests::KeysClaim(request) => {
if let Ok(resp) = self.send(request.clone(), None).await {
self.base_client
.mark_request_as_sent(r.request_id(), &resp)
.await
.unwrap();
}
}
}
}
}
Expand Down
19 changes: 16 additions & 3 deletions matrix_sdk_crypto/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,29 +135,42 @@ pub enum SessionUnpicklingError {
SessionTimestampError,
}

/// Error type describin different errors that happen when we check or create
/// signatures for a Matrix JSON object.
#[derive(Error, Debug)]
pub enum SignatureError {
#[error("the signature used a unsupported algorithm")]
/// The signature was made using an unsupported algorithm.
#[error("the signature used an unsupported algorithm")]
UnsupportedAlgorithm,

#[error("the key id of the signing key is invalid")]
/// The ID of the signing key isn't a valid key ID.
#[error("the ID of the signing key is invalid")]
InvalidKeyId(#[from] IdentifierError),

/// The signing key that should create or check a signature is missing.
#[error("the signing key is missing from the object that signed the message")]
MissingSigningKey,

#[error("the user id of the signing differs from the subkey user id")]
/// The user id of signing key differs from the user id that provided the
/// signature.
#[error("the user id of the signing key differs user id that provided the signature")]
UserIdMissmatch,

/// The provided JSON value that was signed and the signature should be
/// checked isn't a valid JSON object.
#[error("the provided JSON value isn't an object")]
NotAnObject,

/// The provided JSON value that was signed and the signature should be
/// checked isn't a valid JSON object.
#[error("the provided JSON object doesn't contain a signatures field")]
NoSignatureFound,

/// The signature couldn't be verified.
#[error("the signature didn't match the provided key")]
VerificationError,

/// The signed object couldn't be deserialized.
#[error(transparent)]
JsonError(#[from] SerdeError),
}
Expand Down
4 changes: 2 additions & 2 deletions matrix_sdk_crypto/src/file_encryption/attachments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ impl<'a, R: Read + 'a> AttachmentEncryptor<'a, R> {
let mut iv = Zeroizing::new([0u8; IV_SIZE]);

getrandom(&mut *key).expect("Can't generate randomness");
// Only populate the first 8 bits with randomness, the rest is 0
// initialized.
// Only populate the first 8 bytes with randomness, the rest is 0
// initialized for the counter.
getrandom(&mut iv[0..8]).expect("Can't generate randomness");

let web_key = JsonWebKey::from(JsonWebKeyInit {
Expand Down

0 comments on commit 6234089

Please sign in to comment.