Skip to content

Commit

Permalink
Merge pull request #158 from mattrubin/hotfix
Browse files Browse the repository at this point in the history
Release OneTimePassword 3.0.1
  • Loading branch information
mattrubin authored Mar 8, 2018
2 parents 432f496 + 72a4c28 commit 05942de
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
3.2
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ before_script:
- RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.$(echo $RUNTIME | sed -E -e "s/[ \-]+/ /g" -e "s/[^[:alnum:]]/-/g")
- DESTINATION_ID=$(xcrun simctl create Travis $DEVICE_ID $RUNTIME_ID)
- xcrun simctl boot $DESTINATION_ID
- if [[ $BUILD_ONLY == YES ]]; then ACTIONS="build"; else ACTIONS="build test"; fi
- if [[ $BUILD_ONLY == YES ]]; then ACTIONS="build"; else ACTIONS="build-for-testing test-without-building"; fi
- echo "xcodebuild -workspace \"$TRAVIS_XCODE_WORKSPACE\" -scheme \"$TRAVIS_XCODE_SCHEME\" -destination \"id=$DESTINATION_ID\" $ACTIONS"

script: set -o pipefail && xcodebuild -workspace "$TRAVIS_XCODE_WORKSPACE" -scheme "$TRAVIS_XCODE_SCHEME" -destination "id=$DESTINATION_ID" $ACTIONS | xcpretty -c
Expand Down
15 changes: 11 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

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

## [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/)
- 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),
[#78](https://github.com/mattrubin/OneTimePassword/pull/78),
[#80](https://github.com/mattrubin/OneTimePassword/pull/80),
Expand All @@ -14,8 +20,8 @@
[#122](https://github.com/mattrubin/OneTimePassword/pull/122),
[#123](https://github.com/mattrubin/OneTimePassword/pull/123),
[#125](https://github.com/mattrubin/OneTimePassword/pull/125))
- Convert `password(at:)` to take a `Date` instead of a `TimeInterval` ([#124](https://github.com/mattrubin/OneTimePassword/pull/124))
- Update the SwiftLint configuration ([#120](https://github.com/mattrubin/OneTimePassword/pull/120))
- Convert `password(at:)` to take a `Date` instead of a `TimeInterval`. ([#124](https://github.com/mattrubin/OneTimePassword/pull/124))
- Update the SwiftLint configuration. ([#120](https://github.com/mattrubin/OneTimePassword/pull/120))


## [2.1.1][] (2016-12-28)
Expand Down Expand Up @@ -115,8 +121,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...develop
[develop]: https://github.com/mattrubin/OneTimePassword/compare/3.0.1...develop

[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
[2.1]: https://github.com/mattrubin/OneTimePassword/compare/2.0.1...2.1
Expand Down
3 changes: 2 additions & 1 deletion OneTimePassword.podspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Pod::Spec.new do |s|
s.name = "OneTimePassword"
s.version = "3.0"
s.version = "3.0.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.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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ if let token = Token(url: url) {

To create a generator and a token from user input:

> 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.
````swift
let name = "..."
let issuer = "..."
let secretString = "..."

guard let secretData = Data(base32String: secretString),
guard let secretData = MF_Base32Codec.data(fromBase32String: secretString),
!secretData.isEmpty else {
print("Invalid secret")
return nil
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.0</string>
<string>3.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.0</string>
<string>3.0.1</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
8 changes: 3 additions & 5 deletions Sources/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public final class Keychain {
/// - throws: A `Keychain.Error` if an error occurred.
/// - returns: The persistent token, or `nil` if no token matched the given identifier.
public func persistentToken(withIdentifier identifier: Data) throws -> PersistentToken? {
return try keychainItem(forPersistentRef: identifier).flatMap(PersistentToken.init)
return try keychainItem(forPersistentRef: identifier).flatMap(PersistentToken.init(keychainDictionary:))
}

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

// MARK: Write
Expand Down Expand Up @@ -111,9 +111,7 @@ private let urlStringEncoding = String.Encoding.utf8
private extension Token {
func keychainAttributes() throws -> [String: AnyObject] {
let url = try self.toURL()
// This line supports the different optionality of `absoluteString` between Xcode 7 and 8
let urlString: String? = url.absoluteString
guard let data = urlString?.data(using: urlStringEncoding) else {
guard let data = url.absoluteString.data(using: urlStringEncoding) else {
throw Keychain.Error.tokenSerializationFailure
}
return [
Expand Down
4 changes: 2 additions & 2 deletions Sources/Token+URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ private func token(from url: URL, secret externalSecret: Data? = nil) -> Token?
return nil
}

var name = Token.defaultName
var name = ""
let path = url.path
if path.characters.count > 1 {
// Skip the leading "/"
name = path.substring(from: path.characters.index(after: path.startIndex))
}

var issuer = Token.defaultIssuer
var issuer = ""
if let issuerString = queryDictionary[kQueryIssuerKey] {
issuer = issuerString
} else {
Expand Down
10 changes: 1 addition & 9 deletions Sources/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,12 @@ public struct Token: Equatable {
/// - parameter generator: The password generator.
///
/// - returns: A new token with the given parameters.
public init(name: String = defaultName, issuer: String = defaultIssuer, generator: Generator) {
public init(name: String = "", issuer: String = "", generator: Generator) {
self.name = name
self.issuer = issuer
self.generator = generator
}

// MARK: Defaults

/// The default token name, an empty string.
internal static let defaultName: String = ""

/// The default token issuer, an empty string.
internal static let defaultIssuer: String = ""

// MARK: Password Generation

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

0 comments on commit 05942de

Please sign in to comment.