From 71d4329979e1b31b841bdf5ec8c9f82d99f8d473 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Thu, 23 Feb 2023 03:41:08 +0000 Subject: [PATCH 1/8] Set edition to 2018 --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 1786136..b0e9824 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ documentation = "https://docs.rs/bip39/" description = "Library for BIP-39 Bitcoin mnemonic codes" keywords = [ "crypto", "bitcoin", "bip39", "mnemonic" ] readme = "README.md" +edition = "2018" [lib] name = "bip39" From c821ec4aa8b47ea720f65b64fa9be57003c30405 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Thu, 23 Feb 2023 03:41:31 +0000 Subject: [PATCH 2/8] Remove [lib] section from manifest --- Cargo.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b0e9824..f0875d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,10 +11,6 @@ keywords = [ "crypto", "bitcoin", "bip39", "mnemonic" ] readme = "README.md" edition = "2018" -[lib] -name = "bip39" -path = "src/lib.rs" - [features] default = [ "std" ] std = [ "unicode-normalization", "serde/std" ] From 6662e7566b096373fe68df271025281687b6c4c3 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Thu, 23 Feb 2023 03:41:58 +0000 Subject: [PATCH 3/8] Make rand and rand_core deps more flexible --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f0875d5..8d8a231 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,15 +38,15 @@ all-languages = [ [dependencies] bitcoin_hashes = { version = "0.11.0", default-features = false } -rand_core = "0.4.0" +rand_core = ">=0.4.0, <0.7.0" unicode-normalization = { version = "=0.1.9", optional = true } -rand = { version = "0.6.0", optional = true } +rand = { version = ">=0.6.0, <0.9.0", optional = true } serde = { version = "1.0", default-features = false, features = [ "alloc" ], optional = true } # Enabling this feature raises the MSRV to 1.51 zeroize = {version = "1.5", features = ["zeroize_derive"], optional = true} [dev-dependencies] -rand = { version = "0.6.0", optional = false } +rand = { version = "0.8.5", optional = false } bitcoin_hashes = "0.11.0" # enable default features for test From 8d0f5e0d2fa19edef6196e460b2bccbed7c153ed Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Thu, 23 Feb 2023 03:50:49 +0000 Subject: [PATCH 4/8] Bump MSRV to 1.41.1 in README s!Bump MSRV to 1.41 in README and CI --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index be035fc..5db3b76 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,6 @@ Use the `all-languages` feature to enable all languages. ## MSRV -This crate supports Rust v1.29 and up and works with `no_std`. +This crate supports Rust v1.41.1 and up and works with `no_std`. -If you enable the `zeroize` feature the MSRV becomes 1.51 +If you enable the `zeroize` feature the MSRV becomes 1.51. From f348415f1140b4b9e8705df157a57f7ab19c78b5 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sat, 25 Feb 2023 19:57:41 +0000 Subject: [PATCH 5/8] Reorganize dependencies in Cargo.toml --- Cargo.toml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8d8a231..4fae7d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,14 +37,16 @@ all-languages = [ ] [dependencies] -bitcoin_hashes = { version = "0.11.0", default-features = false } rand_core = ">=0.4.0, <0.7.0" - -unicode-normalization = { version = "=0.1.9", optional = true } rand = { version = ">=0.6.0, <0.9.0", optional = true } serde = { version = "1.0", default-features = false, features = [ "alloc" ], optional = true } + # Enabling this feature raises the MSRV to 1.51 -zeroize = {version = "1.5", features = ["zeroize_derive"], optional = true} +zeroize = { version = "1.5", features = ["zeroize_derive"], optional = true } + +# Unexported dependnecies +bitcoin_hashes = { version = "0.11.0", default-features = false } +unicode-normalization = { version = "=0.1.9", optional = true } [dev-dependencies] rand = { version = "0.8.5", optional = false } From 8e6ba6de9be761f427b9509faa0b39948e9eb41d Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sun, 26 Feb 2023 06:26:23 +0000 Subject: [PATCH 6/8] Make rand_core optional and expose rand and rand_core crates --- Cargo.toml | 8 +++++--- src/lib.rs | 9 +++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4fae7d1..5323855 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ edition = "2018" [features] default = [ "std" ] std = [ "unicode-normalization", "serde/std" ] +rand = [ "crate_rand", "rand_core" ] # Note: English is the standard for bip39 so always included chinese-simplified = [] @@ -37,8 +38,8 @@ all-languages = [ ] [dependencies] -rand_core = ">=0.4.0, <0.7.0" -rand = { version = ">=0.6.0, <0.9.0", optional = true } +rand_core = { version = ">=0.4.0, <0.7.0", optional = true } +crate_rand = { package = "rand", version = ">=0.6.0, <0.9.0", optional = true } serde = { version = "1.0", default-features = false, features = [ "alloc" ], optional = true } # Enabling this feature raises the MSRV to 1.51 @@ -49,6 +50,7 @@ bitcoin_hashes = { version = "0.11.0", default-features = false } unicode-normalization = { version = "=0.1.9", optional = true } [dev-dependencies] -rand = { version = "0.8.5", optional = false } +rand_core = { version = "0.6.4", optional = false } +crate_rand = { package = "rand", version = "0.8.5", optional = false } bitcoin_hashes = "0.11.0" # enable default features for test diff --git a/src/lib.rs b/src/lib.rs index 4144865..856ffe6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,13 +31,14 @@ pub extern crate core; extern crate alloc; extern crate bitcoin_hashes; -extern crate rand_core; #[cfg(feature = "std")] extern crate unicode_normalization; +#[cfg(feature = "rand_core")] +pub extern crate rand_core; #[cfg(feature = "rand")] -extern crate rand; +pub extern crate crate_rand as rand; #[cfg(feature = "serde")] pub extern crate serde; @@ -248,14 +249,14 @@ impl Mnemonic { /// Example: /// /// ``` - /// extern crate rand; /// extern crate bip39; /// /// use bip39::{Mnemonic, Language}; /// - /// let mut rng = rand::thread_rng(); + /// let mut rng = bip39::rand::thread_rng(); /// let m = Mnemonic::generate_in_with(&mut rng, Language::English, 24).unwrap(); /// ``` + #[cfg(feature = "rand_core")] pub fn generate_in_with( rng: &mut R, language: Language, From c827c39943eebc58f99de1ca186bf5184d10d75d Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sat, 25 Feb 2023 19:58:18 +0000 Subject: [PATCH 7/8] Bump unicode-normalization dependency to 0.1.22 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5323855..7797832 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ zeroize = { version = "1.5", features = ["zeroize_derive"], optional = true } # Unexported dependnecies bitcoin_hashes = { version = "0.11.0", default-features = false } -unicode-normalization = { version = "=0.1.9", optional = true } +unicode-normalization = { version = "=0.1.22", optional = true } [dev-dependencies] rand_core = { version = "0.6.4", optional = false } From f41bf1789dcd684eb081b0115fd2620cda130558 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Thu, 23 Feb 2023 03:51:24 +0000 Subject: [PATCH 8/8] Update CHANGELOG and bump to v2.0.0 --- CHANGELOG.md | 9 +++++++++ Cargo.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad03ebe..f5ba688 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ CHANGELOG ========= +# v2.0.0 + +- Set Rust edition to 2018 +- Make `rand` and `rand_core` dependencies more flexible + - Increase maximum version in constraint + - Make `rand_core` optional too + - Expose both crates +- Bump MSRV to 1.41.1 + # v1.2.0 - Add `Mnemonic::parse_in_normalized_without_checksum_check` diff --git a/Cargo.toml b/Cargo.toml index 7797832..c092b04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bip39" -version = "1.2.0" +version = "2.0.0" authors = ["Steven Roose "] license = "CC0-1.0" homepage = "https://github.com/rust-bitcoin/rust-bip39/"