diff options
| author | Cristian Le <git@lecris.dev> | 2026-02-10 03:25:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-09 18:25:55 -0800 |
| commit | f4b6d30940a7a13d7850d99adea8c2d94175100b (patch) | |
| tree | adfc902c4b4d6042f5a8c70b40caa51b63e7519c /crates | |
| parent | chore: update changelog (diff) | |
| download | atuin-f4b6d30940a7a13d7850d99adea8c2d94175100b.zip | |
chore(deps): Update to tiny-bip39 2.0.0 (#3151)
<!-- Thank you for making a PR! Bug fixes are always welcome, but if
you're adding a new feature or changing an existing one, we'd really
appreciate if you open an issue, post on the forum, or drop in on
Discord -->
## Checks
- [x] I am happy for maintainers to push small adjustments to this PR,
to speed up the review cycle
- [x] I have checked that there are no existing pull requests for the
same thing
I don't know why the previous PR
https://github.com/atuinsh/atuin/pull/2643 got auto-closed after a
rebase, so I am re-creating it.
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/atuin-client/Cargo.toml | 2 | ||||
| -rw-r--r-- | crates/atuin-client/src/login.rs | 26 | ||||
| -rw-r--r-- | crates/atuin/Cargo.toml | 2 | ||||
| -rw-r--r-- | crates/atuin/src/command/client/account/login.rs | 26 | ||||
| -rw-r--r-- | crates/atuin/src/command/client/store/rekey.rs | 26 |
5 files changed, 29 insertions, 53 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") } } } diff --git a/crates/atuin/Cargo.toml b/crates/atuin/Cargo.toml index 45eecb9b..9a866b6b 100644 --- a/crates/atuin/Cargo.toml +++ b/crates/atuin/Cargo.toml @@ -69,7 +69,7 @@ rpassword = "7.0" semver = { workspace = true } rustix = { workspace = true } runtime-format = "0.1.3" -tiny-bip39 = "1" +tiny-bip39 = "2" futures-util = "0.3" fuzzy-matcher = "0.3.7" colored = "2.0.4" diff --git a/crates/atuin/src/command/client/account/login.rs b/crates/atuin/src/command/client/account/login.rs index 504b8223..3a0d3c5c 100644 --- a/crates/atuin/src/command/client/account/login.rs +++ b/crates/atuin/src/command/client/account/login.rs @@ -75,24 +75,16 @@ impl Cmd { 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") } } } diff --git a/crates/atuin/src/command/client/store/rekey.rs b/crates/atuin/src/command/client/store/rekey.rs index 918bb335..4c537a48 100644 --- a/crates/atuin/src/command/client/store/rekey.rs +++ b/crates/atuin/src/command/client/store/rekey.rs @@ -23,24 +23,16 @@ impl Rekey { 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") } } } |
