KeychainStorageDelegate
open class KeychainStorageDelegate : StorageDelegate
KeychainStorageDelegate
conforming StorageDelegate
protocol.
-
Access group where
StorageData
is in.Declaration
Swift
open var accessGroup: String?
-
Whether the
StorageData
can be synchronized.Declaration
Swift
open var synchronizable: Bool
-
When
StorageData
can be accessed in the keychain.Declaration
Swift
open var accessible: CFString
-
Specifies item class used.
Declaration
Swift
open var secClass: CFString
-
Create a
KeychainStorageDelegate
.Declaration
Swift
public init()
-
Get
StorageData
forStoreKey
from the keychain.Throws
KeychainError.error
.Declaration
Swift
open func data<D>(forKey key: StoreKey) throws -> D? where D : StorageData
Parameters
key
StoreKey
to store theStorageData
.Return Value
StorageData
forStoreKey
. -
Set
StorageData
forStoreKey
in the keychain.Throws
KeychainError.error
.Declaration
Swift
open func set<D>(_ data: D?, forKey key: StoreKey) throws where D : StorageData
Parameters
data
StorageData
to store.key
StoreKey
to store theStorageData
. -
Remove
StorageData
forStoreKey
from the keychain.Throws
KeychainError.error
.Declaration
Swift
open func remove(forKey key: StoreKey) throws
Parameters
key
StoreKey
to remove. -
Store
StorageData
for account in the keychain.Throws
KeychainError.error
.Declaration
Swift
open func store<D: StorageData>(_ value: D, key: String, accessible: CFString = kSecAttrAccessibleWhenUnlocked, accessGroup: String? = nil, synchronizable: Bool = false, secClass: CFString = kSecClassGenericPassword) throws
Parameters
value
StorageData
to store.account
Item’s account name.
accessible
When the keychain item is accessible.
accessGroup
Access group where
StorageData
is in.synchronizable
Whether the
StorageData
can be synchronized.secClass
Specifies item class used.
-
Read
StorageData
for account from the keychain.Throws
KeychainError.error
.Declaration
Swift
open func read<D: StorageData>(key: String, accessGroup: String? = nil, synchronizable: Bool = false, secClass: CFString = kSecClassGenericPassword, returnAttributes: Bool? = nil, returnData: Bool = true) throws -> D?
Parameters
account
Item’s account name.
accessGroup
Access group where
StorageData
is in.synchronizable
Whether the
StorageData
can be synchronized.secClass
Specifies item class used.
returnAttributes
Return item attributes.
returnData
Return item data.
Return Value
StorageData
for account. -
Delete item for account from the keychain.
Throws
KeychainError.error
.Declaration
Swift
open func delete(key: String, accessGroup: String? = nil, synchronizable: Bool = false, secClass: CFString = kSecClassGenericPassword) throws
Parameters
account
Item’s account name.
accessGroup
Access group where
StorageData
is in.synchronizable
Whether the
StorageData
can be synchronized.secClass
Specifies item class used.