pub trait SpendingConditionVerification {
// Required methods
fn inputs(&self) -> &Vec<Proof>;
fn sig_all_msg_to_sign(&self) -> String;
// Provided methods
fn has_at_least_one_sig_all(&self) -> Result<bool, Error> { ... }
fn verify_all_inputs_match_for_sig_all(&self) -> Result<(), Error> { ... }
fn verify_spending_conditions(&self) -> Result<(), Error> { ... }
fn verify_full_sig_all_check(&self) -> Result<(), Error> { ... }
fn verify_inputs_individually(&self) -> Result<(), Error> { ... }
fn verify_sig_all_p2pk(&self) -> Result<(), Error> { ... }
fn verify_sig_all_htlc(&self) -> Result<(), Error> { ... }
}Expand description
Trait for requests that spend proofs (SwapRequest, MeltRequest)
Required Methods§
Sourcefn sig_all_msg_to_sign(&self) -> String
fn sig_all_msg_to_sign(&self) -> String
Construct the message to sign for SIG_ALL verification
This concatenates all relevant transaction data that must be signed. For swap: input secrets + output blinded messages For melt: input secrets + quote/payment request
Provided Methods§
Sourcefn has_at_least_one_sig_all(&self) -> Result<bool, Error>
fn has_at_least_one_sig_all(&self) -> Result<bool, Error>
Check if at least one proof in the set has SIG_ALL flag set
SIG_ALL requires all proofs in the transaction to be signed. If any proof has this flag, we need to verify signatures on all proofs.
Sourcefn verify_all_inputs_match_for_sig_all(&self) -> Result<(), Error>
fn verify_all_inputs_match_for_sig_all(&self) -> Result<(), Error>
Verify all inputs meet SIG_ALL requirements per NUT-11
When any input has SIG_ALL, all inputs must have:
- Same kind (P2PK or HTLC)
- SIG_ALL flag set
- Same Secret.data
- Same Secret.tags
Sourcefn verify_spending_conditions(&self) -> Result<(), Error>
fn verify_spending_conditions(&self) -> Result<(), Error>
Verify spending conditions for this transaction
This is the main entry point for spending condition verification. It checks if any input has SIG_ALL and dispatches to the appropriate verification path.
Sourcefn verify_full_sig_all_check(&self) -> Result<(), Error>
fn verify_full_sig_all_check(&self) -> Result<(), Error>
Verify spending conditions when SIG_ALL is present
When SIG_ALL is set, all proofs in the transaction must be signed together.
Sourcefn verify_inputs_individually(&self) -> Result<(), Error>
fn verify_inputs_individually(&self) -> Result<(), Error>
Verify spending conditions for each input individually
Handles SIG_INPUTS mode, non-NUT-10 secrets, and any other case where inputs are verified independently rather than as a group. This function will NOT be called if any input has SIG_ALL.
Sourcefn verify_sig_all_p2pk(&self) -> Result<(), Error>
fn verify_sig_all_p2pk(&self) -> Result<(), Error>
Verify P2PK SIG_ALL signatures
Do NOT call this directly. This is called only from ‘verify_full_sig_all_check’, which has already done many important SIG_ALL checks. This performs the final signature verification for SIG_ALL+P2PK transactions.
Sourcefn verify_sig_all_htlc(&self) -> Result<(), Error>
fn verify_sig_all_htlc(&self) -> Result<(), Error>
Verify HTLC SIG_ALL signatures
Do NOT call this directly. This is called only from ‘verify_full_sig_all_check’, which has already done many important SIG_ALL checks. This performs the final signature verification for SIG_ALL+HTLC transactions.