From 97cc30593ef5a173c3e8082abb78672c3a526644 Mon Sep 17 00:00:00 2001 From: Arjan Zijderveld <5286904+arjanz@users.noreply.github.com> Date: Tue, 2 Sep 2025 16:09:35 +0200 Subject: [PATCH 1/2] PyO3 0.26.0 update --- Cargo.lock | 173 +++++++++---------------------------------------- Cargo.toml | 10 +-- pyproject.toml | 12 ++-- src/lib.rs | 6 +- 4 files changed, 45 insertions(+), 156 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 63fdda5..75e6bcc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,34 +8,13 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", + "generic-array", ] [[package]] @@ -44,18 +23,6 @@ version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,53 +44,19 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.5", + "generic-array", "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" -dependencies = [ - "generic-array 0.12.4", - "subtle 1.0.0", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "crypto-common", - "subtle 2.4.1", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", + "subtle", ] [[package]] @@ -153,23 +86,13 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hmac" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" -dependencies = [ - "crypto-mac", - "digest 0.8.1", -] - [[package]] name = "hmac" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.7", + "digest", ] [[package]] @@ -210,25 +133,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - -[[package]] -name = "opaque-debug" -version = "0.2.3" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "pbkdf2" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" -dependencies = [ - "byteorder", - "crypto-mac", -] +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "pbkdf2" @@ -236,8 +143,8 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest 0.10.7", - "hmac 0.12.1", + "digest", + "hmac", ] [[package]] @@ -263,22 +170,21 @@ dependencies = [ [[package]] name = "py-bip39-bindings" -version = "0.1.13" +version = "0.3.0" dependencies = [ - "hmac 0.7.1", - "pbkdf2 0.3.0", + "hmac", + "pbkdf2", "pyo3", - "sha2 0.8.2", + "sha2", "tiny-bip39", ] [[package]] name = "pyo3" -version = "0.23.3" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e484fd2c8b4cb67ab05a318f1fd6fa8f199fcc30819f08f07d200809dba26c15" +checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383" dependencies = [ - "cfg-if", "indoc", "libc", "memoffset", @@ -292,19 +198,18 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.23.3" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e0469a84f208e20044b98965e1561028180219e35352a2afaf2b942beff3b" +checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f" dependencies = [ - "once_cell", "target-lexicon", ] [[package]] name = "pyo3-ffi" -version = "0.23.3" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1547a7f9966f6f1a0f0227564a9945fe36b90da5a93b3933fc3dc03fae372d" +checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105" dependencies = [ "libc", "pyo3-build-config", @@ -312,9 +217,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.23.3" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb6da8ec6fa5cedd1626c886fc8749bdcbb09424a86461eb8cdf096b7c33257" +checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -324,9 +229,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.23.3" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38a385202ff5a92791168b1136afae5059d3ac118457bb7bc304c197c2d33e7d" +checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf" dependencies = [ "heck", "proc-macro2", @@ -382,33 +287,15 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "sha2" -version = "0.8.2" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] -[[package]] -name = "subtle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" - [[package]] name = "subtle" version = "2.4.1" @@ -451,9 +338,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.16" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" +checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] name = "thiserror" @@ -482,10 +369,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a30fd743a02bf35236f6faf99adb03089bb77e91c998dac2c2ad76bb424f668c" dependencies = [ "once_cell", - "pbkdf2 0.12.2", + "pbkdf2", "rand", "rustc-hash", - "sha2 0.10.8", + "sha2", "thiserror", "unicode-normalization", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 7822cd5..d0fe5c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "py-bip39-bindings" description = "Python bindings for tiny-bip39 RUST crate" authors=["Stichting Polkascan (Polkascan Foundation)"] -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/polkascan/py-bip39-bindings" homepage = "https://github.com/polkascan/py-bip39-bindings" license = "Apache-2.0" @@ -10,9 +10,9 @@ readme = "README.md" edition = "2021" [dependencies] -hmac = "0.7.1" -pbkdf2 = { version = "0.3.0", default-features = false } -sha2 = "0.8.2" +hmac = "0.12.1" +pbkdf2 = { version = "0.12.2", default-features = false } +sha2 = "0.10.9" tiny-bip39 = { version = "2.0.0", default-features = true } [lib] @@ -20,6 +20,6 @@ name = "bip39" crate-type = ["cdylib"] [dependencies.pyo3] -version = "0.23.3" +version = "0.26.0" features = ["extension-module"] diff --git a/pyproject.toml b/pyproject.toml index b0a90c9..ba6fb96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,26 +1,24 @@ [build-system] -requires = ["maturin>=1.7.0,<1.8.0"] +requires = ["maturin>=1.7.0,<1.10.0"] build-backend = "maturin" [project] name = "py-bip39-bindings" -version = "0.2.0" +version = "0.3.0" description = "Python bindings for tiny-bip39 RUST crate" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9" license = {file = "LICENSE"} authors = [ - {email = "info@polkascan.org"}, - {name = "Polkascan Foundation"} + { name = "JAMdot Technologies", email = "devops@jamdot.tech" } ] maintainers = [ - {name = "Polkascan Foundation", email = "info@polkascan.org"} + { name = "JAMdot Technologies", email = "devops@jamdot.tech" } ] classifiers = [ "License :: OSI Approved :: Apache Software License", "Intended Audience :: Developers", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", diff --git a/src/lib.rs b/src/lib.rs index 817e71e..ce5259b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,6 +40,7 @@ use sha2::Sha512; /// /// Returns the 32-bytes mini-secret via entropy #[pyfunction] +#[pyo3(signature = (phrase, password, language_code="en"))] pub fn bip39_to_mini_secret(phrase: &str, password: &str, language_code: Option<&str>) -> PyResult> { let salt = format!("mnemonic{}", password); @@ -54,7 +55,7 @@ pub fn bip39_to_mini_secret(phrase: &str, password: &str, language_code: Option< }; let mut result = [0u8; 64]; - pbkdf2::>(mnemonic.entropy(), salt.as_bytes(), 2048, &mut result); + let _ = pbkdf2::>(mnemonic.entropy(), salt.as_bytes(), 2048, &mut result); Ok(result[..32].to_vec()) } @@ -70,6 +71,7 @@ pub fn bip39_to_mini_secret(phrase: &str, password: &str, language_code: Option< /// /// A string containing the mnemonic words. #[pyfunction] +#[pyo3(signature = (words, language_code="en"))] pub fn bip39_generate(words: u32, language_code: Option<&str>) -> PyResult { let language = match Language::from_language_code(language_code.unwrap_or("en")) { @@ -102,6 +104,7 @@ pub fn bip39_generate(words: u32, language_code: Option<&str>) -> PyResult) -> PyResult> { let language = match Language::from_language_code(language_code.unwrap_or("en")) { @@ -131,6 +134,7 @@ pub fn bip39_to_seed(phrase: &str, password: &str, language_code: Option<&str>) /// /// Returns boolean with validation result #[pyfunction] +#[pyo3(signature = (phrase, language_code="en"))] pub fn bip39_validate(phrase: &str, language_code: Option<&str>) -> PyResult { let language = match Language::from_language_code(language_code.unwrap_or("en")) { Some(language) => language, From 42d5c0d6cab6ae6be4c590d138613905766642b2 Mon Sep 17 00:00:00 2001 From: Arjan Zijderveld <5286904+arjanz@users.noreply.github.com> Date: Tue, 2 Sep 2025 16:23:00 +0200 Subject: [PATCH 2/2] Modified author --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d0fe5c8..b41d9c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "py-bip39-bindings" description = "Python bindings for tiny-bip39 RUST crate" -authors=["Stichting Polkascan (Polkascan Foundation)"] +authors=["JAMdot Technologies"] version = "0.3.0" repository = "https://github.com/polkascan/py-bip39-bindings" homepage = "https://github.com/polkascan/py-bip39-bindings"