Skip to content

Commit

Permalink
Merge pull request #189 from mattrubin/develop
Browse files Browse the repository at this point in the history
Release OneTimePassword 3.1.4
  • Loading branch information
mattrubin authored Sep 16, 2018
2 parents a1bdada + 22a1c42 commit 09b940e
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 24 deletions.
12 changes: 10 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ opt_in_rules:
- closure_spacing
- conditional_returns_on_newline
- contains_over_first_not_nil
- convenience_type
- discouraged_object_literal
- discouraged_optional_boolean
- discouraged_optional_collection
- empty_count
- empty_string
- empty_xctest_method
- explicit_enum_raw_value
- explicit_init
- extension_access_modifier
- fallthrough
- fatal_error_message
- file_header
- first_where
Expand All @@ -26,28 +29,33 @@ opt_in_rules:
- let_var_whitespace
- literal_expression_end_indentation
- lower_acl_than_parent
- modifier_order
- multiline_function_chains
- multiline_parameters
- nimble_operator
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- private_action
- private_outlet
- prohibited_super_call
- redundant_nil_coalescing
- single_test_class
- sorted_first_last
- switch_case_on_newline
- unavailable_function
- unneeded_parentheses_in_closure_argument
- untyped_error_in_catch
- vertical_parameter_alignment_on_call
- yoda_condition
disabled_rules:
- colon
- comma
- cyclomatic_complexity
- identifier_name

colon:
flexible_right_spacing: true

trailing_comma:
mandatory_comma: true

Expand Down
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ language: objective-c
xcode_workspace: OneTimePassword.xcworkspace
xcode_scheme: OneTimePassword (iOS)

osx_image: xcode9.3
osx_image: xcode10

env:
- RUNTIME="iOS 9.3" DEVICE="iPhone 6s"
- RUNTIME="iOS 10.3" DEVICE="iPhone 7 Plus"
- RUNTIME="iOS 11.3" DEVICE="iPhone X"
- RUNTIME="iOS 12.0" DEVICE="iPhone XS Max"

# Include builds for watchOS
matrix:
Expand All @@ -21,13 +21,19 @@ matrix:
# Include an Xcode 9.2 build to test on iOS 8.x, because Xcode 9.3's iOS 8 simulator fails to launch
- osx_image: xcode9.2
env: RUNTIME="iOS 8.4" DEVICE="iPhone 4s"
# Include an Xcode 9.4 build to ensure compatibility until Xcode 10 is in widespread use
- osx_image: xcode9.4
env: RUNTIME="iOS 9.3" DEVICE="iPhone 6s"
# Include several build-only jobs for watchOS
- xcode_scheme: OneTimePassword (watchOS)
env: BUILD_ONLY="YES" RUNTIME="watchOS 5.0" DEVICE="Apple Watch Series 4 - 44mm"
- xcode_scheme: OneTimePassword (watchOS)
osx_image: xcode9.4
env: BUILD_ONLY="YES" RUNTIME="watchOS 4.3" DEVICE="Apple Watch Series 3 - 38mm"
- xcode_scheme: OneTimePassword (watchOS)
env: BUILD_ONLY="YES" RUNTIME="watchOS 3.2" DEVICE="Apple Watch Series 2 - 42mm"
- xcode_scheme: OneTimePassword (watchOS)
env: BUILD_ONLY="YES" RUNTIME="watchOS 2.2" DEVICE="Apple Watch - 38mm"
env: BUILD_ONLY="YES" RUNTIME="watchOS 2.0" DEVICE="Apple Watch - 38mm"

# Check out nested dependencies
before_install: git submodule update --init --recursive
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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

