iOS reference

class

ClaySDK

The main class that handles security and Mobile Key openings

getPublicKey()

Fetch the App Public Key

declaration

Swift

public apublic func getPublicKey() -> String init(delegate: ClayDelegate)

return value

The Base64 encoded Public Key

openDoor(with:delegate:)

Open a lock with a Mobile Key

declaration

Swift

public func openDoor(with key: String, delegate: OpenDoorDelegate)

parameters
key the encrypted Mobile Key returned by the CLP API
delegate The delegate should comply to OpenDoorDelegate. This handles the feedback for the Mobile Key opening
enum

ClayError

public enum ClayError: Error

ClayError is the error type returned by ClaySDK. It encompasses a few different types of errors, each with their own associated reasons.

  • invalidEncryption: Returned when an encrypted key cannot be decrypted OR when the decryption of the encrypted key fails

  • invalidKey: Returned when the decrypted Mobile Key is not valid.

  • storeError: Returned when an encrypted key fails to be stored in the Keychain.

invalidEncryption

Returned when an encrypted key cannot be decrypted OR when the decryption of the encrypted key fails.

declaration

Swift

case invalidEncryption

invalidKey

Returned when an encrypted key fails to create a valid Mobile Key.

declaration

Swift

case invalidKey

storeError

Returned when storing an encrypted key in the Keychain fails.

declaration

Swift

case storeError

errorDescription

Detailed description for the received error.

declaration

Swift

public var errorDescription: String?

Protocols

ClayDelegate

public protocol ClayDelegate: class

ClayDelegate is the delegate to handle feedback from the ClaySDK initialisation. Implement this delegate for error handling.

didReceive(error:)

Error handler

declaration

Swift

func didReceive(error: Error)

parameters
error Error
Protocols

OpenDoorDelegate

public protocol OpenDoorDelegate: class

OpenDoorDelegate handles feedback from the openDoor method. Implement this delegate for taking the correct action when opening a door, finding a lock or error handling.

didFindLock()

Error handler

declaration

Swift

func didReceive(error: Error)

didOpen()

Open handler

declaration

Swift

func didOpen()

didReceive(error:)

Error handler

declaration

Swift

func didReceive(error: Error)