1e41f4b71Sopenharmony_ci# @ohos.bundle.appDomainVerify (Application Domain Name Verification) (System API)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe appDomainVerify module provides APIs to query the mappings between applications and domain names for the purposes of application domain name verification.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> The initial APIs of this module are supported since API version 13. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Modules to Import
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci```ts
12e41f4b71Sopenharmony_ciimport { appDomainVerify } from '@kit.AbilityKit';
13e41f4b71Sopenharmony_ci```
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## Required Permissions
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci| Permission                                   | APL   | Description            |
18e41f4b71Sopenharmony_ci| --------------------------------------- | ----------- | ---------------- |
19e41f4b71Sopenharmony_ci| ohos.permission.GET_APP_DOMAIN_BUNDLE_INFO | system_basic | Allows an application to access the mappings between applications and domain names.|
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ciFor details about the APL, see [Basic Concepts in the Permission Mechanism](../../security/AccessToken/app-permission-mgmt-overview.md#basic-concepts-in-the-permission-mechanism).
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci## appDomainVerify.queryAssociatedDomains
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ciqueryAssociatedDomains(bundleName: string): string[]
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ciQueries the list of domain names associated with an application based on its bundle name.
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_APP_DOMAIN_BUNDLE_INFO
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.AppDomainVerify
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci**System API**: This is a system API.
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci**Parameters**
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci| Name        | Type    | Mandatory  | Description                                     |
38e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | --------------------------------------- |
39e41f4b71Sopenharmony_ci| bundleName  | string | Yes   | Bundle name of the application.      |
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci**Returns**
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci| Type                       | Description                |
44e41f4b71Sopenharmony_ci| ------------------------- | ------------------ |
45e41f4b71Sopenharmony_ci| string[] | List of domain names associated with the bundle name. If no domain name is associated, an empty array is returned.|
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci**Error codes**
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Application Domain Name Verification Error Codes](errorcode-appDomainVerify.md.md).
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci| ID| Error Message                                 |
52e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- |
53e41f4b71Sopenharmony_ci| 201 | Permission denied. |
54e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
55e41f4b71Sopenharmony_ci| 401 | Parameter error.|
56e41f4b71Sopenharmony_ci| 29900001 | System internal error. |
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci**Example**
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ci```ts
61e41f4b71Sopenharmony_ciimport { appDomainVerify } from '@kit.AbilityKit';
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci// Obtain the list of domain names associated with the bundle name "com.example.app1".
64e41f4b71Sopenharmony_cilet bundleName = "com.example.app1";
65e41f4b71Sopenharmony_cilet domains = appDomainVerify.queryAssociatedDomains(bundleName);
66e41f4b71Sopenharmony_cidomains.forEach(domain => {
67e41f4b71Sopenharmony_ci  console.log(`app:${bundleName} associate with domain:${domain}`);
68e41f4b71Sopenharmony_ci});
69e41f4b71Sopenharmony_ci```
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci## appDomainVerify.queryAssociatedBundleNames
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ciqueryAssociatedBundleNames(domain: string): string[]
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ciObtains the list of bundle names associated with a domain name.
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_APP_DOMAIN_BUNDLE_INFO
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.AppDomainVerify
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci**System API**: This is a system API.
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci**Parameters**
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci| Name        | Type    | Mandatory  | Description                                     |
86e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | --------------------------------------- |
87e41f4b71Sopenharmony_ci| domain  | string | Yes   | Domain name.      |
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci**Returns**
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci| Type                       | Description                |
92e41f4b71Sopenharmony_ci| ------------------------- | ------------------ |
93e41f4b71Sopenharmony_ci| string[] | List of bundle names associated with the domain name. If no application is associated, an empty array is returned.|
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci**Error codes**
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Application Domain Name Verification Error Codes](errorcode-appDomainVerify.md.md).
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci| ID| Error Message                                 |
100e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- |
101e41f4b71Sopenharmony_ci| 201 | Permission denied. |
102e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
103e41f4b71Sopenharmony_ci| 401 | Parameter error.|
104e41f4b71Sopenharmony_ci| 29900001 | System internal error. |
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci**Example**
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci```ts
109e41f4b71Sopenharmony_ciimport { appDomainVerify } from '@kit.AbilityKit';
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci// Obtain the list of bundle names associated with the domain name "example.com".
112e41f4b71Sopenharmony_cilet domain = "example.com";
113e41f4b71Sopenharmony_cilet bundleNames = appDomainVerify.queryAssociatedBundleNames(domain);
114e41f4b71Sopenharmony_cibundleNames.forEach(bundleName => {
115e41f4b71Sopenharmony_ci  console.log(`domain:${domain} associate with app:${bundleName}`);
116e41f4b71Sopenharmony_ci});
117e41f4b71Sopenharmony_ci```
118