Biometrics unlock keys, not screens
The private key never leaves the Secure Enclave. A successful Face ID evaluation lets us sign the transfer payload — the server verifies the signature, not a session cookie.
actor TransferSigner {
private let key: SecureEnclave.P256.Signing.PrivateKey
func sign(_ transfer: Transfer) async throws -> SignedTransfer {
let context = LAContext()
context.localizedReason = "Confirm \(transfer.amount.formatted())"
context.touchIDAuthenticationAllowableReuseDuration = 0
try await context.evaluatePolicy(
.deviceOwnerAuthenticationWithBiometrics,
localizedReason: context.localizedReason)
let payload = try JSONEncoder.canonical.encode(transfer)
let signature = try key.signature(for: payload)
return SignedTransfer(payload: payload, signature: signature.derRepresentation)
}
}