提交 0b01b141 编写于 作者: J jidong

add new api docs

Signed-off-by: Njidong <jidong4@huawei.com>
Change-Id: I6912add9f419eba07707377d46b08a926bc2077a
上级 8c99526d
...@@ -1114,8 +1114,6 @@ getAllAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void ...@@ -1114,8 +1114,6 @@ getAllAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
获取所有可访问的应用帐号信息。使用callback异步回调。 获取所有可访问的应用帐号信息。使用callback异步回调。
**需要权限:** ohos.permission.GET_ALL_APP_ACCOUNTS。
**系统能力:** SystemCapability.Account.AppAccount **系统能力:** SystemCapability.Account.AppAccount
**参数:** **参数:**
...@@ -1153,8 +1151,6 @@ getAllAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt; ...@@ -1153,8 +1151,6 @@ getAllAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
获取所有可访问的应用帐号信息。使用Promise异步回调。 获取所有可访问的应用帐号信息。使用Promise异步回调。
**需要权限:** ohos.permission.GET_ALL_APP_ACCOUNTS。
**系统能力:** SystemCapability.Account.AppAccount **系统能力:** SystemCapability.Account.AppAccount
**返回值:** **返回值:**
...@@ -1190,8 +1186,6 @@ getAccountsByOwner(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccount ...@@ -1190,8 +1186,6 @@ getAccountsByOwner(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccount
根据应用帐号所有者获取调用方可访问的应用帐号列表。使用callback异步回调。 根据应用帐号所有者获取调用方可访问的应用帐号列表。使用callback异步回调。
**需要权限:** ohos.permission.GET_ALL_APP_ACCOUNTS。
**系统能力:** SystemCapability.Account.AppAccount **系统能力:** SystemCapability.Account.AppAccount
**参数:** **参数:**
...@@ -1232,8 +1226,6 @@ getAccountsByOwner(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt; ...@@ -1232,8 +1226,6 @@ getAccountsByOwner(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
根据应用帐号所有者获取调用方可访问的应用帐号列表。使用Promise异步回调。 根据应用帐号所有者获取调用方可访问的应用帐号列表。使用Promise异步回调。
**需要权限:** ohos.permission.GET_ALL_APP_ACCOUNTS。
**系统能力:** SystemCapability.Account.AppAccount **系统能力:** SystemCapability.Account.AppAccount
**参数:** **参数:**
...@@ -1312,7 +1304,7 @@ on(type: 'accountChange', owners: Array&lt;string&gt;, callback: Callback&lt;Arr ...@@ -1312,7 +1304,7 @@ on(type: 'accountChange', owners: Array&lt;string&gt;, callback: Callback&lt;Arr
### off('accountChange')<sup>9+</sup> ### off('accountChange')<sup>9+</sup>
off(type: 'accountChange', callback?: Callback<Array\<AppAccountInfo>>): void off(type: 'accountChange', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
取消订阅帐号信息变更事件。 取消订阅帐号信息变更事件。
...@@ -1323,7 +1315,7 @@ off(type: 'accountChange', callback?: Callback<Array\<AppAccountInfo>>): void ...@@ -1323,7 +1315,7 @@ off(type: 'accountChange', callback?: Callback<Array\<AppAccountInfo>>): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------- | ---- | ------------ | | -------- | -------------------------------- | ---- | ------------ |
| type | 'accountChange' | 是 | 事件回调类型,支持的事件为'accountChange',当帐号所有者更新帐号信息时,触发该事件。 | | type | 'accountChange' | 是 | 事件回调类型,支持的事件为'accountChange',当帐号所有者更新帐号信息时,触发该事件。 |
| callback | Callback<Array\<[AppAccountInfo](#appaccountinfo)>> | 否 | 回调函数,返回信息发生变更的应用帐号列表。 | | callback | Callback&lt;Array&lt;[AppAccountInfo](#appaccountinfo)&gt;&gt; | 否 | 回调函数,返回信息发生变更的应用帐号列表。 |
**错误码:** **错误码:**
...@@ -1337,7 +1329,7 @@ off(type: 'accountChange', callback?: Callback<Array\<AppAccountInfo>>): void ...@@ -1337,7 +1329,7 @@ off(type: 'accountChange', callback?: Callback<Array\<AppAccountInfo>>): void
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager(); let appAccountManager = account_appAccount.createAppAccountManager();
function changeOnCallback(data){ function changeOnCallback(data) {
console.log("receive change data:" + JSON.stringify(data)); console.log("receive change data:" + JSON.stringify(data));
} }
try{ try{
...@@ -3790,7 +3782,7 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A ...@@ -3790,7 +3782,7 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A
### off('change')<sup>(deprecated)</sup> ### off('change')<sup>(deprecated)</sup>
off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void off(type: 'change', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
取消订阅帐号信息变更事件。 取消订阅帐号信息变更事件。
...@@ -3805,7 +3797,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void ...@@ -3805,7 +3797,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------- | ---- | ------------ | | -------- | -------------------------------- | ---- | ------------ |
| type | 'change' | 是 | 事件回调类型,支持的事件为'change',当帐号所有者更新帐号信息时,触发该事件。 | | type | 'change' | 是 | 事件回调类型,支持的事件为'change',当帐号所有者更新帐号信息时,触发该事件。 |
| callback | Callback<Array\<[AppAccountInfo](#appaccountinfo)>> | 否 | 回调函数,返回信息发生变更的应用帐号列表。 | | callback | Callback&lt;Array&lt;[AppAccountInfo](#appaccountinfo)&gt;&gt; | 否 | 回调函数,返回信息发生变更的应用帐号列表。 |
**示例:** **示例:**
......
...@@ -4323,13 +4323,13 @@ unregisterInputer(): void; ...@@ -4323,13 +4323,13 @@ unregisterInputer(): void;
pinAuth.unregisterInputer(); pinAuth.unregisterInputer();
``` ```
### InputerManager <sup>10+</sup> ## InputerManager <sup>9+</sup>
凭据输入管理器。 凭据输入管理器。
### registerInputer<sup>10+</sup> ### registerInputer<sup>9+</sup>
registerInputer(authType: AuthType, inputer: IInputer): void; static registerInputer(authType: AuthType, inputer: IInputer): void
注册凭据输入器。 注册凭据输入器。
...@@ -4357,11 +4357,10 @@ registerInputer(authType: AuthType, inputer: IInputer): void; ...@@ -4357,11 +4357,10 @@ registerInputer(authType: AuthType, inputer: IInputer): void;
**示例:** **示例:**
```js ```js
let inputerMgr = new account_osAccount.InputerManager();
let authType = account_osAccount.AuthType.DOMAIN; let authType = account_osAccount.AuthType.DOMAIN;
let password = new Uint8Array([0, 0, 0, 0, 0]); let password = new Uint8Array([0, 0, 0, 0, 0]);
try { try {
inputerMgr.registerInputer(authType, { account_osAccount.InputerManager.registerInputer(authType, {
onGetData: (authSubType, callback) => { onGetData: (authSubType, callback) => {
callback.onSetData(authSubType, password); callback.onSetData(authSubType, password);
} }
...@@ -4372,9 +4371,9 @@ registerInputer(authType: AuthType, inputer: IInputer): void; ...@@ -4372,9 +4371,9 @@ registerInputer(authType: AuthType, inputer: IInputer): void;
} }
``` ```
### unregisterInputer<sup>10+</sup> ### unregisterInputer<sup>9+</sup>
unregisterInputer(authType: AuthType): void; static unregisterInputer(authType: AuthType): void
解注册凭据输入器。 解注册凭据输入器。
...@@ -4398,16 +4397,129 @@ unregisterInputer(authType: AuthType): void; ...@@ -4398,16 +4397,129 @@ unregisterInputer(authType: AuthType): void;
**示例:** **示例:**
```js ```js
let inputerMgr = new account_osAccount.InputerManager();
let authType = account_osAccount.AuthType.DOMAIN; let authType = account_osAccount.AuthType.DOMAIN;
try { try {
inputerMgr.unregisterInputer(authType); account_osAccount.InputerManager.unregisterInputer(authType);
console.log('unregisterInputer success.'); console.log('unregisterInputer success.');
} catch(err) { } catch(err) {
console.log("unregisterInputer err:" + JSON.stringify(err)); console.log("unregisterInputer err:" + JSON.stringify(err));
} }
``` ```
## DomainPlugin<sup>9+</sup>
域插件,提供域帐号认证功能。
**系统接口:** 此接口为系统接口。
### auth<sup>9+</sup>
auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void
认证指定的域帐号。
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | --------------------------------------- | ---- | --------------- |
| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。|
| credential | Uint8Array | 是 | 指示域帐号的凭据。|
| callback | [IUserAuthCallback](#iuserauthcallback8) | 是 | 指示认证结果回调。|
**示例:**
```js
let plugin = {
auth: (domainInfo, credential, callback) => {
// mock authentication
callback.onResult(0, {});
}
}
account_osAccount.DomainAccountManager.registerPlugin(plugin);
let userAuth = new account_osAccount.UserAuth();
let challenge = new Uint8Array([0]);
let authType = account_osAccount.AuthType.PIN;
let authTrustLevel = account_osAccount.AuthTrustLevel.ATL1;
try {
userAuth.auth(challenge, authType, authTrustLevel, {
onResult: (resultCode, authResult) => {
console.log('auth resultCode = ' + resultCode);
console.log('auth authResult = ' + JSON.stringify(authResult));
}
});
} catch (err) {
console.log('auth exception = ' + JSON.stringify(err));
}
```
## DomainAccountManager <sup>9+</sup>
域帐号管理器类。
### registerPlugin<sup>9+</sup>
static registerPlugin(plugin: DomainPlugin): void
注册域插件。
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.Account.OsAccount
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------| ----------------------- | --- | -------------------------- |
| plugin | [DomainPlugin](#domainplugin9) | 是 | 指示域插件。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | --------------------------- |
| 12300201 | The domain plugin has been registered. |
**示例:**
```js
let plugin = {
auth: (domainInfo, credential, callback) => {
// mock authentication
callback.onResult(0, {});
}
}
try {
account_osAccount.DomainAccountManager.registerPlugin(plugin);
console.log('registerPlugin success.');
} catch(err) {
console.log("registerPlugin err:" + JSON.stringify(err));
}
```
### unregisterPlugin<sup>9+</sup>
static unregisterPlugin(): void
注销域插件。
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.Account.OsAccount
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**示例:**
```js
try {
account_osAccount.DomainAccountManager.unregisterPlugin();
console.log('unregisterPlugin success.');
} catch(err) {
console.log("unregisterPlugin err:" + JSON.stringify(err));
}
```
## UserIdentityManager<sup>8+</sup> ## UserIdentityManager<sup>8+</sup>
获取用户身份管理类。 获取用户身份管理类。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册