未验证 提交 85aa6307 编写于 作者: O openharmony_ci 提交者: Gitee

!20749 js接口资料错误码补充以及一致性问题修改

Merge pull request !20749 from lichenchen/master
...@@ -1559,7 +1559,7 @@ setAuthToken(name: string, authType: string, token: string, callback: AsyncCallb ...@@ -1559,7 +1559,7 @@ setAuthToken(name: string, authType: string, token: string, callback: AsyncCallb
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name, authType or token. | | 12300002 | Invalid name, authType or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400004 | The number of token reaches the upper limit. | | 12400004 | The number of tokens reaches the upper limit. |
**示例:** **示例:**
...@@ -1606,7 +1606,7 @@ setAuthToken(name: string, authType: string, token: string): Promise<void> ...@@ -1606,7 +1606,7 @@ setAuthToken(name: string, authType: string, token: string): Promise<void>
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid name, authType or token. | | 12300002 | Invalid name, authType or token. |
| 12300003 | Account not found. | | 12300003 | Account not found. |
| 12400004 | The number of token reaches the upper limit. | | 12400004 | The number of tokens reaches the upper limit. |
**示例:** **示例:**
......
...@@ -630,6 +630,41 @@ checkOsAccountVerified(localId: number): Promise<boolean> ...@@ -630,6 +630,41 @@ checkOsAccountVerified(localId: number): Promise<boolean>
} }
``` ```
### checkOsAccountVerified<sup>9+</sup>
checkOsAccountVerified(): Promise&lt;boolean&gt;
检查当前系统帐号是否已验证。使用Promise异步回调。
**系统能力:** SystemCapability.Account.OsAccount
**返回值:**
| 类型 | 说明 |
| ---------------------- | ----------------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise对象。返回true表示当前帐号已验证;返回false表示当前帐号未验证。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ------------------- |
| 12300001 | System service exception. |
**示例:**
```js
let accountManager = account_osAccount.getAccountManager();
try {
accountManager.checkOsAccountVerified().then((isVerified) => {
console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
}).catch((err) => {
console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
});
} catch (err) {
console.log('checkOsAccountVerified exception: ' + JSON.stringify(err));
}
```
### removeOsAccount ### removeOsAccount
removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
...@@ -1587,7 +1622,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback& ...@@ -1587,7 +1622,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&
| 12300002 | Invalid localName or type. | | 12300002 | Invalid localName or type. |
| 12300005 | Multi-user not supported. | | 12300005 | Multi-user not supported. |
| 12300006 | Unsupported account type. | | 12300006 | Unsupported account type. |
| 12300007 | The number of account reaches the upper limit. | | 12300007 | The number of accounts reaches the upper limit. |
**示例:** **示例:**
...@@ -1636,7 +1671,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf ...@@ -1636,7 +1671,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf
| 12300002 | Invalid localName or type. | | 12300002 | Invalid localName or type. |
| 12300005 | Multi-user not supported. | | 12300005 | Multi-user not supported. |
| 12300006 | Unsupported account type. | | 12300006 | Unsupported account type. |
| 12300007 | The number of account reaches the upper limit. | | 12300007 | The number of accounts reaches the upper limit. |
**示例:** **示例:**
...@@ -1681,7 +1716,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal ...@@ -1681,7 +1716,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
| 12300002 | Invalid type or domainInfo. | | 12300002 | Invalid type or domainInfo. |
| 12300005 | Multi-user not supported. | | 12300005 | Multi-user not supported. |
| 12300006 | Unsupported account type. | | 12300006 | Unsupported account type. |
| 12300007 | The number of account reaches the upper limit. | | 12300007 | The number of accounts reaches the upper limit. |
**示例:** **示例:**
...@@ -1731,7 +1766,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr ...@@ -1731,7 +1766,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
| 12300002 | Invalid type or domainInfo. | | 12300002 | Invalid type or domainInfo. |
| 12300005 | Multi-user not supported. | | 12300005 | Multi-user not supported. |
| 12300006 | Unsupported account type. | | 12300006 | Unsupported account type. |
| 12300007 | The number of account reaches the upper limit. | | 12300007 | The number of accounts reaches the upper limit. |
**示例:** **示例:**
...@@ -4144,8 +4179,10 @@ auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, ...@@ -4144,8 +4179,10 @@ auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel,
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid challenge, authType or authTrustLevel. | | 12300002 | Invalid challenge, authType or authTrustLevel. |
| 12300101 | Credential is incorrect. | | 12300101 | Credential is incorrect. |
| 12300102 | Credential not enrolled. |
| 12300105 | Unsupported authTrustLevel. | | 12300105 | Unsupported authTrustLevel. |
| 12300106 | Unsupported authType. | | 12300106 | Unsupported authType. |
| 12300109 | Authentication is canceled. |
| 12300110 | Authentication is locked. | | 12300110 | Authentication is locked. |
| 12300111 | Authentication timeout. | | 12300111 | Authentication timeout. |
| 12300112 | Authentication service is busy. | | 12300112 | Authentication service is busy. |
...@@ -4203,8 +4240,10 @@ authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLev ...@@ -4203,8 +4240,10 @@ authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLev
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid userId, challenge, authType or authTrustLevel. | | 12300002 | Invalid userId, challenge, authType or authTrustLevel. |
| 12300101 | Credential is incorrect. | | 12300101 | Credential is incorrect. |
| 12300102 | Credential not enrolled. |
| 12300105 | Unsupported authTrustLevel. | | 12300105 | Unsupported authTrustLevel. |
| 12300106 | Unsupported authType. | | 12300106 | Unsupported authType. |
| 12300109 | Authentication is canceled. |
| 12300110 | Authentication is locked. | | 12300110 | Authentication is locked. |
| 12300111 | Authentication timeout. | | 12300111 | Authentication timeout. |
| 12300112 | Authentication service is busy. | | 12300112 | Authentication service is busy. |
...@@ -5354,6 +5393,9 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; ...@@ -5354,6 +5393,9 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
| 12300002 | Invalid credentialInfo, i.e. authType or authSubType. | | 12300002 | Invalid credentialInfo, i.e. authType or authSubType. |
| 12300101 | Token is invalid. | | 12300101 | Token is invalid. |
| 12300106 | Unsupported authType. | | 12300106 | Unsupported authType. |
| 12300109 | Operation is canceled. |
| 12300111 | Operation timeout. |
| 12300115 | The number of credentials reaches the upper limit. |
**示例:** **示例:**
```js ```js
...@@ -5410,7 +5452,10 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; ...@@ -5410,7 +5452,10 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid credentialInfo, i.e. authType or authSubType or token. | | 12300002 | Invalid credentialInfo, i.e. authType or authSubType or token. |
| 12300101 | Token is invalid. | | 12300101 | Token is invalid. |
| 12300102 | Credential not enrolled.|
| 12300106 | Unsupported authType. | | 12300106 | Unsupported authType. |
| 12300109 | Operation is canceled. |
| 12300111 | Operation timeout. |
**示例:** **示例:**
```js ```js
...@@ -5573,7 +5618,7 @@ delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): vo ...@@ -5573,7 +5618,7 @@ delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): vo
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid credentialId. | | 12300002 | Invalid credentialId. |
| 12300101 | Token is invalid. | | 12300101 | Token is invalid. |
| 12300102 | Credential not found. | | 12300102 | Credential not enrolled. |
**示例:** **示例:**
```js ```js
...@@ -5615,6 +5660,7 @@ getAuthInfo(callback: AsyncCallback&lt;Array&lt;EnrolledCredInfo&gt;&gt;): void; ...@@ -5615,6 +5660,7 @@ getAuthInfo(callback: AsyncCallback&lt;Array&lt;EnrolledCredInfo&gt;&gt;): void;
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | --------------------- | | -------- | --------------------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300102 | Credential not enrolled. |
**示例:** **示例:**
```js ```js
...@@ -5654,6 +5700,7 @@ getAuthInfo(authType: AuthType, callback: AsyncCallback&lt;Array&lt;EnrolledCred ...@@ -5654,6 +5700,7 @@ getAuthInfo(authType: AuthType, callback: AsyncCallback&lt;Array&lt;EnrolledCred
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid authType. | | 12300002 | Invalid authType. |
| 12300102 | Credential not enrolled. |
**示例:** **示例:**
```js ```js
...@@ -5698,6 +5745,7 @@ getAuthInfo(authType?: AuthType): Promise&lt;Array&lt;EnrolledCredInfo&gt;&gt;; ...@@ -5698,6 +5745,7 @@ getAuthInfo(authType?: AuthType): Promise&lt;Array&lt;EnrolledCredInfo&gt;&gt;;
| -------- | ------------------- | | -------- | ------------------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300002 | Invalid authType. | | 12300002 | Invalid authType. |
| 12300102 | Credential not enrolled. |
**示例:** **示例:**
```js ```js
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册