Skip to content

Commit 05942de

Browse files
authored
Merge pull request #158 from mattrubin/hotfix
Release OneTimePassword 3.0.1
2 parents 432f496 + 72a4c28 commit 05942de

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0
1+
3.2

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ before_script:
3636
- RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.$(echo $RUNTIME | sed -E -e "s/[ \-]+/ /g" -e "s/[^[:alnum:]]/-/g")
3737
- DESTINATION_ID=$(xcrun simctl create Travis $DEVICE_ID $RUNTIME_ID)
3838
- xcrun simctl boot $DESTINATION_ID
39-
- if [[ $BUILD_ONLY == YES ]]; then ACTIONS="build"; else ACTIONS="build test"; fi
39+
- if [[ $BUILD_ONLY == YES ]]; then ACTIONS="build"; else ACTIONS="build-for-testing test-without-building"; fi
4040
- echo "xcodebuild -workspace \"$TRAVIS_XCODE_WORKSPACE\" -scheme \"$TRAVIS_XCODE_SCHEME\" -destination \"id=$DESTINATION_ID\" $ACTIONS"
4141

4242
script: set -o pipefail && xcodebuild -workspace "$TRAVIS_XCODE_WORKSPACE" -scheme "$TRAVIS_XCODE_SCHEME" -destination "id=$DESTINATION_ID" $ACTIONS | xcpretty -c

CHANGELOG.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

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

