KeysServiceTrait

Trait KeysServiceTrait 

Source
pub trait KeysServiceTrait: Send + Sync {
    // Required methods
    fn create_key<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
    ) -> Pin<Box<dyn Future<Output = Result<KeyEntry, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn sign_transaction_hash<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
        transaction_hash: &'life2 str,
        key: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<SigEntry, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn sign_transaction<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        config: &'life1 Config,
        transaction_str: &'life2 str,
        key: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn verify<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        transaction_hash_hex: &'life1 str,
        signature_hex: &'life2 str,
        key: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn verify_via_kms<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        transaction_hash_hex: &'life1 str,
        signature_hex: &'life2 str,
        key: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete_key<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_keys<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyEntry>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn create_key<'life0, 'life1, 'async_trait>( &'life0 mut self, config: &'life1 Config, ) -> Pin<Box<dyn Future<Output = Result<KeyEntry, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates a new cryptographic key based on the provided configuration.

§Errors

Returns an error if key creation fails due to misconfiguration, internal cryptographic errors, or if the underlying storage backend is unavailable.

Source

fn sign_transaction_hash<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, config: &'life1 Config, transaction_hash: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<SigEntry, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Signs the given transaction hash using the specified public key.

§Arguments
  • transaction_hash: A hex-encoded hash of the transaction data.
  • key: The key used to locate the corresponding private key for signing.
§Errors

Returns an error if the key is not found, if signing fails, or if the inputs are malformed.

Source

fn sign_transaction<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, config: &'life1 Config, transaction_str: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Signs the raw transaction data using the specified public key.

§Arguments
  • transaction_str: The raw transaction string to be hashed and signed.
  • key: The public key used to determine the signing key.
§Errors

Returns an error if hashing, signing, or key retrieval fails.

Source

fn verify<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, transaction_hash_hex: &'life1 str, signature_hex: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Verifies that the given signature is valid for the provided transaction hash and public key.

§Arguments
  • transaction_hash_hex: A hex-encoded transaction hash.
  • signature_hex: A hex-encoded digital signature.
  • key: The key alias to verify against.
§Errors

Returns an error if the signature is invalid, the input format is incorrect, or if verification logic encounters a failure.

Source

fn verify_via_kms<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, transaction_hash_hex: &'life1 str, signature_hex: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Verifies a transaction hash using an external KMS (Key Management System).

§Arguments
  • transaction_hash_hex: A hex-encoded hash of the transaction.
  • signature_hex: A hex-encoded signature to verify.
  • key: The key alias in the KMS.
§Errors

Returns an error if KMS access fails, if the inputs are malformed, or if verification returns an invalid result.

Source

fn delete_key<'life0, 'life1, 'async_trait>( &'life0 mut self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes the cryptographic key associated with the given key.

§Arguments
  • key: The key whose associated private key should be deleted.
§Errors

Returns an error if the key cannot be found or deletion fails due to internal issues or access control.

Source

fn list_keys<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyEntry>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all available public keys and their metadata.

§Errors

Returns an error if key listing fails due to storage access problems or unexpected internal errors.

Implementors§