Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ generic message signing and verification.
## Types of Signatures

At the moment this crate supports `P2TR`, `P2WPKH` and `P2SH-P2WPKH` single-sig
addresses, as well as `P2WSH`, `P2SH-P2WSH` and `P2SH` CHECKMULTISIG multisig
addresses. Feedback through issues or PRs on the interface design and security
is welcome and encouraged.

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_sign_verify_encoded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn main() {
let message = "Hello World";
let wif_private_key = "L3VFeEujGtevx9w18HD1fhRbCH67Az2dpCymeRE1SoPK6XQtaN2k";

let base64_signature = sign_simple_encoded(address, message, wif_private_key).unwrap();
let base64_signature = sign_simple_encoded(address, message, &[wif_private_key], None).unwrap();

assert!(verify_simple_encoded(address, message, &base64_signature).is_ok());
}
22 changes: 21 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub enum Error {
},
#[snafu(display("Failed to parse private key"))]
PrivateKeyParse { source: bitcoin::key::FromWifError },
#[snafu(display("Unsuported address `{address}`, only P2TR, P2WPKH and P2SH-P2WPKH allowed"))]
#[snafu(display("Unsupported address `{address}`, only P2TR, P2WPKH, P2SH-P2WPKH, and P2WSH/P2SH multisig allowed"))]
UnsupportedAddress { address: String },
#[snafu(display("Decode error for signature `{signature}`"))]
SignatureDecode {
Expand Down Expand Up @@ -66,4 +66,24 @@ pub enum Error {
InvalidWitness,
#[snafu(display("Public key does not match"))]
PublicKeyMismatch,
#[snafu(display("At least one private key is required"))]
NoPrivateKeys,
#[snafu(display("Non-standard sighash type: {source}"))]
SigHashTypeNonStandard {
source: bitcoin::sighash::NonStandardSighashTypeError,
},
#[snafu(display("Signer's public key not present in multisig script"))]
UnknownSigner,
#[snafu(display("Duplicate private key provided"))]
DuplicateSigner,
#[snafu(display("Expected exactly {required} private keys, got {provided}"))]
SignatureCount { required: usize, provided: usize },
#[snafu(display("P2WPKH requires a compressed public key"))]
UncompressedPublicKey {
source: bitcoin::key::UncompressedPublicKeyError,
},
#[snafu(display("Failed to parse witness script"))]
WitnessScriptParse {
source: bitcoin::hex::HexToBytesError,
},
}
Loading
Loading