fix password

This commit is contained in:
John Smith 2023-05-27 18:07:24 +01:00
parent 3b96f75c94
commit 699c0db3db
6 changed files with 55 additions and 26 deletions

30
Cargo.lock generated
View File

@ -767,12 +767,27 @@ dependencies = [
"cmake",
]
[[package]]
name = "bugsalot"
version = "0.2.2"
dependencies = [
"libc",
]
[[package]]
name = "bugsalot"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc12a55e9bd3840279c248c96ecf541d5ba98d6654e08869fe167121384a582c"
[[package]]
name = "bugsalot"
version = "0.2.2"
source = "git+https://github.com/crioux/bugsalot.git#336a7053faadf990b9362edf5752ef34fa1f9615"
dependencies = [
"libc",
]
[[package]]
name = "bumpalo"
version = "3.12.2"
@ -2122,9 +2137,9 @@ dependencies = [
[[package]]
name = "gen_ops"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f41347f4fa32183c2549b86daf6b6b12a26029a77463e25358f7287580b088b"
checksum = "e7c56cad8ee78109d547e40bf4ad78968a25157e7963d799d79921655629825a"
[[package]]
name = "generic-array"
@ -4243,8 +4258,9 @@ dependencies = [
[[package]]
name = "range-set-blaze"
version = "0.1.4"
source = "git+https://github.com/crioux/range-set-blaze.git#102c239382a8c79414dcf1257923ac2fe4772342"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef51566f3ed218c92f4711b54af1c68c4f0c43935d31d216f9cc31b30af6ec64"
dependencies = [
"gen_ops",
"itertools",
@ -6033,7 +6049,7 @@ version = "0.1.0"
dependencies = [
"async-std",
"async-tungstenite 0.8.0",
"bugsalot",
"bugsalot 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"capnp",
"capnp-rpc",
"capnpc",
@ -6075,7 +6091,7 @@ dependencies = [
"async_executors",
"backtrace",
"blake3",
"bugsalot",
"bugsalot 0.2.2 (git+https://github.com/crioux/bugsalot.git)",
"capnp",
"capnpc",
"cfg-if 1.0.0",
@ -6199,7 +6215,7 @@ dependencies = [
"async-std",
"async-tungstenite 0.22.1",
"backtrace",
"bugsalot",
"bugsalot 0.2.2",
"capnp",
"capnp-rpc",
"capnpc",

View File

@ -69,7 +69,7 @@ keyvaluedb = { path = "../external/keyvaluedb/keyvaluedb" }
rkyv = { version = "^0", default_features = false, features = ["std", "alloc", "strict", "size_32", "validation"] }
data-encoding = { version = "^2" }
weak-table = "0.3.2"
range-set-blaze = { git = "https://github.com/crioux/range-set-blaze.git" } # "0.1.4" xxx replace with git repo
range-set-blaze = "0.1.5"
argon2 = "0.5.0"
# Dependencies for native builds only
@ -93,7 +93,7 @@ rustls-pemfile = "^0.2"
futures-util = { version = "^0", default-features = false, features = ["async-await", "sink", "std", "io"] }
keyvaluedb-sqlite = { path = "../external/keyvaluedb/keyvaluedb-sqlite" }
socket2 = { version = "^0", features = ["all"] }
bugsalot = "^0"
bugsalot = { git = "https://github.com/crioux/bugsalot.git" }
chrono = "^0"
libc = "^0"
nix = "^0"

View File

@ -207,6 +207,10 @@ impl TableStore {
));
}
if dek_bytes.len() != (4 + SHARED_SECRET_LENGTH) {
bail!("password protected device encryption key is not valid");
}
Ok(TypedSharedSecret::new(
kind,
SharedSecret::try_from(&dek_bytes[4..])?,
@ -349,7 +353,16 @@ impl TableStore {
device_encryption_key_changed = true;
}
if device_encryption_key_changed {
// Check for password change
let changing_password = self
.config
.get()
.protected_store
.new_device_encryption_key_password
.is_some();
// Save encryption key if it has changed or if the protecting password wants to change
if device_encryption_key_changed || changing_password {
self.save_device_encryption_key(device_encryption_key)
.await?;
}

View File

@ -12,6 +12,6 @@ use super::*;
pub use common::*;
pub use crypto::tests::*;
pub use network_manager::tests::*;
pub use routing_table::tests::*;
pub use routing_table::tests::test_serialize as test_routing_table_serialize;
pub use table_store::tests::*;
pub use veilid_api::tests::*;

View File

@ -31,73 +31,73 @@ pub fn setup() -> () {
}
#[wasm_bindgen_test]
async fn run_test_host_interface() {
async fn wasm_test_host_interface() {
setup();
test_host_interface::test_all().await;
}
#[wasm_bindgen_test]
async fn run_test_types() {
async fn wasm_test_types() {
setup();
test_types::test_all().await;
}
#[wasm_bindgen_test]
async fn run_test_veilid_core() {
async fn wasm_test_veilid_core() {
setup();
test_veilid_core::test_all().await;
}
#[wasm_bindgen_test]
async fn test_veilid_config() {
async fn wasm_test_veilid_config() {
setup();
test_veilid_config::test_all().await;
}
#[wasm_bindgen_test]
async fn run_test_connection_table() {
async fn wasm_test_connection_table() {
setup();
test_connection_table::test_all().await;
}
#[wasm_bindgen_test]
async fn run_test_signed_node_info() {
async fn wasm_test_signed_node_info() {
setup();
test_signed_node_info::test_all().await;
}
#[wasm_bindgen_test]
async fn exec_test_table_store() {
async fn wasm_test_table_store() {
setup();
test_table_store::test_all().await;
}
#[wasm_bindgen_test]
async fn exec_test_protected_store() {
async fn wasm_test_protected_store() {
setup();
test_protected_store::test_all().await;
}
#[wasm_bindgen_test]
async fn exec_test_crypto() {
async fn wasm_test_crypto() {
setup();
test_crypto::test_all().await;
}
#[wasm_bindgen_test]
async fn exec_test_envelope_receipt() {
async fn wasm_test_envelope_receipt() {
setup();
test_envelope_receipt::test_all().await;
}
#[wasm_bindgen_test]
async fn veilid_api__test_serialize_rkyv() {
async fn wasm_test_serialize_rkyv() {
setup();
veilid_api::test_serialize_rkyv::test_all().await;
test_serialize_rkyv::test_all().await;
}
#[wasm_bindgen_test]
async fn routing_table__test_serialize() {
async fn wasm_test_routing_table_serialize() {
setup();
routing_table::test_serialize::test_all().await;
test_routing_table_serialize::test_all().await;
}

View File

@ -52,7 +52,7 @@ futures-util = { version = "^0", default_features = false, features = ["alloc"]
url = "^2"
ctrlc = "^3"
lazy_static = "^1"
bugsalot = "^0"
bugsalot = { path = "../../bugsalot" }
flume = { version = "^0", features = ["async"] }
rpassword = "^6"
hostname = "^0"