From 55e5d86c0300de2cc8202ad4a9c4b6c6b7985c12 Mon Sep 17 00:00:00 2001
From: Awiteb
Date: Mon, 30 Jun 2025 11:10:13 +0000
Subject: [PATCH] deps: Remove `bitcoin_hashes` and use `nostr::hashes`
re-export
Signed-off-by: Awiteb
---
CHANGELOG.md | 1 +
Cargo.lock | 39 ++-------------------------------
Cargo.toml | 1 -
src/cli/commands/patch/apply.rs | 4 ++--
src/cli/commands/patch/merge.rs | 4 ++--
src/cli/commands/patch/send.rs | 6 ++---
src/cli/common_commands.rs | 4 ++--
7 files changed, 12 insertions(+), 47 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c9ef9bf..561d2cc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `either@1.15.0` to the dependencies - by Awiteb
- Update `nostr` to `0.42.2` - by Awiteb
+- Remove `bitcoin_hashes` and use `nostr::hashes` re-export - by Awiteb
### Fixed
diff --git a/Cargo.lock b/Cargo.lock
index 003e00c..9c64a80 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -200,34 +200,19 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb"
-[[package]]
-name = "bitcoin-internals"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b854212e29b96c8f0fe04cab11d57586c8f3257de0d146c76cb3b42b3eb9118"
-
[[package]]
name = "bitcoin-io"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf"
-[[package]]
-name = "bitcoin-io"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26792cd2bf245069a1c5acb06aa7ad7abe1de69b507c90b490bca81e0665d0ee"
-dependencies = [
- "bitcoin-internals 0.4.0",
-]
-
[[package]]
name = "bitcoin_hashes"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b"
dependencies = [
- "bitcoin-internals 0.2.0",
+ "bitcoin-internals",
"hex-conservative 0.1.2",
]
@@ -237,21 +222,11 @@ version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16"
dependencies = [
- "bitcoin-io 0.1.3",
+ "bitcoin-io",
"hex-conservative 0.2.1",
"serde",
]
-[[package]]
-name = "bitcoin_hashes"
-version = "0.16.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e5d09f16329cd545d7e6008b2c6b2af3a90bc678cf41ac3d2f6755943301b16"
-dependencies = [
- "bitcoin-io 0.2.0",
- "hex-conservative 0.3.0",
-]
-
[[package]]
name = "bitflags"
version = "2.9.1"
@@ -727,15 +702,6 @@ dependencies = [
"arrayvec",
]
-[[package]]
-name = "hex-conservative"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4afe881d0527571892c4034822e59bb10c6c991cce6abe8199b6f5cf10766f55"
-dependencies = [
- "arrayvec",
-]
-
[[package]]
name = "hmac"
version = "0.12.1"
@@ -1115,7 +1081,6 @@ dependencies = [
name = "n34"
version = "0.2.0"
dependencies = [
- "bitcoin_hashes 0.16.0",
"chrono",
"clap",
"clap-verbosity-flag",
diff --git a/Cargo.toml b/Cargo.toml
index 935512d..e8040ad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,6 @@ categories = ["command-line-utilities"]
rust-version = "1.85.1"
[dependencies]
-bitcoin_hashes = "0.16.0"
chrono = "0.4.41"
clap = { version = "4.5.37", features = ["derive"] }
clap-verbosity-flag = { version = "3.0.2", default-features = false, features = [
diff --git a/src/cli/commands/patch/apply.rs b/src/cli/commands/patch/apply.rs
index 882ba2e..8af6b67 100644
--- a/src/cli/commands/patch/apply.rs
+++ b/src/cli/commands/patch/apply.rs
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use bitcoin_hashes::Sha1;
use clap::Args;
+use nostr::hashes::sha1::Hash as Sha1Hash;
use super::PatchStatus;
use crate::{
@@ -40,7 +40,7 @@ pub struct ApplyArgs {
patch_id: NostrEvent,
/// The applied commits
#[arg(num_args = 1..)]
- applied_commits: Vec,
+ applied_commits: Vec,
}
impl CommandRunner for ApplyArgs {
diff --git a/src/cli/commands/patch/merge.rs b/src/cli/commands/patch/merge.rs
index 1262f17..8cb0f0b 100644
--- a/src/cli/commands/patch/merge.rs
+++ b/src/cli/commands/patch/merge.rs
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use bitcoin_hashes::Sha1;
use clap::Args;
+use nostr::hashes::sha1::Hash as Sha1Hash;
use super::PatchStatus;
use crate::{
@@ -39,7 +39,7 @@ pub struct MergeArgs {
/// revision root
patch_id: NostrEvent,
/// The merge commit id
- merge_commit: Sha1,
+ merge_commit: Sha1Hash,
}
impl CommandRunner for MergeArgs {
diff --git a/src/cli/commands/patch/send.rs b/src/cli/commands/patch/send.rs
index e5f094d..ea6eb6c 100644
--- a/src/cli/commands/patch/send.rs
+++ b/src/cli/commands/patch/send.rs
@@ -16,11 +16,11 @@
use std::{fs, str::FromStr};
-use bitcoin_hashes::Sha1;
use clap::Args;
use futures::future;
use nostr::{
event::{EventBuilder, EventId, Kind, Tag, TagKind, Tags, UnsignedEvent},
+ hashes::sha1::Hash as Sha1Hash,
key::PublicKey,
nips::{nip01::Coordinate, nip10::Marker},
types::RelayUrl,
@@ -156,7 +156,7 @@ async fn make_patch_series(
original_patch: Option,
relay_hint: Option,
repo_coordinates: Vec,
- euc: &Sha1,
+ euc: Option<&Sha1Hash>,
author_pkey: PublicKey,
) -> N34Result<(Vec, Vec)> {
let mut write_relays = Vec::new();
@@ -207,7 +207,7 @@ async fn make_patch(
reply_to: Option,
write_relay: Option<&RelayUrl>,
repo_coordinates: &[Coordinate],
- euc: &Sha1,
+ euc: Option<&Sha1Hash>,
author_pkey: PublicKey,
) -> (UnsignedEvent, Vec) {
let content_details = client.parse_content(&patch.body).await;
diff --git a/src/cli/common_commands.rs b/src/cli/common_commands.rs
index fc95eca..bc85f5f 100644
--- a/src/cli/common_commands.rs
+++ b/src/cli/common_commands.rs
@@ -16,11 +16,11 @@
use std::iter;
-use bitcoin_hashes::Sha1;
use either::Either;
use nostr::{
event::{EventBuilder, Tag, TagKind},
filter::Filter,
+ hashes::sha1::Hash as Sha1Hash,
nips::nip10::Marker,
};
@@ -128,7 +128,7 @@ pub async fn patch_status_command(
patch_id: NostrEvent,
naddrs: Option>,
new_status: PatchStatus,
- merge_or_applied_commits: Option>>,
+ merge_or_applied_commits: Option>>,
check_fn: impl FnOnce(&PatchStatus) -> N34Result<()>,
) -> N34Result<()> {
let user_pkey = options.pubkey().await?;