Skip to content

Commit

Permalink
Release OneTimePassword 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrubin committed Mar 27, 2018
2 parents 05942de + 62949b1 commit dc3de62
Show file tree
Hide file tree
Showing 26 changed files with 417 additions and 194 deletions.
16 changes: 13 additions & 3 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Configuration for Codecov (https://codecov.io)

codecov:
# Use `develop` as the default branch
branch: develop

ignore:
- Tests
- OneTimePasswordLegacyTests

coverage:
ignore:
- "Tests"
- "OneTimePasswordLegacyTests"
status:
patch:
default:
# Allow patch to be 0% covered without marking a PR with a failing status.
target: 0
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2
4.0
27 changes: 21 additions & 6 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,51 @@
excluded:
- Carthage
opt_in_rules:
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- conditional_returns_on_newline
- contains_over_first_not_nil
- discouraged_object_literal
- discouraged_optional_boolean
- empty_count
- explicit_enum_raw_value
- explicit_init
- extension_access_modifier
- fatal_error_message
- file_header
- first_where
# - missing_docs
- implicit_return
- implicitly_unwrapped_optional
- joined_default_parameter
- let_var_whitespace
- literal_expression_end_indentation
- multiline_parameters
- nimble_operator
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- private_outlet
- prohibited_super_call
- redundant_nil_coalescing
- single_test_class
- sorted_first_last
- switch_case_on_newline
- vertical_whitespace
- unneeded_parentheses_in_closure_argument
- vertical_parameter_alignment_on_call
- yoda_condition
disabled_rules:
- colon
- comma
- cyclomatic_complexity
- function_body_length
- syntactic_sugar
- valid_docs

trailing_comma:
mandatory_comma: true

line_length:
warning: 120
ignores_function_declarations: true

file_header:
required_pattern: |
Expand Down
22 changes: 10 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,26 @@ language: objective-c
xcode_workspace: OneTimePassword.xcworkspace
xcode_scheme: OneTimePassword (iOS)

osx_image: xcode8.2
osx_image: xcode9

env:
- RUNTIME="iOS 8.1" DEVICE="iPad 2"
- RUNTIME="iOS 8.2" DEVICE="iPhone 4s"
- RUNTIME="iOS 8.3" DEVICE="iPhone 5"
- RUNTIME="iOS 8.4" DEVICE="iPhone 5s"
- RUNTIME="iOS 9.0" DEVICE="iPhone 6"
- RUNTIME="iOS 9.1" DEVICE="iPhone 6 Plus"
- RUNTIME="iOS 9.2" DEVICE="iPhone 6s"
- RUNTIME="iOS 9.3" DEVICE="iPhone 6s Plus"
- RUNTIME="iOS 8.4" DEVICE="iPhone 4s"
- RUNTIME="iOS 9.0" DEVICE="iPhone 5s"
- RUNTIME="iOS 9.3" DEVICE="iPhone 6s"
- RUNTIME="iOS 10.0" DEVICE="iPhone SE"
- RUNTIME="iOS 10.1" DEVICE="iPhone 7"
- RUNTIME="iOS 10.2" DEVICE="iPhone 7 Plus"
- RUNTIME="iOS 10.3" DEVICE="iPhone 7 Plus"
- RUNTIME="iOS 11.0" DEVICE="iPhone X"

# Include builds for watchOS
matrix:
include:
- xcode_scheme: OneTimePassword (watchOS)
env: BUILD_ONLY="YES" RUNTIME="watchOS 3.1" DEVICE="Apple Watch Series 2 - 42mm"
env: BUILD_ONLY="YES" RUNTIME="watchOS 4.0" DEVICE="Apple Watch Series 3 - 38mm"
- xcode_scheme: OneTimePassword (watchOS)
env: BUILD_ONLY="YES" RUNTIME="watchOS 2.0" DEVICE="Apple Watch - 38mm"
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"

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

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

## [3.1][] (2018-03-27)
- Upgrade to Swift 4 and Xcode 9.
([#147](https://github.com/mattrubin/OneTimePassword/pull/147),
[#149](https://github.com/mattrubin/OneTimePassword/pull/149),
[#151](https://github.com/mattrubin/OneTimePassword/pull/151),
[#153](https://github.com/mattrubin/OneTimePassword/pull/153),
[#160](https://github.com/mattrubin/OneTimePassword/pull/160))
- Handle keychain deserialization errors.
([#161](https://github.com/mattrubin/OneTimePassword/pull/161))
- Refactor token URL parsing.
([#150](https://github.com/mattrubin/OneTimePassword/pull/150))
- Refactor Generator validation.
([#155](https://github.com/mattrubin/OneTimePassword/pull/155))
- Update SwiftLint configuration and improve code formatting.
([#148](https://github.com/mattrubin/OneTimePassword/pull/148),
[#154](https://github.com/mattrubin/OneTimePassword/pull/154),
[#159](https://github.com/mattrubin/OneTimePassword/pull/159))
- Update CodeCov configuration.
([#162](https://github.com/mattrubin/OneTimePassword/pull/162))


## [3.0.1][] (2018-03-08)
- Fix an issue where CocoaPods was trying to build OneTimePassword with Swift 4. ([#157](https://github.com/mattrubin/OneTimePassword/pull/157))
- Fix the Base32-decoding function in the token creation example code. ([#134](https://github.com/mattrubin/OneTimePassword/pull/134))
- Tweak the Travis CI configuration to work around test timeout flakiness. ([#131](https://github.com/mattrubin/OneTimePassword/pull/131))
- Clean up some old Keychain code which was used to provide Xcode 7 backwards compatibility. ([#133](https://github.com/mattrubin/OneTimePassword/pull/133))


## [3.0][] (2017-02-07)
- Convert to Swift 3 and update the library API to follow the Swift [API Design Guidelines](https://swift.org/documentation/api-design-guidelines/).
([#74](https://github.com/mattrubin/OneTimePassword/pull/74),
Expand Down Expand Up @@ -121,8 +143,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.0.1...develop
[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.1...develop

[3.1]: https://github.com/mattrubin/OneTimePassword/compare/3.0.1...3.1
[3.0.1]: https://github.com/mattrubin/OneTimePassword/compare/3.0...3.0.1
[3.0]: https://github.com/mattrubin/OneTimePassword/compare/2.1.1...3.0
[2.1.1]: https://github.com/mattrubin/OneTimePassword/compare/2.1...2.1.1
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Configuration for Carthage (https://github.com/Carthage/Carthage)

github "mattrubin/Base32" "1.1.2+carthage"
github "mattrubin/Base32" "xcode9"
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Configuration for Carthage (https://github.com/Carthage/Carthage)

github "jspahrsummers/xcconfigs" ~> 0.10
github "jspahrsummers/xcconfigs" ~> 0.11
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "mattrubin/Base32" "1.1.2+carthage"
github "jspahrsummers/xcconfigs" "0.10"
github "jspahrsummers/xcconfigs" "0.11"
github "mattrubin/Base32" "xcode9"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/xcconfigs
4 changes: 2 additions & 2 deletions OneTimePassword.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "OneTimePassword"
s.version = "3.0.1"
s.version = "3.1"
s.summary = "A small library for generating TOTP and HOTP one-time passwords."
s.homepage = "https://github.com/mattrubin/OneTimePassword"
s.license = "MIT"
s.author = "Matt Rubin"
s.swift_version = "3.2"
s.swift_version = "4.0"
s.ios.deployment_target = "8.0"
s.watchos.deployment_target = "2.0"
s.source = { :git => "https://github.com/mattrubin/OneTimePassword.git", :tag => s.version }
Expand Down
15 changes: 8 additions & 7 deletions OneTimePassword.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
C97142361C1155FC0063B37E /* OTPToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC7ECC196C4D3D00B50C82 /* OTPToken.swift */; };
C97142371C1156DB0063B37E /* OneTimePassword.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C97C82381946E51D00FD9F4C /* OneTimePassword.framework */; };
C97C82441946E51D00FD9F4C /* OneTimePassword.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C97C82381946E51D00FD9F4C /* OneTimePassword.framework */; };
C9A486C8196F38C800524F51 /* OTPTokenSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C93A2515196AFE1100F86892 /* OTPTokenSerializationTests.m */; };
C9A486C8196F38C800524F51 /* OTPTokenSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C93A2515196AFE1100F86892 /* OTPTokenSerializationTests.m */; settings = {COMPILER_FLAGS = "-Wno-nullable-to-nonnull-conversion"; }; };
C9A486C9196F38CD00524F51 /* OTPTypeStrings.m in Sources */ = {isa = PBXBuildFile; fileRef = C9C9FE25196D181800C7ACEE /* OTPTypeStrings.m */; };
C9B2A19C199A7F1B00BC4A8A /* EquatableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B2A19B199A7F1B00BC4A8A /* EquatableTests.swift */; };
C9B77D771C03078B00BAF6BF /* KeychainTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C93A2514196AFE1100F86892 /* KeychainTests.swift */; };
Expand Down Expand Up @@ -521,7 +521,7 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Matt Rubin";
TargetAttributes = {
5B39F4931DBD06BA00CD2DAB = {
Expand All @@ -530,22 +530,23 @@
};
C97C82371946E51D00FD9F4C = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
C97C82421946E51D00FD9F4C = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
TestTargetID = FD6C3C0B1E0200F800EC4528;
};
C9A486B2196F352E00524F51 = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
FD6C3C0B1E0200F800EC4528 = {
CreatedOnToolsVersion = 8.2;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
FDD3B8661DD6E59E00F87980 = {
Expand Down Expand Up @@ -731,7 +732,7 @@
baseConfigurationReference = C996EC2C1A74D5830076B105 /* Debug.xcconfig */;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
name = Debug;
Expand All @@ -741,7 +742,7 @@
baseConfigurationReference = C996EC2E1A74D5830076B105 /* Release.xcconfig */;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0810"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -66,6 +67,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0810"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand All @@ -46,6 +47,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
22 changes: 13 additions & 9 deletions OneTimePasswordLegacyTests/OTPToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ import OneTimePassword
public final class OTPToken: NSObject {
required public override init() {}

public var name: String = OTPToken.defaultName
public var issuer: String = OTPToken.defaultIssuer
public var type: OTPTokenType = .timer
public var secret: Data = Data()
public var algorithm: OTPAlgorithm = OTPToken.defaultAlgorithm
public var digits: UInt = OTPToken.defaultDigits
public var period: TimeInterval = OTPToken.defaultPeriod
public var counter: UInt64 = OTPToken.defaultInitialCounter
@objc public var name: String = OTPToken.defaultName
@objc public var issuer: String = OTPToken.defaultIssuer
@objc public var type: OTPTokenType = .timer
@objc public var secret: Data = Data()
@objc public var algorithm: OTPAlgorithm = OTPToken.defaultAlgorithm
@objc public var digits: UInt = OTPToken.defaultDigits
@objc public var period: TimeInterval = OTPToken.defaultPeriod
@objc public var counter: UInt64 = OTPToken.defaultInitialCounter

private static let defaultName: String = ""
private static let defaultIssuer: String = ""
Expand All @@ -66,11 +66,12 @@ public final class OTPToken: NSObject {
}
}

fileprivate convenience init(token: Token) {
private convenience init(token: Token) {
self.init()
update(with: token)
}

@objc
public func validate() -> Bool {
return (tokenForOTPToken(self) != nil)
}
Expand All @@ -90,6 +91,7 @@ public extension OTPToken {
return self.init(token: token)
}

@objc
func url() -> URL? {
guard let token = tokenForOTPToken(self) else {
return nil
Expand All @@ -100,6 +102,7 @@ public extension OTPToken {

// MARK: Enums

// swiftlint:disable explicit_enum_raw_value
@objc
public enum OTPTokenType: UInt8 {
case counter
Expand All @@ -112,6 +115,7 @@ public enum OTPAlgorithm: UInt32 {
@objc(OTPAlgorithmSHA256) case sha256
@objc(OTPAlgorithmSHA512) case sha512
}
// swiftlint:enable explicit_enum_raw_value

// MARK: Conversion

Expand Down
2 changes: 2 additions & 0 deletions OneTimePasswordLegacyTests/OTPTokenSerializationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,11 @@ - (void)testTokenWithInvalidURLs
{
NSArray *badURLs = @[@"http://foo", // invalid scheme
@"otpauth://foo", // invalid type
@"otpauth:///bar?secret=AAAQEAYEAUDAOCAJBIFQYDIOB4", // missing type
@"otpauth://totp/bar", // missing secret
@"otpauth://totp/bar?secret=AAAQEAYEAUDAOCAJBIFQYDIOB4&period=0", // invalid period
@"otpauth://totp/bar?secret=AAAQEAYEAUDAOCAJBIFQYDIOB4&period=x", // non-numeric period
@"otpauth://totp/bar?secret=AAAQEAYEAUDAOCAJBIFQYDIOB4&period=30&period=60", // multiple period
@"otpauth://totp/bar?secret=AAAQEAYEAUDAOCAJBIFQYDIOB4&algorithm=MD5", // invalid algorithm
@"otpauth://totp/bar?secret=AAAQEAYEAUDAOCAJBIFQYDIOB4&digits=2", // invalid digits
@"otpauth://totp/bar?secret=AAAQEAYEAUDAOCAJBIFQYDIOB4&digits=x", // non-numeric digits
Expand Down
Loading

0 comments on commit dc3de62

Please sign in to comment.