TwilioVerify

public protocol TwilioVerify

Describes the available operations to proccess Factors and Challenges

  • Creates a Factor from a FactorPayload

    Declaration

    Swift

    func createFactor(
      withPayload payload: FactorPayload,
      success: @escaping FactorSuccessBlock,
      failure: @escaping TwilioVerifyErrorBlock
    )

    Parameters

    payload

    Describes the information needed to create a factor

    success

    Closure to be called when the operation succeeds, returns the created Factor

    failure

    Closure to be called when the operation fails with the cause of failure

  • Verifies a Factor from a VerifyFactorPayload

    Declaration

    Swift

    func verifyFactor(
      withPayload payload: VerifyFactorPayload,
      success: @escaping FactorSuccessBlock,
      failure: @escaping TwilioVerifyErrorBlock
    )

    Parameters

    payload

    Describes the information needed to verify a factor

    success

    Closure to be called when the operation succeeds, returns the verified Factor

    failure

    Closure to be called when the operation fails with the cause of failure

  • Updates a Factor from a UpdateFactorPayload

    Declaration

    Swift

    func updateFactor(
      withPayload payload: UpdateFactorPayload,
      success: @escaping FactorSuccessBlock,
      failure: @escaping TwilioVerifyErrorBlock
    )

    Parameters

    payload

    Describes the information needed to update a factor

    success

    Closure to be called when the operation succeeds, returns the updated Factor

    failure

    Closure to be called when the operation fails with the cause of failure

  • Gets all Factors created by the app, this method will return the factors in local storage.

    Declaration

    Swift

    func getAllFactors(
      success: @escaping FactorListSuccessBlock,
      failure: @escaping TwilioVerifyErrorBlock
    )

    Parameters

    success

    Closure to be called when the operation succeeds, returns an array of Factors

    failure

    Closure to be called when the operation fails with the cause of failure

  • Deletes a Factor with the given sid. This method calls Verify Push API to delete the factor and will remove the factor from local storage if the API call succeeds.

    Declaration

    Swift

    func deleteFactor(
      withSid sid: String,
      success: @escaping EmptySuccessBlock,
      failure: @escaping TwilioVerifyErrorBlock
    )

    Parameters

    sid

    Sid of the Factor to be deleted

    success

    Closure to be called when the operation succeeds

    failure

    Closure to be called when the operation fails with the cause of failure

  • Gets a Challenge with the given Challenge sid and Factor sid

    Declaration

    Swift

    func getChallenge(
      challengeSid: String,
      factorSid: String,
      success: @escaping ChallengeSuccessBlock,
      failure: @escaping TwilioVerifyErrorBlock
    )

    Parameters

    challengeSid

    Sid of the Challenge requested

    factorSid

    Sid of the Factor to which the Challenge corresponds

    success

    Closure to be called when the operation succeeds, returns the requested Challenge

    failure

    Closure to be called when the operation fails with the cause of failure

  • Updates a Challenge from a UpdateChallengePayload

    Declaration

    Swift

    func updateChallenge(
      withPayload payload: UpdateChallengePayload,
      success: @escaping EmptySuccessBlock,
      failure: @escaping TwilioVerifyErrorBlock
    )

    Parameters

    payload

    Describes the information needed to update a challenge

    success

    Closure to be called when the operation succeeds

    failure

    Closure to be called when the operation fails with the cause of failure

  • Gets all Challenges associated to a Factor with the given ChallengeListPayload

    Declaration

    Swift

    func getAllChallenges(
      withPayload payload: ChallengeListPayload,
      success: @escaping (ChallengeList) -> (),
      failure: @escaping TwilioVerifyErrorBlock
    )

    Parameters

    payload

    Describes the information needed to fetch all the Challenges

    success

    Closure to be called when the operation succeeds, returns a ChallengeList which contains the Challenges and the metadata associated to the request

    failure

    Closure to be called when the operation fails with the cause of failure

  • Clears local storage, it will delete factors and key pairs in this device.

    Throws

    An error, if there is an error clearing the local storage. ## Important Note ## Calling this method will not delete factors in Verify Push API, so you need to delete them from your backend to prevent invalid/deleted factors when getting factors for an identity.

    Declaration

    Swift

    func clearLocalStorage() throws