-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from bitmark-inc/Sang/security_audit/1_biometric
fix(security_audit): 1_ Biometric is not event-bound
- Loading branch information
Showing
10 changed files
with
487 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// AccessControl.swift | ||
// | ||
// | ||
// Created by Nguyen Phuoc Sang on 27/03/2024. | ||
// | ||
|
||
import Foundation | ||
import LocalAuthentication | ||
|
||
|
||
class AccessControl { | ||
|
||
// MARK: - Singleton | ||
public static let shared = AccessControl() | ||
|
||
// Policy | ||
private var policy: LAPolicy = .deviceOwnerAuthentication | ||
|
||
var accessible: CFString = kSecAttrAccessibleWhenUnlocked | ||
|
||
// Reason | ||
var reason: String = NSLocalizedString("Access your password on the keychain", comment: "") | ||
|
||
// Context | ||
lazy var context: LAContext = { | ||
let mainContext = LAContext() | ||
mainContext.touchIDAuthenticationAllowableReuseDuration = Double(5) | ||
mainContext.localizedReason = reason | ||
return mainContext | ||
}() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.