use async_trait::async_trait;
use tari_crypto::ristretto::{RistrettoPublicKey, RistrettoSecretKey};
use tari_ootle_common_types::engine_types::crypto::OutputBody;
use tari_ootle_wallet_crypto::DecryptedData;
use tari_template_lib_types::{
Amount,
EncryptedData,
crypto::PedersenCommitmentBytes,
stealth::{StealthOutputsStatement, StealthTransferStatement},
};
use crate::stealth::{BurnClaimStatementSpec, Output, ResolvedStealthTransferSpec, error::StealthProviderError};
pub type StealthResult<T> = Result<T, StealthProviderError>;
#[async_trait]
pub trait StealthStatementProvider {
async fn create_transfer_statement(
&self,
spec: ResolvedStealthTransferSpec,
) -> StealthResult<StealthTransferStatement>;
}
#[async_trait]
pub(crate) trait StealthOutputStatementFactory {
async fn generate_outputs_statement(
&self,
specs: Vec<Output>,
revealed_output_amount: Amount,
) -> StealthResult<(StealthOutputsStatement, RistrettoSecretKey)>;
}
#[async_trait]
pub(crate) trait InputDecryptor {
async fn decrypt_input_data(
&self,
commitment: &PedersenCommitmentBytes,
input: &OutputBody,
skip_memo: bool,
) -> StealthResult<DecryptedData>;
}
#[async_trait]
pub trait BurnClaimKeyProvider {
async fn derive_burn_claim_secret(
&self,
sender_offset_public_key: &RistrettoPublicKey,
) -> StealthResult<RistrettoSecretKey>;
async fn decrypt_burn_claim_output(
&self,
encrypted_data: &EncryptedData,
commitment: &PedersenCommitmentBytes,
sender_offset_public_key: &RistrettoPublicKey,
) -> StealthResult<DecryptedData>;
async fn create_burn_claim_statement(
&self,
spec: BurnClaimStatementSpec,
) -> StealthResult<StealthTransferStatement>;
}
pub trait StealthSigner {
type Signature;
fn sign_with_stealth_key(&self, public_key: &RistrettoPublicKey) -> Result<Self::Signature, String>;
}