mirror of
https://github.com/chatmail/core.git
synced 2026-04-25 09:26:30 +03:00
No clippy warnings anymore!
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::path::PathBuf;
|
||||
use std::{hint::black_box, io::Write};
|
||||
use std::hint::black_box;
|
||||
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
use deltachat::benchmark_internals::create_dummy_keypair;
|
||||
use deltachat::benchmark_internals::save_broadcast_shared_secret;
|
||||
use deltachat::{
|
||||
Events,
|
||||
@@ -11,10 +11,7 @@ use deltachat::{
|
||||
chat::ChatId,
|
||||
config::Config,
|
||||
context::Context,
|
||||
imex::{ImexMode, imex},
|
||||
key,
|
||||
pgp::{KeyPair, create_dummy_keypair, decrypt, encrypt_for_broadcast, pk_encrypt},
|
||||
receive_imf,
|
||||
pgp::{KeyPair, decrypt, encrypt_for_broadcast, pk_encrypt},
|
||||
stock_str::StockStrings,
|
||||
tools::create_broadcast_shared_secret_pub,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
//! Re-exports of internal functions needed for benchmarks.
|
||||
#![allow(missing_docs)] // Not necessary to put a doc comment on the pub functions here
|
||||
|
||||
use anyhow::Result;
|
||||
use deltachat_contact_tools::EmailAddress;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::chat::ChatId;
|
||||
@@ -32,3 +34,7 @@ pub async fn save_broadcast_shared_secret(
|
||||
) -> Result<()> {
|
||||
crate::chat::save_broadcast_shared_secret(context, chat_id, secret).await
|
||||
}
|
||||
|
||||
pub fn create_dummy_keypair(addr: &str) -> Result<KeyPair> {
|
||||
pgp::create_keypair(EmailAddress::new(addr)?)
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ impl EncryptHelper {
|
||||
|
||||
println!(
|
||||
"\nEncrypting pk:\n{}\n",
|
||||
str::from_utf8(&raw_message).unwrap()
|
||||
);
|
||||
String::from_utf8_lossy(&raw_message)
|
||||
); // TODO
|
||||
|
||||
let ctext = pgp::pk_encrypt(raw_message, keyring, Some(sign_key), compress).await?;
|
||||
|
||||
@@ -80,8 +80,8 @@ impl EncryptHelper {
|
||||
|
||||
println!(
|
||||
"\nEncrypting symm:\n{}\n",
|
||||
str::from_utf8(&raw_message).unwrap()
|
||||
);
|
||||
String::from_utf8_lossy(&raw_message)
|
||||
); // TODO
|
||||
|
||||
let ctext = pgp::encrypt_for_broadcast(raw_message, passphrase, sign_key, compress).await?;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::key::{DcKey, Fingerprint};
|
||||
#[cfg(test)]
|
||||
pub(crate) const HEADER_AUTOCRYPT: &str = "autocrypt-prefer-encrypt";
|
||||
|
||||
pub const HEADER_SETUPCODE: &str = "passphrase-begin";
|
||||
pub(crate) const HEADER_SETUPCODE: &str = "passphrase-begin";
|
||||
|
||||
/// Preferred symmetric encryption algorithm.
|
||||
const SYMMETRIC_KEY_ALGORITHM: SymmetricKeyAlgorithm = SymmetricKeyAlgorithm::AES128;
|
||||
@@ -149,11 +149,6 @@ pub(crate) fn create_keypair(addr: EmailAddress) -> Result<KeyPair> {
|
||||
Ok(key_pair)
|
||||
}
|
||||
|
||||
#[cfg(feature = "internals")]
|
||||
pub fn create_dummy_keypair(addr: &str) -> Result<KeyPair> {
|
||||
create_keypair(EmailAddress::new(addr)?)
|
||||
}
|
||||
|
||||
/// Selects a subkey of the public key to use for encryption.
|
||||
///
|
||||
/// Returns `None` if the public key cannot be used for encryption.
|
||||
|
||||
13
src/qr.rs
13
src/qr.rs
@@ -86,16 +86,25 @@ pub enum Qr {
|
||||
|
||||
/// Ask whether to join the broadcast channel.
|
||||
AskJoinBroadcast {
|
||||
// TODO document
|
||||
/// The user-visible name of this broadcast channel
|
||||
broadcast_name: String,
|
||||
|
||||
// TODO not sure wheter it makes sense to call this grpid just because it's called like this in the db
|
||||
/// A string of random characters,
|
||||
/// uniquely identifying this broadcast channel in the database.
|
||||
/// Called `grpid` for historic reasons:
|
||||
/// The id of multi-user chats is always called `grpid` in the database
|
||||
/// because groups were once the only multi-user chats.
|
||||
grpid: String,
|
||||
|
||||
/// The contact id of the inviter
|
||||
contact_id: ContactId,
|
||||
|
||||
/// The PGP fingerprint of the inviter
|
||||
fingerprint: Fingerprint,
|
||||
|
||||
/// The AUTH code from the secure-join protocol,
|
||||
/// which is both used to encrypt the first message to the inviter
|
||||
/// and to prove to the inviter that we saw the QR code.
|
||||
authcode: String,
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user