This commit is contained in:
启星
2025-08-08 10:49:36 +08:00
parent 6400cf78bb
commit b5ce3d580a
8780 changed files with 978183 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#define ANDROID_CUSTOM_NONE (1)
#define ANDROID_CUSTOM_FOR_IOT (0)
#define ANDROID_CUSTOM_FOR_UNIONPAY (0)
#define ANDROID_CUSTOM_SUPPORT_VTS (0)
//vts && vndk: https://source.android.com/devices/architecture/images/VNDK.pdf
#define CUSTOM_FOR_QQ (0)
#define ALLOW_EMPTY_SECRET_KEY (1)
// change namespace for different business
#define YTLICENSE_NAMESPACE ytliveness
#define CLASS_WITH_PREFIX(__class) YTLiveness##__class
#define FUNCTION_WITH_PREFIX(__func) ytliveness_##__func
#define INNER_INTERFACE_USE_NAMESPACE (1)

View File

@@ -0,0 +1,79 @@
/**
* @file yt_auth.h
* @author tencent
* @brief 鉴权接口
* @version 2.0
* @date 2020-09-10
*
* @copyright Copyright (c) 2020
*
*/
#ifndef _YT_AUTH_H_
#define _YT_AUTH_H_
#include "yt_defines.h"
// license文件申请https://docs.qq.com/doc/DZERXWmNYeVNyWlF0
/**
* @brief 使用license文件初始化授权
* @param `platform_context` Android平台输入JNIEnv*其他平台输入NULL
* @param `license_path` Android平台将license文件打包到assets中传入文件名其他平台传入文件完整路径
* @param `secret_key` 传入license对应的secret_key在申请的时候获得
* @return 授权结果0代表成功错误码参考[授权错误代码](#errorcode)
*/
YT_PUBLIC int ytliveness_auth_init_by_path(void* platform_context, const char* license_path, const char* secret_key);
/**
* @brief 使用license字符串初始化鉴权字符串获取方式将license文件做base64即可
* @param `platform_context` Android平台输入JNIEnv*其他平台输入NULL
* @param `license_string` license字符串
* @param `secret_key` 传入license对应的secret_key在申请的时候获得
* @return 授权结果0代表成功错误码参考[授权错误代码](#errorcode)
*/
YT_PUBLIC int ytliveness_auth_init_by_string(void* platform_context, const char* license_string, const char* secret_key);
/**
* @brief 腾讯内部业务专用授权接口
* @param `platform_context` Android平台输入JNIEnv*其他平台输入NULL
* @return 授权结果0代表成功错误码参考[授权错误代码](#errorcode)
*/
YT_PUBLIC int ytliveness_auth_init_for_qq(void* platform_context);
/**
* @brief 授权成功后,查询授权有效期
* @return 授权到期时间的时间戳
*/
YT_PUBLIC long long ytliveness_auth_get_endtime();
/**
* @brief 查询授权库的版本
* @return 授权库的版本号
*/
YT_PUBLIC const char* ytliveness_auth_get_version();
/**
* @brief 获取已授权的SDK列表
* @param sdklist_buf 出参返回sdklist调用者自己分配一个int[]数组用于存储SDKlist
* @param max_count 入参传入的sdklist_buf的最大index
* @return 实际返回的sdklist数量
* @note 如果sdklist_buf传NULL返回值代表SDK列表的总数
*/
YT_PUBLIC int ytliveness_auth_get_sdklist_ids(int* sdklist_buf, int max_count);
/**
* @brief 获取sdk_id代表的SDK名称
* @param sdk_id
* @return 该id代表的SDK名称
*/
YT_PUBLIC const char* ytliveness_auth_get_sdkname(int sdk_id);
/**
* @brief 设置是否显示log默认为显示
* @param enable1-显示 0-不显示
* @return
*/
YT_PUBLIC void ytliveness_auth_enable_log(int enable);
#endif

View File

