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:
FfiWorkspace::create_with_p256_hardware_signerandFfiWorkspace::open_with_p256_hardware_signer— the P-256 shape shipping elements actually provide:enroll/classical_public_keyreturn a SEC1 public key andsign_classicala DER-encoded ECDSA signature overSHA-256(msg).FfiWorkspace::create_with_hardware_signer— the Ed25519 shape: a 32-byte public key and a 64-byte signature overmsg. No shipping secure element holds Ed25519 keys, so this is the software/TPM reference path.
Either way Rust composes the classical half with a software-sealed ML-DSA-65 half into the published hybrid device key.
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 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.
Sourcefn classical_public_key(
&self,
key_alias: String,
) -> Result<Vec<u8>, FfiHardwareSignerError>
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).
Sourcefn sign_classical(
&self,
key_alias: String,
msg: Vec<u8>,
) -> Result<Vec<u8>, FfiHardwareSignerError>
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.
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 FfiHardwareSigner
impl<T> FfiConverterArc<T> for dyn FfiHardwareSigner
Source§impl<T> LiftRef<T> for dyn FfiHardwareSigner
impl<T> LiftRef<T> for dyn FfiHardwareSigner
type LiftType = Arc<dyn FfiHardwareSigner>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".