diff --git a/Cargo.lock b/Cargo.lock index 9c31c426..7883512d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -620,6 +620,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" + [[package]] name = "base64ct" version = "1.6.0" @@ -662,11 +668,11 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.65.1" +version = "0.66.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", "cexpr", "clang-sys", "lazy_static", @@ -680,7 +686,7 @@ dependencies = [ "rustc-hash", "shlex", "syn 2.0.53", - "which", + "which 4.4.2", ] [[package]] @@ -802,7 +808,7 @@ dependencies = [ "async-trait", "aws-sign-v4", "backend", - "base64 0.21.7", + "base64 0.22.0", "bigdecimal", "bytes", "chirpstack_api", @@ -813,6 +819,7 @@ dependencies = [ "diesel-async", "diesel_migrations", "dotenv", + "email_address", "futures", "futures-util", "gcp_auth", @@ -865,7 +872,7 @@ dependencies = [ "tokio-postgres-rustls", "tokio-reactor-trait", "tokio-stream", - "toml", + "toml 0.8.12", "tonic", "tonic-reflection", "tonic-web", @@ -875,7 +882,6 @@ dependencies = [ "tracing-subscriber", "urlencoding", "uuid", - "validator", "warp", ] @@ -909,7 +915,7 @@ dependencies = [ "serde", "serde_json", "tokio", - "toml", + "toml 0.8.12", "tracing", "tracing-subscriber", ] @@ -1058,6 +1064,15 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "cookie-factory" version = "0.3.2" @@ -1506,6 +1521,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "email_address" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2153bd83ebc09db15bcbdc3e2194d901804952e3dc96967e1cd3b0c5c32d112" +dependencies = [ + "serde", +] + [[package]] name = "ena" version = "0.14.2" @@ -1820,27 +1844,27 @@ dependencies = [ [[package]] name = "gcp_auth" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d3b20d3058763d26d88e6e7a49998841e5296735b00dbfb064ff7cb142933dd" +checksum = "0945a7cceec112dc8a4a0cfa10d1c3b7bc227652d09f7edcab42ef51cbfc46e3" dependencies = [ "async-trait", - "base64 0.21.7", - "dirs-next", + "base64 0.22.0", + "chrono", + "home", "hyper", - "hyper-rustls", - "ring 0.16.20", - "rustls 0.21.10", - "rustls-pemfile 1.0.4", + "hyper-rustls 0.25.0", + "ring 0.17.8", + "rustls 0.22.2", + "rustls-pemfile 2.1.1", "serde", "serde_json", "thiserror", - "time", "tokio", "tracing", "tracing-futures", "url", - "which", + "which 6.0.0", ] [[package]] @@ -1944,9 +1968,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.5.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" +checksum = "ab283476b99e66691dee3f1640fea91487a8d81f50fb5ecc75538f8f8879a1e4" dependencies = [ "log", "pest", @@ -2161,11 +2185,26 @@ dependencies = [ "http", "hyper", "rustls 0.21.10", - "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.24.1", ] +[[package]] +name = "hyper-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "399c78f9338483cb7e630c8474b07268983c6bd5acee012e4211f9f7bb21b070" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls 0.22.2", + "rustls-native-certs 0.7.0", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.25.0", +] + [[package]] name = "hyper-timeout" version = "0.4.1" @@ -2207,16 +2246,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.5.0" @@ -2533,7 +2562,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f23f71580015254b020e856feac3df5878c2c7a8812297edd6c0a485ac9dada" dependencies = [ "serde", - "toml", + "toml 0.7.8", ] [[package]] @@ -3253,7 +3282,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", ] [[package]] @@ -3317,7 +3370,7 @@ dependencies = [ "regex", "syn 2.0.53", "tempfile", - "which", + "which 4.4.2", ] [[package]] @@ -3544,7 +3597,7 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-rustls", + "hyper-rustls 0.24.2", "ipnet", "js-sys", "log", @@ -3613,18 +3666,19 @@ dependencies = [ [[package]] name = "rquickjs" -version = "0.3.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db7788c2818f4546daabe9ae2d1ee2f4db61ab1998d4b483494c4193cc38dab" +checksum = "ad7f63201fa6f2ff8173e4758ea552549d687d8f63003361a8b5c50f7c446ded" dependencies = [ "rquickjs-core", + "rquickjs-macro", ] [[package]] name = "rquickjs-core" -version = "0.3.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b12cf8646fe0af5bcff2822ccd162990f0679a1f9287c7257f4f4193a9d31ea9" +checksum = "cad00eeddc0f88af54ee202c8385fb214fe0423897c056a7df8369fb482e3695" dependencies = [ "chrono", "relative-path", @@ -3632,10 +3686,28 @@ dependencies = [ ] [[package]] -name = "rquickjs-sys" -version = "0.3.1" +name = "rquickjs-macro" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b747058afd4d988d056e4972ec8516a5a86fdfc103c1c1485bfee8966a0743ae" +checksum = "f27b39e889cc951e3e5f6b74012f943e642fa0fac51a8552948751f19a9b62f8" +dependencies = [ + "convert_case", + "fnv", + "ident_case", + "indexmap 2.2.5", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "rquickjs-core", + "syn 2.0.53", +] + +[[package]] +name = "rquickjs-sys" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120dbbc3296de9b96de8890091635d46f3506cd38b4e8f21800c386c035d64fa" dependencies = [ "bindgen", "cc", @@ -4661,7 +4733,19 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.19.15", +] + +[[package]] +name = "toml" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.8", ] [[package]] @@ -4683,7 +4767,20 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c12219811e0c1ba077867254e5ad62ee2c9c190b0d957110750ac0cda1ae96cd" +dependencies = [ + "indexmap 2.2.5", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.5", ] [[package]] @@ -4941,6 +5038,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + [[package]] name = "unicode-width" version = "0.1.11" @@ -4978,7 +5081,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", "serde", ] @@ -5005,21 +5108,6 @@ dependencies = [ "serde", ] -[[package]] -name = "validator" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd" -dependencies = [ - "idna 0.4.0", - "lazy_static", - "regex", - "serde", - "serde_derive", - "serde_json", - "url", -] - [[package]] name = "valuable" version = "0.1.0" @@ -5199,6 +5287,19 @@ dependencies = [ "rustix 0.38.31", ] +[[package]] +name = "which" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fa5e0c10bf77f44aac573e498d1a82d5fbd5e91f6fc0a99e7be4b38e85e101c" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.31", + "windows-sys 0.52.0", +] + [[package]] name = "whoami" version = "1.5.1" @@ -5391,6 +5492,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index c70bcc55..23e50ad2 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -16,7 +16,7 @@ rand = "0.8" aes-kw = "0.2" reqwest = { version = "0.11", features = ["json", "rustls-tls"], default-features = false } chrono = { version = "0.4", features = ["serde"] } -tokio = { version = "1.32", features = ["macros" ] } +tokio = { version = "1.36", features = ["macros" ] } chirpstack_api = { path = "../api/rust", default-features = false, features = ["json"] } # Development and testing diff --git a/chirpstack-integration/Cargo.toml b/chirpstack-integration/Cargo.toml index 9d82b032..2db8c65f 100644 --- a/chirpstack-integration/Cargo.toml +++ b/chirpstack-integration/Cargo.toml @@ -23,7 +23,7 @@ ], default-features = true } async-trait = "0.1.73" serde = { version = "1.0", features = ["derive"] } - tokio = { version = "1.32", features = ["macros", "rt-multi-thread"] } + tokio = { version = "1.36", features = ["macros", "rt-multi-thread"] } lazy_static = "1.4" serde_json = "1.0" - toml = "0.7" + toml = "0.8" diff --git a/chirpstack-integration/src/lib.rs b/chirpstack-integration/src/lib.rs index 5c66caae..ab91e499 100644 --- a/chirpstack-integration/src/lib.rs +++ b/chirpstack-integration/src/lib.rs @@ -467,7 +467,10 @@ mod test { sleep(Duration::from_millis(100)).await; let redis_client = redis::Client::open(redis_url).unwrap(); - let mut redis_conn = redis_client.get_async_connection().await.unwrap(); + let mut redis_conn = redis_client + .get_multiplexed_async_connection() + .await + .unwrap(); println!("Uplink"); diff --git a/chirpstack/Cargo.toml b/chirpstack/Cargo.toml index 578f9d5d..567505e6 100644 --- a/chirpstack/Cargo.toml +++ b/chirpstack/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT" [dependencies] # CLI interface -clap = { version = "4.4", features = ["derive"] } +clap = { version = "4.5", features = ["derive"] } # Configuration serde = { version = "1.0", features = ["derive", "rc"] } @@ -19,11 +19,11 @@ serde_yaml = "0.9" serde_json = "1.0" serde_urlencoded = "0.7" humantime-serde = "1.1" -toml = "0.7" -handlebars = "4.4" +toml = "0.8" +handlebars = "5.1" # Database -validator = "0.16" +email_address = "0.2" diesel = { version = "2.1", features = [ "chrono", "uuid", @@ -65,7 +65,7 @@ hmac = "0.12" sha2 = "0.10" urlencoding = "2.1" geohash = "0.13" -gcp_auth = "0.9" +gcp_auth = "0.11" lapin = "2.3" tokio-executor-trait = "2.1" tokio-reactor-trait = "1.1" @@ -89,7 +89,7 @@ futures = "0.3" futures-util = "0.3" http = "0.2" http-body = "0.4" -rust-embed = "8.1" +rust-embed = "8.3" mime_guess = "2.0" tower-http = { version = "0.4", features = ["trace", "auth"] } @@ -103,10 +103,10 @@ rand_core = { version = "0.6", features = ["std"] } jsonwebtoken = "9.2" rustls = "0.22" rustls-native-certs = "0.7" -rustls-pemfile = "2.0" +rustls-pemfile = "2.1" rsa = "0.9" rcgen = { version = "0.12", features = [ "x509-parser" ] } -openidconnect = { version = "3.3", features = ["accept-rfc3339-timestamps"] } +openidconnect = { version = "3.5", features = ["accept-rfc3339-timestamps"] } oauth2 = "4.4" # MQTT @@ -114,7 +114,7 @@ rumqttc = { version = "0.24", features = ["url"] } hex = "0.4" # Codecs -rquickjs = { version = "0.3", features = [ +rquickjs = { version = "0.5", features = [ "bindgen", "loader", "array-buffer", @@ -123,14 +123,14 @@ rquickjs = { version = "0.3", features = [ # Misc lazy_static = "1.4" -uuid = { version = "1.4", features = ["v4", "serde"] } +uuid = { version = "1.8", features = ["v4", "serde"] } chrono = "0.4" async-trait = "0.1" aes = "0.8" rand = "0.8" -base64 = "0.21" +base64 = "0.22" async-recursion = "1.0" -regex = "1.9" +regex = "1.10" petgraph = "0.6" prometheus-client = "0.22" pin-project = "1.1" @@ -138,7 +138,7 @@ pin-project = "1.1" # Development and testing [dev-dependencies] httpmock = "0.7.0" -bytes = "1.4" +bytes = "1.5" dotenv = "0.15" [features] diff --git a/chirpstack/src/adr/plugin.rs b/chirpstack/src/adr/plugin.rs index f6f10696..3ce82eca 100644 --- a/chirpstack/src/adr/plugin.rs +++ b/chirpstack/src/adr/plugin.rs @@ -52,16 +52,17 @@ impl Handler for Plugin { ctx.with::<_, Result>(|ctx| { let m = ctx + .clone() .compile("script", self.script.clone()) .context("Compile script")?; let func: rquickjs::Function = m.get("handle").context("Get handle function")?; - let device_variables = rquickjs::Object::new(ctx)?; + let device_variables = rquickjs::Object::new(ctx.clone())?; for (k, v) in &req.device_variables { device_variables.set(k, v)?; } - let input = rquickjs::Object::new(ctx)?; + let input = rquickjs::Object::new(ctx.clone())?; input.set("regionConfigId", req.region_config_id.clone())?; input.set("regionCommonName", req.region_common_name.to_string())?; input.set("devEui", req.dev_eui.to_string())?; @@ -81,7 +82,7 @@ impl Handler for Plugin { let mut uplink_history: Vec = Vec::new(); for uh in &req.uplink_history { - let obj = rquickjs::Object::new(ctx)?; + let obj = rquickjs::Object::new(ctx.clone())?; obj.set("fCnt", uh.f_cnt)?; obj.set("maxSnr", uh.max_snr)?; obj.set("maxRssi", uh.max_rssi)?; diff --git a/chirpstack/src/backend/roaming.rs b/chirpstack/src/backend/roaming.rs index 0fd4609c..fac6067f 100644 --- a/chirpstack/src/backend/roaming.rs +++ b/chirpstack/src/backend/roaming.rs @@ -249,7 +249,7 @@ pub fn ul_meta_data_to_rx_info(ul_meta_data: &ULMetaData) -> Result Option( - ctx: rquickjs::Ctx<'js>, + ctx: &rquickjs::Ctx<'js>, obj: &prost_types::Struct, ) -> rquickjs::Object<'js> { - let out = rquickjs::Object::new(ctx).unwrap(); + let out = rquickjs::Object::new(ctx.clone()).unwrap(); for (k, v) in &obj.fields { out.set(k, _struct_to_rquickjs(ctx, v)).unwrap(); @@ -75,27 +75,27 @@ pub fn struct_to_rquickjs<'js>( } fn _struct_to_rquickjs<'js>( - ctx: rquickjs::Ctx<'js>, + ctx: &rquickjs::Ctx<'js>, val: &prost_types::Value, ) -> rquickjs::Value<'js> { match &val.kind { - None => rquickjs::Value::new_null(ctx), + None => rquickjs::Value::new_null(ctx.clone()), Some(val) => match val { - prost_types::value::Kind::NullValue(_) => rquickjs::Value::new_null(ctx), - prost_types::value::Kind::NumberValue(v) => rquickjs::Value::new_float(ctx, *v), + prost_types::value::Kind::NullValue(_) => rquickjs::Value::new_null(ctx.clone()), + prost_types::value::Kind::NumberValue(v) => rquickjs::Value::new_float(ctx.clone(), *v), prost_types::value::Kind::StringValue(v) => { - rquickjs::Value::from_string(rquickjs::String::from_str(ctx, v).unwrap()) + rquickjs::Value::from_string(rquickjs::String::from_str(ctx.clone(), v).unwrap()) } - prost_types::value::Kind::BoolValue(v) => rquickjs::Value::new_bool(ctx, *v), + prost_types::value::Kind::BoolValue(v) => rquickjs::Value::new_bool(ctx.clone(), *v), prost_types::value::Kind::StructValue(v) => { - let out = rquickjs::Object::new(ctx).unwrap(); + let out = rquickjs::Object::new(ctx.clone()).unwrap(); for (k, v) in &v.fields { out.set(k, _struct_to_rquickjs(ctx, v)).unwrap(); } rquickjs::Value::from_object(out) } prost_types::value::Kind::ListValue(v) => { - let out = rquickjs::Array::new(ctx).unwrap(); + let out = rquickjs::Array::new(ctx.clone()).unwrap(); for (i, v) in v.values.iter().enumerate() { out.set(i, _struct_to_rquickjs(ctx, v)).unwrap(); } diff --git a/chirpstack/src/codec/js/mod.rs b/chirpstack/src/codec/js/mod.rs index 395f0043..34f3861f 100644 --- a/chirpstack/src/codec/js/mod.rs +++ b/chirpstack/src/codec/js/mod.rs @@ -50,7 +50,7 @@ pub async fn decode( let out = ctx.with(|ctx| -> Result { // We need to export the Buffer class, as eval / eval_with_options // does not allow using import statement. - let buff: rquickjs::Module = ctx.compile( + let buff: rquickjs::Module = ctx.clone().compile( "b", r#" import { Buffer } from "buffer"; @@ -59,11 +59,11 @@ pub async fn decode( )?; let buff: rquickjs::Function = buff.get("Buffer")?; - let input = rquickjs::Object::new(ctx)?; - input.set("bytes", b.into_js(ctx)?)?; - input.set("fPort", f_port.into_js(ctx)?)?; - input.set("recvTime", recv_time.into_js(ctx)?)?; - input.set("variables", variables.into_js(ctx)?)?; + let input = rquickjs::Object::new(ctx.clone())?; + input.set("bytes", b.into_js(&ctx)?)?; + input.set("fPort", f_port.into_js(&ctx)?)?; + input.set("recvTime", recv_time.into_js(&ctx)?)?; + input.set("variables", variables.into_js(&ctx)?)?; let globals = ctx.globals(); globals.set("chirpstack_input", input)?; @@ -134,7 +134,7 @@ pub async fn encode( ctx.with(|ctx| { // We need to export the Buffer class, as eval / eval_with_options // does not allow using import statement. - let buff: rquickjs::Module = ctx.compile( + let buff: rquickjs::Module = ctx.clone().compile( "b", r#" import { Buffer } from "buffer"; @@ -143,10 +143,10 @@ pub async fn encode( )?; let buff: rquickjs::Function = buff.get("Buffer")?; - let input = rquickjs::Object::new(ctx)?; - input.set("fPort", f_port.into_js(ctx)?)?; - input.set("variables", variables.into_js(ctx)?)?; - input.set("data", convert::struct_to_rquickjs(ctx, s))?; + let input = rquickjs::Object::new(ctx.clone())?; + input.set("fPort", f_port.into_js(&ctx)?)?; + input.set("variables", variables.into_js(&ctx)?)?; + input.set("data", convert::struct_to_rquickjs(&ctx, s))?; let globals = ctx.globals(); globals.set("chirpstack_input", input)?; diff --git a/chirpstack/src/integration/gcp_pub_sub.rs b/chirpstack/src/integration/gcp_pub_sub.rs index bfb36bfb..555762e9 100644 --- a/chirpstack/src/integration/gcp_pub_sub.rs +++ b/chirpstack/src/integration/gcp_pub_sub.rs @@ -46,7 +46,7 @@ impl Integration { pub async fn new(conf: &GcpPubSubConfiguration) -> Result { trace!("Initializing GCP Pub-Sub integration"); let service_account = CustomServiceAccount::from_json(&conf.credentials_file)?; - let auth_manager = AuthenticationManager::from(service_account); + let auth_manager = AuthenticationManager::try_from(service_account)?; Ok(Integration { json: match Encoding::try_from(conf.encoding) diff --git a/chirpstack/src/storage/user.rs b/chirpstack/src/storage/user.rs index bf043bdf..7d9b1ded 100644 --- a/chirpstack/src/storage/user.rs +++ b/chirpstack/src/storage/user.rs @@ -2,6 +2,7 @@ use anyhow::Result; use chrono::{DateTime, Utc}; use diesel::{dsl, prelude::*}; use diesel_async::RunQueryDsl; +use email_address::EmailAddress; use pbkdf2::{ password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString}, Algorithm, Pbkdf2, @@ -9,7 +10,6 @@ use pbkdf2::{ use rand_core::OsRng; use tracing::info; use uuid::Uuid; -use validator::validate_email; use super::error::Error; use super::get_async_db_conn; @@ -51,7 +51,7 @@ impl Default for User { impl User { pub fn validate(&self) -> Result<(), Error> { - if self.email != "admin" && !validate_email(&self.email) { + if self.email != "admin" && !EmailAddress::is_valid(&self.email) { return Err(Error::InvalidEmail); }