---
agentTools:
  projectIndex: https://docs.privakey.com/llms.txt
---

# Enabling Privakey

After [setting up and configuring the library](setup-and-configuration-1), 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](mobile-library#section-account-binding).

[block:code]
{
  "codes": [
    {
      "code": "let pin = \"a user selected PIN used to grant authorization\"\nlet notificationId = \"this device's notification ID as a base64 encoded string\"\nlet notificationFramework = \"your notification framework. eg firebase, apns\"\nlet deviceName = \"a device nickname\"\nlet appSpaceGuid = \"your app space GUID\"\nlet sessionToken = \"your session token\"\n\nself.privakeyCX.enablePrivakey(password: pin, notificationId: notificationId, notificationFramework: notificationFramework, name: deviceName, appSpaceGuid: appSpaceGuid, sessionToken: sessionToken) { success, error in\n    if error == nil {\n        // success! store any needed info\n    }\n}",
      "language": "swift"
    }
  ]
}
[/block]

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.

[block:code]
{
  "codes": [
    {
      "code": "self.privakeyCX.enableBiometrics(password: pin) { success, error in\n    if error == nil {\n        // success\n    } else {\n        // failure\n    }\n}",
      "language": "swift"
    }
  ]
}
[/block]