SPB Git

Repository Public

DeviceBiometry.swift 2.7 KB 76 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project          : QYVORA7// File             : App/Sources/Lock/DeviceBiometry.swift8// Module           : Lock9// Repository       : https://git.spboucher.ai/qyvora10// Project Website  : Not specified11// Created          : 2026-12-0412// Last Modified    : 2026-12-0413//14// Author           : Simon-Pierre Boucher15// Position         : Professor of Finance16// Institution      : Université du Québec en Outaouais (UQO)17// Organization     : SP Boucher18// Website          : https://spboucher.ai19// Git              : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development      : dev@spboucher.ai23// Support          : support@spboucher.ai24// Security/Admin   : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License          : None specified (no license file in this repository)33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import LocalAuthentication42import QyvoraUI4344/// What biometric sensor this device offers, for labels and glyphs only. Authentication itself is done by45/// the vault through the Keychain; this type never evaluates a policy.46enum DeviceBiometry {47    /// nil when no biometric sensor is enrolled or available.48    static var kind: PINPad.Biometry? {49        let context = LAContext()50        var error: NSError?51        guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else { return nil }52        switch context.biometryType {53        case .faceID: return .faceID54        case .touchID: return .touchID55        case .opticID: return .opticID56        default: return nil57        }58    }5960    static var name: String {61        switch kind {62        case .touchID: return "Touch ID"63        case .opticID: return "Optic ID"64        default: return "Face ID"65        }66    }6768    static var systemImage: String {69        switch kind {70        case .touchID: return "touchid"71        case .opticID: return "opticid"72        default: return "faceid"73        }74    }75}76
Files main
Menu

Theme