Skip to content

Commit ef855c3

Browse files
offer: make the merkle tree signature public
This is helpfull for the users that want to use the merkle tree signature in their own code, for example to verify the signature of bolt12 invoices or recreate it. Very useful for people that are building command line tools for the bolt12 offers. Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent f5dd77c commit ef855c3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lightning/src/offers/merkle.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub enum SignError {
9494
}
9595

9696
/// A function for signing a [`TaggedHash`].
97-
pub(super) trait SignFn<T: AsRef<TaggedHash>> {
97+
pub trait SignFn<T: AsRef<TaggedHash>> {
9898
/// Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream.
9999
fn sign(&self, message: &T) -> Result<Signature, ()>;
100100
}
@@ -117,9 +117,7 @@ where
117117
///
118118
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
119119
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
120-
pub(super) fn sign_message<F, T>(
121-
f: F, message: &T, pubkey: PublicKey,
122-
) -> Result<Signature, SignError>
120+
pub fn sign_message<F, T>(f: F, message: &T, pubkey: PublicKey) -> Result<Signature, SignError>
123121
where
124122
F: SignFn<T>,
125123
T: AsRef<TaggedHash>,
@@ -136,7 +134,7 @@ where
136134

137135
/// Verifies the signature with a pubkey over the given message using a tagged hash as the message
138136
/// digest.
139-
pub(super) fn verify_signature(
137+
pub fn verify_signature(
140138
signature: &Signature, message: &TaggedHash, pubkey: PublicKey,
141139
) -> Result<(), secp256k1::Error> {
142140
let digest = message.as_digest();

0 commit comments

Comments
 (0)