This is an SDK to integrate with an iOS app Silt's KYC & ID verification. The Silt's SDK Framework is inside the SiltSDK directory. More information concerning API and other SDKs is available at https://getsilt.com/developers
- Simply create a pod file named
Podfile
or add the linepod 'SiltSDK', '~> 1.2'
.
target 'MyApp' do
pod 'SiltSDK', '~> 1.2'
end
(More info on Podfile here: (https://guides.cocoapods.org/using/the-podfile.html))
- Run the command
$ pod install
. - IMPORTANT: Open
YourApp.xcworkspacep
and build. - To finish, add
Privacy - Camera Usage Description
:Camera usage description
to yourInfo.plist
file.
The SiltSDK is a cocoapod available at: https://cocoapods.org/pods/SiltSDK
Here is a guide to get started with cocoapods: https://guides.cocoapods.org/using/getting-started.html And a guide to import a cocoapod library to your app: https://guides.cocoapods.org/using/using-cocoapods.html
The only code you will need to add to your app is in the example ViewController file:
SiltSDKExamples/ViewController.swift
// siltButtonBlue position and target
siltButtonBlue.addTarget(self, action: #selector(loadSiltSignup), for: .touchUpInside)
siltButtonBlue.setStyle(bStyle: "blue")
siltButtonBlue.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
Check the SiltSDKExamples/ViewController.swift
for an example.
Ask for your companyAppId
on [email protected] or get it from https://dashboard.getsilt.com
and use it in the initializer.
Example of all code for function loadSiltSignup
for verifying users for KYC:
@objc func loadSiltSignup() {
let vc = SiltWebviewController(companyAppId:"{{YOUR_COMPANY_APP_ID}}", extraQuery:"&[email protected]")
// Subscribe to the notification that will be triggered when a user finishes Silt's verification flow,
// that will run "onFinishedSiltVerification" function
NotificationCenter.default.addObserver(self, selector: #selector(onFinishedSiltVerification(_:)), name: .didFinishedSiltVerification, object: nil)
// set the Presentation style of the webview
vc.modalPresentationStyle = .overFullScreen //or .overFullScreen for transparency
self.present(vc, animated: true, completion: nil)
}
Detailed explanation for loadSiltSignup
function.
Ask for your companyAppId
on [email protected] or get it from https://dashboard.getsilt.com
and use it in the initializer as:
SiltWebviewController(companyAppId: {YOUR_CUSTOMER_APP_ID} )
Demo companyAppId: 2022a022-a662-4c58-8865-a1fb904d2cde
.
Add the argument "outTransition: .fromLeft"
to SiltWebviewController to define an out animation when closing the webview
Example KYC:
@objc func loadSiltSignup() {
let vc = SiltWebviewController(companyAppId:"2022a022-a662-4c58-8865-a1fb904d2cde", extraQuery:"&[email protected]")
...
Example Biocheck:
@objc func loadSiltSignup() {
let vc = SiltWebviewController(companyAppId:"2022a022-a662-4c58-8865-a1fb904d2cde",
path: "biocheck",
extraQuery:"&temp_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxx")
...
Subscribe to the notification that will be triggered when a user finishes Silt's verification flow,
that will run onFinishedSiltVerification
function
NotificationCenter.default.addObserver(self, selector: #selector(onFinishedSiltVerification(_:)), name: .didFinishedSiltVerification, object: nil)
You can also subscribe to the notifications didGotSiltUserID
after getting a userID, and didGotCompanyAppToken
after getting an app token.
siltUserId
or siltCompanyAppToken
values will be inside the userInfo object.
NotificationCenter.default.addObserver(self, selector: #selector(onGotSiltUserId(_:)), name: .didGotSiltUserID, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(onGotCompanyAppToken(_:)), name: .didGotCompanyAppToken, object: nil)
You can create a transition with the getTransition
func provided by Silt
view.window!.layer.add(getTransition(subtype: .fromRight), forKey: kCATransition)
Set the Presentation style of the webview
vc.modalPresentationStyle = .overFullScreen //or .overFullScreen for transparency
self.present(vc, animated: true, completion: nil)
You can also set default animation
self.present(vc, animated: true, completion: nil)
The onFinishedSiltVerification
func that recovers the silt Id. Check the SiltSDKExamples/ViewController.swift
for an example.
@objc func onFinishedSiltVerification(_ notification: Notification) {
let siltUserId = notification.userInfo?["siltUserId"] as? String
let siltCompanyAppToken = notification.userInfo?["siltCompanyAppToken"] as? String
if(!(siltUserId!).isEmpty && !(siltCompanyAppToken!).isEmpty){
// Call your backend here to verify this userId
print("Got a verified user Id: \(siltUserId!) \(siltCompanyAppToken!)")
}
}
Implement a call from your backend to Silt's backend to retrieve the user verification status and information. Check more on this in https://getsilt.com/developers
This SDK consists only in a button that opens a webview and captures once the user has finished the verification in the webview a user ID. This is the user ID you can use to verify the ID verification of that user in Silt.