## [3.1.4][] (2018-09-15)
- Fix compilation errors and add CI testing for Xcode 10.
([#182](https://github.com/mattrubin/OneTimePassword/pull/182),
[#186](https://github.com/mattrubin/OneTimePassword/pull/186))
- Enable several new SwiftLint opt-in rules. ([#187](https://github.com/mattrubin/OneTimePassword/pull/187))


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

Expand Down Expand Up @@ -159,8 +166,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.3...develop
[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.1.4...develop

[3.1.4]: https://github.com/mattrubin/OneTimePassword/compare/3.1.3...3.1.4
[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
Expand Down
2 changes: 1 addition & 1 deletion CommonCrypto/appletvos/module.modulemap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CommonCrypto [system] {
module CommonCryptoShim [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
2 changes: 1 addition & 1 deletion CommonCrypto/appletvsimulator/module.modulemap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CommonCrypto [system] {
module CommonCryptoShim [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
2 changes: 1 addition & 1 deletion CommonCrypto/iphoneos/module.modulemap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CommonCrypto [system] {
module CommonCryptoShim [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
2 changes: 1 addition & 1 deletion CommonCrypto/iphonesimulator/module.modulemap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CommonCrypto [system] {
module CommonCryptoShim [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
2 changes: 1 addition & 1 deletion CommonCrypto/macosx/module.modulemap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CommonCrypto [system] {
module CommonCryptoShim [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
2 changes: 1 addition & 1 deletion CommonCrypto/watchos/module.modulemap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CommonCrypto [system] {
module CommonCryptoShim [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
2 changes: 1 addition & 1 deletion CommonCrypto/watchsimulator/module.modulemap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module CommonCrypto [system] {
module CommonCryptoShim [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
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.3"
s.version = "3.1.4"
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
2 changes: 1 addition & 1 deletion OneTimePasswordLegacyTests/OTPToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import OneTimePassword
/// information about its properties and methods, consult the underlying `OneTimePassword`
/// documentation.
public final class OTPToken: NSObject {
required public override init() {}
override public required init() {}

@objc public var name: String = OTPToken.defaultName
@objc public var issuer: String = OTPToken.defaultIssuer
Expand Down
10 changes: 9 additions & 1 deletion Sources/Crypto.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@
//

import Foundation
import CommonCrypto
#if swift(>=4.1)
#if canImport(CommonCrypto)
import CommonCrypto
#else
import CommonCryptoShim
#endif
#else
import CommonCryptoShim
#endif

func HMAC(algorithm: Generator.Algorithm, key: Data, data: Data) -> Data {
let (hashFunction, hashLength) = algorithm.hashInfo
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.3</string>
<string>3.1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.1.3</string>
<string>3.1.4</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
10 changes: 5 additions & 5 deletions Sources/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public final class Keychain {
// 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) }))
return Set(allItems.flatMap({ try? PersistentToken(keychainDictionary: $0) }))
}

// MARK: Write
Expand Down Expand Up @@ -180,7 +180,7 @@ private func addKeychainItem(withAttributes attributes: [String: AnyObject]) thr

private func updateKeychainItem(forPersistentRef persistentRef: Data,
withAttributes attributesToUpdate: [String: AnyObject]) throws {
let queryDict: [String : AnyObject] = [
let queryDict: [String: AnyObject] = [
kSecClass as String: kSecClassGenericPassword,
kSecValuePersistentRef as String: persistentRef as NSData,
]
Expand All @@ -193,7 +193,7 @@ private func updateKeychainItem(forPersistentRef persistentRef: Data,
}

private func deleteKeychainItem(forPersistentRef persistentRef: Data) throws {
let queryDict: [String : AnyObject] = [
let queryDict: [String: AnyObject] = [
kSecClass as String: kSecClassGenericPassword,
kSecValuePersistentRef as String: persistentRef as NSData,
]
Expand All @@ -206,7 +206,7 @@ private func deleteKeychainItem(forPersistentRef persistentRef: Data) throws {
}

private func keychainItem(forPersistentRef persistentRef: Data) throws -> NSDictionary? {
let queryDict: [String : AnyObject] = [
let queryDict: [String: AnyObject] = [
kSecClass as String: kSecClassGenericPassword,
kSecValuePersistentRef as String: persistentRef as NSData,
kSecReturnPersistentRef as String: kCFBooleanTrue,
Expand All @@ -233,7 +233,7 @@ private func keychainItem(forPersistentRef persistentRef: Data) throws -> NSDict
}

private func allKeychainItems() throws -> [NSDictionary] {
let queryDict: [String : AnyObject] = [
let queryDict: [String: AnyObject] = [
kSecClass as String: kSecClassGenericPassword,
kSecMatchLimit as String: kSecMatchLimitAll,
kSecReturnPersistentRef as String: kCFBooleanTrue,
Expand Down
2 changes: 2 additions & 0 deletions Tests/GeneratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ class GeneratorTests: XCTestCase {

func testCounter() {
let factors: [(TimeInterval, TimeInterval, UInt64)] = [
// swiftlint:disable comma
(100, 30, 3),
(10000, 30, 333),
(1000000, 30, 33333),
(100000000, 60, 1666666),
(10000000000, 90, 111111111),
// swiftlint:enable comma
]

for (timeSinceEpoch, period, count) in factors {
Expand Down
2 changes: 1 addition & 1 deletion Tests/KeychainTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ private func addKeychainItem(withAttributes attributes: [String: AnyObject]) thr
}

public func deleteKeychainItem(forPersistentRef persistentRef: Data) throws {
let queryDict: [String : AnyObject] = [
let queryDict: [String: AnyObject] = [
kSecClass as String: kSecClassGenericPassword,
kSecValuePersistentRef as String: persistentRef as NSData,
]
Expand Down

0 comments on commit 09b940e

Please sign in to comment.