CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.
TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | BSD |
ReleasedLast Release | Feb 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by James Barclay, Pepijn Bruienne, Mike Brown.
DuoAPISwift is an API client to call Duo API methods with Swift.
The Duo Auth API provides a low-level API for adding strong two-factor authentication to applications that cannot directly display rich web content.
import DuoAPISwift
let auth = Auth(
ikey: "<IKEY>",
skey: "<SKEY (Keep this secret!)>",
host: "api-xxxxxxxx.duosecurity.com")
auth.ping({response in
print(response)
})
auth.check({response in
print(response)
})
auth.logo({ response in
if let data = response as? NSData {
if let image = NSImage(data: data) {
self.logoImageView.image = image
}
}
})
auth.auth("push",
username: "<USERNAME>",
device: "auto",
completion: { response in
var allowed = false
if let r = response["response"],
result = r?["result"] as? String {
if result == "allow" {
allowed = true
}
}
if allowed {
print("Success. Logging you in...")
} else {
print("Access denied.")
}
})