pub trait FfiHardwareKeyAgreement: Send + Sync {
// Required methods
fn enroll(
&self,
key_alias: String,
) -> Result<Vec<u8>, FfiHardwareSignerError>;
fn public_key(
&self,
key_alias: String,
) -> Result<Vec<u8>, FfiHardwareSignerError>;
fn key_agreement(
&self,
key_alias: String,
peer_public: Vec<u8>,
) -> Result<Vec<u8>, FfiHardwareSignerError>;
fn assert_non_exportable(
&self,
key_alias: String,
) -> Result<(), FfiHardwareSignerError>;
}Expand description
The per-platform key-agreement element (Secure Enclave P256.KeyAgreement, StrongBox
ECDH, TPM 2.0 ECDH), implemented by native Swift/Kotlin over the uniffi foreign-trait
boundary — the ECDH analogue of FfiHardwareSigner, and this namespace’s declaration of
capsule-core’s HardwareKeyAgreement contract.
It backs the hardware-bound classical half of the device encryption key:
the element holds a static P-256 private key and performs the ECDH, so the scalar never
leaves hardware, while Rust drives the software-sealed ML-KEM-768 half and the hybrid
combiner. Failures reuse FfiHardwareSignerError, exactly as core’s trait reuses its
signer error.
Required Methods§
Sourcefn enroll(&self, key_alias: String) -> Result<Vec<u8>, FfiHardwareSignerError>
fn enroll(&self, key_alias: String) -> Result<Vec<u8>, FfiHardwareSignerError>
Generate (or bind to) the hardware P-256 key-agreement keypair for key_alias,
returning its public key as uncompressed SEC1 (0x04‖x‖y, 65 bytes). Idempotent per
alias.
Sourcefn public_key(
&self,
key_alias: String,
) -> Result<Vec<u8>, FfiHardwareSignerError>
fn public_key( &self, key_alias: String, ) -> Result<Vec<u8>, FfiHardwareSignerError>
The uncompressed-SEC1 P-256 public key for an already-enrolled key_alias.
Sourcefn key_agreement(
&self,
key_alias: String,
peer_public: Vec<u8>,
) -> Result<Vec<u8>, FfiHardwareSignerError>
fn key_agreement( &self, key_alias: String, peer_public: Vec<u8>, ) -> Result<Vec<u8>, FfiHardwareSignerError>
ECDH against peer_public (the sender’s ephemeral P-256 public key, uncompressed SEC1)
with the hardware key for key_alias, returning the raw 32-byte shared secret (the
big-endian x-coordinate, before any KDF).
Sourcefn assert_non_exportable(
&self,
key_alias: String,
) -> Result<(), FfiHardwareSignerError>
fn assert_non_exportable( &self, key_alias: String, ) -> Result<(), FfiHardwareSignerError>
Non-exportability assertion: a conforming element MUST refuse to reveal the private
bytes, returning FfiHardwareSignerError::Exportable if they can be read.
Trait Implementations§
Source§impl<T> FfiConverterArc<T> for dyn FfiHardwareKeyAgreement
impl<T> FfiConverterArc<T> for dyn FfiHardwareKeyAgreement
Source§impl<T> LiftRef<T> for dyn FfiHardwareKeyAgreement
impl<T> LiftRef<T> for dyn FfiHardwareKeyAgreement
type LiftType = Arc<dyn FfiHardwareKeyAgreement>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".