diff --git a/crates/lox-library/Cargo.toml b/crates/lox-library/Cargo.toml index 0adbd53..4142439 100644 --- a/crates/lox-library/Cargo.toml +++ b/crates/lox-library/Cargo.toml @@ -12,7 +12,6 @@ zkp = "0.8" bincode = "1" rand = "0.7" serde = "1" -serde-big-array = "0.3.2" serde_with = "1.9.1" sha2 = "0.9" lazy_static = "1" diff --git a/crates/lox-library/src/bridge_table.rs b/crates/lox-library/src/bridge_table.rs index 94c9a46..d7ef7fa 100644 --- a/crates/lox-library/src/bridge_table.rs +++ b/crates/lox-library/src/bridge_table.rs @@ -18,17 +18,12 @@ use curve25519_dalek::ristretto::CompressedRistretto; use curve25519_dalek::ristretto::RistrettoBasepointTable; use curve25519_dalek::scalar::Scalar; use rand::RngCore; -use serde::{Serialize, Deserialize}; -use serde_big_array::big_array; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; use std::collections::{HashMap, HashSet}; use std::convert::TryInto; use subtle::ConstantTimeEq; -big_array! { - BigArray; - +202, -} - /// Each bridge information line is serialized into this many bytes pub const BRIDGE_BYTES: usize = 220; @@ -42,6 +37,7 @@ pub const MAX_BRIDGES_PER_BUCKET: usize = 3; pub const MIN_BUCKET_REACHABILITY: usize = 2; /// A bridge information line +#[serde_as] #[derive(Serialize, Deserialize, Copy, Clone, Hash, Eq, PartialEq, Debug)] pub struct BridgeLine { /// IPv4 or IPv6 address @@ -50,7 +46,7 @@ pub struct BridgeLine { pub port: u16, /// other protocol information, including pluggable transport, /// public key, etc. - #[serde(with = "BigArray")] + #[serde_as(as = "[_; BRIDGE_BYTES - 18]")] pub info: [u8; BRIDGE_BYTES - 18], } diff --git a/crates/lox-library/src/proto/blockage_migration.rs b/crates/lox-library/src/proto/blockage_migration.rs index 8a1aab6..dc8c5b6 100644 --- a/crates/lox-library/src/proto/blockage_migration.rs +++ b/crates/lox-library/src/proto/blockage_migration.rs @@ -43,7 +43,7 @@ use zkp::CompactProof; use zkp::ProofError; use zkp::Transcript; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use super::super::cred; use super::super::dup_filter::SeenType; @@ -95,7 +95,6 @@ pub struct State { blockages: Scalar, } - #[derive(Serialize, Deserialize)] pub struct Response { // The new attributes; the trust_level and invites_remaining are diff --git a/crates/lox-library/src/proto/check_blockage.rs b/crates/lox-library/src/proto/check_blockage.rs index a879aa3..9cba4fc 100644 --- a/crates/lox-library/src/proto/check_blockage.rs +++ b/crates/lox-library/src/proto/check_blockage.rs @@ -37,7 +37,7 @@ use zkp::CompactProof; use zkp::ProofError; use zkp::Transcript; -use serde::{Serialize,Deserialize}; +use serde::{Deserialize, Serialize}; use serde_with::serde_as; use std::collections::HashMap; @@ -92,7 +92,7 @@ pub struct Response { // A table of encrypted Migration credentials; the encryption keys // are formed from the possible values of Qk (the decrypted form of // EncQk) - #[serde_as(as = "Vec<(_,[_; migration_table::ENC_MIGRATION_BYTES])>")] + #[serde_as(as = "Vec<(_,[_; migration_table::ENC_MIGRATION_BYTES])>")] enc_migration_table: HashMap<[u8; 16], [u8; migration_table::ENC_MIGRATION_BYTES]>, } diff --git a/crates/lox-library/src/proto/issue_invite.rs b/crates/lox-library/src/proto/issue_invite.rs index 97446f3..f2ed162 100644 --- a/crates/lox-library/src/proto/issue_invite.rs +++ b/crates/lox-library/src/proto/issue_invite.rs @@ -54,7 +54,7 @@ use zkp::CompactProof; use zkp::ProofError; use zkp::Transcript; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use super::super::cred; use super::super::dup_filter::SeenType; diff --git a/crates/lox-library/src/proto/level_up.rs b/crates/lox-library/src/proto/level_up.rs index aa23249..7978e68 100644 --- a/crates/lox-library/src/proto/level_up.rs +++ b/crates/lox-library/src/proto/level_up.rs @@ -47,7 +47,7 @@ use zkp::CompactProof; use zkp::ProofError; use zkp::Transcript; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use super::super::cred; use super::super::dup_filter::SeenType; diff --git a/crates/lox-library/src/proto/migration.rs b/crates/lox-library/src/proto/migration.rs index bce93fb..383dfa2 100644 --- a/crates/lox-library/src/proto/migration.rs +++ b/crates/lox-library/src/proto/migration.rs @@ -39,7 +39,7 @@ use zkp::CompactProof; use zkp::ProofError; use zkp::Transcript; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use super::super::cred; use super::super::dup_filter::SeenType; diff --git a/crates/lox-library/src/proto/open_invite.rs b/crates/lox-library/src/proto/open_invite.rs index fb9e86d..306489a 100644 --- a/crates/lox-library/src/proto/open_invite.rs +++ b/crates/lox-library/src/proto/open_invite.rs @@ -22,8 +22,8 @@ use zkp::CompactProof; use zkp::ProofError; use zkp::Transcript; -use serde::{Serialize, Deserialize}; -use serde_big_array::big_array; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; use super::super::bridge_table; use super::super::bridge_table::BridgeLine; @@ -33,12 +33,11 @@ use super::super::OPENINV_LENGTH; use super::super::{BridgeAuth, BridgeDb, IssuerPubKey}; use super::super::{CMZ_A, CMZ_A_TABLE, CMZ_B, CMZ_B_TABLE}; -big_array! { BigArray; } - /// The request message for this protocol +#[serde_as] #[derive(Serialize, Deserialize)] pub struct Request { - #[serde(with = "BigArray")] + #[serde_as(as = "[_; OPENINV_LENGTH]")] invite: [u8; OPENINV_LENGTH], D: RistrettoPoint, EncIdClient: (RistrettoPoint, RistrettoPoint), diff --git a/crates/lox-library/src/proto/redeem_invite.rs b/crates/lox-library/src/proto/redeem_invite.rs index ed285e9..59ce73b 100644 --- a/crates/lox-library/src/proto/redeem_invite.rs +++ b/crates/lox-library/src/proto/redeem_invite.rs @@ -30,7 +30,7 @@ use zkp::CompactProof; use zkp::ProofError; use zkp::Transcript; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use super::super::cred; use super::super::dup_filter::SeenType; diff --git a/crates/lox-library/src/proto/trust_promotion.rs b/crates/lox-library/src/proto/trust_promotion.rs index a49a77b..fed5a25 100644 --- a/crates/lox-library/src/proto/trust_promotion.rs +++ b/crates/lox-library/src/proto/trust_promotion.rs @@ -36,7 +36,7 @@ use zkp::CompactProof; use zkp::ProofError; use zkp::Transcript; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; use serde_with::serde_as; use std::collections::HashMap;