Skip to content

Commit

Permalink
merge #125 into cyphar/paperback:main
Browse files Browse the repository at this point in the history
Aleksa Sarai (1):
  cargo: update to tiny-bip39 v2

LGTMs: cyphar
  • Loading branch information
cyphar committed Oct 23, 2024
2 parents 0d9cabb + 4b6cc3b commit e4750a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
12 changes: 5 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pkg/paperback-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ edition = "2021"

[dependencies]
aead = { version = "^0.5", features = ["std"] }
anyhow = "^1"
chacha20poly1305 = "^0.10"
crypto-common = "^0.1"
digest = "^0.10"
Expand All @@ -48,7 +47,7 @@ qrcode = "^0.14"
serde = { version = "^1", features = ["derive"] }
signature = "^2"
thiserror = "^1"
tiny-bip39 = "^1.0"
tiny-bip39 = "^2"
typenum = "^1"
unsigned-varint = { version = "^0.7", features = ["nom"] }

Expand Down
11 changes: 1 addition & 10 deletions pkg/paperback-core/src/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ pub enum Error {
Other(String),
}

impl From<anyhow::Error> for Error {
fn from(inner: anyhow::Error) -> Self {
match inner.downcast::<bip39::ErrorKind>() {
Ok(err) => Self::Bip39(err),
Err(err) => Self::Other(err.to_string()),
}
}
}

#[derive(Clone, Debug, Eq, PartialEq)]
struct Identity {
id_public_key: VerifyingKey,
Expand Down Expand Up @@ -230,7 +221,7 @@ impl KeyShard {

// Convert key to a BIP-39 mnemonic.
let phrase = Mnemonic::from_entropy(&shard_key, CODEWORD_LANGUAGE)
.map_err(Error::from)? // XXX: Ugly, fix this.
.map_err(Error::Bip39)?
.into_phrase();
let codewords = phrase
.split_whitespace()
Expand Down

0 comments on commit e4750a1

Please sign in to comment.