Skip to main content

FfiHardwareSigner

Trait FfiHardwareSigner 

Source
pub trait FfiHardwareSigner: Send + Sync {
    // Required methods
    fn enroll(
        &self,
        key_alias: String,
    ) -> Result<Vec<u8>, FfiHardwareSignerError>;
    fn classical_public_key(
        &self,
        key_alias: String,
    ) -> Result<Vec<u8>, FfiHardwareSignerError>;
    fn sign_classical(
        &self,
        key_alias: String,
        msg: Vec<u8>,
    ) -> Result<Vec<u8>, FfiHardwareSignerError>;
    fn assert_non_exportable(
        &self,
        key_alias: String,
    ) -> Result<(), FfiHardwareSignerError>;
}
Expand description

The per-platform secure element (Secure Enclave, StrongBox, TPM), implemented by native Swift/Kotlin over the uniffi foreign-trait boundary.

The byte shapes are fixed by the constructor the element is handed to, not by the trait:

Either way Rust composes the classical half with a software-sealed ML-DSA-65 half into the published hybrid device key.

Required Methods§

Source

fn enroll(&self, key_alias: String) -> Result<Vec<u8>, FfiHardwareSignerError>

Generate (or bind to) the hardware keypair for key_alias, returning its public key in the constructor’s shape: a SEC1 P-256 key for FfiWorkspace::create_with_p256_hardware_signer, a 32-byte Ed25519 key for FfiWorkspace::create_with_hardware_signer. Idempotent per alias.

Source

fn classical_public_key( &self, key_alias: String, ) -> Result<Vec<u8>, FfiHardwareSignerError>

The public key for an already-enrolled key_alias, in the same constructor-dependent shape enroll returns (SEC1 P-256, or 32-byte Ed25519).

Source

fn sign_classical( &self, key_alias: String, msg: Vec<u8>, ) -> Result<Vec<u8>, FfiHardwareSignerError>

Sign msg with the hardware key for key_alias, in the constructor’s shape: a DER-encoded ECDSA signature over SHA-256(msg) for FfiWorkspace::create_with_p256_hardware_signer, a 64-byte Ed25519 signature over msg for FfiWorkspace::create_with_hardware_signer.

Source

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 FfiHardwareSigner

Source§

const TYPE_ID_META: MetadataBuffer

Source§

type FfiType = Handle

Source§

fn lower(obj: Arc<Self>) -> Self::FfiType

Source§

fn try_lift(handle: Self::FfiType) -> Result<Arc<Self>>

Source§

fn write(obj: Arc<Self>, buf: &mut Vec<u8>)

Source§

fn try_read(buf: &mut &[u8]) -> Result<Arc<Self>>

Source§

impl<T> LiftRef<T> for dyn FfiHardwareSigner

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§