-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release OneTimePassword 3.1.3 #181
Changes from all commits
3d2c3e7
c14a295
065540d
ee0d5cb
4515cfd
e1d7d17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,12 @@ public final class Keychain { | |
/// | ||
/// - throws: A `Keychain.Error` if an error occurred. | ||
public func allPersistentTokens() throws -> Set<PersistentToken> { | ||
return Set(try allKeychainItems().map(PersistentToken.init(keychainDictionary:))) | ||
let allItems = try allKeychainItems() | ||
// This code intentionally ignores items which fail deserialization, instead opting to return as many readable | ||
// tokens as possible. | ||
// TODO: Restore deserialization error handling, in a way that provides info on the failure reason and allows | ||
// the caller to choose whether to fail completely or recover some data. | ||
return Set(allItems.flatMap({ try? PersistentToken.init(keychainDictionary:$0) })) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explicit Init Violation: Explicitly calling .init() should be avoided. (explicit_init) |
||
} | ||
|
||
// MARK: Write | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,7 +231,8 @@ class KeychainTests: XCTestCase { | |
let persistentRef = try addKeychainItem(withAttributes: keychainAttributes) | ||
|
||
XCTAssertThrowsError(try keychain.persistentToken(withIdentifier: persistentRef)) | ||
XCTAssertThrowsError(try keychain.allPersistentTokens()) | ||
// TODO: Restore deserialization error handling in allPersistentTokens() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo Violation: TODOs should be resolved (Restore deserialization error ...). (todo) |
||
// XCTAssertThrowsError(try keychain.allPersistentTokens()) | ||
|
||
XCTAssertNoThrow(try deleteKeychainItem(forPersistentRef: persistentRef), | ||
"Failed to delete the test token from the keychain. This may cause future test runs to fail.") | ||
|
@@ -247,7 +248,8 @@ class KeychainTests: XCTestCase { | |
let persistentRef = try addKeychainItem(withAttributes: keychainAttributes) | ||
|
||
XCTAssertThrowsError(try keychain.persistentToken(withIdentifier: persistentRef)) | ||
XCTAssertThrowsError(try keychain.allPersistentTokens()) | ||
// TODO: Restore deserialization error handling in allPersistentTokens() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo Violation: TODOs should be resolved (Restore deserialization error ...). (todo) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo Violation: TODOs should be resolved (Restore deserialization error ...). (todo) |
||
// XCTAssertThrowsError(try keychain.allPersistentTokens()) | ||
|
||
XCTAssertNoThrow(try deleteKeychainItem(forPersistentRef: persistentRef), | ||
"Failed to delete the test token from the keychain. This may cause future test runs to fail.") | ||
|
@@ -264,7 +266,8 @@ class KeychainTests: XCTestCase { | |
let persistentRef = try addKeychainItem(withAttributes: keychainAttributes) | ||
|
||
XCTAssertThrowsError(try keychain.persistentToken(withIdentifier: persistentRef)) | ||
XCTAssertThrowsError(try keychain.allPersistentTokens()) | ||
// TODO: Restore deserialization error handling in allPersistentTokens() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo Violation: TODOs should be resolved (Restore deserialization error ...). (todo) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo Violation: TODOs should be resolved (Restore deserialization error ...). (todo) |
||
// XCTAssertThrowsError(try keychain.allPersistentTokens()) | ||
|
||
XCTAssertNoThrow(try deleteKeychainItem(forPersistentRef: persistentRef), | ||
"Failed to delete the test token from the keychain. This may cause future test runs to fail.") | ||
|
@@ -281,7 +284,8 @@ class KeychainTests: XCTestCase { | |
let persistentRef = try addKeychainItem(withAttributes: keychainAttributes) | ||
|
||
XCTAssertThrowsError(try keychain.persistentToken(withIdentifier: persistentRef)) | ||
XCTAssertThrowsError(try keychain.allPersistentTokens()) | ||
// TODO: Restore deserialization error handling in allPersistentTokens() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo Violation: TODOs should be resolved (Restore deserialization error ...). (todo) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Todo Violation: TODOs should be resolved (Restore deserialization error ...). (todo) |
||
// XCTAssertThrowsError(try keychain.allPersistentTokens()) | ||
|
||
XCTAssertNoThrow(try deleteKeychainItem(forPersistentRef: persistentRef), | ||
"Failed to delete the test token from the keychain. This may cause future test runs to fail.") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo Violation: TODOs should be resolved (Restore deserialization error ...). (todo)