use crate::primitives::PublicKey;
use crate::wallet::types::{
Counterparty, RevealCounterpartyKeyLinkageResult, RevealSpecificKeyLinkageResult,
};
use crate::wallet::{
AbortActionArgs, AbortActionResult, AcquireCertificateArgs, AuthenticatedResult,
CreateActionArgs, CreateActionResult, CreateHmacArgs, CreateHmacResult, CreateSignatureArgs,
CreateSignatureResult, DecryptArgs, DecryptResult, DiscoverByAttributesArgs,
DiscoverByIdentityKeyArgs, DiscoverCertificatesResult, EncryptArgs, EncryptResult,
GetHeaderArgs, GetHeaderResult, GetHeightResult, GetNetworkResult, GetPublicKeyArgs,
GetPublicKeyResult, GetVersionResult, InternalizeActionArgs, InternalizeActionResult,
ListActionsArgs, ListActionsResult, ListCertificatesArgs, ListCertificatesResult,
ListOutputsArgs, ListOutputsResult, Protocol, ProveCertificateArgs, ProveCertificateResult,
RelinquishCertificateArgs, RelinquishCertificateResult, RelinquishOutputArgs,
RelinquishOutputResult, SignActionArgs, SignActionResult, VerifyHmacArgs, VerifyHmacResult,
VerifySignatureArgs, VerifySignatureResult, WalletCertificate,
};
use crate::Result;
use async_trait::async_trait;
#[derive(Debug, Clone)]
pub struct RevealCounterpartyKeyLinkageArgs {
pub counterparty: PublicKey,
pub verifier: PublicKey,
pub privileged: Option<bool>,
pub privileged_reason: Option<String>,
}
#[derive(Debug, Clone)]
pub struct RevealSpecificKeyLinkageArgs {
pub counterparty: Counterparty,
pub verifier: PublicKey,
pub protocol_id: Protocol,
pub key_id: String,
pub privileged: Option<bool>,
pub privileged_reason: Option<String>,
}
#[async_trait]
pub trait WalletInterface: Send + Sync {
async fn get_public_key(
&self,
args: GetPublicKeyArgs,
originator: &str,
) -> Result<GetPublicKeyResult>;
async fn encrypt(&self, args: EncryptArgs, originator: &str) -> Result<EncryptResult>;
async fn decrypt(&self, args: DecryptArgs, originator: &str) -> Result<DecryptResult>;
async fn create_hmac(&self, args: CreateHmacArgs, originator: &str)
-> Result<CreateHmacResult>;
async fn verify_hmac(&self, args: VerifyHmacArgs, originator: &str)
-> Result<VerifyHmacResult>;
async fn create_signature(
&self,
args: CreateSignatureArgs,
originator: &str,
) -> Result<CreateSignatureResult>;
async fn verify_signature(
&self,
args: VerifySignatureArgs,
originator: &str,
) -> Result<VerifySignatureResult>;
async fn reveal_counterparty_key_linkage(
&self,
args: RevealCounterpartyKeyLinkageArgs,
originator: &str,
) -> Result<RevealCounterpartyKeyLinkageResult>;
async fn reveal_specific_key_linkage(
&self,
args: RevealSpecificKeyLinkageArgs,
originator: &str,
) -> Result<RevealSpecificKeyLinkageResult>;
async fn create_action(
&self,
args: CreateActionArgs,
originator: &str,
) -> Result<CreateActionResult>;
async fn sign_action(&self, args: SignActionArgs, originator: &str)
-> Result<SignActionResult>;
async fn abort_action(
&self,
args: AbortActionArgs,
originator: &str,
) -> Result<AbortActionResult>;
async fn list_actions(
&self,
args: ListActionsArgs,
originator: &str,
) -> Result<ListActionsResult>;
async fn internalize_action(
&self,
args: InternalizeActionArgs,
originator: &str,
) -> Result<InternalizeActionResult>;
async fn list_outputs(
&self,
args: ListOutputsArgs,
originator: &str,
) -> Result<ListOutputsResult>;
async fn relinquish_output(
&self,
args: RelinquishOutputArgs,
originator: &str,
) -> Result<RelinquishOutputResult>;
async fn acquire_certificate(
&self,
args: AcquireCertificateArgs,
originator: &str,
) -> Result<WalletCertificate>;
async fn list_certificates(
&self,
args: ListCertificatesArgs,
originator: &str,
) -> Result<ListCertificatesResult>;
async fn prove_certificate(
&self,
args: ProveCertificateArgs,
originator: &str,
) -> Result<ProveCertificateResult>;
async fn relinquish_certificate(
&self,
args: RelinquishCertificateArgs,
originator: &str,
) -> Result<RelinquishCertificateResult>;
async fn discover_by_identity_key(
&self,
args: DiscoverByIdentityKeyArgs,
originator: &str,
) -> Result<DiscoverCertificatesResult>;
async fn discover_by_attributes(
&self,
args: DiscoverByAttributesArgs,
originator: &str,
) -> Result<DiscoverCertificatesResult>;
async fn is_authenticated(&self, originator: &str) -> Result<AuthenticatedResult>;
async fn wait_for_authentication(&self, originator: &str) -> Result<AuthenticatedResult>;
async fn get_height(&self, originator: &str) -> Result<GetHeightResult>;
async fn get_header_for_height(
&self,
args: GetHeaderArgs,
originator: &str,
) -> Result<GetHeaderResult>;
async fn get_network(&self, originator: &str) -> Result<GetNetworkResult>;
async fn get_version(&self, originator: &str) -> Result<GetVersionResult>;
}
pub trait CryptoWallet: WalletInterface {}
pub trait FullWallet: WalletInterface {}