aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-client
diff options
context:
space:
mode:
Diffstat (limited to 'crates/atuin-client')
-rw-r--r--crates/atuin-client/Cargo.toml2
-rw-r--r--crates/atuin-client/src/login.rs26
2 files changed, 10 insertions, 18 deletions
diff --git a/crates/atuin-client/Cargo.toml b/crates/atuin-client/Cargo.toml
index c5057af7..f686960a 100644
--- a/crates/atuin-client/Cargo.toml
+++ b/crates/atuin-client/Cargo.toml
@@ -65,7 +65,7 @@ reqwest = { workspace = true, optional = true }
hex = { version = "0.4", optional = true }
sha2 = { version = "0.10", optional = true }
indicatif = "0.18.0"
-tiny-bip39 = "=1.0.0"
+tiny-bip39 = "2.0.0"
# theme
crossterm = { version = "0.29.0", features = ["serde"] }
diff --git a/crates/atuin-client/src/login.rs b/crates/atuin-client/src/login.rs
index ab265928..d72d1c09 100644
--- a/crates/atuin-client/src/login.rs
+++ b/crates/atuin-client/src/login.rs
@@ -23,24 +23,16 @@ pub async fn login(
let key = match bip39::Mnemonic::from_phrase(&key, bip39::Language::English) {
Ok(mnemonic) => encode_key(Key::from_slice(mnemonic.entropy()))?,
Err(err) => {
- match err.downcast_ref::<bip39::ErrorKind>() {
- Some(err) => {
- match err {
- // assume they copied in the base64 key
- bip39::ErrorKind::InvalidWord => key,
- bip39::ErrorKind::InvalidChecksum => {
- bail!("key mnemonic was not valid")
- }
- bip39::ErrorKind::InvalidKeysize(_)
- | bip39::ErrorKind::InvalidWordLength(_)
- | bip39::ErrorKind::InvalidEntropyLength(_, _) => {
- bail!("key was not the correct length")
- }
- }
+ match err {
+ // assume they copied in the base64 key
+ bip39::ErrorKind::InvalidWord(_) => key,
+ bip39::ErrorKind::InvalidChecksum => {
+ bail!("key mnemonic was not valid")
}
- _ => {
- // unknown error. assume they copied the base64 key
- key
+ bip39::ErrorKind::InvalidKeysize(_)
+ | bip39::ErrorKind::InvalidWordLength(_)
+ | bip39::ErrorKind::InvalidEntropyLength(_, _) => {
+ bail!("key was not the correct length")
}
}
}