-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically migrate unencrypted databases on request (#121)
* Automatically migrate unencrypted databases on request * Format * Clippy * Improve error handling without strings * Format * Clippy lint ignore * Skip encrypt migration test on Windows * Update changelog * Fail fast false * Try vcpkg * Try getting libsodium from vcpkg * lib dir? * Lib dir with pwsh * Set one var and correct path * Check dir * More listing * It's in release * Finish fixing build
- Loading branch information
1 parent
026c1e7
commit 97fe682
Showing
9 changed files
with
281 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
## 0.4.1 | ||
|
||
- Add a way to migrate unencrypted databases to encrypted by providing an environment variable `LAIR_MIGRATE_UNENCRYPTED="true"`, Lair will detect databases which can't be opened and attempt migration. #121 | ||
|
||
# 0.4.0 | ||
|
||
- pin serde and rmp-serde #119 | ||
|
||
## 0.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use lair_keystore::dependencies::*; | ||
use lair_keystore_api::prelude::*; | ||
use std::sync::Arc; | ||
|
||
pub async fn create_config( | ||
tmpdir: &tempdir::TempDir, | ||
passphrase: sodoken::BufRead, | ||
) -> Arc<LairServerConfigInner> { | ||
// create the config for the test server | ||
Arc::new( | ||
hc_seed_bundle::PwHashLimits::Minimum | ||
.with_exec(|| { | ||
LairServerConfigInner::new(tmpdir.path(), passphrase.clone()) | ||
}) | ||
.await | ||
.unwrap(), | ||
) | ||
} | ||
|
||
pub async fn connect_with_config( | ||
config: Arc<LairServerConfigInner>, | ||
passphrase: sodoken::BufRead, | ||
) -> LairResult<lair_keystore_api::LairClient> { | ||
// execute the server | ||
lair_keystore::server::StandaloneServer::new(config.clone()) | ||
.await? | ||
.run(passphrase.clone()) | ||
.await?; | ||
|
||
// create a client connection | ||
lair_keystore_api::ipc_keystore::ipc_keystore_connect( | ||
config.connection_url.clone(), | ||
passphrase, | ||
) | ||
.await | ||
} | ||
|
||
#[allow(dead_code)] | ||
pub async fn connect( | ||
tmpdir: &tempdir::TempDir, | ||
) -> lair_keystore_api::LairClient { | ||
// set up a passphrase | ||
let passphrase = sodoken::BufRead::from(&b"passphrase"[..]); | ||
|
||
let config = create_config(tmpdir, passphrase.clone()).await; | ||
|
||
connect_with_config(config, passphrase).await.unwrap() | ||
} |
Oops, something went wrong.