Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

[WIP] Security fixes #1

Merged
merged 2 commits into from
Jul 5, 2017
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
2 changes: 1 addition & 1 deletion SoftU2F
18 changes: 17 additions & 1 deletion SoftU2FTool/UserPresence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,25 @@ class UserPresence: NSObject {

typealias Callback = (_ success: Bool) -> Void

static var current: UserPresence?
static var skip = false

// Hacks to avoid a race between reads/writes to current.
static let currentAccessQueue = DispatchQueue(label: "currentAccessQueue")
static var _current: UserPresence?
static var current: UserPresence? {
get {
return currentAccessQueue.sync {
return _current
}
}

set(newValue) {
currentAccessQueue.sync {
_current = newValue
}
}
}

// Display a notification, wait for the user to click it, and call the callback with `true`.
// Calls callback with `false` if another test is done while we're waiting for this one.
static func test(_ type: Notification, with callback: @escaping Callback) {
Expand Down