-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Guilherme Souza
committed
Jan 15, 2022
1 parent
35b209f
commit af361ec
Showing
3 changed files
with
48 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import KeychainAccess | ||
|
||
extension KeychainClient { | ||
|
||
/// Creates a live implementation of the KeychainClient. | ||
/// - Parameter keychain: Configured Keychain instance to use. | ||
/// - Returns: The KeychainClient. | ||
public static func live(keychain: Keychain) -> KeychainClient { | ||
return KeychainClient( | ||
getString: { try keychain.get($0) }, | ||
getData: { try keychain.getData($0) }, | ||
setString: { try keychain.set($0, key: $1) }, | ||
setData: { try keychain.set($0, key: $1) }, | ||
remove: { try keychain.remove($0) }, | ||
getString: { try keychain.get($0.rawValue) }, | ||
getData: { try keychain.getData($0.rawValue) }, | ||
setString: { try keychain.set($0, key: $1.rawValue) }, | ||
setData: { try keychain.set($0, key: $1.rawValue) }, | ||
remove: { try keychain.remove($0.rawValue) }, | ||
removeAll: { try keychain.removeAll() }, | ||
contains: { try keychain.contains($0) } | ||
contains: { try keychain.contains($0.rawValue) } | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters