openharmony 鸿蒙 changelogs-useriam

2022-12-22 浏览 (797)

用户IAM子系统Changelog

cl.useriam.1 API异常处理方式变更

用户IAM部分接口使用业务逻辑返回值表示错误信息,不符合OpenHarmony接口错误码规范。从API9开始作以下变更:

接口通过抛出异常的方式返回错误信息。

变更影响

基于此版本以前开发的应用不受影响,以后的需适配变更接口的错误信息返回方式,否则会影响业务逻辑。

关键接口/组件变更

为适配统一的API异常处理方式,对用户IAM相关接口进行废弃(下表中 原接口 列内容),并新增对应接口(下表中 新接口 列内容)。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致。

模块名类名方法/属性/枚举/常量变更类型
ohos.userIAM.userAuthUserAuthconstructor()废弃
ohos.userIAM.userAuthUserAuthgetVersion() : number废弃
ohos.userIAM.userAuthUserAuthgetAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : number废弃
ohos.userIAM.userAuthUserAuthauth(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array废弃
ohos.userIAM.userAuthUserAuthcancelAuth(contextID : Uint8Array) : number废弃
ohos.userIAM.userAuthIUserAuthCallbackonResult: (result : number, extraInfo : AuthResult) => void废弃
ohos.userIAM.userAuthIUserAuthCallbackonAcquireInfo ?: (module : number, acquire : number, extraInfo : any) => void废弃
ohos.userIAM.userAuthAuthResultAuthResult {
token ?: Uint8Array;
remainTimes ?: number;
freezingTime ?: number;}
废弃
ohos.userIAM.userAuth枚举ResultCode {
SUCCESS = 0,
FAIL = 1,
GENERAL_ERROR = 2,
CANCELED = 3,
TIMEOUT = 4,
TYPE_NOT_SUPPORT = 5,
TRUST_LEVEL_NOT_SUPPORT = 6,
BUSY = 7,
INVALID_PARAMETERS = 8,
LOCKED = 9,
NOT_ENROLLED = 10,}
废弃
ohos.userIAM.userAuthtypeAuthEventKey = "result"新增
ohos.userIAM.userAuthtypeEventInfo = AuthResultInfo新增
ohos.userIAM.userAuthAuthResultInfoAuthResultInfo {
result : number;
token ?: Uint8Array;
remainAttempts ?: number;
lockoutDuration ?: number;}
新增
ohos.userIAM.userAuthTipInfoTipInfo {
module : number;
tip : number;}
新增
ohos.userIAM.userAuthAuthInstanceAuthInstance {
on: (name: AuthEventKey, callback: AuthEvent) => void;
off: (name: AuthEventKey) => void;
start: () => void;
cancel: () => void;}
新增
ohos.userIAM.userAuth枚举ResultCodeV9 {
SUCCESS = 12500000,
FAIL = 12500001,
GENERAL_ERROR = 12500002,
CANCELED = 12500003,
TIMEOUT = 12500004,
TYPE_NOT_SUPPORT = 12500005,
TRUST_LEVEL_NOT_SUPPORT = 12500006,
BUSY = 12500007,
LOCKED = 12500009,
NOT_ENROLLED = 12500010,}
新增
ohos.userIAM.userAuthfunctiongetAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel) : AuthInstance新增
ohos.userIAM.userAuthfunctiongetVersion() : number新增
ohos.userIAM.userAuthfunctiongetAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : void新增
ohos.userIAM.faceAuthFaceAuthManagersetSurfaceId(surfaceId : string) : ResultCode删除
ohos.userIAM.faceAuth枚举ResultCode {
SUCCESS = 0,
FAIL = 1,}
删除
ohos.userIAM.faceAuthFaceAuthManagersetSurfaceId(surfaceId: string) : void新增

适配指导

以getVersion接口为例,示例代码如下:

import userIAM_userAuth from '@ohos.userIAM.userAuth';

try {
    let version = userIAM_userAuth.getVersion();
    console.info("auth version = " + version);
} catch (error) {
    console.info("get version failed, error = " + error);
}

更多接口的示例代码可参考用户认证API文档人脸认证API文档

cl.useriam.2 接口调用权限变更

用户IAM部分接口只允许被系统应用调起,需要做系统应用运行时鉴权。从API9开始作以下变更:

人脸认证模块的setSurfaceId接口增加判别是否为系统应用的逻辑,非系统应用无法调用该接口。

变更影响

基于此版本以前开发的应用不受影响,以后的需要持有相应权限,否则无法正常调用接口。

关键接口/组件变更

setSurfaceId接口的实现中增加系统应用鉴权处理,非系统应用调用将返回202错误码。

适配指导

需要修改应用签名相关文件UnsgnedReleasedProfileTemplate.json,其中的app-feature字段要改为"hos_system_app",才可保证签名所得到的应用是系统应用。

你可能感兴趣的鸿蒙文章

harmony 鸿蒙分布式调度子系统ChangeLog

harmony 鸿蒙基础通信WIFI子系统ChangeLog

harmony 鸿蒙元能力子系统ChangeLog

harmony 鸿蒙帐号子系统ChangeLog

harmony 鸿蒙定制子系统ChangeLog

harmony 鸿蒙位置服务子系统ChangeLog

harmony 鸿蒙多媒体子系统ChangeLog

harmony 鸿蒙事件通知子系统ChangeLog

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/685e1dcb4b864785892f01232053ba8a