CLI: Add multi-session signing support (#8927)
* SDK: Add `NullSigner` implementation * SDK: Split `Transaction::verify()` to gain access to results * CLI: Minor refactor of --sign_only result parsing * CLI: Enable paritial signing Signers specified by pubkey, but without a matching --signer arg supplied fall back to a `NullSigner` when --sign-only is in effect. This allows their pubkey to be used for TX construction as usual, but leaves their `sign_message()` a NOP. As such, with --sign-only in effect, signing and verification must be done separately, with the latter's per-signature results considered * CLI: Surface/report missing/bad signers to user * CLI: Suppress --sign-only JSON output * nits * Docs for multi-session offline signing
This commit is contained in:
@@ -300,14 +300,20 @@ impl Transaction {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Verify the transaction
|
||||
pub fn verify(&self) -> Result<()> {
|
||||
if !self
|
||||
.signatures
|
||||
pub fn verify_with_results(&self) -> Vec<bool> {
|
||||
self.signatures
|
||||
.iter()
|
||||
.zip(&self.message.account_keys)
|
||||
.map(|(signature, pubkey)| signature.verify(pubkey.as_ref(), &self.message_data()))
|
||||
.all(|verify_result| verify_result)
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Verify the transaction
|
||||
pub fn verify(&self) -> Result<()> {
|
||||
if !self
|
||||
.verify_with_results()
|
||||
.iter()
|
||||
.all(|verify_result| *verify_result)
|
||||
{
|
||||
Err(TransactionError::SignatureFailure)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user