 import UIKit
 import AudioToolbox
 import LocalAuthentication
+import Valet
 
 public enum ALConstants {
   static let nibName = "AppLocker"
-  static let kPincode = "pincode" // Key for saving pincode to UserDefaults
+  static let kPincode = "pincode" // Key for saving pincode to keychain
   static let kLocalizedReason = "Unlock with sensor" // Your message when sensors must be shown
   static let duration = 0.3 // Duration of indicator filling
   static let maxPinLength = 4

  }
  
  private func removePin() {
    UserDefaults.standard.removeObject(forKey: ALConstants.kPincode)
    dismiss(animated: true, completion: nil)
  }
  

  private var isFirstCreationStep = true
  private var savedPin: String? {
    get {
      return AppLocker.myValet.string(forKey: ALConstants.kPincode)
    }
    set {
      guard let newValue = newValue else { return }
      AppLocker.myValet.set(string: newValue, forKey: ALConstants.kPincode)
    }
  }
  
