提交 4817c383 编写于 作者: W wangyihui

add domain auth

Signed-off-by: Nwangyihui <wangyihui16@huawei.com>
Change-Id: I9adfa88329be083db9b163a27ff4142046a30463
上级 b4ac624a
...@@ -4243,7 +4243,7 @@ cancelAuth(contextID: Uint8Array): void; ...@@ -4243,7 +4243,7 @@ cancelAuth(contextID: Uint8Array): void;
## PINAuth<sup>8+</sup> ## PINAuth<sup>8+</sup>
Pin码认证功能基类。 PIN码认证基类。
**系统接口:** 此接口为系统接口。 **系统接口:** 此接口为系统接口。
...@@ -4251,7 +4251,7 @@ Pin码认证功能基类。 ...@@ -4251,7 +4251,7 @@ Pin码认证功能基类。
constructor() constructor()
创建Pin码认证的实例。 创建PIN码认证的实例。
**系统接口:** 此接口为系统接口。 **系统接口:** 此接口为系统接口。
...@@ -4280,17 +4280,12 @@ registerInputer(inputer: IInputer): void; ...@@ -4280,17 +4280,12 @@ registerInputer(inputer: IInputer): void;
| ----------| ----------------------- | --- | -------------------------- | | ----------| ----------------------- | --- | -------------------------- |
| inputer | [IInputer](#iinputer8) | 是 | PIN码输入器,用于获取PIN码。 | | inputer | [IInputer](#iinputer8) | 是 | PIN码输入器,用于获取PIN码。 |
**返回值:**
| 类型 | 说明 |
| :------ | :-------------------------------------------- |
| boolean | 返回布尔值,true表示注册成功,false表示注册失败。 |
**错误码:** **错误码:**
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | --------------------------- | | -------- | --------------------------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300102 | Invalid inputer. |
| 12300103 | Inputer already registered. | | 12300103 | Inputer already registered. |
**示例:** **示例:**
...@@ -4299,8 +4294,8 @@ registerInputer(inputer: IInputer): void; ...@@ -4299,8 +4294,8 @@ registerInputer(inputer: IInputer): void;
let password = new Uint8Array([0, 0, 0, 0, 0]); let password = new Uint8Array([0, 0, 0, 0, 0]);
try { try {
let result = pinAuth.registerInputer({ let result = pinAuth.registerInputer({
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
}); });
console.log('registerInputer result = ' + result); console.log('registerInputer result = ' + result);
...@@ -4327,6 +4322,91 @@ unregisterInputer(): void; ...@@ -4327,6 +4322,91 @@ unregisterInputer(): void;
pinAuth.unregisterInputer(); pinAuth.unregisterInputer();
``` ```
### InputerManager <sup>10+</sup>
凭据输入管理器。
### registerInputer<sup>10+</sup>
registerInputer(authType: AuthType, inputer: IInputer): void;
注册凭据输入器。
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.Account.OsAccount
**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL 或 ohos.permission.MANAGE_USER_IDM
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------| ----------------------- | --- | -------------------------- |
| authType | [AuthType](#authtype8) | 是 | 认证类型。 |
| inputer | [IInputer](#iinputer8) | 是 | 凭据输入器,用于获取凭据。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | --------------------------- |
| 12300001 | System service exception. |
| 12300102 | Invalid authType or inputer. |
| 12300103 | The credential inputer has been registered. |
| 12300106 | Unsupported authType. |
**示例:**
```js
let inputerMgr = new account_osAccount.InputerManager();
let authType = account_osAccount.AuthType.DOMAIN;
let password = new Uint8Array([0, 0, 0, 0, 0]);
try {
InputerMgr.registerInputer(authType, {
onGetData: (authSubType, callback) => {
callback.onSetData(authSubType, password);
}
});
console.log('registerInputer success.');
} catch (e) {
console.log('registerInputer exception = ' + JSON.stringify(e));
}
```
### unregisterInputer<sup>10+</sup>
unregisterInputer(authType: AuthType): void;
解注册凭据输入器。
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.Account.OsAccount
**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL 或 ohos.permission.MANAGE_USER_IDM
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------| ----------------------- | --- | -------------------------- |
| authType | [AuthType](#authtype8) | 是 | 认证类型。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | --------------------------- |
| 12300002 | Invalid authType. |
**示例:**
```js
let inputerMgr = new account_osAccount.InputerManager();
let authType = account_osAccount.AuthType.DOMAIN;
try {
inputerMgr.unregisterInputer(authType);
console.log('unregisterInputer success.');
} catch(err) {
console.log("unregisterInputer err:" + JSON.stringify(err));
}
```
## UserIdentityManager<sup>8+</sup> ## UserIdentityManager<sup>8+</sup>
获取用户身份管理类。 获取用户身份管理类。
...@@ -4456,8 +4536,8 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; ...@@ -4456,8 +4536,8 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
let password = new Uint8Array([0, 0, 0, 0, 0, 0]); let password = new Uint8Array([0, 0, 0, 0, 0, 0]);
let pinAuth = new account_osAccount.PINAuth(); let pinAuth = new account_osAccount.PINAuth();
pinAuth.registerInputer({ pinAuth.registerInputer({
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
}); });
let credentialInfo = { let credentialInfo = {
...@@ -4470,12 +4550,12 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; ...@@ -4470,12 +4550,12 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
try { try {
userIDM.addCredential(credentialInfo, { userIDM.addCredential(credentialInfo, {
onResult: (result, extraInfo) => { onResult: (result, extraInfo) => {
console.log('updateCredential result = ' + result); console.log('addCredential result = ' + result);
console.log('updateCredential extraInfo = ' + extraInfo); console.log('addCredential extraInfo = ' + extraInfo);
} }
}); });
} catch (e) { } catch (e) {
console.log('updateCredential exception = ' + JSON.stringify(e)); console.log('addCredential exception = ' + JSON.stringify(e));
} }
}); });
``` ```
...@@ -4520,8 +4600,8 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; ...@@ -4520,8 +4600,8 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
token: null token: null
}; };
pinAuth.registerInputer({ pinAuth.registerInputer({
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
}); });
userIDM.openSession((err, challenge) => { userIDM.openSession((err, challenge) => {
...@@ -4820,7 +4900,7 @@ getAuthInfo(authType?: AuthType): Promise&lt;Array&lt;EnrolledCredInfo&gt;&gt;; ...@@ -4820,7 +4900,7 @@ getAuthInfo(authType?: AuthType): Promise&lt;Array&lt;EnrolledCredInfo&gt;&gt;;
### onSetData<sup>8+</sup> ### onSetData<sup>8+</sup>
onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void; onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
**系统接口:** 此接口为系统接口。 **系统接口:** 此接口为系统接口。
...@@ -4832,7 +4912,7 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void; ...@@ -4832,7 +4912,7 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------------------- | ---- | ----------------------------------------------- | | ---------- | ---------------------------------------- | ---- | ----------------------------------------------- |
| pinSubType | [AuthSubType](#authsubtype8) | 是 | 用于认证的凭据子类型。 | | authSubType | [AuthSubType](#authsubtype8) | 是 | 用于认证的凭据子类型。 |
| data | Uint8Array | 是 | 要设置的数据是凭据,用来在认证、添加、修改凭据操作。 | | data | Uint8Array | 是 | 要设置的数据是凭据,用来在认证、添加、修改凭据操作。 |
**示例:** **示例:**
...@@ -4840,11 +4920,11 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void; ...@@ -4840,11 +4920,11 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
let password = new Uint8Array([0, 0, 0, 0, 0, 0]); let password = new Uint8Array([0, 0, 0, 0, 0, 0]);
let passwordNumber = new Uint8Array([1, 2, 3, 4]); let passwordNumber = new Uint8Array([1, 2, 3, 4]);
let inputer = { let inputer = {
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
if (pinSubType == account_osAccount.AuthSubType.PIN_NUMBER) { if (authSubType == account_osAccount.AuthSubType.PIN_NUMBER) {
callback.onSetData(pinSubType, passwordNumber); callback.onSetData(authSubType, passwordNumber);
} else { } else {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
} }
}; };
...@@ -4852,13 +4932,13 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void; ...@@ -4852,13 +4932,13 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
## IInputer<sup>8+</sup> ## IInputer<sup>8+</sup>
密码输入框回调。 凭据输入器回调。
**系统接口:** 此接口为系统接口。 **系统接口:** 此接口为系统接口。
### onGetData<sup>8+</sup> ### onGetData<sup>8+</sup>
onGetData: (pinSubType: AuthSubType, callback: IInputData) => void; onGetData: (authSubType: AuthSubType, callback: IInputData) => void;
通知获取数据。 通知获取数据。
...@@ -4877,11 +4957,11 @@ onGetData: (pinSubType: AuthSubType, callback: IInputData) => void; ...@@ -4877,11 +4957,11 @@ onGetData: (pinSubType: AuthSubType, callback: IInputData) => void;
let password = new Uint8Array([0, 0, 0, 0, 0, 0]); let password = new Uint8Array([0, 0, 0, 0, 0, 0]);
let passwordNumber = new Uint8Array([1, 2, 3, 4]); let passwordNumber = new Uint8Array([1, 2, 3, 4]);
let inputer = { let inputer = {
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
if (pinSubType == account_osAccount.AuthSubType.PIN_NUMBER) { if (authSubType == account_osAccount.AuthSubType.PIN_NUMBER) {
callback.onSetData(pinSubType, passwordNumber); callback.onSetData(authSubType, passwordNumber);
} else { } else {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
} }
}; };
...@@ -5155,8 +5235,10 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; ...@@ -5155,8 +5235,10 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
| 名称 | 值 | 说明 | | 名称 | 值 | 说明 |
| ----- | ----- | ---------------- | | ----- | ----- | ---------------- |
| PIN | 1 | 指示PIN认证类型。 | | PIN | 1 | 表示PIN认证类型。 |
| FACE | 2 | 指示脸部认证类型。| | FACE | 2 | 表示脸部认证类型。|
| FINGERPRINT<sup>10+</sup> | 4 | 表示指纹认证类型。 |
| DOMAIN<sup>10+</sup> | 1024 | 表示域认证类型。|
## AuthSubType<sup>8+</sup> ## AuthSubType<sup>8+</sup>
...@@ -5171,8 +5253,9 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; ...@@ -5171,8 +5253,9 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
| PIN_SIX | 10000 | 表示6位凭证。 | | PIN_SIX | 10000 | 表示6位凭证。 |
| PIN_NUMBER | 10001 | 表示自定义数字凭证。 | | PIN_NUMBER | 10001 | 表示自定义数字凭证。 |
| PIN_MIXED | 10002 | 表示自定义混合凭据。 | | PIN_MIXED | 10002 | 表示自定义混合凭据。 |
| FACE_2D | 20000 | 指示2D 人脸凭证。 | | FACE_2D | 20000 | 表示2D 人脸凭证。 |
| FACE_3D | 20001 | 指示3D 人脸凭证。 | | FACE_3D | 20001 | 表示3D 人脸凭证。 |
| DOMAIN_MIXED<sup>10+</sup> | 10240001 | 表示域认证混合凭证。 |
## AuthTrustLevel<sup>8+</sup> ## AuthTrustLevel<sup>8+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册