summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/KeychainError.swift
blob: 5ee831c83f8a05b78fd6b2b5b7391373b63044bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//
//  KeychainError.swift
//  MullvadVPN
//
//  Created by pronebird on 02/10/2019.
//  Copyright © 2019 Mullvad VPN AB. All rights reserved.
//

import Foundation
import Security

struct KeychainError: LocalizedError, Equatable {
    let code: OSStatus

    var errorDescription: String? {
        return SecCopyErrorMessageString(code, nil) as String?
    }

    static let duplicateItem = KeychainError(code: errSecDuplicateItem)
    static let itemNotFound = KeychainError(code: errSecItemNotFound)

    static func == (lhs: KeychainError, rhs: KeychainError) -> Bool {
        return lhs.code == rhs.code
    }
}