Skip to content

Commit

Permalink
chore: update to edition 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
boxdot committed Feb 26, 2025
1 parent 69b82e9 commit b185db9
Show file tree
Hide file tree
Showing 148 changed files with 424 additions and 408 deletions.
2 changes: 1 addition & 1 deletion apiclient/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[package]
name = "phnxapiclient"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
description = "HTTP client for the server REST API"

Expand Down
6 changes: 3 additions & 3 deletions apiclient/src/as_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

use phnxtypes::{
credentials::{keys::ClientSigningKey, ClientCredentialPayload},
credentials::{ClientCredentialPayload, keys::ClientSigningKey},
crypto::{
RatchetEncryptionKey,
kdf::keys::RatchetSecret,
opaque::{
OpaqueLoginFinish, OpaqueLoginRequest, OpaqueRegistrationRecord,
OpaqueRegistrationRequest,
},
signatures::signable::Signable,
RatchetEncryptionKey,
},
endpoint_paths::ENDPOINT_AS,
errors::auth_service::AsProcessingError,
identifiers::{AsClientId, QualifiedUserName},
messages::{
AsTokenType,
client_as::{
AsCredentialsParams, AsPublishConnectionPackagesParamsTbs, AsRequestParams,
ClientConnectionPackageParamsTbs, ClientToAsMessage, ConnectionPackage,
Expand All @@ -33,7 +34,6 @@ use phnxtypes::{
UserClientsResponseIn, UserConnectionPackagesResponseIn,
},
client_qs::DequeueMessagesResponse,
AsTokenType,
},
};
use privacypass::batched_tokens_ristretto255::TokenRequest;
Expand Down
8 changes: 4 additions & 4 deletions apiclient/src/ds_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ use super::*;
use mls_assist::{
messages::AssistedMessageOut,
openmls::prelude::{
tls_codec::Serialize, GroupEpoch, GroupId, LeafNodeIndex, MlsMessageOut, RatchetTreeIn,
GroupEpoch, GroupId, LeafNodeIndex, MlsMessageOut, RatchetTreeIn, tls_codec::Serialize,
},
};
use phnxtypes::{
LibraryError,
credentials::keys::{ClientSigningKey, PseudonymousCredentialSigningKey},
crypto::{
ear::keys::GroupStateEarKey,
Expand All @@ -24,8 +25,8 @@ use phnxtypes::{
identifiers::QsReference,
messages::{
client_ds::{
ConnectionGroupInfoParams, ExternalCommitInfoParams, UpdateQsClientReferenceParams,
WelcomeInfoParams, SUPPORTED_DS_API_VERSIONS,
ConnectionGroupInfoParams, ExternalCommitInfoParams, SUPPORTED_DS_API_VERSIONS,
UpdateQsClientReferenceParams, WelcomeInfoParams,
},
client_ds_out::{
ClientToDsMessageOut, ClientToDsMessageTbsOut, CreateGroupParamsOut,
Expand All @@ -37,7 +38,6 @@ use phnxtypes::{
},
},
time::TimeStamp,
LibraryError,
};

use tls_codec::DeserializeBytes;
Expand Down
2 changes: 1 addition & 1 deletion apiclient/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use std::{sync::Arc, time::Duration};

use phnxtypes::{endpoint_paths::ENDPOINT_HEALTH_CHECK, DEFAULT_PORT_HTTP, DEFAULT_PORT_HTTPS};
use phnxtypes::{DEFAULT_PORT_HTTP, DEFAULT_PORT_HTTPS, endpoint_paths::ENDPOINT_HEALTH_CHECK};
use reqwest::{Client, ClientBuilder, StatusCode, Url};
use thiserror::Error;
use url::ParseError;
Expand Down
12 changes: 6 additions & 6 deletions apiclient/src/qs_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@
use http::StatusCode;
use mls_assist::openmls::prelude::KeyPackage;
use phnxtypes::{
LibraryError,
crypto::{
RatchetEncryptionKey,
ear::keys::KeyPackageEarKey,
kdf::keys::RatchetSecret,
signatures::{
keys::{QsClientSigningKey, QsClientVerifyingKey, QsUserSigningKey},
signable::Signable,
traits::SigningKeyBehaviour,
},
RatchetEncryptionKey,
},
endpoint_paths::ENDPOINT_QS,
errors::version::VersionError,
identifiers::{QsClientId, QsUserId},
messages::{
FriendshipToken,
client_qs::{
ClientKeyPackageParams, ClientKeyPackageResponse, CreateClientRecordResponse,
CreateUserRecordResponse, DeleteClientRecordParams, DeleteUserRecordParams,
DequeueMessagesParams, DequeueMessagesResponse, EncryptionKeyResponse,
KeyPackageParams, KeyPackageResponseIn, QsProcessResponseIn,
QsVersionedProcessResponseIn, UpdateClientRecordParams, UpdateUserRecordParams,
SUPPORTED_QS_API_VERSIONS,
QsVersionedProcessResponseIn, SUPPORTED_QS_API_VERSIONS, UpdateClientRecordParams,
UpdateUserRecordParams,
},
client_qs_out::{
ClientToQsMessageOut, ClientToQsMessageTbsOut, CreateClientRecordParamsOut,
CreateUserRecordParamsOut, PublishKeyPackagesParamsOut, QsRequestParamsOut,
QsVersionedRequestParamsOut,
},
push_token::EncryptedPushToken,
FriendshipToken,
},
LibraryError,
};
use thiserror::Error;
use tls_codec::{DeserializeBytes, Serialize};

use crate::{
version::{extract_api_version_negotiation, negotiate_api_version},
ApiClient, Protocol,
version::{extract_api_version_negotiation, negotiate_api_version},
};

pub mod ws;
Expand Down
6 changes: 3 additions & 3 deletions apiclient/src/qs_api/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use std::{net::TcpListener, time::Duration};

use actix::{Actor, ActorContext, AsyncContext, StreamHandler};
use actix_web::{
App, HttpRequest, HttpResponse, HttpServer, Responder,
dev::Server,
middleware::Logger,
web::{self},
App, HttpRequest, HttpResponse, HttpServer, Responder,
};
use actix_web_actors::ws;
use base64::{engine::general_purpose, Engine as _};
use base64::{Engine as _, engine::general_purpose};
use phnxtypes::{
codec::PhnxCodec,
endpoint_paths::ENDPOINT_QS_WS,
Expand All @@ -24,7 +24,7 @@ use tokio_util::sync::CancellationToken;
use tracing::{error, info};
use uuid::Uuid;

use crate::{qs_api::ws::WsEvent, ApiClient};
use crate::{ApiClient, qs_api::ws::WsEvent};

static QUEUE_ID_VALUE: Uuid = Uuid::nil();

Expand Down
7 changes: 3 additions & 4 deletions apiclient/src/qs_api/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use core::time;
use std::{pin::pin, time::Duration};

use base64::{engine::general_purpose, Engine as _};
use base64::{Engine as _, engine::general_purpose};
use futures_util::{SinkExt, StreamExt};
use http::{HeaderValue, Request};
use phnxtypes::{
Expand All @@ -19,12 +19,11 @@ use tls_codec::DeserializeBytes;
use tokio::{
net::TcpStream,
sync::mpsc,
time::{sleep, Instant},
time::{Instant, sleep},
};
use tokio_tungstenite::{
connect_async,
MaybeTlsStream, WebSocketStream, connect_async,
tungstenite::{client::IntoClientRequest, protocol::Message},
MaybeTlsStream, WebSocketStream,
};
use tokio_util::sync::{CancellationToken, DropGuard};
use tracing::{error, info};
Expand Down
4 changes: 2 additions & 2 deletions apiclient/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use std::{

use http::{HeaderMap, StatusCode};
use phnxtypes::{
errors::version::VersionError,
messages::{client_ds::CURRENT_DS_API_VERSION, client_qs::CURRENT_QS_API_VERSION, ApiVersion},
ACCEPTED_API_VERSIONS_HEADER,
errors::version::VersionError,
messages::{ApiVersion, client_ds::CURRENT_DS_API_VERSION, client_qs::CURRENT_QS_API_VERSION},
};
use tracing::error;

Expand Down
2 changes: 1 addition & 1 deletion applogic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
name = "phnxapplogic"
version = "0.1.0"
authors = ["Phoenix R&D GmbH <[email protected]>"]
edition = "2021"
edition = "2024"
publish = false
description = "Multi-platform client application logic"

Expand Down
6 changes: 3 additions & 3 deletions applogic/src/api/conversation_details_cubit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ use std::{sync::Arc, time::Duration};

use chrono::{DateTime, SubsecRound, Utc};
use flutter_rust_bridge::frb;
use phnxcoreclient::{clients::CoreUser, store::Store, ConversationMessageId, MimiContent};
use phnxcoreclient::{store::StoreNotification, ConversationId};
use phnxcoreclient::{ConversationId, store::StoreNotification};
use phnxcoreclient::{ConversationMessageId, MimiContent, clients::CoreUser, store::Store};
use tokio::{sync::watch, time::sleep};
use tokio_stream::{Stream, StreamExt};
use tokio_util::sync::CancellationToken;
use tracing::error;

use crate::util::{spawn_from_sync, Cubit, CubitCore};
use crate::StreamSink;
use crate::util::{Cubit, CubitCore, spawn_from_sync};

use super::{
conversation_list_cubit::converation_into_ui_details,
Expand Down
6 changes: 3 additions & 3 deletions applogic/src/api/conversation_list_cubit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ use std::{pin::pin, sync::Arc};

use flutter_rust_bridge::frb;
use phnxcoreclient::{
Conversation,
clients::CoreUser,
store::{Store, StoreEntityId, StoreOperation},
Conversation,
};
use phnxcoreclient::{store::StoreNotification, ConversationId};
use phnxcoreclient::{ConversationId, store::StoreNotification};
use tokio::sync::watch;
use tokio_stream::{Stream, StreamExt};
use tokio_util::sync::CancellationToken;
use tracing::debug;

use crate::util::{spawn_from_sync, Cubit, CubitCore};
use crate::StreamSink;
use crate::util::{Cubit, CubitCore, spawn_from_sync};

use super::{
types::{UiConversation, UiConversationDetails, UiConversationMessage},
Expand Down
4 changes: 2 additions & 2 deletions applogic/src/api/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use flutter_rust_bridge::frb;
use regex::Regex;

use crate::{
logging::{init_logger, LOG_FILE_RING_BUFFER, LOG_FILE_RING_BUFFER_SIZE},
util::{FileRingBuffer, FileRingBufferLock},
StreamSink,
logging::{LOG_FILE_RING_BUFFER, LOG_FILE_RING_BUFFER_SIZE, init_logger},
util::{FileRingBuffer, FileRingBufferLock},
};

/// Initializes the Rust logging system
Expand Down
6 changes: 3 additions & 3 deletions applogic/src/api/message_cubit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ use std::{pin::pin, sync::Arc};

use flutter_rust_bridge::frb;
use phnxcoreclient::{
store::{Store, StoreNotification, StoreOperation, StoreResult},
ConversationMessageId,
store::{Store, StoreNotification, StoreOperation, StoreResult},
};
use tokio::sync::watch;
use tokio_stream::{Stream, StreamExt};
use tokio_util::sync::CancellationToken;
use tracing::{debug, error};

use crate::{
api::types::UiFlightPosition,
util::{spawn_from_sync, Cubit, CubitCore},
StreamSink,
api::types::UiFlightPosition,
util::{Cubit, CubitCore, spawn_from_sync},
};

use super::{types::UiConversationMessage, user_cubit::UserCubitBase};
Expand Down
4 changes: 2 additions & 2 deletions applogic/src/api/message_list_cubit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ use std::{collections::HashMap, pin::pin, sync::Arc};

use flutter_rust_bridge::frb;
use phnxcoreclient::{
store::{Store, StoreEntityId, StoreNotification, StoreOperation},
ConversationId, ConversationMessage, ConversationMessageId,
store::{Store, StoreEntityId, StoreNotification, StoreOperation},
};
use tokio::sync::watch;
use tokio_stream::{Stream, StreamExt};
use tokio_util::sync::CancellationToken;
use tracing::{debug, error, warn};

use crate::{
util::{spawn_from_sync, Cubit, CubitCore},
StreamSink,
util::{Cubit, CubitCore, spawn_from_sync},
};

use super::{
Expand Down
5 changes: 3 additions & 2 deletions applogic/src/api/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
use anyhow::{Context, Result};
use flutter_rust_bridge::frb;
use phnxcoreclient::{
Asset, UserProfile,
clients::{
store::{ClientRecord, ClientRecordState},
CoreUser,
store::{ClientRecord, ClientRecordState},
},
open_client_db, Asset, UserProfile,
open_client_db,
};
use phnxtypes::{
identifiers::{AsClientId, QualifiedUserName},
Expand Down
10 changes: 5 additions & 5 deletions applogic/src/api/user_cubit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ use std::time::Duration;
use anyhow::bail;
use flutter_rust_bridge::frb;
use phnxapiclient::qs_api::ws::WsEvent;
use phnxcoreclient::{clients::CoreUser, store::Store, ConversationId};
use phnxcoreclient::{Asset, UserProfile};
use phnxcoreclient::{ConversationId, clients::CoreUser, store::Store};
use phnxtypes::identifiers::QualifiedUserName;
use phnxtypes::messages::client_ds::QsWsMessage;
use tokio::sync::RwLock;
use tokio_util::sync::{CancellationToken, DropGuard};
use tracing::{error, info, warn};

use crate::{
api::types::{UiContact, UiUserProfile},
messages::FetchedMessages,
StreamSink,
util::{FibonacciBackoff, spawn_from_sync},
};
use crate::{
util::{spawn_from_sync, FibonacciBackoff},
StreamSink,
api::types::{UiContact, UiUserProfile},
messages::FetchedMessages,
};

use super::{types::ImageData, user::User};
Expand Down
2 changes: 1 addition & 1 deletion applogic/src/background_execution/java_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

use jni::{
JNIEnv,
objects::{JClass, JString},
sys::jstring,
JNIEnv,
};

use crate::{background_execution::processing::retrieve_messages_sync, logging::init_logger};
Expand Down
4 changes: 2 additions & 2 deletions applogic/src/background_execution/swift_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later

use std::ffi::{c_char, CStr, CString};
use std::ffi::{CStr, CString, c_char};

use crate::background_execution::{
processing::retrieve_messages_sync, IncomingNotificationContent,
IncomingNotificationContent, processing::retrieve_messages_sync,
};
use crate::logging::init_logger;

Expand Down
6 changes: 3 additions & 3 deletions applogic/src/logging/dart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ use std::sync::LazyLock;
use chrono::Utc;
use parking_lot::RwLock;
use tracing::field::{Field, Visit};
use tracing::{warn, Event, Subscriber};
use tracing::{Event, Subscriber, warn};
use tracing_subscriber::Layer;
use tracing_subscriber::layer::Context;
use tracing_subscriber::registry::LookupSpan;
use tracing_subscriber::Layer;

use crate::api::logging::LogEntry;
use crate::StreamSink;
use crate::api::logging::LogEntry;

static DART_SINK: LazyLock<RwLock<Option<StreamSink<LogEntry>>>> =
LazyLock::new(|| RwLock::new(None));
Expand Down
2 changes: 1 addition & 1 deletion applogic/src/logging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use anyhow::Context;
use tracing::warn;
use tracing::{info, level_filters::LevelFilter};
use tracing_subscriber::util::{SubscriberInitExt, TryInitError};
use tracing_subscriber::{EnvFilter, registry};
use tracing_subscriber::{fmt, layer::SubscriberExt};
use tracing_subscriber::{registry, EnvFilter};

use crate::util::{FileRingBuffer, FileRingBufferLock};

Expand Down
2 changes: 1 addition & 1 deletion applogic/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

use anyhow::Result;
use phnxcoreclient::{clients::process::process_qs::ProcessedQsMessages, ConversationId};
use phnxcoreclient::{ConversationId, clients::process::process_qs::ProcessedQsMessages};

use crate::{api::user::User, notifications::LocalNotificationContent};

Expand Down
Loading

0 comments on commit b185db9

Please sign in to comment.