Skip to content

Commit a1bdada

Browse files
authored
Merge pull request #181 from mattrubin/develop
Release OneTimePassword 3.1.3
2 parents 2c091c8 + e1d7d17 commit a1bdada

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

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

5+
## [3.1.3][] (2018-04-29)
6+
- Ignore un-deserializable tokens in `allPersistentTokens()`. ([#179](https://github.com/mattrubin/OneTimePassword/pull/179))
7+
8+
59
## [3.1.2][] (2018-04-23)
610
- Synthesize Equatable conformance when compiling with Swift 4.1. ([#173](https://github.com/mattrubin/OneTimePassword/pull/173))
711
- 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))
@@ -155,8 +159,9 @@ Changes between prerelease versions of OneTimePassword version 2 can be found be
155159

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

158-
[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.1.2...develop
162+
[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.1.3...develop
159163

164+
[3.1.3]: https://github.com/mattrubin/OneTimePassword/compare/3.1.2...3.1.3
160165
[3.1.2]: https://github.com/mattrubin/OneTimePassword/compare/3.1.1...3.1.2
161166
[3.1.1]: https://github.com/mattrubin/OneTimePassword/compare/3.1...3.1.1
162167
[3.1]: https://github.com/mattrubin/OneTimePassword/compare/3.0.1...3.1

OneTimePassword.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "OneTimePassword"
3-
s.version = "3.1.2"
3+
s.version = "3.1.3"
44
s.summary = "A small library for generating TOTP and HOTP one-time passwords."
55
s.homepage = "https://github.com/mattrubin/OneTimePassword"
66
s.license = "MIT"

Sources/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>3.1.2</string>
18+
<string>3.1.3</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>3.1.2</string>
22+
<string>3.1.3</string>
2323
<key>NSPrincipalClass</key>
2424
<string></string>
2525
</dict>

Sources/Keychain.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ public final class Keychain {
4747
///
4848
/// - throws: A `Keychain.Error` if an error occurred.
4949
public func allPersistentTokens() throws -> Set<PersistentToken> {
50-
return Set(try allKeychainItems().map(PersistentToken.init(keychainDictionary:)))
50+
let allItems = try allKeychainItems()
51+
// This code intentionally ignores items which fail deserialization, instead opting to return as many readable
52+
// tokens as possible.
53+
// TODO: Restore deserialization error handling, in a way that provides info on the failure reason and allows
54+
// the caller to choose whether to fail completely or recover some data.
55+
return Set(allItems.flatMap({ try? PersistentToken.init(keychainDictionary:$0) }))
5156
}
5257

5358
// MARK: Write

Tests/KeychainTests.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ class KeychainTests: XCTestCase {
231231
let persistentRef = try addKeychainItem(withAttributes: keychainAttributes)
232232

233233
XCTAssertThrowsError(try keychain.persistentToken(withIdentifier: persistentRef))
234-
XCTAssertThrowsError(try keychain.allPersistentTokens())
234+
// TODO: Restore deserialization error handling in allPersistentTokens()
235+
// XCTAssertThrowsError(try keychain.allPersistentTokens())
235236

236237
XCTAssertNoThrow(try deleteKeychainItem(forPersistentRef: persistentRef),
237238
"Failed to delete the test token from the keychain. This may cause future test runs to fail.")
@@ -247,7 +248,8 @@ class KeychainTests: XCTestCase {
247248
let persistentRef = try addKeychainItem(withAttributes: keychainAttributes)
248249

249250
XCTAssertThrowsError(try keychain.persistentToken(withIdentifier: persistentRef))
250-
XCTAssertThrowsError(try keychain.allPersistentTokens())
251+
// TODO: Restore deserialization error handling in allPersistentTokens()
252+
// XCTAssertThrowsError(try keychain.allPersistentTokens())
251253

252254
XCTAssertNoThrow(try deleteKeychainItem(forPersistentRef: persistentRef),
253255
"Failed to delete the test token from the keychain. This may cause future test runs to fail.")
@@ -264,7 +266,8 @@ class KeychainTests: XCTestCase {
264266
let persistentRef = try addKeychainItem(withAttributes: keychainAttributes)
265267

266268
XCTAssertThrowsError(try keychain.persistentToken(withIdentifier: persistentRef))
267-
XCTAssertThrowsError(try keychain.allPersistentTokens())
269+
// TODO: Restore deserialization error handling in allPersistentTokens()
270+
// XCTAssertThrowsError(try keychain.allPersistentTokens())
268271

269272
XCTAssertNoThrow(try deleteKeychainItem(forPersistentRef: persistentRef),
270273
"Failed to delete the test token from the keychain. This may cause future test runs to fail.")
@@ -281,7 +284,8 @@ class KeychainTests: XCTestCase {
281284
let persistentRef = try addKeychainItem(withAttributes: keychainAttributes)
282285

283286
XCTAssertThrowsError(try keychain.persistentToken(withIdentifier: persistentRef))
284-
XCTAssertThrowsError(try keychain.allPersistentTokens())
287+
// TODO: Restore deserialization error handling in allPersistentTokens()
288+
// XCTAssertThrowsError(try keychain.allPersistentTokens())
285289

286290
XCTAssertNoThrow(try deleteKeychainItem(forPersistentRef: persistentRef),
287291
"Failed to delete the test token from the keychain. This may cause future test runs to fail.")

0 commit comments

Comments
 (0)