mirror of
https://bitbucket.org/vendoo/vendoo_v1.0.git
synced 2025-12-25 19:57:41 +00:00
45 lines
1.6 KiB
Swift
45 lines
1.6 KiB
Swift
import Foundation
|
|
|
|
// MARK: Locksmith Error
|
|
public enum LocksmithError: String, ErrorType {
|
|
case Allocate = "Failed to allocate memory."
|
|
case AuthFailed = "Authorization/Authentication failed."
|
|
case Decode = "Unable to decode the provided data."
|
|
case Duplicate = "The item already exists."
|
|
case InteractionNotAllowed = "Interaction with the Security Server is not allowed."
|
|
case NoError = "No error."
|
|
case NotAvailable = "No trust results are available."
|
|
case NotFound = "The item cannot be found."
|
|
case Param = "One or more parameters passed to the function were not valid."
|
|
case RequestNotSet = "The request was not set"
|
|
case TypeNotFound = "The type was not found"
|
|
case UnableToClear = "Unable to clear the keychain"
|
|
case Undefined = "An undefined error occurred"
|
|
case Unimplemented = "Function or operation not implemented."
|
|
|
|
init?(fromStatusCode code: Int) {
|
|
switch code {
|
|
case Int(errSecAllocate):
|
|
self = Allocate
|
|
case Int(errSecAuthFailed):
|
|
self = AuthFailed
|
|
case Int(errSecDecode):
|
|
self = Decode
|
|
case Int(errSecDuplicateItem):
|
|
self = Duplicate
|
|
case Int(errSecInteractionNotAllowed):
|
|
self = InteractionNotAllowed
|
|
case Int(errSecItemNotFound):
|
|
self = NotFound
|
|
case Int(errSecNotAvailable):
|
|
self = NotAvailable
|
|
case Int(errSecParam):
|
|
self = Param
|
|
case Int(errSecUnimplemented):
|
|
self = Unimplemented
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
}
|