mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 05:16:28 +03:00
No clippy warnings anymore!
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
use std::path::PathBuf;
|
use std::hint::black_box;
|
||||||
use std::{hint::black_box, io::Write};
|
|
||||||
|
|
||||||
use criterion::{Criterion, criterion_group, criterion_main};
|
use criterion::{Criterion, criterion_group, criterion_main};
|
||||||
|
use deltachat::benchmark_internals::create_dummy_keypair;
|
||||||
use deltachat::benchmark_internals::save_broadcast_shared_secret;
|
use deltachat::benchmark_internals::save_broadcast_shared_secret;
|
||||||
use deltachat::{
|
use deltachat::{
|
||||||
Events,
|
Events,
|
||||||
@@ -11,10 +11,7 @@ use deltachat::{
|
|||||||
chat::ChatId,
|
chat::ChatId,
|
||||||
config::Config,
|
config::Config,
|
||||||
context::Context,
|
context::Context,
|
||||||
imex::{ImexMode, imex},
|
pgp::{KeyPair, decrypt, encrypt_for_broadcast, pk_encrypt},
|
||||||
key,
|
|
||||||
pgp::{KeyPair, create_dummy_keypair, decrypt, encrypt_for_broadcast, pk_encrypt},
|
|
||||||
receive_imf,
|
|
||||||
stock_str::StockStrings,
|
stock_str::StockStrings,
|
||||||
tools::create_broadcast_shared_secret_pub,
|
tools::create_broadcast_shared_secret_pub,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
//! Re-exports of internal functions needed for benchmarks.
|
//! 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 anyhow::Result;
|
||||||
|
use deltachat_contact_tools::EmailAddress;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use crate::chat::ChatId;
|
use crate::chat::ChatId;
|
||||||
@@ -32,3 +34,7 @@ pub async fn save_broadcast_shared_secret(
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
crate::chat::save_broadcast_shared_secret(context, chat_id, secret).await
|
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!(
|
println!(
|
||||||
"\nEncrypting pk:\n{}\n",
|
"\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?;
|
let ctext = pgp::pk_encrypt(raw_message, keyring, Some(sign_key), compress).await?;
|
||||||
|
|
||||||
@@ -80,8 +80,8 @@ impl EncryptHelper {
|
|||||||
|
|
||||||
println!(
|
println!(
|
||||||
"\nEncrypting symm:\n{}\n",
|
"\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?;
|
let ctext = pgp::encrypt_for_broadcast(raw_message, passphrase, sign_key, compress).await?;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use crate::key::{DcKey, Fingerprint};
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) const HEADER_AUTOCRYPT: &str = "autocrypt-prefer-encrypt";
|
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.
|
/// Preferred symmetric encryption algorithm.
|
||||||
const SYMMETRIC_KEY_ALGORITHM: SymmetricKeyAlgorithm = SymmetricKeyAlgorithm::AES128;
|
const SYMMETRIC_KEY_ALGORITHM: SymmetricKeyAlgorithm = SymmetricKeyAlgorithm::AES128;
|
||||||
@@ -149,11 +149,6 @@ pub(crate) fn create_keypair(addr: EmailAddress) -> Result<KeyPair> {
|
|||||||
Ok(key_pair)
|
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.
|
/// Selects a subkey of the public key to use for encryption.
|
||||||
///
|
///
|
||||||
/// Returns `None` if the public key cannot be used 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.
|
/// Ask whether to join the broadcast channel.
|
||||||
AskJoinBroadcast {
|
AskJoinBroadcast {
|
||||||
// TODO document
|
/// The user-visible name of this broadcast channel
|
||||||
broadcast_name: String,
|
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,
|
grpid: String,
|
||||||
|
|
||||||
|
/// The contact id of the inviter
|
||||||
contact_id: ContactId,
|
contact_id: ContactId,
|
||||||
|
|
||||||
|
/// The PGP fingerprint of the inviter
|
||||||
fingerprint: Fingerprint,
|
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,
|
authcode: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user