Summary#
- Adds
device_key.rswith compile-time#[cfg]dispatch: macOS/Simulator uses a software P-256 keypair (viacryptocrate + Keychain), real iOS device uses the Secure Enclave viasecurity_framework 3.x - Wires
device_key::get_or_create()intocreate_accountso the relay receives the SE-backed public key instead of an ephemeral software keypair - Exposes
get_or_create_device_keyandsign_with_device_keyas Tauri IPC commands with typed TypeScript wrappers inipc.ts
Notable decisions#
- cfg deviation: uses
any(target_os = "macos", all(target_os = "ios", target_env = "sim"))for the software path socargo testexercises real code on macOS host (the design'starget_env = "sim"predicate doesn't match macOS wheretarget_env = ""). - Low-S normalization: SE signatures are normalized via
normalize_s()for ATProto/did:plc compatibility; the simulator path uses RFC 6979 which produces low-S natively. - Safe wrapper over raw FFI: uses
security_framework3.x safe API instead of rawsecurity-framework-sys— same functionality, nounsafeblocks.
Test plan#
-
cargo test -p identity-wallet -- --test-threads=1— 22 tests pass (8 device_key + 14 lib) - Manual simulator verification per
docs/test-plans/2026-03-18-MM-145.md(key generation, signing, IPC round-trip) - Manual physical device verification: SE persistence across cold restart (AC2.1), private key non-extractable (AC2.2)