Running your First Job

  1. Make the ViewController be a delegate for the upload callbacks

    class MyUploadResultViewController: UIViewController,
    SIDNetworkRequestDelegate
  2. Create a method that creates a SIDConfig object. SIDConfig, SIDNetData, and SIDNetworkRequest are implemented in the Smile Identity SDK. SIDNetURL is defined in the application. It contains specific definitions for the urls that are used in for the upload.

    class SIDNetURL

    SIDNetURL contains values that are app specific.

    Parameter

    Description

    partnerUrl

    The URL to the Smile ID Partners Authorisation Server - performs business logic before running a job *Note this is not the callback URL

    partnerPort

    The port used for for the Authorisation Server

    authUrl

    The endpoint Smile ID will hit in order to get Authorisation to kick off a job

    lambdaUrl

    The endpoint Smile ID uses to return Job Status

    sidAddress

    Currently unused. The value is bundled with the configuration parameters and uploaded with the metadata.

    sidPort

    Currently unused. The value is bundled with the configuration parameters and uploaded with the metadata

    User id, job id, job type and custom parameters can be set in the partnerParams.

    RetryOnFailurePolicy can be customized. See the API documentation below for details.

    The SIDConfig.build function has a userTag parameter. userTag is the custom user tag. In this example, it is send the default user tag value that is defined in the SmileIDSingleton. For example, here is a function that creates an SIDConfig object.

    SIDConfig object.func createConfig() -> SIDConfig {
    let sidNetworkRequest = SIDNetworkRequest()
    sidNetworkRequest.setDelegate(delegate: self)
    sidNetworkRequest.initialize()
    let sidNetData = SIDNetData();
    sidNetData.setAuthToken( authToken :SIDNetUrl.AUTH_TOKEN )
    sidNetData.setAuthUrl(authUrl:SIDNetUrl.AUTH_URL)
    sidNetData.setPartnerUrl(partnerUrl:SIDNetUrl.PARTNER_URL )
    sidNetData.setPartnerPort( partnerPort :SIDNetUrl.PARTNER_PORT )
    sidNetData.setLambdaUrl( lambdaUrl:SIDNetUrl.LAMBDA_URL )
    sidNetData.setJobStatusUrl( jobStatusUrl:SIDNetUrl.JOB_STATUS_URL )
    sidNetData.setSidAddress( sidAddress :SIDNetUrl.SID_ADDRESS )
    sidNetData.setSidPort( sidPort :SIDNetUrl.SID_PORT )
    let sidConfig = SIDConfig()
    sidConfig.setSidNetworkRequest( sidNetworkRequest :sidNetworkRequest )
    sidConfig.setSidNetData( sidNetData : sidNetData )
    sidConfig.setRetryOnFailurePolicy( retryOnFailurePolicy:
    getRetryOnFailurePolicy() )
    let partnerParams = PartnerParams()
    if( isEnrollMode ){
    sidConfig.setIsEnrollMode( isEnrollMode: true )
    sidConfig.setUseIdCard( useIdCard: hasId )
    }
    else{
    sidConfig.setIsEnrollMode( isEnrollMode : false )
    partnerParams.setJobType(jobType: jobType )
    }
    sidConfig.setPartnerParams( partnerParams :
    partnerParams )
    return sidConfig
    }
  3. To start the send the Job to Smile ID, add the following lines. For example, this could added into an IBAction method for a button.

    let sidConfig = createConfig()
    sidConfig.build( userTag:SmileIDSingleton.DEFAULT_US
    ER_TAG )
    try sidNetworkRequest!.submit( sidConfig:
    sidConfig )

  4. Implement the SIDNetworkRequestDelegate callbacks