Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 152 additions & 133 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ version = "0.0.25"
[dependencies.matrix-sdk]
version = "0.16.0"
default-features = false
features = ["e2e-encryption", "sqlite", "sso-login"]
features = ["e2e-encryption", "qrcode", "sqlite", "sso-login"]

[dependencies.matrix-sdk-crypto]
version = "0.16.0"
Expand Down
2 changes: 2 additions & 0 deletions docs/iamb.1
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ Import and decrypt keys from
View a list of ongoing E2EE verifications.
.It Sy ":verify accept [key]"
Accept a verification request.
.It Sy ":verify emoji [key]"
Transition a request to use interactive emoji verification.
.It Sy ":verify cancel [key]"
Cancel an in-progress verification.
.It Sy ":verify confirm [key]"
Expand Down
29 changes: 4 additions & 25 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::sync::Arc;
use std::time::{Duration, Instant};

use emojis::Emoji;
use matrix_sdk::encryption::verification::VerificationRequest;
use matrix_sdk::ruma::events::receipt::ReceiptThread;
use ratatui::{
buffer::Buffer,
Expand All @@ -32,7 +33,6 @@ use tokio::sync::Mutex as AsyncMutex;
use url::Url;

use matrix_sdk::{
encryption::verification::SasVerification,
room::Room as MatrixRoom,
ruma::{
events::{
Expand Down Expand Up @@ -93,6 +93,7 @@ use crate::config::ImagePreviewProtocolValues;
use crate::message::ImageStatus;
use crate::notifications::NotificationHandle;
use crate::preview::{source_from_event, spawn_insert_preview};
use crate::verifications::VerifyAction;
use crate::{
message::{Message, MessageEvent, MessageKey, MessageTimeStamp, Messages},
worker::Requester,
Expand Down Expand Up @@ -120,22 +121,6 @@ const ROOM_FETCH_DEBOUNCE: Duration = Duration::from_secs(2);
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum IambInfo {}

/// An action taken against an ongoing verification request.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum VerifyAction {
/// Accept a verification request.
Accept,

/// Cancel an in-progress verification.
Cancel,

/// Confirm an in-progress verification.
Confirm,

/// Reject an in-progress verification due to mismatched Emoji.
Mismatch,
}

/// An action taken against the currently selected message.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum MessageAction {
Expand Down Expand Up @@ -1586,7 +1571,8 @@ pub struct ChatStore {
pub presences: CompletionMap<OwnedUserId, PresenceState>,

/// In-progress and completed verifications.
pub verifications: HashMap<String, SasVerification>,
/// The map key is the `flow_id`.
pub verifications: HashMap<String, VerificationRequest>,

/// Settings for the current profile loaded from config file.
pub settings: ApplicationSettings,
Expand Down Expand Up @@ -1674,13 +1660,6 @@ impl ChatStore {
pub fn set_room_name(&mut self, room_id: &RoomId, name: &str) {
self.rooms.get_or_default(room_id.to_owned()).name = name.to_string().into();
}

/// Insert a new E2EE verification.
pub fn insert_sas(&mut self, sas: SasVerification) {
let key = format!("{}/{}", sas.other_user_id(), sas.other_device().device_id());

self.verifications.insert(key, sas);
}
}

impl ApplicationStore for ChatStore {}
Expand Down
3 changes: 2 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ use crate::base::{
RoomField,
SendAction,
SpaceAction,
VerifyAction,
};
use crate::verifications::VerifyAction;

type ProgContext = CommandContext;
type ProgResult = CommandResult<ProgramCommand>;
Expand Down Expand Up @@ -147,6 +147,7 @@ fn iamb_verify(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
"cancel" => VerifyAction::Cancel,
"confirm" => VerifyAction::Confirm,
"mismatch" => VerifyAction::Mismatch,
"emoji" => VerifyAction::Emoji,
"request" => {
let iact = IambAction::VerifyRequest(args.remove(1));
let step = CommandStep::Continue(iact.into(), ctx.context.clone());
Expand Down
Loading
Loading