Enabling Privakey

After setting up and configuring the library, you can start implementing enabling Privakey.

First the user must bind their device and local account identity to a Privakey account. This is accomplished by having your configured request origin implement a "Bind" endpoint that calls to the PrivakeyCX Auth Server API "Bind" endpoint. This will return a session token and Privakey ID that should also be returned to your app instance on the user's device. You can then use this information to enable Privakey on the device. More info on implementing this endpoint on your request origin app server can be found here.

let pin = "a user selected PIN used to grant authorization"
let notificationId = "this device's notification ID as a base64 encoded string"
let notificationFramework = "your notification framework. eg firebase, apns"
let deviceName = "a device nickname"
let appSpaceGuid = "your app space GUID"
let sessionToken = "your session token"

self.privakeyCX.enablePrivakey(password: pin, notificationId: notificationId, notificationFramework: notificationFramework, name: deviceName, appSpaceGuid: appSpaceGuid, sessionToken: sessionToken) { success, error in
    if error == nil {
        // success! store any needed info

If Face ID/Touch ID is to be used then after enabling Privakey, make a call to enable biometrics. Biometrics will be the prefered way to authorize but the Pin will still be usable as a fallback.

self.privakeyCX.enableBiometrics(password: pin) { success, error in
    if error == nil {
        // success
    } else {
        // failure