Get Started

Requirements

osp_selfie SDK requires iOS 11 or newer.

Resource

Integration Sample

Installation

osp_selfie is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'osp_selfie'

Integration

  1. The OSP SDK lets you securely and seamlessly collect your user's information
pod 'Moya'
pod 'PromiseKit'
pod 'SwiftMessages'

Usage

Register

/**
name: The NodeType you want to register.
node: The instance of nodeable.
*/
OneStopManager.default.registerNode(name: .selfie, node: SelfieNode.init()) 

📘

Note

The start and end node already supported by SDK, but you need manual specify selfie、document、or format node according to your demand.The NodeType euum:

enum NodeType: String {
    case start
    case selfie
    case document
    case format
    case end
}

NodeType & Nodeable class map:

NodeTypeclass
selfieSelfieNode
documentDocumentNode
formatcoming

Start a workflow

Generate SDK Token

The first step is to obtain a sdkToken, which is a necessary parameter to start the process. A quick access is provided in the demo to obtain the sdkToken. In your environment, this parameter needs to be obtained from your server.

📘

Note:

Here is the example of sandbox environment

curl --location --request POST 'https://sandbox-oop-api.advai.net/intl/openapi/sdk/v2/trans/start' \
--header 'X-ADVAI-KEY: XXXX' \
--header 'journeyId: xxx' \
--header 'Content-Type: application/json' \
--data '{
    "referenceId": "123213123",
}'
/**
token: Generate SDK Token step
context: The current UIViewController, this context.naviationController cannt be nil
*/

public func ex_start(token: String, context: UIViewController)

Callback

nameparamsdecription
onReadystart
onFinishstatus:true,false
onExitnodeType: stringUser actively ends the process
onError
onEventeventName:String,params:[string: string]

eventName & params

nameparams
start
document_country_selectcountry: String
document_type_selecttype:string
document_camera_capturetype:front,back,unknow
document_uploadtype:front,back,unknow
selfie_camera_capturetype:2D,3D
selfie_photo_uploadtype:2D,3D
enable_camerasource:document,selie
retrysource:document,selie
failuresource:document,selie
load_camera_failed
form
form_submitstatus:success,fail
decline
success
pending

You can call this method to listen for an event, example:

/**
des: you can call this method multiple times
type: CallBackType
*/
public func subscribe(type: CallBackType, _ act: @escaping (CallBackData?) -> Void)

or

public func subScribe(types: [CallBackType], _ act: @escaping (CallBackData?) -> Void)

ipa Volume

Using selfie single node, the ipa package size will increase by 7.3M.

License

osp_selfie is available under the MIT license. See the [LICENSE file](https://github.com/aai-osp-fe/aai-osp-ios-sdk-selfie?tab=MIT-1-ov-file) for more info.