diff --git a/keyserver/addons/rust-node-addon/Cargo.lock b/keyserver/addons/rust-node-addon/Cargo.lock --- a/keyserver/addons/rust-node-addon/Cargo.lock +++ b/keyserver/addons/rust-node-addon/Cargo.lock @@ -47,7 +47,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] @@ -58,7 +58,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] @@ -192,6 +192,7 @@ "log", "opaque-ke", "rand", + "serde", "tonic", "wasm-bindgen", ] @@ -469,6 +470,7 @@ dependencies = [ "derive_more", "prost", + "serde", "tonic", "tonic-build", "tracing", @@ -907,9 +909,9 @@ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -970,9 +972,9 @@ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1169,22 +1171,22 @@ [[package]] name = "serde" -version = "1.0.152" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn 2.0.51", ] [[package]] @@ -1268,9 +1270,9 @@ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" dependencies = [ "proc-macro2", "quote", diff --git a/native/native_rust_library/Cargo.lock b/native/native_rust_library/Cargo.lock --- a/native/native_rust_library/Cargo.lock +++ b/native/native_rust_library/Cargo.lock @@ -89,7 +89,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.51", ] [[package]] @@ -100,7 +100,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.51", ] [[package]] @@ -335,6 +335,7 @@ "log", "opaque-ke", "rand", + "serde", "tonic", "wasm-bindgen", ] @@ -720,6 +721,7 @@ dependencies = [ "derive_more", "prost", + "serde", "tonic", "tonic-build", "tracing", @@ -1190,7 +1192,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.51", ] [[package]] @@ -1311,9 +1313,9 @@ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1374,9 +1376,9 @@ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1709,22 +1711,22 @@ [[package]] name = "serde" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.51", ] [[package]] @@ -1847,9 +1849,9 @@ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" dependencies = [ "proc-macro2", "quote", @@ -1935,7 +1937,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.51", ] [[package]] @@ -1998,7 +2000,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.51", ] [[package]] @@ -2402,7 +2404,7 @@ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.51", "wasm-bindgen-shared", ] @@ -2436,7 +2438,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.51", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/services/blob/Cargo.lock b/services/blob/Cargo.lock --- a/services/blob/Cargo.lock +++ b/services/blob/Cargo.lock @@ -1518,6 +1518,7 @@ dependencies = [ "derive_more", "prost", + "serde", "tonic 0.9.2", "tonic-build", "tracing", diff --git a/services/commtest/Cargo.lock b/services/commtest/Cargo.lock --- a/services/commtest/Cargo.lock +++ b/services/commtest/Cargo.lock @@ -319,6 +319,7 @@ "log", "opaque-ke", "rand", + "serde", "tonic 0.9.2", "wasm-bindgen", ] @@ -714,6 +715,7 @@ dependencies = [ "derive_more", "prost", + "serde", "tonic 0.9.2", "tonic-build 0.9.2", "tracing", @@ -1609,18 +1611,18 @@ [[package]] name = "serde" -version = "1.0.194" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.194" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", diff --git a/services/identity/Cargo.lock b/services/identity/Cargo.lock --- a/services/identity/Cargo.lock +++ b/services/identity/Cargo.lock @@ -869,6 +869,7 @@ "log", "opaque-ke", "rand 0.8.5", + "serde", "tonic", "wasm-bindgen", ] @@ -1756,6 +1757,7 @@ dependencies = [ "derive_more", "prost", + "serde", "tonic", "tonic-build", "tracing", @@ -3566,18 +3568,18 @@ [[package]] name = "serde" -version = "1.0.195" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote 1.0.35", diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs --- a/services/identity/src/client_service.rs +++ b/services/identity/src/client_service.rs @@ -7,6 +7,7 @@ use comm_opaque2::grpc::protocol_error_to_grpc_status; use moka::future::Cache; use rand::rngs::OsRng; +use serde::{Deserialize, Serialize}; use siwe::eip55; use tonic::Response; use tracing::{debug, error, warn}; @@ -48,33 +49,33 @@ IdentityClientService, IdentityClientServiceServer, }; -#[derive(Clone)] +#[derive(Clone, Serialize, Deserialize)] pub enum WorkflowInProgress { Registration(Box), Login(Box), Update(UpdateState), } -#[derive(Clone)] +#[derive(Clone, Serialize, Deserialize)] pub struct UserRegistrationInfo { pub username: String, pub flattened_device_key_upload: FlattenedDeviceKeyUpload, pub user_id: Option, } -#[derive(Clone)] +#[derive(Clone, Serialize, Deserialize)] pub struct UserLoginInfo { pub user_id: String, pub flattened_device_key_upload: FlattenedDeviceKeyUpload, pub opaque_server_login: comm_opaque2::server::Login, } -#[derive(Clone)] +#[derive(Clone, Serialize, Deserialize)] pub struct UpdateState { pub user_id: String, } -#[derive(Clone)] +#[derive(Clone, Serialize, Deserialize)] pub struct FlattenedDeviceKeyUpload { pub device_id_key: String, pub key_payload: String, diff --git a/services/identity/src/constants.rs b/services/identity/src/constants.rs --- a/services/identity/src/constants.rs +++ b/services/identity/src/constants.rs @@ -71,6 +71,11 @@ pub const NONCE_TABLE_EXPIRATION_TIME_UNIX_ATTRIBUTE: &str = "expirationTimeUnix"; +pub const WORKFLOWS_IN_PROGRESS_TABLE: &str = "identity-workflows-in-progress"; +pub const WORKFLOWS_IN_PROGRESS_PARTITION_KEY: &str = "id"; +pub const WORKFLOWS_IN_PROGRESS_TABLE_EXPIRATION_TIME_UNIX_ATTRIBUTE: &str = + "expirationTimeUnix"; + // Usernames reserved because they exist in Ashoat's keyserver already pub const RESERVED_USERNAMES_TABLE: &str = "identity-reserved-usernames"; pub const RESERVED_USERNAMES_TABLE_PARTITION_KEY: &str = "username"; @@ -151,6 +156,10 @@ pub const NONCE_LENGTH: usize = 17; pub const NONCE_TTL_DURATION: i64 = 120; // seconds +// Workflows in progress + +pub const WORKFLOWS_IN_PROGRESS_TTL_DURATION: i64 = 120; // seconds + // Identity pub const DEFAULT_IDENTITY_ENDPOINT: &str = "http://localhost:50054"; diff --git a/services/tunnelbroker/Cargo.lock b/services/tunnelbroker/Cargo.lock --- a/services/tunnelbroker/Cargo.lock +++ b/services/tunnelbroker/Cargo.lock @@ -255,7 +255,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] @@ -272,7 +272,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] @@ -858,7 +858,7 @@ "heck", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] @@ -979,6 +979,9 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +dependencies = [ + "powerfmt", +] [[package]] name = "derive_more" @@ -1147,7 +1150,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] @@ -1210,6 +1213,7 @@ dependencies = [ "derive_more", "prost", + "serde", "tonic 0.9.2", "tonic-build 0.9.2", "tracing", @@ -1622,6 +1626,12 @@ "winapi", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.45" @@ -1806,6 +1816,12 @@ "windows-sys 0.48.0", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1824,9 +1840,9 @@ [[package]] name = "proc-macro2" -version = "1.0.71" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1887,9 +1903,9 @@ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -2187,22 +2203,22 @@ [[package]] name = "serde" -version = "1.0.160" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] @@ -2322,9 +2338,9 @@ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" dependencies = [ "proc-macro2", "quote", @@ -2379,7 +2395,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] @@ -2394,11 +2410,13 @@ [[package]] name = "time" -version = "0.3.26" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a79d09ac6b08c1ab3906a2f7cc2e81a0e27c7ae89c63812df75e52bef0751e07" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -2406,16 +2424,17 @@ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.12" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75c65469ed6b3a4809d987a41eb1dc918e9bc1d92211cbad7ae82931846f7451" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -2469,7 +2488,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] @@ -2673,7 +2692,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.51", ] [[package]] diff --git a/shared/comm-lib/Cargo.lock b/shared/comm-lib/Cargo.lock --- a/shared/comm-lib/Cargo.lock +++ b/shared/comm-lib/Cargo.lock @@ -80,7 +80,7 @@ checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.29", + "syn 2.0.51", ] [[package]] @@ -389,7 +389,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.51", ] [[package]] @@ -400,7 +400,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.51", ] [[package]] @@ -1376,6 +1376,7 @@ dependencies = [ "derive_more", "prost", + "serde", "tonic", "tonic-build", "tracing", @@ -2068,9 +2069,9 @@ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -2131,9 +2132,9 @@ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -2439,22 +2440,22 @@ [[package]] name = "serde" -version = "1.0.147" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.51", ] [[package]] @@ -2595,9 +2596,9 @@ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" dependencies = [ "proc-macro2", "quote", @@ -2720,7 +2721,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.51", ] [[package]] diff --git a/shared/comm-opaque2/Cargo.lock b/shared/comm-opaque2/Cargo.lock --- a/shared/comm-opaque2/Cargo.lock +++ b/shared/comm-opaque2/Cargo.lock @@ -87,6 +87,7 @@ "log", "opaque-ke", "rand", + "serde", "tonic", "wasm-bindgen", ] @@ -158,7 +159,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -189,7 +190,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -407,7 +408,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -430,18 +431,18 @@ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -491,22 +492,22 @@ [[package]] name = "serde" -version = "1.0.156" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.156" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.50", ] [[package]] @@ -537,6 +538,17 @@ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "synstructure" version = "0.12.6" @@ -545,7 +557,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "unicode-xid", ] @@ -623,7 +635,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -705,7 +717,7 @@ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -727,7 +739,7 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -821,6 +833,6 @@ dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "synstructure", ] diff --git a/shared/comm-opaque2/Cargo.toml b/shared/comm-opaque2/Cargo.toml --- a/shared/comm-opaque2/Cargo.toml +++ b/shared/comm-opaque2/Cargo.toml @@ -10,3 +10,4 @@ rand = "0.8" tonic = { version = "0.9.1", default-features = false } wasm-bindgen = "0.2" +serde = { version = "1.0.197", features = ["derive"] } diff --git a/shared/comm-opaque2/src/server/login.rs b/shared/comm-opaque2/src/server/login.rs --- a/shared/comm-opaque2/src/server/login.rs +++ b/shared/comm-opaque2/src/server/login.rs @@ -4,12 +4,14 @@ ServerLoginStartParameters, ServerSetup, }; use rand::rngs::OsRng; +use serde::{Deserialize, Serialize}; use crate::Cipher; -#[derive(Clone)] +#[derive(Clone, Serialize, Deserialize, Debug)] pub struct Login { state: Option>, + #[serde(default = "OsRng::default", skip)] rng: OsRng, pub session_key: Option>, } diff --git a/shared/grpc_clients/Cargo.lock b/shared/grpc_clients/Cargo.lock --- a/shared/grpc_clients/Cargo.lock +++ b/shared/grpc_clients/Cargo.lock @@ -51,7 +51,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.50", ] [[package]] @@ -62,7 +62,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.50", ] [[package]] @@ -302,6 +302,7 @@ dependencies = [ "derive_more", "prost", + "serde", "tonic", "tonic-build", "tracing", @@ -584,7 +585,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.50", ] [[package]] @@ -617,9 +618,9 @@ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -680,9 +681,9 @@ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -878,9 +879,23 @@ [[package]] name = "serde" -version = "1.0.183" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] [[package]] name = "sharded-slab" @@ -945,9 +960,9 @@ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" dependencies = [ "proc-macro2", "quote", @@ -1017,7 +1032,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.50", ] [[package]] @@ -1152,7 +1167,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.50", ] [[package]] @@ -1254,7 +1269,7 @@ "once_cell", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.50", "wasm-bindgen-shared", ] @@ -1276,7 +1291,7 @@ dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.50", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/shared/grpc_clients/Cargo.toml b/shared/grpc_clients/Cargo.toml --- a/shared/grpc_clients/Cargo.toml +++ b/shared/grpc_clients/Cargo.toml @@ -9,6 +9,7 @@ tonic = { version = "0.9.1", features = ["tls-webpki-roots"] } tracing = "0.1" tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } +serde = { version = "1.0", features = ["derive"] } [build-dependencies] tonic-build = "0.9.1" diff --git a/shared/grpc_clients/src/identity/device.rs b/shared/grpc_clients/src/identity/device.rs --- a/shared/grpc_clients/src/identity/device.rs +++ b/shared/grpc_clients/src/identity/device.rs @@ -3,6 +3,8 @@ use crate::error::Error; pub use crate::identity::protos::unauth::DeviceType; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + impl TryFrom for DeviceType { type Error = crate::error::Error; @@ -32,6 +34,41 @@ } } +impl Serialize for DeviceType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let value = match self { + DeviceType::Keyserver => 0, + DeviceType::Web => 1, + DeviceType::Ios => 2, + DeviceType::Android => 3, + DeviceType::Windows => 4, + DeviceType::MacOs => 5, + }; + serializer.serialize_i32(value) + } +} + +impl<'de> Deserialize<'de> for DeviceType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value = i32::deserialize(deserializer)?; + match value { + 0 => Ok(DeviceType::Keyserver), + 1 => Ok(DeviceType::Web), + 2 => Ok(DeviceType::Ios), + 3 => Ok(DeviceType::Android), + 4 => Ok(DeviceType::Windows), + 5 => Ok(DeviceType::MacOs), + _ => Err(serde::de::Error::custom("Invalid DeviceType value")), + } + } +} + #[cfg(test)] mod device_tests { use super::*;