Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitespace #79

Merged
merged 2 commits into from
Jul 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Sources/Generator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import Foundation

/// A `Generator` contains all of the parameters needed to generate a one-time password.
public struct Generator: Equatable {

/// The moving factor, either timer- or counter-based.
public let factor: Factor

Expand Down
2 changes: 1 addition & 1 deletion Sources/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private extension Token {
private extension PersistentToken {
private init?(keychainDictionary: NSDictionary) {
guard let urlData = keychainDictionary[kSecAttrGeneric as String] as? NSData,
let string = NSString(data: urlData, encoding:NSUTF8StringEncoding),
let string = NSString(data: urlData, encoding: NSUTF8StringEncoding),
let secret = keychainDictionary[kSecValueData as String] as? NSData,
let keychainItemRef = keychainDictionary[kSecValuePersistentRef as String] as? NSData,
let url = NSURL(string: string as String),
Expand Down
10 changes: 5 additions & 5 deletions Sources/Token+URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ private func urlForToken(name name: String, issuer: String, factor: Generator.Fa
urlComponents.path = "/" + name

var queryItems = [
NSURLQueryItem(name:kQueryAlgorithmKey, value:stringForAlgorithm(algorithm)),
NSURLQueryItem(name:kQueryDigitsKey, value:String(digits)),
NSURLQueryItem(name:kQueryIssuerKey, value:issuer)
NSURLQueryItem(name: kQueryAlgorithmKey, value: stringForAlgorithm(algorithm)),
NSURLQueryItem(name: kQueryDigitsKey, value: String(digits)),
NSURLQueryItem(name: kQueryIssuerKey, value: issuer)
]

switch factor {
case .Timer(let period):
urlComponents.host = kFactorTimerKey
queryItems.append(NSURLQueryItem(name:kQueryPeriodKey, value:String(Int(period))))
queryItems.append(NSURLQueryItem(name: kQueryPeriodKey, value: String(Int(period))))
case .Counter(let counter):
urlComponents.host = kFactorCounterKey
queryItems.append(NSURLQueryItem(name:kQueryCounterKey, value:String(counter)))
queryItems.append(NSURLQueryItem(name: kQueryCounterKey, value: String(counter)))
}

urlComponents.queryItems = queryItems
Expand Down
1 change: 0 additions & 1 deletion Sources/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import Foundation

/// A `Token` contains a password generator and information identifying the corresponding account.
public struct Token: Equatable {

/// A string indicating the account represented by the token.
/// This is often an email address or username.
public let name: String
Expand Down
2 changes: 1 addition & 1 deletion Tests/TokenSerializationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class TokenSerializationTests: XCTestCase {
// Test name
XCTAssertEqual(url.path!.substringFromIndex(url.path!.startIndex.successor()), name, "The url path should be \"\(name)\"")

let urlComponents = NSURLComponents(URL:url, resolvingAgainstBaseURL:false)
let urlComponents = NSURLComponents(URL: url, resolvingAgainstBaseURL: false)
let items = urlComponents?.queryItems
let expectedItemCount = 4
XCTAssertEqual(items?.count, expectedItemCount, "There shouldn't be any unexpected query arguments: \(url)")
Expand Down