Skip to content
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

Merged
merged 6 commits into from
Apr 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<!--## [In development][develop]-->

## [3.1.3][] (2018-04-29)
- Ignore un-deserializable tokens in `allPersistentTokens()`. ([#179](https://github.com/mattrubin/OneTimePassword/pull/179))


## [3.1.2][] (2018-04-23)
- Synthesize Equatable conformance when compiling with Swift 4.1. ([#173](https://github.com/mattrubin/OneTimePassword/pull/173))
- Fix a warning about deprecation of cross-module struct initializers by simplifying test cases for impossible-to-create invalid Generators. ([#174](https://github.com/mattrubin/OneTimePassword/pull/174))
Expand Down Expand Up @@ -155,8 +159,9 @@ Changes between prerelease versions of OneTimePassword version 2 can be found be

## [1.0.0][] (2014-07-17)

[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.1.2...develop
[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.1.3...develop

[3.1.3]: https://github.com/mattrubin/OneTimePassword/compare/3.1.2...3.1.3
[3.1.2]: https://github.com/mattrubin/OneTimePassword/compare/3.1.1...3.1.2
[3.1.1]: https://github.com/mattrubin/OneTimePassword/compare/3.1...3.1.1
[3.1]: https://github.com/mattrubin/OneTimePassword/compare/3.0.1...3.1
Expand Down
2 changes: 1 addition & 1 deletion OneTimePassword.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OneTimePassword"
s.version = "3.1.2"
s.version = "3.1.3"
s.summary = "A small library for generating TOTP and HOTP one-time passwords."
s.homepage = "https://github.com/mattrubin/OneTimePassword"
s.license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions Sources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.1.2</string>
<string>3.1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.1.2</string>
<string>3.1.3</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
7 changes: 6 additions & 1 deletion Sources/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

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)

// the caller to choose whether to fail completely or recover some data.
return Set(allItems.flatMap({ try? PersistentToken.init(keychainDictionary:$0) }))

Choose a reason for hiding this comment

The 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
Expand Down
12 changes: 8 additions & 4 deletions Tests/KeychainTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()

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)

// 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.")
Expand All @@ -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()

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)

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)

// 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.")
Expand All @@ -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()

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)

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)

// 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.")
Expand All @@ -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()

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)

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)

// 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.")
Expand Down