5+
## [3.0.1][] (2018-03-08)
6+
- Fix an issue where CocoaPods was trying to build OneTimePassword with Swift 4. ([#157](https://github.com/mattrubin/OneTimePassword/pull/157))
7+
- Fix the Base32-decoding function in the token creation example code. ([#134](https://github.com/mattrubin/OneTimePassword/pull/134))
8+
- Tweak the Travis CI configuration to work around test timeout flakiness. ([#131](https://github.com/mattrubin/OneTimePassword/pull/131))
9+
- Clean up some old Keychain code which was used to provide Xcode 7 backwards compatibility. ([#133](https://github.com/mattrubin/OneTimePassword/pull/133))
10+
511
## [3.0][] (2017-02-07)
6-
- Convert to Swift 3 and update the library API to follow the Swift [API Design Guidelines](https://swift.org/documentation/api-design-guidelines/)
12+
- Convert to Swift 3 and update the library API to follow the Swift [API Design Guidelines](https://swift.org/documentation/api-design-guidelines/).
713
([#74](https://github.com/mattrubin/OneTimePassword/pull/74),
814
[#78](https://github.com/mattrubin/OneTimePassword/pull/78),
915
[#80](https://github.com/mattrubin/OneTimePassword/pull/80),
@@ -14,8 +20,8 @@
1420
[#122](https://github.com/mattrubin/OneTimePassword/pull/122),
1521
[#123](https://github.com/mattrubin/OneTimePassword/pull/123),
1622
[#125](https://github.com/mattrubin/OneTimePassword/pull/125))
17-
- Convert `password(at:)` to take a `Date` instead of a `TimeInterval` ([#124](https://github.com/mattrubin/OneTimePassword/pull/124))
18-
- Update the SwiftLint configuration ([#120](https://github.com/mattrubin/OneTimePassword/pull/120))
23+
- Convert `password(at:)` to take a `Date` instead of a `TimeInterval`. ([#124](https://github.com/mattrubin/OneTimePassword/pull/124))
24+
- Update the SwiftLint configuration. ([#120](https://github.com/mattrubin/OneTimePassword/pull/120))
1925

2026

2127
## [2.1.1][] (2016-12-28)
@@ -115,8 +121,9 @@ Changes between prerelease versions of OneTimePassword version 2 can be found be
115121

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

118-
[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.0...develop
124+
[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.0.1...develop
119125

126+
[3.0.1]: https://github.com/mattrubin/OneTimePassword/compare/3.0...3.0.1
120127
[3.0]: https://github.com/mattrubin/OneTimePassword/compare/2.1.1...3.0
121128
[2.1.1]: https://github.com/mattrubin/OneTimePassword/compare/2.1...2.1.1
122129
[2.1]: https://github.com/mattrubin/OneTimePassword/compare/2.0.1...2.1

OneTimePassword.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
Pod::Spec.new do |s|
22
s.name = "OneTimePassword"
3-
s.version = "3.0"
3+
s.version = "3.0.1"
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"
77
s.author = "Matt Rubin"
8+
s.swift_version = "3.2"
89
s.ios.deployment_target = "8.0"
910
s.watchos.deployment_target = "2.0"
1011
s.source = { :git => "https://github.com/mattrubin/OneTimePassword.git", :tag => s.version }

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ if let token = Token(url: url) {
7878

7979
To create a generator and a token from user input:
8080

81+
> This example assumes the user provides the secret as a Base32-encoded string. To use the decoding function seen below, add `import Base32` to the top of your Swift file.
82+
8183
````swift
8284
let name = "..."
8385
let issuer = "..."
8486
let secretString = "..."
8587

86-
guard let secretData = Data(base32String: secretString),
88+
guard let secretData = MF_Base32Codec.data(fromBase32String: secretString),
8789
!secretData.isEmpty else {
8890
print("Invalid secret")
8991
return nil

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.0</string>
18+
<string>3.0.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>3.0</string>
22+
<string>3.0.1</string>
2323
<key>NSPrincipalClass</key>
2424
<string></string>
2525
</dict>

Sources/Keychain.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ public final class Keychain {
4040
/// - throws: A `Keychain.Error` if an error occurred.
4141
/// - returns: The persistent token, or `nil` if no token matched the given identifier.
4242
public func persistentToken(withIdentifier identifier: Data) throws -> PersistentToken? {
43-
return try keychainItem(forPersistentRef: identifier).flatMap(PersistentToken.init)
43+
return try keychainItem(forPersistentRef: identifier).flatMap(PersistentToken.init(keychainDictionary:))
4444
}
4545

4646
/// Returns the set of all persistent tokens found in the keychain.
4747
///
4848
/// - throws: A `Keychain.Error` if an error occurred.
4949
public func allPersistentTokens() throws -> Set<PersistentToken> {
50-
return Set(try allKeychainItems().flatMap(PersistentToken.init))
50+
return Set(try allKeychainItems().flatMap(PersistentToken.init(keychainDictionary:)))
5151
}
5252

5353
// MARK: Write
@@ -111,9 +111,7 @@ private let urlStringEncoding = String.Encoding.utf8
111111
private extension Token {
112112
func keychainAttributes() throws -> [String: AnyObject] {
113113
let url = try self.toURL()
114-
// This line supports the different optionality of `absoluteString` between Xcode 7 and 8
115-
let urlString: String? = url.absoluteString
116-
guard let data = urlString?.data(using: urlStringEncoding) else {
114+
guard let data = url.absoluteString.data(using: urlStringEncoding) else {
117115
throw Keychain.Error.tokenSerializationFailure
118116
}
119117
return [

Sources/Token+URL.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@ private func token(from url: URL, secret externalSecret: Data? = nil) -> Token?
174174
return nil
175175
}
176176

177-
var name = Token.defaultName
177+
var name = ""
178178
let path = url.path
179179
if path.characters.count > 1 {
180180
// Skip the leading "/"
181181
name = path.substring(from: path.characters.index(after: path.startIndex))
182182
}
183183

184-
var issuer = Token.defaultIssuer
184+
var issuer = ""
185185
if let issuerString = queryDictionary[kQueryIssuerKey] {
186186
issuer = issuerString
187187
} else {

Sources/Token.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,12 @@ public struct Token: Equatable {
4444
/// - parameter generator: The password generator.
4545
///
4646
/// - returns: A new token with the given parameters.
47-
public init(name: String = defaultName, issuer: String = defaultIssuer, generator: Generator) {
47+
public init(name: String = "", issuer: String = "", generator: Generator) {
4848
self.name = name
4949
self.issuer = issuer
5050
self.generator = generator
5151
}
5252

53-
// MARK: Defaults
54-
55-
/// The default token name, an empty string.
56-
internal static let defaultName: String = ""
57-
58-
/// The default token issuer, an empty string.
59-
internal static let defaultIssuer: String = ""
60-
6153
// MARK: Password Generation
6254

6355
/// Calculates the current password based on the token's generator. The password generated will

0 commit comments

Comments
 (0)