feat: device_auth 在不支持 jsapi 的平台移除 napi 依赖 Created-by: handyohos Commit-by: handyohos Merged-by: openharmony_ci Description: Resolves Issue: https://gitcode.com/handyohos/security_device_auth/issues/1 ## Changes Description 修改 BUILD.gn 构建配置,在不支持 jsapi 的平台上移除 napi 依赖。 ## Technical Details 在 `deviceauth_napi_build` 组中添加 `support_jsapi` 条件判断: - 当 os_level == "standard" 且 support_jsapi 为 true 时才构建 napi 组件 - 避免 taihe 等不支持 jsapi 的平台尝试编译 napi 相关代码 ## File Changes - BUILD.gn: 添加 support_jsapi 条件判断 - 1 个文件变更,1 行修改,0 行删除 ## Commit Info - Signed-off-by: handyohos <zhangxiaotian@huawei.com> - Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> - Change-Id: If8cf6a030e84e912bc1447258d676edbbbb4709a - Single clean commit ## Testing - ✅ 本地构建测试通过 - ✅ 条件编译逻辑正确 - ✅ 与其他组件逻辑保持一致 --- **From fork: handyohos/security_device_auth branch: dev** **To upstream: openharmony/security_device_auth branch: master** **Related Issue: #1** See merge request: openharmony/security_device_auth!1281
deviceauth
Introduction
The device authentication module belongs to the security subsystem of OpenHarmony. It manages the entire lifecycle of trust relationships between devices, including establishment, maintenance, use, and cancellation, and implements authentication and secure session key exchange between trusted devices. It provides basic capabilities for trusted interconnections between devices that run OpenHarmony.
The device authentication module provides the following capabilities:
- Device trust relationship management: manages the establishment, maintenance, and cancellation of trust relationships between devices in a unified manner; allows the isolation and controllable sharing of trust relationships created by different services.
- Device trust relationship authentication: authenticates trust relationships between devices, allows trusted devices to exchange secure session keys with each other, and sets up connections between trusted devices through the DSoftBus.
The device authentication module consists of three submodules: device group management, device group authentication, and account-irrelevant P2P device authentication. The following figure shows the logical architecture of the device authentication module.
Figure 1 Architecture of the device authentication module
In the architecture:
- Device group management: allows you to manage the trust relationships between the local device and other devices created by different services in a unified manner, create trust relationships between devices using the provided APIs, create an account-irrelevant device group, add trusted devices to the group, and create a trust relationship between isolated devices.
- Device group authentication: allows devices to authenticate the trust relationships that have been established between them and exchange session keys.
- Account-irrelevant P2P device authentication: allows two devices to establish a trust relationship based on a shared secret, and exchange a session key for secure communication based on the trusted relationship.
Directory Structure
/base/security/device_auth
├── frameworks # Device authentication framework code
├── hals # HAL code for the tool library
│ ├── inc # Tool library header files
│ └── src # Tool library source files
├── interfaces # APIs exposed externally
└── services # Device authentication services
├── common # Common code
├── group_auth # Device group authentication
├── group_manager # Device group management
├── module # Authenticator module (including the account-irrelevant P2P device authenticator)
└── session # Scheduling and session management module
Usage
Available APIs
The device group management sub-module abstracts trust relationships established by different services between devices into trust groups and provides unified APIs for creating, deleting, and querying groups. The device group authentication sub-module provides trusted device authentication and end-to-end session key exchange based on the trust groups.
Table 1 APIs in DeviceGroupManager
Table 2 APIs in GroupAuthManager
int32_t AuthDevice(int64_t authReqId, const char *authParams, const DeviceAuthCallback *gaCallback) |
|
int32_t ProcessData(int64_t authReqId, const uint8_t *data, uint32_t dataLen, |
Repositories Involved
Security subsystem
