Skip to content

Commit 0c5c036

Browse files
committed
chore: migrate bdk_bip322 to bdk_message_signer 0.2.0
1 parent 9b58a1a commit 0c5c036

7 files changed

Lines changed: 49 additions & 35 deletions

File tree

Cargo.lock

Lines changed: 28 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ shlex = { version = "1.3.0", optional = true }
3939
payjoin = { version = "0.25.0", features = ["v1", "v2", "io", "_test-utils"], optional = true}
4040
reqwest = { version = "0.13.2", default-features = false, features = ["rustls"], optional = true }
4141
url = { version = "2.5.8", optional = true }
42-
bdk_bip322 = { version = "0.1.0", optional = true }
42+
bdk_message_signer = { version = "0.2.0", optional = true }
4343
bitcoin-payment-instructions = { version = "0.7.0", optional = true}
4444

4545
[features]
@@ -61,7 +61,7 @@ dns_payment = ["bitcoin-payment-instructions"]
6161

6262
# Internal features
6363
_payjoin-dependencies = ["payjoin", "reqwest", "url", "sqlite"]
64-
bip322 = ["bdk_bip322"]
64+
message_signer = ["dep:bdk_message_signer"]
6565

6666
# Use this to consensus verify transactions at sync time
6767
verify = []

src/commands.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! All subcommands are defined in the below enums.
1414
1515
#![allow(clippy::large_enum_variant)]
16-
#[cfg(feature = "bip322")]
16+
#[cfg(feature = "message_signer")]
1717
use crate::handlers::offline::{SignMessageCommand, VerifyMessageCommand};
1818
use crate::handlers::{
1919
config::{ListWalletsCommand, SaveConfigCommand},
@@ -361,10 +361,10 @@ pub enum OfflineWalletSubCommand {
361361
/// Combines multiple PSBTs into one.
362362
CombinePsbt(CombinePsbtCommand),
363363
/// Sign a message using BIP322
364-
#[cfg(feature = "bip322")]
364+
#[cfg(feature = "message_signer")]
365365
SignMessage(SignMessageCommand),
366366
/// Verify a BIP322 signature
367-
#[cfg(feature = "bip322")]
367+
#[cfg(feature = "message_signer")]
368368
VerifyMessage(VerifyMessageCommand),
369369
/// Creates a new unsigned transaction from DNS payment instructions.
370370
#[cfg(feature = "dns_payment")]

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ pub enum BDKCliError {
156156
#[error("Payjoin database error: {0}")]
157157
PayjoinDb(#[from] crate::handlers::payjoin::db::Error),
158158

159-
#[cfg(feature = "bip322")]
159+
#[cfg(feature = "message_signer")]
160160
#[error("BIP-322 error: {0}")]
161-
Bip322Error(#[from] bdk_bip322::error::Error),
161+
MessageSignerError(#[from] bdk_message_signer::error::Error),
162162
}
163163

164164
impl From<ExtractTxError> for BDKCliError {

src/handlers/offline.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ use {
2828
bdk_wallet::keys::{DescriptorPublicKey, DescriptorSecretKey, SinglePubKey},
2929
std::collections::HashMap,
3030
};
31-
#[cfg(feature = "bip322")]
31+
#[cfg(feature = "message_signer")]
3232
use {
3333
crate::utils::parse_signature_format,
3434
crate::utils::types::MessageResult,
35-
bdk_bip322::{BIP322, MessageProof},
35+
bdk_message_signer::{MessageSigner, MessageProof},
3636
};
3737

3838
impl OfflineWalletSubCommand {
@@ -73,11 +73,11 @@ impl OfflineWalletSubCommand {
7373
Self::CombinePsbt(combine_psbt_command) => combine_psbt_command
7474
.execute(ctx)?
7575
.write_out(std::io::stdout()),
76-
#[cfg(feature = "bip322")]
76+
#[cfg(feature = "message_signer")]
7777
Self::SignMessage(sign_message_command) => sign_message_command
7878
.execute(ctx)?
7979
.write_out(std::io::stdout()),
80-
#[cfg(feature = "bip322")]
80+
#[cfg(feature = "message_signer")]
8181
Self::VerifyMessage(verify_message_command) => verify_message_command
8282
.execute(ctx)?
8383
.write_out(std::io::stdout()),
@@ -764,7 +764,7 @@ impl AppCommand<AppContext<OfflineOperations<'_>>> for CombinePsbtCommand {
764764
}
765765
}
766766

767-
#[cfg(feature = "bip322")]
767+
#[cfg(feature = "message_signer")]
768768
#[derive(Debug, Parser, Clone, PartialEq)]
769769
pub struct SignMessageCommand {
770770
/// The message to sign
@@ -784,7 +784,7 @@ pub struct SignMessageCommand {
784784
pub utxos: Option<Vec<OutPoint>>,
785785
}
786786

787-
#[cfg(feature = "bip322")]
787+
#[cfg(feature = "message_signer")]
788788
impl AppCommand<AppContext<OfflineOperations<'_>>> for SignMessageCommand {
789789
type Output = MessageResult;
790790

@@ -814,7 +814,7 @@ impl AppCommand<AppContext<OfflineOperations<'_>>> for SignMessageCommand {
814814
}
815815
}
816816

817-
#[cfg(feature = "bip322")]
817+
#[cfg(feature = "message_signer")]
818818
#[derive(Debug, Parser, Clone, PartialEq)]
819819
pub struct VerifyMessageCommand {
820820
/// The signature proof to verify
@@ -830,7 +830,7 @@ pub struct VerifyMessageCommand {
830830
pub address: String,
831831
}
832832

833-
#[cfg(feature = "bip322")]
833+
#[cfg(feature = "message_signer")]
834834
impl AppCommand<AppContext<OfflineOperations<'_>>> for VerifyMessageCommand {
835835
type Output = MessageResult;
836836

src/utils/common.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{commands::WalletOpts, config::WalletConfig, error::BDKCliError as Error};
2-
#[cfg(feature = "bip322")]
3-
use bdk_bip322::SignatureFormat;
2+
#[cfg(feature = "message_signer")]
3+
use bdk_message_signer::SignatureFormat;
44
#[cfg(feature = "cbf")]
55
use bdk_kyoto::{Info, Receiver, UnboundedReceiver, Warning};
66
#[cfg(feature = "silent-payments")]
@@ -198,7 +198,7 @@ pub(crate) fn parse_sp_code_value_pairs(s: &str) -> Result<(SilentPaymentCode, u
198198
}
199199

200200
/// Function to parse the signature format from a string
201-
#[cfg(feature = "bip322")]
201+
#[cfg(feature = "message_signer")]
202202
pub(crate) fn parse_signature_format(format_str: &str) -> Result<SignatureFormat, Error> {
203203
match format_str.to_lowercase().as_str() {
204204
"legacy" => Ok(SignatureFormat::Legacy),
@@ -229,10 +229,10 @@ pub fn command_requires_db(command: &OfflineWalletSubCommand) -> bool {
229229
| OfflineWalletSubCommand::FinalizePsbt(_)
230230
| OfflineWalletSubCommand::CombinePsbt(_) => false,
231231

232-
#[cfg(feature = "bip322")]
232+
#[cfg(feature = "message_signer")]
233233
OfflineWalletSubCommand::SignMessage(_) => true,
234234

235-
#[cfg(feature = "bip322")]
235+
#[cfg(feature = "message_signer")]
236236
OfflineWalletSubCommand::VerifyMessage(_) => true,
237237
#[cfg(feature = "silent-payments")]
238238
OfflineWalletSubCommand::CreateSpTx(_) => true,

src/utils/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub struct KeychainPair<T> {
108108
pub internal: T,
109109
}
110110

111-
#[cfg(feature = "bip322")]
111+
#[cfg(feature = "message_signer")]
112112
#[derive(Serialize, Debug, Default)]
113113
pub struct MessageResult {
114114
#[serde(skip_serializing_if = "Option::is_none")]

0 commit comments

Comments
 (0)