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

Commit

Permalink
Merge pull request #1 from mastahyeti/security-fixes
Browse files Browse the repository at this point in the history
[WIP] Security fixes
  • Loading branch information
mastahyeti authored Jul 5, 2017
2 parents e526fb6 + e48dbe7 commit 573e475
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
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

0 comments on commit 573e475

Please sign in to comment.