GenericPasswordItem
public class GenericPasswordItem : AbstractPasswordItem
A generic password, that can be persisted securely in the systems Keychain.
A generic password is always used for a specified service, which can be your application itself. It might be tied to or used by an account.
Two generic password items are considered equal if their service
and
account
values are equal.
Note
For internet passwords useInternetPassword
instead.
-
The service for which the password is used. This can simply be your application.
See
kSecAttrService
Declaration
Swift
public let service: String
-
Initialize a generic password Keychain item.
Declaration
Swift
public init(for service: String, using account: String? = nil, with description: String? = nil, and comment: String? = nil)
Parameters
service
A service, e.g., your application name.
account
The account for which the password is used.
description
A description or purpose of the item.
comment
A comment.
-
Helper function to construct the Keychain query.
Declaration
Swift
fileprivate override func addAttributes(to query: KeychainQuery) -> KeychainQuery
Parameters
query
The query, where attributes should be added.
Return Value
The
query
with additional attributes added.
-
The Keychain type of a generic password, which is
kSecClassGenericPassword
.Declaration
Swift
public var type: CFString { get }
-
Constructs a keychain query for a generic password.
Declaration
Swift
public var query: [String : AnyObject] { get }