-
Notifications
You must be signed in to change notification settings - Fork 231
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
Showing
15 changed files
with
784 additions
and
62 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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import SimpleKeychain | ||
|
||
/// Generic storage API for storing credentials | ||
public protocol CredentialsStorage { | ||
/// Retrieve a storage entry | ||
/// | ||
/// - Parameters: | ||
/// - forKey: The key to get from the store | ||
/// - Returns: The stored data | ||
func getEntry(forKey: String) -> Data? | ||
|
||
/// Set a storage entry | ||
/// | ||
/// - Parameters: | ||
/// - _: The data to be stored | ||
/// - forKey: The key to store it to | ||
/// - Returns: if credentials were stored | ||
func setEntry(_: Data, forKey: String) -> Bool | ||
|
||
/// Delete a storage entry | ||
/// | ||
/// - Parameters: | ||
/// - forKey: The key to delete from the store | ||
/// - Returns: if credentials were deleted | ||
func deleteEntry(forKey: String) -> Bool | ||
} | ||
|
||
extension A0SimpleKeychain: CredentialsStorage { | ||
|
||
public func getEntry(forKey: String) -> Data? { | ||
return data(forKey: forKey) | ||
} | ||
|
||
public func setEntry(_ data: Data, forKey: String) -> Bool { | ||
return setData(data, forKey: forKey) | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.