
SdkToken for the linked selfie verification process and to pull the final verification result using the SdkToken.
var FaceIdClient *faceid.Clientfunc init() {// When initializing the client configuration, you can specify the timeout and other configuration items.prof := profile.NewClientProfile()prof.HttpProfile.ReqTimeout = 60// TODO: Replace with the SecretId and SecretKey of your calling account.credential := cloud.NewCredential("SecretId", "SecretKey")var err error// Initialize the client for calling the eKYC Selfie Verification service.FaceIdClient, err = faceid.NewClient(credential, "ap-singapore", prof)if nil != err {log.Fatal("FaceIdClient init error: ", err)}}// GetFaceIdToken obtains the Face Identity Verification Token.func GetFaceIdToken(w http.ResponseWriter, r *http.Request) {log.Println("get face id token")// Step 1: Parse the request parameters._ = r.ParseForm()var SecureLevel = r.FormValue("SecureLevel")// Step 2: Initialize the request object and assign values to the necessary parameters.request := faceid.NewGetFaceIdTokenIntlRequest()request.SecureLevel = &SecureLevel// Step 3: Call the Face Identity Verification service via FaceIdClient.response, err := FaceIdClient.GetFaceIdTokenIntl(request)// Step 4: Process the TencentCloud API response and construct the return object.if nil != err {_, _ = w.Write([]byte("error"))return}SdkToken := response.Response.SdkTokenapiResp := struct {SdkToken *string}{SdkToken: SdkToken}b, _ := json.Marshal(apiResp)// ... Other business processing code.// Step 5: Return the service response._, _ = w.Write(b)}// GetFaceIdResult obtains the Face Identity Verification result.func GetFaceIdResult(w http.ResponseWriter, r *http.Request) {// Step 1: ... Parse the request parameters._ = r.ParseForm()SdkToken := r.FormValue("SdkToken")// Step 2: Initialize the request object and assign values to the necessary parameters.request := faceid.NewGetFaceIdResultIntlRequest()request.SdkToken = &SdkToken// Step 3: Call the Face Identity Verification service via FaceIdClient.response, err := FaceIdClient.GetFaceIdResultIntl(request)// Step 4: Process the TencentCloud API response and construct the return object.if nil != err {_, _ = w.Write([]byte("error"))return}result := response.Response.ResultapiResp := struct {Result *string}{Result: result}b, _ := json.Marshal(apiResp)// ... Other business processing code.// Step 5: Return the service response._, _ = w.Write(b)}func main() {// Register the http API path.http.HandleFunc("/api/v1/get-token", GetFaceIdToken)http.HandleFunc("/api/v1/get-result", GetFaceIdResult)// Listen on the port.err := http.ListenAndServe(":8080", nil)if nil != err {log.Fatal("ListenAndServe error: ", err)}}
Result field is 0, thereby determining whether the server-side integration is successful. For detailed response results, refer to the API section.huiyansdk_android_overseas_1.0.9.6_release.aar (the specific version is subject to the official website download), tencent-ai-sdk-youtu-base-1.0.1.39-release.aar , tencent-ai-sdk-common-1.1.36-release.aar, and tencent-ai-sdk-aicamera-1.0.22-release.aar (the specific versions are subject to the final provision) to the libs directory of your project.├── codedemo│ ├── build.gradle│ ├── libs│ │ ├── huiyansdk_android_overseas_1.0.9.14_release.aar│ │ ├── tencent-ai-sdk-aicamera-1.0.25-release.aar│ │ ├── tencent-ai-sdk-common-1.1.43-release.aar│ │ ├── tencent-ai-sdk-network-1.0.2.3.6-release.aar│ │ └── tencent-ai-sdk-youtu-base-1.0.1.44-release.aar│ ├── proguard-rules.pro│ └── src│ └── main
// Configure ndk so library architecture filtering (using armeabi-v7a as an example; you can also add arm64-v8a if the device supports it).defaultConfig {ndk {abiFilters 'armeabi-v7a'}}dependencies {// Import the SDK.implementation files("libs/huiyansdk_android_overseas_1.0.9.5_release.aar")// General Algorithm SDKimplementation files("libs/tencent-ai-sdk-youtu-base-1.0.1.32-release.aar")// General Capability Component Libraryimplementation files("libs/tencent-ai-sdk-common-1.1.27-release.aar")implementation files("libs/tencent-ai-sdk-aicamera-1.0.18-release.aar")implementation files("libs/tencent-ai-sdk-network-1.0.2.3.6-release.aar")// Third-party libraries required by the SDK.// gsonimplementation 'com.google.code.gson:gson:2.8.9'}
<!-- Camera Permission --><uses-permission android:name="android.permission.CAMERA" /><uses-featureandroid:name="android.hardware.camera"android:required="true" /><!-- Network Permission Required by the SDK --><uses-permission android:name="android.permission.INTERNET" /><!-- Device Risk Control Dependencies --><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /><!-- Optional Permissions for the SDK --><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
@Overridepublic void onCreate() {super.onCreate();instance = this;// The SDK must be initialized when the Application initializes.HuiYanOsApi.init(getApp());}

// Parameters related to HuiYanOsHuiYanOsConfig huiYanOsConfig = new HuiYanOsConfig();// This license file is stored under the assets directory.huiYanOsConfig.setAuthLicense("YTFaceSDK.license");// The license file for device risk control (required when using device risk control mode) must also be stored under the assets directory.huiYanOsConfig.setRiskLicense("turing.lic");// Enable Device Risk ControlhuiYanOsConfig.setOpenCheckRiskMode(true);if (compatCheckBox.isChecked()) {huiYanOsConfig.setPageColorStyle(PageColorStyle.Dark);}// Start the selfie verification method to initiate liveness detection. The currentToken is data issued by the backend.HuiYanOsApi.startHuiYanAuth(currentToken, huiYanOsConfig, new HuiYanOsAuthCallBack() {@Overridepublic void onSuccess(HuiYanOsAuthResult authResult) {// Display ResultrunOnUiThread(new Runnable() {@Overridepublic void run() {Toast.makeText(SimplifyActivity.this, "Liveness passed!", Toast.LENGTH_SHORT).show();}});}@Overridepublic void onFail(int errorCode, String errorMsg, String token) {String msg = "Liveness failed " + "code: " + errorCode + " msg: " + errorMsg + " token: " + token;Log.e(TAG, "onFail" + msg);// Display ResultrunOnUiThread(new Runnable() {@Overridepublic void run() {Toast.makeText(SimplifyActivity.this, msg, Toast.LENGTH_SHORT).show();}});}});
├── codedemo│ ├── build.gradle│ ├── libs│ ├── proguard-rules.pro│ └── src│ └── main│ └── assets│ ├── turing.lic│ └── YTFaceSDK.license
@Overrideprotected void onDestroy() {super.onDestroy();// Release resources upon exitHuiYanOsApi.release();}
#SDK Obfuscation Includes-keep class com.tencent.could.huiyansdk.** {*;}-keep class com.tencent.could.aicamare.** {*;}-keep class com.tencent.could.component.** {*;}-keep class com.tencent.youtu.** {*;}-keep class com.tenpay.utils.SMUtils {*;}-keep class com.tencent.turingface.** {*;}-keep class com.turingface.sdk.** {*;}-keep class com.tencent.cloud.ai.network.** {*;}
└──HuiYanOverseasSDK.xcframework
├── YTFaceSDK.license├── turing.license└── face-tracker-v003.bundle
└── HuiYanSDKUI.bundle
├──Your Project.xcodeproj├──Podfile├──CloudHuiYanSDK_FW├───────CloudHuiYanSDK_FW.podspec├───────Frameworks├────────────HuiYanOverseasSDK.xcframework├───────Resources├────────────HuiYanSDKUI.bundle└────────────face-tracker-v003.bundle
Pod::Spec.new do |s|s.name = "CloudHuiYanSDK_FW"s.version = "1.0.0"s.platform = :ios, "9.0"s.summary = 'frameworks and bundle resources for youtu mobile hdr's.homepage = 'xx's.license = 'MIT's.source = {:git => 'xx' ,:tag => "#{s.version}"}s.static_framework = trues.compiler_flags = "-ObjC"s.author = {'xx' => 'xx'}s.pod_target_xcconfig = {'VALID_ARCHS' =>['arm64', 'x86_64']}s.subspec 'Resources' do |framework|framework.resource = 'Resources/*.bundle'ends.subspec 'Framework' do |framework|framework.frameworks = 'Accelerate'framework.vendored_frameworks = 'Frameworks/*.xcframework'endend
target 'HuiYanAuthDemo' douse_frameworks!pod 'CloudHuiYanSDK_FW', :path => './CloudHuiYanSDK_FW'end
Build Settings -> Framework Search Paths add $(inherited)Build Settings -> Other Linker Flags add $(inherited)key-value pairs.<key>Privacy - Camera Usage Description</key><string>Face Identity Verification requires enabling your camera permission for Face Recognition.</string>

#import <HuiYanOverseasSDK/HuiYanSDK.h>// Obtain the token.NSString *faceToken = self.tokenTextField.text;// Configure the SDK.HuiYanOsConfig *config = [[HuiYanOsConfig alloc] init];// Set the license.config.authLicense = [[NSBundle mainBundle] pathForResource:@"YTFaceSDK.license" ofType:@""];// Preparation Phase Timeout Configurationconfig.prepareTimeoutMs = 20000;// Action Phase Timeout Configurationconfig.actionTimeoutMs = 20000;// Delete the local liveness video.config.isDeleteVideoCache = YES;// Set UI-related callbacks.config.delegate = self;// Custom Multilingual Configurationconfig.languageType = EN;// config.userLanguageFileName = @"ko";// config.userLanguageBundleName = @"UseLanguageBundle";config.iShowTipsPage = YES;[[HuiYanOSKit sharedInstance] startHuiYaneKYC:faceToken withConfig:config witSuccCallback:^(HuiYanOsAuthResult * _Nonnull authResult, id _Nullable reserved) {NSString *token = authResult.faceToken;} withFailCallback:^(int errCode, NSString * _Nonnull errMsg, id _Nullable reserved) {NSString *showMsg = [NSString stringWithFormat:@"err:%d:%@",errCode,errMsg];NSLog(@"err:%@",showMsg);}];
HuiYanOsConfig *config = [[HuiYanOsConfig alloc] init];config.authLicense = [[NSBundle mainBundle] pathForResource:@"YTFaceSDK.license" ofType:@""];config.openCheckRiskMode = YES;config.riskLicense = [[NSBundle mainBundle] pathForResource:@"turing.license" ofType:@""];
GetFaceIdTokenIntl or ApplySdkVerificationToken API to obtain a business Token, you must specify Enhanced Mode or Plus Mode by setting the SdkVersion parameter:SdkVersion value.SdkVersion value.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback