|
@@ -7,8 +7,11 @@ use std::str::FromStr;
|
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
-use super::{Id, Proofs, PublicKey, Signatures, SigningKey};
|
|
|
|
|
|
+use super::{Id, Proofs, PublicKey};
|
|
|
|
+#[cfg(feature = "nut11")]
|
|
|
|
+use super::{Signatures, SigningKey};
|
|
use crate::error::Error;
|
|
use crate::error::Error;
|
|
|
|
+#[cfg(feature = "nut11")]
|
|
use crate::nuts::nut11::{witness_deserialize, witness_serialize};
|
|
use crate::nuts::nut11::{witness_deserialize, witness_serialize};
|
|
use crate::secret::Secret;
|
|
use crate::secret::Secret;
|
|
use crate::url::UncheckedUrl;
|
|
use crate::url::UncheckedUrl;
|
|
@@ -26,6 +29,7 @@ pub struct BlindedMessage {
|
|
#[serde(rename = "B_")]
|
|
#[serde(rename = "B_")]
|
|
pub b: PublicKey,
|
|
pub b: PublicKey,
|
|
/// Witness
|
|
/// Witness
|
|
|
|
+ #[cfg(feature = "nut11")]
|
|
#[serde(default)]
|
|
#[serde(default)]
|
|
#[serde(skip_serializing_if = "Signatures::is_empty")]
|
|
#[serde(skip_serializing_if = "Signatures::is_empty")]
|
|
#[serde(serialize_with = "witness_serialize")]
|
|
#[serde(serialize_with = "witness_serialize")]
|
|
@@ -39,10 +43,12 @@ impl BlindedMessage {
|
|
amount,
|
|
amount,
|
|
keyset_id,
|
|
keyset_id,
|
|
b,
|
|
b,
|
|
|
|
+ #[cfg(feature = "nut11")]
|
|
witness: Signatures::default(),
|
|
witness: Signatures::default(),
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #[cfg(feature = "nut11")]
|
|
pub fn sign_p2pk_blinded_message(&mut self, secret_key: SigningKey) -> Result<(), Error> {
|
|
pub fn sign_p2pk_blinded_message(&mut self, secret_key: SigningKey) -> Result<(), Error> {
|
|
let msg_to_sign = hex::decode(self.b.to_string())?;
|
|
let msg_to_sign = hex::decode(self.b.to_string())?;
|
|
|
|
|
|
@@ -131,7 +137,9 @@ pub mod wallet {
|
|
use super::{CurrencyUnit, MintProofs};
|
|
use super::{CurrencyUnit, MintProofs};
|
|
use crate::dhke::blind_message;
|
|
use crate::dhke::blind_message;
|
|
use crate::error::wallet;
|
|
use crate::error::wallet;
|
|
- use crate::nuts::{BlindedMessage, Id, P2PKConditions, Proofs, SecretKey};
|
|
|
|
|
|
+ #[cfg(feature = "nut11")]
|
|
|
|
+ use crate::nuts::P2PKConditions;
|
|
|
|
+ use crate::nuts::{BlindedMessage, Id, Proofs, SecretKey};
|
|
use crate::secret::Secret;
|
|
use crate::secret::Secret;
|
|
use crate::url::UncheckedUrl;
|
|
use crate::url::UncheckedUrl;
|
|
use crate::{error, Amount};
|
|
use crate::{error, Amount};
|