Skip to content

Commit

Permalink
move blocking library to lib, rename to blowocking
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Feb 11, 2024
1 parent 67252a0 commit abcd006
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 43 deletions.
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ opt-level = "z"
[workspace]
members = [
"crates/kitsune-activitypub",
"crates/kitsune-blocking",
"crates/kitsune-cache",
"crates/kitsune-captcha",
"crates/kitsune-config",
Expand Down Expand Up @@ -47,6 +46,7 @@ members = [
"kitsune-cli",
"kitsune-job-runner",
"lib/athena",
"lib/blowocking",
"lib/cursiv",
"lib/http-compat",
"lib/http-signatures",
Expand Down
1 change: 0 additions & 1 deletion crates/kitsune-blocking/LICENSE-AGPL-3.0

This file was deleted.

2 changes: 1 addition & 1 deletion crates/kitsune-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license.workspace = true
build = "build.rs"

[dependencies]
blowocking = { path = "../../lib/blowocking" }
diesel = { version = "2.1.4", features = ["uuid"] }
diesel-async = { version = "0.4.1", features = [
"async-connection-wrapper",
Expand All @@ -20,7 +21,6 @@ futures-util = { version = "0.3.30", default-features = false, features = [
"alloc",
] }
iso8601-timestamp = { version = "0.2.17", features = ["diesel-pg"] }
kitsune-blocking = { path = "../kitsune-blocking" }
kitsune-config = { path = "../kitsune-config" }
kitsune-language = { path = "../kitsune-language" }
kitsune-type = { path = "../kitsune-type" }
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-db/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl StdError for IsoCodeConversionError {}
#[derive(Debug, Diagnostic, Error)]
pub enum Error {
#[error(transparent)]
Blocking(#[from] kitsune_blocking::Error),
Blocking(#[from] blowocking::Error),

#[error(transparent)]
Diesel(#[from] diesel::result::Error),
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
pub async fn connect(config: &DatabaseConfig) -> Result<PgPool> {
LogTracer::init().ok();

kitsune_blocking::io({
blowocking::io({
let conn_str = config.url.clone();

move || {
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-db/src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn load_certs() -> rustls::RootCertStore {
// Load certificates on a background thread to avoid blocking the runtime
//
// TODO(aumetra): Maybe add a fallback to `webpki-roots`?
let certs = kitsune_blocking::io(rustls_native_certs::load_native_certs)
let certs = blowocking::io(rustls_native_certs::load_native_certs)
.await
.unwrap()
.expect("Failed to load native certificates");
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-http-signatures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ license.workspace = true

[dependencies]
base64-simd = "0.8.0"
blowocking = { path = "../../lib/blowocking" }
derive_builder = "0.13.0"
http = "1.0.0"
kitsune-blocking = { path = "../kitsune-blocking" }
itertools = { version = "0.12.1", default-features = false }
ring = { version = "0.17.7", features = ["std"] }
time = { version = "0.3.34", default-features = false, features = [
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-http-signatures/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub enum Error {
Base64(#[from] base64_simd::Error),

#[error(transparent)]
Blocking(#[from] kitsune_blocking::Error),
Blocking(#[from] blowocking::Error),

#[error("Signature is expired")]
ExpiredSignature,
Expand Down
4 changes: 2 additions & 2 deletions crates/kitsune-http-signatures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl HttpSigner {
let stringified_signature_string: String = signature_string.try_into()?;

let signature =
kitsune_blocking::crypto(move || key.key.sign(stringified_signature_string.as_bytes()))
blowocking::crypto(move || key.key.sign(stringified_signature_string.as_bytes()))
.await?;

let signature_header = SignatureHeader {
Expand Down Expand Up @@ -309,7 +309,7 @@ impl HttpVerifier {
};
let stringified_signature_string: String = signature_string.try_into()?;

kitsune_blocking::crypto(move || {
blowocking::crypto(move || {
public_key.verify(
stringified_signature_string.as_bytes(),
&signature_header.signature,
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ahash = "0.8.8"
argon2 = "0.5.3"
async-stream = "0.3.5"
athena = { path = "../../lib/athena" }
blowocking = { path = "../../lib/blowocking" }
bytes = "1.5.0"
deadpool-redis = "0.14.0"
derive_builder = "0.13.0"
Expand All @@ -26,7 +27,6 @@ garde = { version = "0.18.0", default-features = false, features = [
http = "1.0.0"
img-parts = "0.3.0"
iso8601-timestamp = "0.2.17"
kitsune-blocking = { path = "../kitsune-blocking" }
kitsune-cache = { path = "../kitsune-cache" }
kitsune-captcha = { path = "../kitsune-captcha" }
kitsune-config = { path = "../kitsune-config" }
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-service/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub enum Error {
Attachment(#[from] AttachmentError),

#[error(transparent)]
Blocking(#[from] kitsune_blocking::Error),
Blocking(#[from] blowocking::Error),

#[error(transparent)]
Cache(#[from] kitsune_cache::Error),
Expand Down
4 changes: 2 additions & 2 deletions crates/kitsune-service/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl UserService {
}

let hashed_password_fut = OptionFuture::from(register.password.map(|password| {
kitsune_blocking::crypto(move || {
blowocking::crypto(move || {
let salt = SaltString::generate(rand::thread_rng());
let argon2 = Argon2::default();

Expand All @@ -153,7 +153,7 @@ impl UserService {
})
}));
let private_key_fut =
kitsune_blocking::crypto(|| RsaPrivateKey::new(&mut rand::thread_rng(), 4096));
blowocking::crypto(|| RsaPrivateKey::new(&mut rand::thread_rng(), 4096));

let (hashed_password, private_key) = tokio::join!(hashed_password_fut, private_key_fut);
let hashed_password = hashed_password.transpose()?.transpose()?;
Expand Down
2 changes: 1 addition & 1 deletion kitsune/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ axum-extra = { version = "0.9.2", features = [
"query",
] }
axum-flash = "0.8.0"
blowocking = { path = "../lib/blowocking" }
bytes = "1.5.0"
chrono = { version = "0.4.34", default-features = false }
clap = { version = "4.5.0", features = ["derive", "wrap_help"] }
Expand All @@ -45,7 +46,6 @@ http-body-util = "0.1.0"
iso8601-timestamp = "0.2.17"
itertools = { version = "0.12.1", default-features = false }
kitsune-activitypub = { path = "../crates/kitsune-activitypub" }
kitsune-blocking = { path = "../crates/kitsune-blocking" }
kitsune-cache = { path = "../crates/kitsune-cache" }
kitsune-captcha = { path = "../crates/kitsune-captcha" }
kitsune-config = { path = "../crates/kitsune-config" }
Expand Down
2 changes: 1 addition & 1 deletion kitsune/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum Error {
ActivityPub(#[from] kitsune_activitypub::error::Error),

#[error(transparent)]
Blocking(#[from] kitsune_blocking::Error),
Blocking(#[from] blowocking::Error),

#[error(transparent)]
Cache(#[from] kitsune_cache::Error),
Expand Down
2 changes: 1 addition & 1 deletion kitsune/src/http/handler/oauth/authorize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub async fn post(
)));
}

let is_valid = kitsune_blocking::crypto(move || {
let is_valid = blowocking::crypto(move || {
let password_hash = PasswordHash::new(user.password.as_ref().unwrap())?;
let argon2 = Argon2::default();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "kitsune-blocking"
name = "blowocking"
authors.workspace = true
edition.workspace = true
version.workspace = true
license.workspace = true
license = "MIT OR Apache-2.0"

[dependencies]
once_cell = "1.19.0"
Expand Down
1 change: 1 addition & 0 deletions lib/blowocking/LICENSE-APACHE-2.0
1 change: 1 addition & 0 deletions lib/blowocking/LICENSE-MIT
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/http-signatures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "kitsune-http-signatures-new"
name = "http-signatures"
authors.workspace = true
edition.workspace = true
version.workspace = true
Expand Down

0 comments on commit abcd006

Please sign in to comment.