@@ -0,0 +1,21 @@
#import <Foundation/Foundation.h>
__attribute__((visibility("default"))) @interface YTLivenessAuthManager : NSObject
+ (int)initAuthByFilePath:(NSString*) license_path withSecretKey:(NSString*) secret_key;
+ (int)initAuthByString:(NSString*) license_string withSecretKey:(NSString*) secret_key;
+ (int)initAuthForQQ;
+ (NSString*)getVersion;
+ (int64_t)getEndTime;
+ (NSArray*)getSDKList;
+ (NSString*)getSDKNameByID:(int)sdk_id;
+ (void)setEnableLog:(int)enable;
@end

View File

@@ -0,0 +1,15 @@
#ifndef __YT_AUTH_ERRORCODE_H__
#define __YT_AUTH_ERRORCODE_H__
#define YT_AUTH_ERROR_FETCH_FAIL (1002)
#define YT_AUTH_ERROR_DECODE_FAIL (3004)
#define YT_AUTH_ERROR_EMPTY_STRING (3005)
#define YT_AUTH_ERROR_UNMATCH_DEVICE_INFO (3013)
#define YT_AUTH_ERROR_UNMATCH_IDENTIFIER (3015)
#define YT_AUTH_ERROR_EMPTY_IDENTIFIER (3016)
#define YT_AUTH_ERROR_TIME_EXPIRED (3018)
#define YT_AUTH_ERROR_UNMATCH_SECRET_KEY (3024)
#define YT_AUTH_ERROR_INVALID_DEVICE_INFO (4003)
#define YT_AUTH_ERROR_FUNC_NOT_IMPLEMENT (5001)
#endif // __YT_AUTH_ERRORCODE_H__

View File

@@ -0,0 +1,72 @@
#ifndef _YT_DEFINES_H_
#define _YT_DEFINES_H_
// ----------------------------------------------------------------------------
// YouTu for cross platform defines export c api.
// windows @see: http://geoffair.net/ms/declspec.htm
// ----------------------------------------------------------------------------
#if (defined(WIN32) || defined(WIN64))
#ifdef YT_EXPORT
#define YT_PUBLIC_ __declspec(dllexport)
#else
#define YT_PUBLIC_ __declspec(dllimport)
#endif
#else
#ifdef YT_EXPORT
#define YT_PUBLIC_ __attribute__((visibility("default")))
#else
#define YT_PUBLIC_
#endif
#endif
#ifdef __cplusplus
#define YT_PUBLIC extern "C" YT_PUBLIC_
#else
#define YT_PUBLIC YT_PUBLIC_
#endif
// ----------------------------------------------------------------------------
// YouTu error code defines
// ----------------------------------------------------------------------------
#define YT_SUCCESS 0
#define YT_ERROR -1
// init error code: [-10, -99]
#define YT_ERROR_OPEN_FILE -10
#define YT_ERROR_READ_FILE -11
#define YT_ERROR_FILE_EMPTY -12
#define YT_ERROR_RPN_NET_INIT -20
#define YT_ERROR_RPN_NET_NOT_INIT -21
#define YT_ERROR_RPN_INST_INIT -22
#define YT_ERROR_RPN_INST_NOT_INIT -23
#define YT_ERROR_RPN_FORWARD -24
#define YT_ERROR_INVALID_INSTANCE -99
// arguments error code: [-100, -999]
#define YT_ERROR_MUST_NOT_NULL -100
#define YT_ERROR_IMAGE_TYPE -110
#define YT_ERROR_FACE_POINTS -120
#define YT_ERROR_FACE_FIVE_POINTS -121
#define YT_ERROR_FACE_NINETY_POINTS -122
#define YT_ERROR_FACE_RECT -123
#define YT_ERROR_INVALID_MODEL_VERSION -130
#define YT_ERROR_MODEL_THRESHOLDS_SIZE -131
// auth error code
#define YT_ERROR_AUTH_FAILED -1024
// ----------------------------------------------------------------------------
// YouTu common code defines
// ----------------------------------------------------------------------------
#define YT_FACE_FEATURE_SIZE_512 512
#define YT_FACE_FEATURE_SIZE_1024 1024
#define YT_FACE_FIVE_POINTS_SIZE 5
#define YT_FACE_NINETY_POINTS_SIZE 90
#endif // _YT_DEFINES_H_