Skip to content

Commit

Permalink
fixup! crypto: Extract a test helper function for simulating verifica…
Browse files Browse the repository at this point in the history
…tion

Convert comment to code example
  • Loading branch information
andybalaam committed Oct 18, 2024
1 parent 1d6c5d1 commit 6ad623f
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions crates/matrix-sdk-crypto/src/identities/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,12 @@ pub(crate) mod testing {
/// signature_upload_request will be the result of calling
/// [`super::OtherUserIdentity::verify`].
///
/// msk_json should be JSON like: {
/// # Example
///
/// ```no_run
/// let signature_upload_request = their_identity.verify().await.unwrap();
///
/// let msk_json = json!({
/// "their_user_id": {
/// "keys": { "ed25519:blah": "blah" }
/// "signatures": {
Expand All @@ -1292,9 +1297,9 @@ pub(crate) mod testing {
/// "usage": [ "master" ],
/// "user_id": "their_user_id"
/// }
/// }
/// });
///
/// ssk_json should be JSON like: {
/// let ssk_json = json!({
/// "their_user_id": {
/// "keys": { "ed25519:blah": "blah" },
/// "signatures": {
Expand All @@ -1303,7 +1308,25 @@ pub(crate) mod testing {
/// "usage": [ "self_signing" ],
/// "user_id": "their_user_id"
/// }
/// }
/// })
///
/// let response = simulate_key_query_response_for_verification(
/// signature_upload_request,
/// my_identity,
/// my_user_id,
/// their_user_id,
/// msk_json,
/// ssk_json
/// ).await;
///
/// olm_machine
/// .mark_request_as_sent(
/// &TransactionId::new(),
/// crate::IncomingResponse::KeysQuery(&kq_response),
/// )
/// .await
/// .unwrap();
/// ```
pub fn simulate_key_query_response_for_verification(
signature_upload_request: SignatureUploadRequest,
my_identity: OwnUserIdentity,
Expand Down

0 comments on commit 6ad623f

Please sign in to comment.