pub enum Condition {
Hashlock(Hashlock),
Ed25519(Ed25519),
Secp256k1(Secp256k1),
Threshold(Threshold),
}Expand description
A cryptographic condition that can be deterministically verified.
Variants§
Hashlock(Hashlock)
XRPL-style hashlock: SHA-256(preimage) == hash.
Ed25519(Ed25519)
Ed25519 signature over an arbitrary message.
Secp256k1(Secp256k1)
Secp256k1 ECDSA signature over an arbitrary message.
Threshold(Threshold)
Threshold condition: at least threshold subconditions must hold.
Implementations§
Source§impl Condition
impl Condition
Sourcepub fn verify(&self) -> Result<()>
pub fn verify(&self) -> Result<()>
Validates the provided witness data against this cryptographic condition.
§Errors
Returns EscrowError::Condition under any of the following circumstances:
- Hashlock:
SHA-256(preimage)does not match the expected hash. - Ed25519: Public key parsing or signature verification fails.
- Secp256k1: Public key parsing or signature verification fails.
- Threshold: Fewer than
thresholdsubconditions were satisfied.
Sourcepub fn hashlock(hash: [u8; 32], preimage: Vec<u8>) -> Self
pub fn hashlock(hash: [u8; 32], preimage: Vec<u8>) -> Self
Construct a hashlock (preimage) condition.
Sourcepub fn ed25519(
public_key: [u8; 32],
message: Vec<u8>,
signature: Vec<u8>,
) -> Self
pub fn ed25519( public_key: [u8; 32], message: Vec<u8>, signature: Vec<u8>, ) -> Self
Construct an Ed25519 signature condition.
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for Condition
impl<'__de, __Context> BorrowDecode<'__de, __Context> for Condition
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
impl Eq for Condition
impl StructuralPartialEq for Condition
Auto Trait Implementations§
impl Freeze for Condition
impl RefUnwindSafe for Condition
impl Send for Condition
impl Sync for Condition
impl Unpin for Condition
impl UnwindSafe for Condition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more