KeychainStoreManager
open class KeychainStoreManager : PersistentStoreManaging
KeychainStoreManager implementation of PersistentStoreManaging
Creates/opens/removes KeychainStorage instances. The used cipherHandler provides the Cipher to used for encryption. When there is no Cipher then the data won’t be enctypted.
-
To share the
KeychainStorevalues this accessGroup should be the same in each applicationDeclaration
Swift
public let accessGroup: String -
Initializes a new instance of
KeychainStoreManagerDeclaration
Swift
public init(keychainAccessGroup: String = "", cipherHandler: @escaping (String?, String) throws -> Ciphering? = KeychainStoreManager.cipher(for:salt:), saltProvider: SaltProviding? = nil)Parameters
keychainAccessGroupthe keychain access group used to share the data. If
nilpassed the data won’t be shared. Default value isnilcipherHandlerthe close which should provide a
Cipheringinstance which is used for encryption. If returnsnilthe data won’t be encrypted. The defautl value isKeychainStoreManager.cipher(for:) -
Creates a
KeychainStorageinstance. If passcode is not nil it usesCipherto encrypt data.Throws
StoreManagerErrorDeclaration
Swift
open func createStore(name: String, passcode: String?) throws -> DataStoringParameters
namename of the store
passcodepasscode used to encrypt the data stored in the store. Passing
nilmeans no encryption will be used. In any other case aCipherinstance will be created with its default parametersReturn Value
initialized KeychainStorage instance, can be used to store/retrieve data
-
Tries to open the store with the given passcode
Throws
StoreManagerErrorDeclaration
Swift
open func openStore(name: String, passcode: String?) throws -> DataStoringParameters
namename of the store
passcodethe passcode given by the user
Return Value
opened store
-
Declaration
Swift
open func removeStore(name: String, store: DataStoring?) throws -
Declaration
Swift
open func changePasscode(store: DataStoring, newPasscode: String?) throws -
Declaration
Swift
open func storeExists(name: String) throws -> Bool -
Creates a new instance of
Cipherclass with its default values when thepasscodeparameter is notnil(even if it is empty string). Returnsnilif the passcode isnil.Declaration
Swift
public class func cipher(for passcode: String?, salt: String) throws -> Ciphering?Parameters
passcodethe passcode to used to create
CipherReturn Value
new
Cipherinstance or nil