refactor(native): rename C API auth_* -> craft_* across header, core, JNI bridge, and smoke tests

This commit is contained in:
2026-04-28 18:27:34 +08:00
parent 5073a4193f
commit 53c52a0b3e
3 changed files with 25 additions and 25 deletions
+11 -11
View File
@@ -15,10 +15,10 @@
* - 所有 `const char*` 均为 **UTF-8** 编码、以 `\0` 结尾。
* - `config_json`UTF-8 JSON,语义与仓库 `schemas/craftlabs-auth-config.schema.json` 及 `examples/config/`
* 一致;Java 侧可先经 `cn.craftlabs.auth.config.AuthConfigs` 校验后再序列化传入。
* - `AuthHandle`:不透明指针,仅由本库函数产生与销毁(`auth_initialize` / `auth_destroy`)。
* - `AuthHandle`:不透明指针,仅由本库函数产生与销毁(`craft_initialize` / `craft_destroy`)。
* - `AuthResult`、`LicenseInfo` 使用 `stdint` 定宽字段,避免 `time_t`/`int` 宽度随平台变化导致 Python 侧 Structure 布局错误。
* - `AuthResult.message`:指向 **由本库管理的静态或内部只读缓冲区**,调用方不得 `free`;在任意后续对本库的再次调用之后视为可能失效(与其它 FFI 语言惯例一致)。
* - `auth_get_license_info` 返回的 `LicenseInfo*`(及其中 `feature_names` / `feature_values` 指向的数组)须通过 `auth_free_license_info` 释放;释放后不得再读指针成员。
* - `craft_get_license_info` 返回的 `LicenseInfo*`(及其中 `feature_names` / `feature_values` 指向的数组)须通过 `craft_free_license_info` 释放;释放后不得再读指针成员。
* - 官方 Python 绑定见仓库 `python/craftlabs_auth/`ctypes,与本头文件字段一一对应)。
*/
@@ -47,23 +47,23 @@ typedef struct {
int32_t feature_count;
} LicenseInfo;
CRAFTLABS_API AuthHandle auth_initialize(const char* config_json);
CRAFTLABS_API AuthHandle craft_initialize(const char* config_json);
CRAFTLABS_API AuthResult auth_activate(AuthHandle handle, const char* license_key);
CRAFTLABS_API AuthResult craft_activate(AuthHandle handle, const char* license_key);
CRAFTLABS_API AuthResult auth_check_license(AuthHandle handle);
CRAFTLABS_API AuthResult craft_check_license(AuthHandle handle);
CRAFTLABS_API LicenseInfo* auth_get_license_info(AuthHandle handle);
CRAFTLABS_API LicenseInfo* craft_get_license_info(AuthHandle handle);
CRAFTLABS_API void auth_free_license_info(LicenseInfo* info);
CRAFTLABS_API void craft_free_license_info(LicenseInfo* info);
CRAFTLABS_API int32_t auth_has_feature(AuthHandle handle, const char* feature_name);
CRAFTLABS_API int32_t craft_has_feature(AuthHandle handle, const char* feature_name);
CRAFTLABS_API AuthResult auth_release(AuthHandle handle);
CRAFTLABS_API AuthResult craft_release(AuthHandle handle);
CRAFTLABS_API AuthResult auth_heartbeat(AuthHandle handle);
CRAFTLABS_API AuthResult craft_heartbeat(AuthHandle handle);
CRAFTLABS_API void auth_destroy(AuthHandle handle);
CRAFTLABS_API void craft_destroy(AuthHandle handle);
#ifdef __cplusplus
}