Skip to main content

HardwareSigner

Trait HardwareSigner 

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

The per-platform hardware secure element, implemented by native code (Swift/Kotlin) behind the capsule_sdk namespace’s FfiHardwareSigner foreign trait. Rust calls into it to enroll a non-exportable Ed25519 key and to sign with it; the ML-DSA-65 half is handled in Rust.

Required Methods§

Source

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

Generate (or bind to) the hardware Ed25519 keypair for key_alias, returning its 32-byte public key. Idempotent per alias.

Source

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

The 32-byte Ed25519 public key for an already-enrolled key_alias.

Source

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

Produce a 64-byte Ed25519 signature over msg with the hardware key for key_alias.

Source

fn assert_non_exportable( &self, key_alias: String, ) -> Result<(), HardwareSignerError>

Non-exportability assertion: a conforming element MUST refuse to reveal the private bytes, returning HardwareSignerError::Exportable if they can be read. This drives the per-platform smoke test (keys.md Validation).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§