161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit DataProtectionKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport type { AsyncCallback, Callback } from './@ohos.base';
2261847f8eSopenharmony_ciimport type common from './@ohos.app.ability.common';
2361847f8eSopenharmony_ciimport type Want from './@ohos.app.ability.Want';
2461847f8eSopenharmony_ci
2561847f8eSopenharmony_ci/**
2661847f8eSopenharmony_ci * Provides the capability to access the data loss prevention (DLP) files.
2761847f8eSopenharmony_ci *
2861847f8eSopenharmony_ci * @namespace dlpPermission
2961847f8eSopenharmony_ci * @syscap SystemCapability.Security.DataLossPrevention
3061847f8eSopenharmony_ci * @since 10
3161847f8eSopenharmony_ci */
3261847f8eSopenharmony_cideclare namespace dlpPermission {
3361847f8eSopenharmony_ci  /**
3461847f8eSopenharmony_ci   * Enumerates the types of actions that can be performed on a DLP file.
3561847f8eSopenharmony_ci   *
3661847f8eSopenharmony_ci   * @enum { number }
3761847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
3861847f8eSopenharmony_ci   * @since 10
3961847f8eSopenharmony_ci   */
4061847f8eSopenharmony_ci  export enum ActionFlagType {
4161847f8eSopenharmony_ci    /**
4261847f8eSopenharmony_ci     * View a DLP file.
4361847f8eSopenharmony_ci     *
4461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
4561847f8eSopenharmony_ci     * @since 10
4661847f8eSopenharmony_ci     */
4761847f8eSopenharmony_ci    ACTION_VIEW = 0x00000001,
4861847f8eSopenharmony_ci
4961847f8eSopenharmony_ci    /**
5061847f8eSopenharmony_ci     * Save a DLP file.
5161847f8eSopenharmony_ci     *
5261847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
5361847f8eSopenharmony_ci     * @since 10
5461847f8eSopenharmony_ci     */
5561847f8eSopenharmony_ci    ACTION_SAVE = 0x00000002,
5661847f8eSopenharmony_ci
5761847f8eSopenharmony_ci    /**
5861847f8eSopenharmony_ci     * Save a DLP file as another file.
5961847f8eSopenharmony_ci     *
6061847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
6161847f8eSopenharmony_ci     * @since 10
6261847f8eSopenharmony_ci     */
6361847f8eSopenharmony_ci    ACTION_SAVE_AS = 0x00000004,
6461847f8eSopenharmony_ci
6561847f8eSopenharmony_ci    /**
6661847f8eSopenharmony_ci     * Edit a DLP file.
6761847f8eSopenharmony_ci     *
6861847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
6961847f8eSopenharmony_ci     * @since 10
7061847f8eSopenharmony_ci     */
7161847f8eSopenharmony_ci    ACTION_EDIT = 0x00000008,
7261847f8eSopenharmony_ci
7361847f8eSopenharmony_ci    /**
7461847f8eSopenharmony_ci     * Take a screenshot of a DLP file.
7561847f8eSopenharmony_ci     *
7661847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
7761847f8eSopenharmony_ci     * @since 10
7861847f8eSopenharmony_ci     */
7961847f8eSopenharmony_ci    ACTION_SCREEN_CAPTURE = 0x00000010,
8061847f8eSopenharmony_ci
8161847f8eSopenharmony_ci    /**
8261847f8eSopenharmony_ci     * Share the screen, on which a DLP file is opened.
8361847f8eSopenharmony_ci     *
8461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
8561847f8eSopenharmony_ci     * @since 10
8661847f8eSopenharmony_ci     */
8761847f8eSopenharmony_ci    ACTION_SCREEN_SHARE = 0x00000020,
8861847f8eSopenharmony_ci
8961847f8eSopenharmony_ci    /**
9061847f8eSopenharmony_ci     * Record the screen, on which a DLP file is opened.
9161847f8eSopenharmony_ci     *
9261847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
9361847f8eSopenharmony_ci     * @since 10
9461847f8eSopenharmony_ci     */
9561847f8eSopenharmony_ci    ACTION_SCREEN_RECORD = 0x00000040,
9661847f8eSopenharmony_ci
9761847f8eSopenharmony_ci    /**
9861847f8eSopenharmony_ci     * Copy in the editor, on which a DLP file is opened.
9961847f8eSopenharmony_ci     *
10061847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
10161847f8eSopenharmony_ci     * @since 10
10261847f8eSopenharmony_ci     */
10361847f8eSopenharmony_ci    ACTION_COPY = 0x00000080,
10461847f8eSopenharmony_ci
10561847f8eSopenharmony_ci    /**
10661847f8eSopenharmony_ci     * Print a DLP file.
10761847f8eSopenharmony_ci     *
10861847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
10961847f8eSopenharmony_ci     * @since 10
11061847f8eSopenharmony_ci     */
11161847f8eSopenharmony_ci    ACTION_PRINT = 0x00000100,
11261847f8eSopenharmony_ci
11361847f8eSopenharmony_ci    /**
11461847f8eSopenharmony_ci     * Export a DLP file.
11561847f8eSopenharmony_ci     *
11661847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
11761847f8eSopenharmony_ci     * @since 10
11861847f8eSopenharmony_ci     */
11961847f8eSopenharmony_ci    ACTION_EXPORT = 0x00000200,
12061847f8eSopenharmony_ci
12161847f8eSopenharmony_ci    /**
12261847f8eSopenharmony_ci     * Change the permissions for a DLP file.
12361847f8eSopenharmony_ci     *
12461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
12561847f8eSopenharmony_ci     * @since 10
12661847f8eSopenharmony_ci     */
12761847f8eSopenharmony_ci    ACTION_PERMISSION_CHANGE = 0x00000400
12861847f8eSopenharmony_ci  }
12961847f8eSopenharmony_ci
13061847f8eSopenharmony_ci  /**
13161847f8eSopenharmony_ci   * Enumerates the access permissions for a DLP file.
13261847f8eSopenharmony_ci   *
13361847f8eSopenharmony_ci   * @enum { number }
13461847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
13561847f8eSopenharmony_ci   * @since 10
13661847f8eSopenharmony_ci   */
13761847f8eSopenharmony_ci  export enum DLPFileAccess {
13861847f8eSopenharmony_ci    /**
13961847f8eSopenharmony_ci     * No permission.
14061847f8eSopenharmony_ci     *
14161847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
14261847f8eSopenharmony_ci     * @since 10
14361847f8eSopenharmony_ci     */
14461847f8eSopenharmony_ci    NO_PERMISSION = 0,
14561847f8eSopenharmony_ci
14661847f8eSopenharmony_ci    /**
14761847f8eSopenharmony_ci     * Read-only.
14861847f8eSopenharmony_ci     *
14961847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
15061847f8eSopenharmony_ci     * @since 10
15161847f8eSopenharmony_ci     */
15261847f8eSopenharmony_ci    READ_ONLY = 1,
15361847f8eSopenharmony_ci
15461847f8eSopenharmony_ci    /**
15561847f8eSopenharmony_ci     * Edit.
15661847f8eSopenharmony_ci     *
15761847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
15861847f8eSopenharmony_ci     * @since 10
15961847f8eSopenharmony_ci     */
16061847f8eSopenharmony_ci    CONTENT_EDIT = 2,
16161847f8eSopenharmony_ci
16261847f8eSopenharmony_ci    /**
16361847f8eSopenharmony_ci     * Full control.
16461847f8eSopenharmony_ci     *
16561847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
16661847f8eSopenharmony_ci     * @since 10
16761847f8eSopenharmony_ci     */
16861847f8eSopenharmony_ci    FULL_CONTROL = 3
16961847f8eSopenharmony_ci  }
17061847f8eSopenharmony_ci
17161847f8eSopenharmony_ci  /**
17261847f8eSopenharmony_ci   * Represents the permission info of a DLP file.
17361847f8eSopenharmony_ci   *
17461847f8eSopenharmony_ci   * @interface DLPPermissionInfo
17561847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
17661847f8eSopenharmony_ci   * @since 10
17761847f8eSopenharmony_ci   */
17861847f8eSopenharmony_ci  export interface DLPPermissionInfo {
17961847f8eSopenharmony_ci    /**
18061847f8eSopenharmony_ci     * Access permission for the DLP file.
18161847f8eSopenharmony_ci     *
18261847f8eSopenharmony_ci     * @type { DLPFileAccess }
18361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
18461847f8eSopenharmony_ci     * @since 10
18561847f8eSopenharmony_ci     */
18661847f8eSopenharmony_ci    dlpFileAccess: DLPFileAccess;
18761847f8eSopenharmony_ci
18861847f8eSopenharmony_ci    /**
18961847f8eSopenharmony_ci     * Actions allowed for the DLP file. The value is a combination of flags in {@link ActionFlagType}.
19061847f8eSopenharmony_ci     *
19161847f8eSopenharmony_ci     * @type { number }
19261847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
19361847f8eSopenharmony_ci     * @since 10
19461847f8eSopenharmony_ci     */
19561847f8eSopenharmony_ci    flags: number;
19661847f8eSopenharmony_ci  }
19761847f8eSopenharmony_ci
19861847f8eSopenharmony_ci  /**
19961847f8eSopenharmony_ci   * Represents the accessed DLP file info.
20061847f8eSopenharmony_ci   *
20161847f8eSopenharmony_ci   * @interface AccessedDLPFileInfo
20261847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
20361847f8eSopenharmony_ci   * @since 10
20461847f8eSopenharmony_ci   */
20561847f8eSopenharmony_ci  export interface AccessedDLPFileInfo {
20661847f8eSopenharmony_ci    /**
20761847f8eSopenharmony_ci     * URI of the DLP file.
20861847f8eSopenharmony_ci     *
20961847f8eSopenharmony_ci     * @type { string }
21061847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
21161847f8eSopenharmony_ci     * @since 10
21261847f8eSopenharmony_ci     */
21361847f8eSopenharmony_ci    uri: string;
21461847f8eSopenharmony_ci
21561847f8eSopenharmony_ci    /**
21661847f8eSopenharmony_ci     * Time when the DLP file was last opened.
21761847f8eSopenharmony_ci     *
21861847f8eSopenharmony_ci     * @type { number }
21961847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
22061847f8eSopenharmony_ci     * @since 10
22161847f8eSopenharmony_ci     */
22261847f8eSopenharmony_ci    lastOpenTime: number;
22361847f8eSopenharmony_ci  }
22461847f8eSopenharmony_ci
22561847f8eSopenharmony_ci  /**
22661847f8eSopenharmony_ci   * Represents the retention sandbox info.
22761847f8eSopenharmony_ci   *
22861847f8eSopenharmony_ci   * @interface RetentionSandboxInfo
22961847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
23061847f8eSopenharmony_ci   * @since 10
23161847f8eSopenharmony_ci   */
23261847f8eSopenharmony_ci  export interface RetentionSandboxInfo {
23361847f8eSopenharmony_ci    /**
23461847f8eSopenharmony_ci     * Application index of the DLP sandbox.
23561847f8eSopenharmony_ci     *
23661847f8eSopenharmony_ci     * @type { number }
23761847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
23861847f8eSopenharmony_ci     * @since 10
23961847f8eSopenharmony_ci     */
24061847f8eSopenharmony_ci    appIndex: number;
24161847f8eSopenharmony_ci
24261847f8eSopenharmony_ci    /**
24361847f8eSopenharmony_ci     * Bundle name of the application.
24461847f8eSopenharmony_ci     *
24561847f8eSopenharmony_ci     * @type { string }
24661847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
24761847f8eSopenharmony_ci     * @since 10
24861847f8eSopenharmony_ci     */
24961847f8eSopenharmony_ci    bundleName: string;
25061847f8eSopenharmony_ci
25161847f8eSopenharmony_ci    /**
25261847f8eSopenharmony_ci     * List of file URIs.
25361847f8eSopenharmony_ci     *
25461847f8eSopenharmony_ci     * @type { Array<string> }
25561847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
25661847f8eSopenharmony_ci     * @since 10
25761847f8eSopenharmony_ci     */
25861847f8eSopenharmony_ci    docUris: Array<string>;
25961847f8eSopenharmony_ci  }
26061847f8eSopenharmony_ci
26161847f8eSopenharmony_ci  /**
26261847f8eSopenharmony_ci   * Checks whether a file is a DLP file. This method uses a promise to return the result.
26361847f8eSopenharmony_ci   *
26461847f8eSopenharmony_ci   * @param { number } fd - Indicates the file descriptor of the file to check.
26561847f8eSopenharmony_ci   * @returns { Promise<boolean> } Returns {@code true} if {@link fd} is a DLP file; returns {@code false} otherwise.
26661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
26761847f8eSopenharmony_ci   *     2. Incorrect parameter types.
26861847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
26961847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
27061847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
27161847f8eSopenharmony_ci   * @since 10
27261847f8eSopenharmony_ci   */
27361847f8eSopenharmony_ci  function isDLPFile(fd: number): Promise<boolean>;
27461847f8eSopenharmony_ci
27561847f8eSopenharmony_ci  /**
27661847f8eSopenharmony_ci   * Checks whether a file is a DLP file. This method uses an asynchronous callback to return the result.
27761847f8eSopenharmony_ci   *
27861847f8eSopenharmony_ci   * @param { number } fd - Indicates the file descriptor of the file to check.
27961847f8eSopenharmony_ci   * @param { AsyncCallback<boolean> } callback - Indicates the callback of isDLPFile.
28061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
28161847f8eSopenharmony_ci   *     2. Incorrect parameter types.
28261847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
28361847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
28461847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
28561847f8eSopenharmony_ci   * @since 10
28661847f8eSopenharmony_ci   */
28761847f8eSopenharmony_ci  function isDLPFile(fd: number, callback: AsyncCallback<boolean>): void;
28861847f8eSopenharmony_ci
28961847f8eSopenharmony_ci  /**
29061847f8eSopenharmony_ci   * Obtains the permission info of this DLP file. This method uses a promise to return the result.
29161847f8eSopenharmony_ci   *
29261847f8eSopenharmony_ci   * @returns { Promise<DLPPermissionInfo> } Returns the {@link DLPPermissionInfo}.
29361847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
29461847f8eSopenharmony_ci   * @throws { BusinessError } 19100006 - No permission to call this API,
29561847f8eSopenharmony_ci   *     which is available only for DLP sandbox applications.
29661847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
29761847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
29861847f8eSopenharmony_ci   * @since 10
29961847f8eSopenharmony_ci   */
30061847f8eSopenharmony_ci  function getDLPPermissionInfo(): Promise<DLPPermissionInfo>;
30161847f8eSopenharmony_ci
30261847f8eSopenharmony_ci  /**
30361847f8eSopenharmony_ci   * Obtains the permission info of this DLP file. This method uses an asynchronous callback to return the result.
30461847f8eSopenharmony_ci   *
30561847f8eSopenharmony_ci   * @param { AsyncCallback<DLPPermissionInfo> } callback - Indicates the callback of getDLPPermissionInfo.
30661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
30761847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
30861847f8eSopenharmony_ci   * @throws { BusinessError } 19100006 - No permission to call this API,
30961847f8eSopenharmony_ci   *     which is available only for DLP sandbox applications.
31061847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
31161847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
31261847f8eSopenharmony_ci   * @since 10
31361847f8eSopenharmony_ci   */
31461847f8eSopenharmony_ci  function getDLPPermissionInfo(callback: AsyncCallback<DLPPermissionInfo>): void;
31561847f8eSopenharmony_ci
31661847f8eSopenharmony_ci  /**
31761847f8eSopenharmony_ci   * Obtains the original file name from a DLP file name. This method removes the DLP file name extension from the DLP file name.
31861847f8eSopenharmony_ci   *
31961847f8eSopenharmony_ci   * @param { string } fileName - Indicates the DLP file name.
32061847f8eSopenharmony_ci   * @returns { string } Returns the original file name obtained.
32161847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
32261847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
32361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
32461847f8eSopenharmony_ci   * @since 10
32561847f8eSopenharmony_ci   */
32661847f8eSopenharmony_ci  function getOriginalFileName(fileName: string): string;
32761847f8eSopenharmony_ci
32861847f8eSopenharmony_ci  /**
32961847f8eSopenharmony_ci   * Obtains the DLP file name extension.
33061847f8eSopenharmony_ci   *
33161847f8eSopenharmony_ci   * @returns { string } Returns the DLP file name extension obtained.
33261847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
33361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
33461847f8eSopenharmony_ci   * @since 10
33561847f8eSopenharmony_ci   */
33661847f8eSopenharmony_ci  function getDLPSuffix(): string;
33761847f8eSopenharmony_ci
33861847f8eSopenharmony_ci  /**
33961847f8eSopenharmony_ci   * Subscribes to the event reported when a DLP file is opened by current application.
34061847f8eSopenharmony_ci   *
34161847f8eSopenharmony_ci   * @param { 'openDLPFile' } type - Indicates the type of the event to subscribe to.
34261847f8eSopenharmony_ci   *     The value of type must be openDLPFile.
34361847f8eSopenharmony_ci   * @param { Callback<AccessedDLPFileInfo> } listener - Indicates the callback invoked when a DLP file is opened by current application.
34461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
34561847f8eSopenharmony_ci   *     2. Incorrect parameter types. 3. Parameter verification failed.
34661847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
34761847f8eSopenharmony_ci   * @throws { BusinessError } 19100007 - No permission to call this API,
34861847f8eSopenharmony_ci   *     which is available only for non-DLP sandbox applications.
34961847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
35061847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
35161847f8eSopenharmony_ci   * @since 10
35261847f8eSopenharmony_ci   */
35361847f8eSopenharmony_ci  function on(type: 'openDLPFile', listener: Callback<AccessedDLPFileInfo>): void;
35461847f8eSopenharmony_ci
35561847f8eSopenharmony_ci  /**
35661847f8eSopenharmony_ci   * Unsubscribes from the event reported when a DLP file is opened by current application.
35761847f8eSopenharmony_ci   *
35861847f8eSopenharmony_ci   * @param { 'openDLPFile' } type - Indicates the type of the event to unsubscribe from.
35961847f8eSopenharmony_ci   *     The value of type must be openDLPFile.
36061847f8eSopenharmony_ci   * @param { Callback<AccessedDLPFileInfo> } listener - Indicates the callback invoked when a DLP file is opened by current application.
36161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
36261847f8eSopenharmony_ci   *     2. Incorrect parameter types. 3. Parameter verification failed.
36361847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
36461847f8eSopenharmony_ci   * @throws { BusinessError } 19100007 - No permission to call this API,
36561847f8eSopenharmony_ci   *     which is available only for non-DLP sandbox applications.
36661847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
36761847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
36861847f8eSopenharmony_ci   * @since 10
36961847f8eSopenharmony_ci   */
37061847f8eSopenharmony_ci  function off(type: 'openDLPFile', listener?: Callback<AccessedDLPFileInfo>): void;
37161847f8eSopenharmony_ci
37261847f8eSopenharmony_ci  /**
37361847f8eSopenharmony_ci   * Checks whether current application is in the DLP sandbox. This method uses a promise to return the result.
37461847f8eSopenharmony_ci   *
37561847f8eSopenharmony_ci   * @returns { Promise<boolean> } Returns {@code true} if current application is in a DLP sandbox; returns {@code false} otherwise.
37661847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
37761847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
37861847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
37961847f8eSopenharmony_ci   * @since 10
38061847f8eSopenharmony_ci   */
38161847f8eSopenharmony_ci  function isInSandbox(): Promise<boolean>;
38261847f8eSopenharmony_ci
38361847f8eSopenharmony_ci  /**
38461847f8eSopenharmony_ci   * Checks whether current application is in the DLP sandbox. This method uses an asynchronous callback to return the result.
38561847f8eSopenharmony_ci   *
38661847f8eSopenharmony_ci   * @param { AsyncCallback<boolean> } callback - Indicates the callback of isInSandbox.
38761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
38861847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
38961847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
39061847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
39161847f8eSopenharmony_ci   * @since 10
39261847f8eSopenharmony_ci   */
39361847f8eSopenharmony_ci  function isInSandbox(callback: AsyncCallback<boolean>): void;
39461847f8eSopenharmony_ci
39561847f8eSopenharmony_ci  /**
39661847f8eSopenharmony_ci   * Obtains the file types supported by DLP. This method uses a promise to return the result.
39761847f8eSopenharmony_ci   *
39861847f8eSopenharmony_ci   * @returns { Promise<Array<string>> } Returns the list of file types supported.
39961847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
40061847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
40161847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
40261847f8eSopenharmony_ci   * @since 10
40361847f8eSopenharmony_ci   */
40461847f8eSopenharmony_ci  function getDLPSupportedFileTypes(): Promise<Array<string>>;
40561847f8eSopenharmony_ci
40661847f8eSopenharmony_ci  /**
40761847f8eSopenharmony_ci   * Obtains the file types supported by DLP. This method uses an asynchronous callback to return the result.
40861847f8eSopenharmony_ci   *
40961847f8eSopenharmony_ci   * @param { AsyncCallback<Array<string>> } callback - Indicates the callback of getDLPSupportedFileTypes.
41061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
41161847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
41261847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
41361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
41461847f8eSopenharmony_ci   * @since 10
41561847f8eSopenharmony_ci   */
41661847f8eSopenharmony_ci  function getDLPSupportedFileTypes(callback: AsyncCallback<Array<string>>): void;
41761847f8eSopenharmony_ci
41861847f8eSopenharmony_ci  /**
41961847f8eSopenharmony_ci   * Sets the retention status for the files specified by URI list. This method uses a promise to return the result.
42061847f8eSopenharmony_ci   *
42161847f8eSopenharmony_ci   * @param { Array<string> } docUris - Indicates the URIs of the files, for which the retention status is to set.
42261847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
42361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
42461847f8eSopenharmony_ci   *     2. Incorrect parameter types.
42561847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
42661847f8eSopenharmony_ci   * @throws { BusinessError } 19100006 - No permission to call this API,
42761847f8eSopenharmony_ci   *     which is available only for DLP sandbox applications.
42861847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
42961847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
43061847f8eSopenharmony_ci   * @since 10
43161847f8eSopenharmony_ci   */
43261847f8eSopenharmony_ci  function setRetentionState(docUris: Array<string>): Promise<void>;
43361847f8eSopenharmony_ci
43461847f8eSopenharmony_ci  /**
43561847f8eSopenharmony_ci   * Sets the retention status for the files specified by URI list. This method uses an asynchronous callback to return the result.
43661847f8eSopenharmony_ci   *
43761847f8eSopenharmony_ci   * @param { Array<string> } docUris - Indicates the URIs of the files, for which the retention status is to set.
43861847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - Indicates the callback of setRetentionState.
43961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
44061847f8eSopenharmony_ci   *     2. Incorrect parameter types.
44161847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
44261847f8eSopenharmony_ci   * @throws { BusinessError } 19100006 - No permission to call this API,
44361847f8eSopenharmony_ci   *     which is available only for DLP sandbox applications.
44461847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
44561847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
44661847f8eSopenharmony_ci   * @since 10
44761847f8eSopenharmony_ci   */
44861847f8eSopenharmony_ci  function setRetentionState(docUris: Array<string>, callback: AsyncCallback<void>): void;
44961847f8eSopenharmony_ci
45061847f8eSopenharmony_ci  /**
45161847f8eSopenharmony_ci   * Cancels the retention status for the files specified by URI list. This method uses a promise to return the result.
45261847f8eSopenharmony_ci   *
45361847f8eSopenharmony_ci   * @param { Array<string> } docUris - Indicates the list of the file URIs.
45461847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
45561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
45661847f8eSopenharmony_ci   *     2. Incorrect parameter types.
45761847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
45861847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
45961847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
46061847f8eSopenharmony_ci   * @since 10
46161847f8eSopenharmony_ci   */
46261847f8eSopenharmony_ci  function cancelRetentionState(docUris: Array<string>): Promise<void>;
46361847f8eSopenharmony_ci
46461847f8eSopenharmony_ci  /**
46561847f8eSopenharmony_ci   * Cancels the retention status for the files specified by URI list. This method uses an asynchronous callback to return the result.
46661847f8eSopenharmony_ci   *
46761847f8eSopenharmony_ci   * @param { Array<string> } docUris - Indicates the list of the file URIs.
46861847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - Indicates the callback of cancelRetentionState.
46961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
47061847f8eSopenharmony_ci   *     2. Incorrect parameter types.
47161847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
47261847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
47361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
47461847f8eSopenharmony_ci   * @since 10
47561847f8eSopenharmony_ci   */
47661847f8eSopenharmony_ci  function cancelRetentionState(docUris: Array<string>, callback: AsyncCallback<void>): void;
47761847f8eSopenharmony_ci
47861847f8eSopenharmony_ci  /**
47961847f8eSopenharmony_ci   * Obtains information about the retained DLP sandboxes of an application. This method uses a promise to return the result.
48061847f8eSopenharmony_ci   *
48161847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the bundle name of the application.
48261847f8eSopenharmony_ci   * @returns { Promise<Array<RetentionSandboxInfo>> } Returns a list of {@link RetentionSandboxInfo}.
48361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
48461847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
48561847f8eSopenharmony_ci   * @throws { BusinessError } 19100007 - No permission to call this API,
48661847f8eSopenharmony_ci   *     which is available only for non-DLP sandbox applications.
48761847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
48861847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
48961847f8eSopenharmony_ci   * @since 10
49061847f8eSopenharmony_ci   */
49161847f8eSopenharmony_ci  function getRetentionSandboxList(bundleName?: string): Promise<Array<RetentionSandboxInfo>>;
49261847f8eSopenharmony_ci
49361847f8eSopenharmony_ci  /**
49461847f8eSopenharmony_ci   * Obtains information about the retained DLP sandboxes of an application. This method uses an asynchronous callback to return the result.
49561847f8eSopenharmony_ci   *
49661847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the bundle name of the application.
49761847f8eSopenharmony_ci   * @param { AsyncCallback<Array<RetentionSandboxInfo>> } callback - Indicates the callback of getRetentionSandboxList.
49861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
49961847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
50061847f8eSopenharmony_ci   * @throws { BusinessError } 19100007 - No permission to call this API,
50161847f8eSopenharmony_ci   *     which is available only for non-DLP sandbox applications.
50261847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
50361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
50461847f8eSopenharmony_ci   * @since 10
50561847f8eSopenharmony_ci   */
50661847f8eSopenharmony_ci  function getRetentionSandboxList(bundleName: string, callback: AsyncCallback<Array<RetentionSandboxInfo>>): void;
50761847f8eSopenharmony_ci
50861847f8eSopenharmony_ci  /**
50961847f8eSopenharmony_ci   * Obtains information about the retained DLP sandboxes of an application. This method uses an asynchronous callback to return the result.
51061847f8eSopenharmony_ci   *
51161847f8eSopenharmony_ci   * @param { AsyncCallback<Array<RetentionSandboxInfo>> } callback - Indicates the callback of getRetentionSandboxList.
51261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
51361847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
51461847f8eSopenharmony_ci   * @throws { BusinessError } 19100007 - No permission to call this API,
51561847f8eSopenharmony_ci   *     which is available only for non-DLP sandbox applications.
51661847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
51761847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
51861847f8eSopenharmony_ci   * @since 10
51961847f8eSopenharmony_ci   */
52061847f8eSopenharmony_ci  function getRetentionSandboxList(callback: AsyncCallback<Array<RetentionSandboxInfo>>): void;
52161847f8eSopenharmony_ci
52261847f8eSopenharmony_ci  /**
52361847f8eSopenharmony_ci   * Obtains the DLP file access records. This method uses a promise to return the result.
52461847f8eSopenharmony_ci   *
52561847f8eSopenharmony_ci   * @returns { Promise<Array<AccessedDLPFileInfo>> } Returns a list of {@link AccessedDLPFileInfo}.
52661847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
52761847f8eSopenharmony_ci   * @throws { BusinessError } 19100007 - No permission to call this API,
52861847f8eSopenharmony_ci   *     which is available only for non-DLP sandbox applications.
52961847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
53061847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
53161847f8eSopenharmony_ci   * @since 10
53261847f8eSopenharmony_ci   */
53361847f8eSopenharmony_ci  function getDLPFileAccessRecords(): Promise<Array<AccessedDLPFileInfo>>;
53461847f8eSopenharmony_ci
53561847f8eSopenharmony_ci  /**
53661847f8eSopenharmony_ci   * Obtains the DLP file access records. This method uses an asynchronous callback to return the result.
53761847f8eSopenharmony_ci   *
53861847f8eSopenharmony_ci   * @param { AsyncCallback<Array<AccessedDLPFileInfo>> } callback - Indicates the callback of getDLPFileAccessRecords.
53961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
54061847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
54161847f8eSopenharmony_ci   * @throws { BusinessError } 19100007 - No permission to call this API,
54261847f8eSopenharmony_ci   *     which is available only for non-DLP sandbox applications.
54361847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
54461847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
54561847f8eSopenharmony_ci   * @since 10
54661847f8eSopenharmony_ci   */
54761847f8eSopenharmony_ci  function getDLPFileAccessRecords(callback: AsyncCallback<Array<AccessedDLPFileInfo>>): void;
54861847f8eSopenharmony_ci
54961847f8eSopenharmony_ci  /**
55061847f8eSopenharmony_ci   * Represents the return value of the function startDLPManagerForResult.
55161847f8eSopenharmony_ci   *
55261847f8eSopenharmony_ci   * @interface DLPManagerResult
55361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
55461847f8eSopenharmony_ci   * @StageModelOnly
55561847f8eSopenharmony_ci   * @since 11
55661847f8eSopenharmony_ci   */
55761847f8eSopenharmony_ci  export interface DLPManagerResult {
55861847f8eSopenharmony_ci    /**
55961847f8eSopenharmony_ci     * Indicates the result code returned after the DLP manager is destroyed.
56061847f8eSopenharmony_ci     *
56161847f8eSopenharmony_ci     * @type { number }
56261847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
56361847f8eSopenharmony_ci     * @StageModelOnly
56461847f8eSopenharmony_ci     * @since 11
56561847f8eSopenharmony_ci     */
56661847f8eSopenharmony_ci    resultCode: number;
56761847f8eSopenharmony_ci
56861847f8eSopenharmony_ci    /**
56961847f8eSopenharmony_ci     * Indicates the data returned after the DLP manager is destroyed.
57061847f8eSopenharmony_ci     *
57161847f8eSopenharmony_ci     * @type { Want }
57261847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
57361847f8eSopenharmony_ci     * @StageModelOnly
57461847f8eSopenharmony_ci     * @since 11
57561847f8eSopenharmony_ci     */
57661847f8eSopenharmony_ci    want: Want;
57761847f8eSopenharmony_ci  }
57861847f8eSopenharmony_ci
57961847f8eSopenharmony_ci  /**
58061847f8eSopenharmony_ci   * Starts the DLP manager. This method uses a promise to return the result.
58161847f8eSopenharmony_ci   *
58261847f8eSopenharmony_ci   * @param { common.UIAbilityContext } context - Indicates the UIAbility context of the caller.
58361847f8eSopenharmony_ci   * @param { Want } want - Indicates the request to the DLP manager.
58461847f8eSopenharmony_ci   * @returns { Promise<DLPManagerResult> } Returns the {@link DLPManagerResult}.
58561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
58661847f8eSopenharmony_ci   *     2. Incorrect parameter types.
58761847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
58861847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
58961847f8eSopenharmony_ci   * @throws { BusinessError } 19100016 - uri missing in want.
59061847f8eSopenharmony_ci   * @throws { BusinessError } 19100017 - displayName missing in want.
59161847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
59261847f8eSopenharmony_ci   * @StageModelOnly
59361847f8eSopenharmony_ci   * @since 11
59461847f8eSopenharmony_ci   */
59561847f8eSopenharmony_ci  function startDLPManagerForResult(context: common.UIAbilityContext, want: Want): Promise<DLPManagerResult>;
59661847f8eSopenharmony_ci
59761847f8eSopenharmony_ci  /**
59861847f8eSopenharmony_ci   * Enumerates the gathering policy types for DLP files.
59961847f8eSopenharmony_ci   *
60061847f8eSopenharmony_ci   * @enum { number }
60161847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
60261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
60361847f8eSopenharmony_ci   * @since 10
60461847f8eSopenharmony_ci   */
60561847f8eSopenharmony_ci  export enum GatheringPolicyType {
60661847f8eSopenharmony_ci    /**
60761847f8eSopenharmony_ci     * Gathering, which allows multiple DLP files to be opened in a sandbox.
60861847f8eSopenharmony_ci     *
60961847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
61061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
61161847f8eSopenharmony_ci     * @since 10
61261847f8eSopenharmony_ci     */
61361847f8eSopenharmony_ci    GATHERING = 1,
61461847f8eSopenharmony_ci
61561847f8eSopenharmony_ci    /**
61661847f8eSopenharmony_ci     * Non-gathering, which allows only one DLP file to be opened in a sandbox.
61761847f8eSopenharmony_ci     *
61861847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
61961847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
62061847f8eSopenharmony_ci     * @since 10
62161847f8eSopenharmony_ci     */
62261847f8eSopenharmony_ci    NON_GATHERING = 2
62361847f8eSopenharmony_ci  }
62461847f8eSopenharmony_ci
62561847f8eSopenharmony_ci  /**
62661847f8eSopenharmony_ci   * Obtains the DLP sandbox gathering policy. This method uses a promise to return the result.
62761847f8eSopenharmony_ci   *
62861847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
62961847f8eSopenharmony_ci   * @returns { Promise<GatheringPolicyType> } Returns the {@link GatheringPolicyType}.
63061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
63161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
63261847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
63361847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
63461847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
63561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
63661847f8eSopenharmony_ci   * @since 10
63761847f8eSopenharmony_ci   */
63861847f8eSopenharmony_ci  function getDLPGatheringPolicy(): Promise<GatheringPolicyType>;
63961847f8eSopenharmony_ci
64061847f8eSopenharmony_ci  /**
64161847f8eSopenharmony_ci   * Obtains the DLP sandbox gathering policy. This method uses an asynchronous callback to return the result.
64261847f8eSopenharmony_ci   *
64361847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
64461847f8eSopenharmony_ci   * @param { AsyncCallback<GatheringPolicyType> } callback - Indicates the callback of getDLPGatheringPolicy.
64561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
64661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
64761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
64861847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
64961847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
65061847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
65161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
65261847f8eSopenharmony_ci   * @since 10
65361847f8eSopenharmony_ci   */
65461847f8eSopenharmony_ci  function getDLPGatheringPolicy(callback: AsyncCallback<GatheringPolicyType>): void;
65561847f8eSopenharmony_ci
65661847f8eSopenharmony_ci  /**
65761847f8eSopenharmony_ci   * Represents the installed DLP sandbox application info.
65861847f8eSopenharmony_ci   *
65961847f8eSopenharmony_ci   * @interface DLPSandboxInfo
66061847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
66161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
66261847f8eSopenharmony_ci   * @since 10
66361847f8eSopenharmony_ci   */
66461847f8eSopenharmony_ci  export interface DLPSandboxInfo {
66561847f8eSopenharmony_ci    /**
66661847f8eSopenharmony_ci     * Index of the installed DLP sandbox application.
66761847f8eSopenharmony_ci     *
66861847f8eSopenharmony_ci     * @type { number }
66961847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
67061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
67161847f8eSopenharmony_ci     * @since 10
67261847f8eSopenharmony_ci     */
67361847f8eSopenharmony_ci    appIndex: number;
67461847f8eSopenharmony_ci
67561847f8eSopenharmony_ci    /**
67661847f8eSopenharmony_ci     * Token ID of the installed DLP sandbox application.
67761847f8eSopenharmony_ci     *
67861847f8eSopenharmony_ci     * @type { number }
67961847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
68061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
68161847f8eSopenharmony_ci     * @since 10
68261847f8eSopenharmony_ci     */
68361847f8eSopenharmony_ci    tokenID: number;
68461847f8eSopenharmony_ci  }
68561847f8eSopenharmony_ci
68661847f8eSopenharmony_ci  /**
68761847f8eSopenharmony_ci   * Installs a DLP sandbox application. This method uses a promise to return the result.
68861847f8eSopenharmony_ci   *
68961847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
69061847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the bundle name of the application.
69161847f8eSopenharmony_ci   * @param { DLPFileAccess } access - Indicates the access permission for the DLP file.
69261847f8eSopenharmony_ci   * @param { number } userId - Indicates the user ID.
69361847f8eSopenharmony_ci   * @param { string } uri - Indicates the URI of the file.
69461847f8eSopenharmony_ci   * @returns { Promise<DLPSandboxInfo> } Returns the {@link DLPSandboxInfo}.
69561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
69661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
69761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
69861847f8eSopenharmony_ci   *     2. Incorrect parameter types.
69961847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
70061847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
70161847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
70261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
70361847f8eSopenharmony_ci   * @since 10
70461847f8eSopenharmony_ci   */
70561847f8eSopenharmony_ci  function installDLPSandbox(
70661847f8eSopenharmony_ci    bundleName: string,
70761847f8eSopenharmony_ci    access: DLPFileAccess,
70861847f8eSopenharmony_ci    userId: number,
70961847f8eSopenharmony_ci    uri: string
71061847f8eSopenharmony_ci  ): Promise<DLPSandboxInfo>;
71161847f8eSopenharmony_ci
71261847f8eSopenharmony_ci  /**
71361847f8eSopenharmony_ci   * Installs a DLP sandbox application. This method uses an asynchronous callback to return the result.
71461847f8eSopenharmony_ci   *
71561847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
71661847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the bundle name of the application.
71761847f8eSopenharmony_ci   * @param { DLPFileAccess } access - Indicates the access permission for the DLP file.
71861847f8eSopenharmony_ci   * @param { number } userId - Indicates the user ID.
71961847f8eSopenharmony_ci   * @param { string } uri - Indicates the URI of the file.
72061847f8eSopenharmony_ci   * @param { AsyncCallback<DLPSandboxInfo> } callback - Indicates the callback of installDLPSandbox.
72161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
72261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
72361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
72461847f8eSopenharmony_ci   *     2. Incorrect parameter types.
72561847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
72661847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
72761847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
72861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
72961847f8eSopenharmony_ci   * @since 10
73061847f8eSopenharmony_ci   */
73161847f8eSopenharmony_ci  function installDLPSandbox(
73261847f8eSopenharmony_ci    bundleName: string,
73361847f8eSopenharmony_ci    access: DLPFileAccess,
73461847f8eSopenharmony_ci    userId: number,
73561847f8eSopenharmony_ci    uri: string,
73661847f8eSopenharmony_ci    callback: AsyncCallback<DLPSandboxInfo>
73761847f8eSopenharmony_ci  ): void;
73861847f8eSopenharmony_ci
73961847f8eSopenharmony_ci  /**
74061847f8eSopenharmony_ci   * Uninstalls a DLP sandbox application. This method uses a promise to return the result.
74161847f8eSopenharmony_ci   *
74261847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
74361847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the bundle name of the application.
74461847f8eSopenharmony_ci   * @param { number } userId - Indicates the user ID.
74561847f8eSopenharmony_ci   * @param { number } appIndex - Indicates the index of DLP sandbox.
74661847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
74761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
74861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
74961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
75061847f8eSopenharmony_ci   *     2. Incorrect parameter types.
75161847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
75261847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
75361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
75461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
75561847f8eSopenharmony_ci   * @since 10
75661847f8eSopenharmony_ci   */
75761847f8eSopenharmony_ci  function uninstallDLPSandbox(bundleName: string, userId: number, appIndex: number): Promise<void>;
75861847f8eSopenharmony_ci
75961847f8eSopenharmony_ci  /**
76061847f8eSopenharmony_ci   * Uninstalls a DLP sandbox application. This method uses an asynchronous callback to return the result.
76161847f8eSopenharmony_ci   *
76261847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
76361847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the bundle name of the application.
76461847f8eSopenharmony_ci   * @param { number } userId - Indicates the user ID.
76561847f8eSopenharmony_ci   * @param { number } appIndex - Indicates the index of DLP sandbox.
76661847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - Indicates the callback of uninstallDLPSandbox.
76761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
76861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
76961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
77061847f8eSopenharmony_ci   *     2. Incorrect parameter types.
77161847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
77261847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
77361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
77461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
77561847f8eSopenharmony_ci   * @since 10
77661847f8eSopenharmony_ci   */
77761847f8eSopenharmony_ci  function uninstallDLPSandbox(
77861847f8eSopenharmony_ci    bundleName: string,
77961847f8eSopenharmony_ci    userId: number,
78061847f8eSopenharmony_ci    appIndex: number,
78161847f8eSopenharmony_ci    callback: AsyncCallback<void>
78261847f8eSopenharmony_ci  ): void;
78361847f8eSopenharmony_ci
78461847f8eSopenharmony_ci  /**
78561847f8eSopenharmony_ci   * Represents the DLP sandbox state.
78661847f8eSopenharmony_ci   *
78761847f8eSopenharmony_ci   * @interface DLPSandboxState
78861847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
78961847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
79061847f8eSopenharmony_ci   * @since 10
79161847f8eSopenharmony_ci   */
79261847f8eSopenharmony_ci  export interface DLPSandboxState {
79361847f8eSopenharmony_ci    /**
79461847f8eSopenharmony_ci     * Bundle name of the application.
79561847f8eSopenharmony_ci     *
79661847f8eSopenharmony_ci     * @type { string }
79761847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
79861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
79961847f8eSopenharmony_ci     * @since 10
80061847f8eSopenharmony_ci     */
80161847f8eSopenharmony_ci    bundleName: string;
80261847f8eSopenharmony_ci
80361847f8eSopenharmony_ci    /**
80461847f8eSopenharmony_ci     * Application index of the DLP sandbox.
80561847f8eSopenharmony_ci     *
80661847f8eSopenharmony_ci     * @type { number }
80761847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
80861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
80961847f8eSopenharmony_ci     * @since 10
81061847f8eSopenharmony_ci     */
81161847f8eSopenharmony_ci    appIndex: number;
81261847f8eSopenharmony_ci  }
81361847f8eSopenharmony_ci
81461847f8eSopenharmony_ci  /**
81561847f8eSopenharmony_ci   * Subscribes to the event reported when a DLP sandbox application is uninstalled.
81661847f8eSopenharmony_ci   *
81761847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
81861847f8eSopenharmony_ci   * @param { 'uninstallDLPSandbox' } type - Indicates the type of event to subscribe to.
81961847f8eSopenharmony_ci   *     The value of type must be uninstallDLPSandbox.
82061847f8eSopenharmony_ci   * @param { Callback<DLPSandboxState> } listener - Indicates the callback for the DLP sandbox application uninstall event.
82161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
82261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
82361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
82461847f8eSopenharmony_ci   *     2. Incorrect parameter types. 3. Parameter verification failed.
82561847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
82661847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
82761847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
82861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
82961847f8eSopenharmony_ci   * @since 10
83061847f8eSopenharmony_ci   */
83161847f8eSopenharmony_ci  function on(type: 'uninstallDLPSandbox', listener: Callback<DLPSandboxState>): void;
83261847f8eSopenharmony_ci
83361847f8eSopenharmony_ci  /**
83461847f8eSopenharmony_ci   * Unsubscribes from the event reported when a DLP sandbox application is uninstalled.
83561847f8eSopenharmony_ci   *
83661847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
83761847f8eSopenharmony_ci   * @param { 'uninstallDLPSandbox' } type - Indicates the type of event to unsubscribe from.
83861847f8eSopenharmony_ci   *     The value of type must be uninstallDLPSandbox.
83961847f8eSopenharmony_ci   * @param { Callback<DLPSandboxState> } listener - Indicates the callback for the DLP sandbox application uninstall event.
84061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
84161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
84261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
84361847f8eSopenharmony_ci   *     2. Incorrect parameter types. 3. Parameter verification failed.
84461847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
84561847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
84661847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
84761847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
84861847f8eSopenharmony_ci   * @since 10
84961847f8eSopenharmony_ci   */
85061847f8eSopenharmony_ci  function off(type: 'uninstallDLPSandbox', listener?: Callback<DLPSandboxState>): void;
85161847f8eSopenharmony_ci
85261847f8eSopenharmony_ci  /**
85361847f8eSopenharmony_ci   * Enumerates the account types for a DLP file.
85461847f8eSopenharmony_ci   *
85561847f8eSopenharmony_ci   * @enum { number }
85661847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
85761847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
85861847f8eSopenharmony_ci   * @since 10
85961847f8eSopenharmony_ci   */
86061847f8eSopenharmony_ci  export enum AccountType {
86161847f8eSopenharmony_ci    /**
86261847f8eSopenharmony_ci     * Cloud account.
86361847f8eSopenharmony_ci     *
86461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
86561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
86661847f8eSopenharmony_ci     * @since 10
86761847f8eSopenharmony_ci     */
86861847f8eSopenharmony_ci    CLOUD_ACCOUNT = 1,
86961847f8eSopenharmony_ci
87061847f8eSopenharmony_ci    /**
87161847f8eSopenharmony_ci     * Domain account.
87261847f8eSopenharmony_ci     *
87361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
87461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
87561847f8eSopenharmony_ci     * @since 10
87661847f8eSopenharmony_ci     */
87761847f8eSopenharmony_ci    DOMAIN_ACCOUNT = 2,
87861847f8eSopenharmony_ci  }
87961847f8eSopenharmony_ci
88061847f8eSopenharmony_ci  /**
88161847f8eSopenharmony_ci   * Represents the authorized user information.
88261847f8eSopenharmony_ci   *
88361847f8eSopenharmony_ci   * @interface AuthUser
88461847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
88561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
88661847f8eSopenharmony_ci   * @since 10
88761847f8eSopenharmony_ci   */
88861847f8eSopenharmony_ci  export interface AuthUser {
88961847f8eSopenharmony_ci    /**
89061847f8eSopenharmony_ci     * Authorized account of the DLP file.
89161847f8eSopenharmony_ci     *
89261847f8eSopenharmony_ci     * @type { string }
89361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
89461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
89561847f8eSopenharmony_ci     * @since 10
89661847f8eSopenharmony_ci     */
89761847f8eSopenharmony_ci    authAccount: string;
89861847f8eSopenharmony_ci
89961847f8eSopenharmony_ci    /**
90061847f8eSopenharmony_ci     * Type of the authorized account.
90161847f8eSopenharmony_ci     *
90261847f8eSopenharmony_ci     * @type { AccountType }
90361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
90461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
90561847f8eSopenharmony_ci     * @since 10
90661847f8eSopenharmony_ci     */
90761847f8eSopenharmony_ci    authAccountType: AccountType;
90861847f8eSopenharmony_ci
90961847f8eSopenharmony_ci    /**
91061847f8eSopenharmony_ci     * Authorized permission for the DLP file.
91161847f8eSopenharmony_ci     *
91261847f8eSopenharmony_ci     * @type { DLPFileAccess }
91361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
91461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
91561847f8eSopenharmony_ci     * @since 10
91661847f8eSopenharmony_ci     */
91761847f8eSopenharmony_ci    dlpFileAccess: DLPFileAccess;
91861847f8eSopenharmony_ci
91961847f8eSopenharmony_ci    /**
92061847f8eSopenharmony_ci     * Authorization expiration time of the DLP file.
92161847f8eSopenharmony_ci     *
92261847f8eSopenharmony_ci     * @type { number }
92361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
92461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
92561847f8eSopenharmony_ci     * @since 10
92661847f8eSopenharmony_ci     */
92761847f8eSopenharmony_ci    permExpiryTime: number;
92861847f8eSopenharmony_ci  }
92961847f8eSopenharmony_ci
93061847f8eSopenharmony_ci  /**
93161847f8eSopenharmony_ci   * Represents the DLP file property.
93261847f8eSopenharmony_ci   *
93361847f8eSopenharmony_ci   * @interface DLPProperty
93461847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
93561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
93661847f8eSopenharmony_ci   * @since 10
93761847f8eSopenharmony_ci   */
93861847f8eSopenharmony_ci  export interface DLPProperty {
93961847f8eSopenharmony_ci    /**
94061847f8eSopenharmony_ci     * Owner account of the DLP file.
94161847f8eSopenharmony_ci     *
94261847f8eSopenharmony_ci     * @type { string }
94361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
94461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
94561847f8eSopenharmony_ci     * @since 10
94661847f8eSopenharmony_ci     */
94761847f8eSopenharmony_ci    ownerAccount: string;
94861847f8eSopenharmony_ci
94961847f8eSopenharmony_ci    /**
95061847f8eSopenharmony_ci     * Owner account ID of the DLP file.
95161847f8eSopenharmony_ci     *
95261847f8eSopenharmony_ci     * @type { string }
95361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
95461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
95561847f8eSopenharmony_ci     * @since 10
95661847f8eSopenharmony_ci     */
95761847f8eSopenharmony_ci    ownerAccountID: string;
95861847f8eSopenharmony_ci
95961847f8eSopenharmony_ci    /**
96061847f8eSopenharmony_ci     * Type of the owner account of the DLP file.
96161847f8eSopenharmony_ci     *
96261847f8eSopenharmony_ci     * @type { AccountType }
96361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
96461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
96561847f8eSopenharmony_ci     * @since 10
96661847f8eSopenharmony_ci     */
96761847f8eSopenharmony_ci    ownerAccountType: AccountType;
96861847f8eSopenharmony_ci
96961847f8eSopenharmony_ci    /**
97061847f8eSopenharmony_ci     * Authorized users of the DLP file.
97161847f8eSopenharmony_ci     *
97261847f8eSopenharmony_ci     * @type { ?Array<AuthUser> }
97361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
97461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
97561847f8eSopenharmony_ci     * @since 10
97661847f8eSopenharmony_ci     */
97761847f8eSopenharmony_ci    authUserList?: Array<AuthUser>;
97861847f8eSopenharmony_ci
97961847f8eSopenharmony_ci    /**
98061847f8eSopenharmony_ci     * Contact account of the DLP file.
98161847f8eSopenharmony_ci     *
98261847f8eSopenharmony_ci     * @type { string }
98361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
98461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
98561847f8eSopenharmony_ci     * @since 10
98661847f8eSopenharmony_ci     */
98761847f8eSopenharmony_ci    contactAccount: string;
98861847f8eSopenharmony_ci
98961847f8eSopenharmony_ci    /**
99061847f8eSopenharmony_ci     * Whether the DLP file can be accessed offline.
99161847f8eSopenharmony_ci     * If the DLP file supports offline access, the credential server needs to be connected to the network only when the DLP file is opened for the first time.
99261847f8eSopenharmony_ci     *
99361847f8eSopenharmony_ci     * @type { boolean }
99461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
99561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
99661847f8eSopenharmony_ci     * @since 10
99761847f8eSopenharmony_ci     */
99861847f8eSopenharmony_ci    offlineAccess: boolean;
99961847f8eSopenharmony_ci
100061847f8eSopenharmony_ci    /**
100161847f8eSopenharmony_ci     * Everyone access list for the DLP file.
100261847f8eSopenharmony_ci     *
100361847f8eSopenharmony_ci     * @type { ?Array<DLPFileAccess> }
100461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
100561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
100661847f8eSopenharmony_ci     * @since 10
100761847f8eSopenharmony_ci     */
100861847f8eSopenharmony_ci    everyoneAccessList?: Array<DLPFileAccess>;
100961847f8eSopenharmony_ci
101061847f8eSopenharmony_ci    /**
101161847f8eSopenharmony_ci     * Timestamp of the time when the DLP file expires.
101261847f8eSopenharmony_ci     *
101361847f8eSopenharmony_ci     * @type { ?number }
101461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
101561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
101661847f8eSopenharmony_ci     * @since 11
101761847f8eSopenharmony_ci     */
101861847f8eSopenharmony_ci    expireTime?: number;
101961847f8eSopenharmony_ci  }
102061847f8eSopenharmony_ci
102161847f8eSopenharmony_ci  /**
102261847f8eSopenharmony_ci   * Defines the DLP file object.
102361847f8eSopenharmony_ci   *
102461847f8eSopenharmony_ci   * @interface DLPFile
102561847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
102661847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
102761847f8eSopenharmony_ci   * @since 10
102861847f8eSopenharmony_ci   */
102961847f8eSopenharmony_ci  export interface DLPFile {
103061847f8eSopenharmony_ci    /**
103161847f8eSopenharmony_ci     * DLP file property.
103261847f8eSopenharmony_ci     *
103361847f8eSopenharmony_ci     * @type { DLPProperty }
103461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
103561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
103661847f8eSopenharmony_ci     * @since 10
103761847f8eSopenharmony_ci     */
103861847f8eSopenharmony_ci    dlpProperty: DLPProperty;
103961847f8eSopenharmony_ci
104061847f8eSopenharmony_ci    /**
104161847f8eSopenharmony_ci     * Adds a link file for the DLP file. This method uses a promise to return the result.
104261847f8eSopenharmony_ci     * The link file is implemented through the Filesystem in Userspace (FUSE).
104361847f8eSopenharmony_ci     *
104461847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
104561847f8eSopenharmony_ci     * @param { string } linkFileName - Indicates the name of link file to add.
104661847f8eSopenharmony_ci     * @returns { Promise<void> } The promise returned by the function.
104761847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
104861847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
104961847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
105061847f8eSopenharmony_ci     *     2. Incorrect parameter types.
105161847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
105261847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
105361847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
105461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
105561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
105661847f8eSopenharmony_ci     * @since 10
105761847f8eSopenharmony_ci     */
105861847f8eSopenharmony_ci    addDLPLinkFile(linkFileName: string): Promise<void>;
105961847f8eSopenharmony_ci
106061847f8eSopenharmony_ci    /**
106161847f8eSopenharmony_ci     * Adds a link file for the DLP file. This method uses an asynchronous callback to return the result.
106261847f8eSopenharmony_ci     * The link file is implemented through the FUSE.
106361847f8eSopenharmony_ci     *
106461847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
106561847f8eSopenharmony_ci     * @param { string } linkFileName - Indicates the name of link file to add.
106661847f8eSopenharmony_ci     * @param { AsyncCallback<void> } callback - Indicates the callback of addDLPLinkFile.
106761847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
106861847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
106961847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
107061847f8eSopenharmony_ci     *     2. Incorrect parameter types.
107161847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
107261847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
107361847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
107461847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
107561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
107661847f8eSopenharmony_ci     * @since 10
107761847f8eSopenharmony_ci     */
107861847f8eSopenharmony_ci    addDLPLinkFile(linkFileName: string, callback: AsyncCallback<void>): void;
107961847f8eSopenharmony_ci
108061847f8eSopenharmony_ci    /**
108161847f8eSopenharmony_ci     * Stops the FUSE link between the DLP file and a link file. This method uses a promise to return the result.
108261847f8eSopenharmony_ci     *
108361847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
108461847f8eSopenharmony_ci     * @returns { Promise<void> } The promise returned by the function.
108561847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
108661847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
108761847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
108861847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
108961847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
109061847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
109161847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
109261847f8eSopenharmony_ci     * @since 10
109361847f8eSopenharmony_ci     */
109461847f8eSopenharmony_ci    stopFuseLink(): Promise<void>;
109561847f8eSopenharmony_ci
109661847f8eSopenharmony_ci    /**
109761847f8eSopenharmony_ci     * Stops the FUSE link between the DLP file and a link file. This method uses an asynchronous callback to return the result.
109861847f8eSopenharmony_ci     *
109961847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
110061847f8eSopenharmony_ci     * @param { AsyncCallback<void> } callback - Indicates the callback of stopFuseLink.
110161847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
110261847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
110361847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
110461847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
110561847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
110661847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
110761847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
110861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
110961847f8eSopenharmony_ci     * @since 10
111061847f8eSopenharmony_ci     */
111161847f8eSopenharmony_ci    stopFuseLink(callback: AsyncCallback<void>): void;
111261847f8eSopenharmony_ci
111361847f8eSopenharmony_ci    /**
111461847f8eSopenharmony_ci     * Resumes the FUSE link between the DLP file and a link file. This method uses a promise to return the result.
111561847f8eSopenharmony_ci     *
111661847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
111761847f8eSopenharmony_ci     * @returns { Promise<void> } The promise returned by the function.
111861847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
111961847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
112061847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
112161847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
112261847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
112361847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
112461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
112561847f8eSopenharmony_ci     * @since 10
112661847f8eSopenharmony_ci     */
112761847f8eSopenharmony_ci    resumeFuseLink(): Promise<void>;
112861847f8eSopenharmony_ci
112961847f8eSopenharmony_ci    /**
113061847f8eSopenharmony_ci     * Resumes the FUSE link between the DLP file and a link file. This method uses an asynchronous callback to return the result.
113161847f8eSopenharmony_ci     *
113261847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
113361847f8eSopenharmony_ci     * @param { AsyncCallback<void> } callback - Indicates the callback of resumeFuseLink.
113461847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
113561847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
113661847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
113761847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
113861847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
113961847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
114061847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
114161847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
114261847f8eSopenharmony_ci     * @since 10
114361847f8eSopenharmony_ci     */
114461847f8eSopenharmony_ci    resumeFuseLink(callback: AsyncCallback<void>): void;
114561847f8eSopenharmony_ci
114661847f8eSopenharmony_ci    /**
114761847f8eSopenharmony_ci     * Replaces the link file of the DLP file. This method uses a promise to return the result.
114861847f8eSopenharmony_ci     *
114961847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
115061847f8eSopenharmony_ci     * @param { string } linkFileName - Indicates the name of link file.
115161847f8eSopenharmony_ci     * @returns { Promise<void> } The promise returned by the function.
115261847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
115361847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
115461847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
115561847f8eSopenharmony_ci     *     2. Incorrect parameter types.
115661847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
115761847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
115861847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
115961847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
116061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
116161847f8eSopenharmony_ci     * @since 10
116261847f8eSopenharmony_ci     */
116361847f8eSopenharmony_ci    replaceDLPLinkFile(linkFileName: string): Promise<void>;
116461847f8eSopenharmony_ci
116561847f8eSopenharmony_ci    /**
116661847f8eSopenharmony_ci     * Replaces the link file of the DLP file. This method uses an asynchronous callback to return the result.
116761847f8eSopenharmony_ci     *
116861847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
116961847f8eSopenharmony_ci     * @param { string } linkFileName - Indicates the name of link file.
117061847f8eSopenharmony_ci     * @param { AsyncCallback<void> } callback - Indicates the callback of replaceDLPLinkFile.
117161847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
117261847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
117361847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
117461847f8eSopenharmony_ci     *     2. Incorrect parameter types.
117561847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
117661847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
117761847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
117861847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
117961847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
118061847f8eSopenharmony_ci     * @since 10
118161847f8eSopenharmony_ci     */
118261847f8eSopenharmony_ci    replaceDLPLinkFile(linkFileName: string, callback: AsyncCallback<void>): void;
118361847f8eSopenharmony_ci
118461847f8eSopenharmony_ci    /**
118561847f8eSopenharmony_ci     * Deletes a link file of the DLP file. This method uses a promise to return the result.
118661847f8eSopenharmony_ci     *
118761847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
118861847f8eSopenharmony_ci     * @param { string } linkFileName - Indicates the name of link file to delete.
118961847f8eSopenharmony_ci     * @returns { Promise<void> } The promise returned by the function.
119061847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
119161847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
119261847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
119361847f8eSopenharmony_ci     *     2. Incorrect parameter types.
119461847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
119561847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
119661847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
119761847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
119861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
119961847f8eSopenharmony_ci     * @since 10
120061847f8eSopenharmony_ci     */
120161847f8eSopenharmony_ci    deleteDLPLinkFile(linkFileName: string): Promise<void>;
120261847f8eSopenharmony_ci
120361847f8eSopenharmony_ci    /**
120461847f8eSopenharmony_ci     * Deletes a link file of the DLP file. This method uses an asynchronous callback to return the result.
120561847f8eSopenharmony_ci     *
120661847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
120761847f8eSopenharmony_ci     * @param { string } linkFileName - Indicates the name of link file to delete.
120861847f8eSopenharmony_ci     * @param { AsyncCallback<void> } callback - Indicates the callback of deleteDLPLinkFile.
120961847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
121061847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
121161847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
121261847f8eSopenharmony_ci     *     2. Incorrect parameter types.
121361847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
121461847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
121561847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
121661847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
121761847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
121861847f8eSopenharmony_ci     * @since 10
121961847f8eSopenharmony_ci     */
122061847f8eSopenharmony_ci    deleteDLPLinkFile(linkFileName: string, callback: AsyncCallback<void>): void;
122161847f8eSopenharmony_ci
122261847f8eSopenharmony_ci    /**
122361847f8eSopenharmony_ci     * Recovers the file in plaintext from the DLP file. This method uses a promise to return the result.
122461847f8eSopenharmony_ci     *
122561847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
122661847f8eSopenharmony_ci     * @param { number } plaintextFd - Indicates the file descriptor of the file in plaintext.
122761847f8eSopenharmony_ci     * @returns { Promise<void> } The promise returned by the function.
122861847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
122961847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
123061847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
123161847f8eSopenharmony_ci     *     2. Incorrect parameter types.
123261847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
123361847f8eSopenharmony_ci     * @throws { BusinessError } 19100002 - Credential task error.
123461847f8eSopenharmony_ci     * @throws { BusinessError } 19100003 - Credential task time out.
123561847f8eSopenharmony_ci     * @throws { BusinessError } 19100004 - Credential service error.
123661847f8eSopenharmony_ci     * @throws { BusinessError } 19100005 - Credential authentication server error.
123761847f8eSopenharmony_ci     * @throws { BusinessError } 19100008 - The file is not a DLP file.
123861847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
123961847f8eSopenharmony_ci     * @throws { BusinessError } 19100010 - The DLP file is read only.
124061847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
124161847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
124261847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
124361847f8eSopenharmony_ci     * @since 10
124461847f8eSopenharmony_ci     */
124561847f8eSopenharmony_ci    recoverDLPFile(plaintextFd: number): Promise<void>;
124661847f8eSopenharmony_ci
124761847f8eSopenharmony_ci    /**
124861847f8eSopenharmony_ci     * Recovers the file in plaintext from the DLP file. This method uses an asynchronous callback to return the result.
124961847f8eSopenharmony_ci     *
125061847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
125161847f8eSopenharmony_ci     * @param { number } plaintextFd - Indicates the file descriptor of the file in plaintext.
125261847f8eSopenharmony_ci     * @param { AsyncCallback<void> } callback - Indicates the callback of recoverDLPFile.
125361847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
125461847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
125561847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
125661847f8eSopenharmony_ci     *     2. Incorrect parameter types.
125761847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
125861847f8eSopenharmony_ci     * @throws { BusinessError } 19100002 - Credential task error.
125961847f8eSopenharmony_ci     * @throws { BusinessError } 19100003 - Credential task time out.
126061847f8eSopenharmony_ci     * @throws { BusinessError } 19100004 - Credential service error.
126161847f8eSopenharmony_ci     * @throws { BusinessError } 19100005 - Credential authentication server error.
126261847f8eSopenharmony_ci     * @throws { BusinessError } 19100008 - The file is not a DLP file.
126361847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
126461847f8eSopenharmony_ci     * @throws { BusinessError } 19100010 - The DLP file is read only.
126561847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
126661847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
126761847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
126861847f8eSopenharmony_ci     * @since 10
126961847f8eSopenharmony_ci     */
127061847f8eSopenharmony_ci    recoverDLPFile(plaintextFd: number, callback: AsyncCallback<void>): void;
127161847f8eSopenharmony_ci
127261847f8eSopenharmony_ci    /**
127361847f8eSopenharmony_ci     * Closes the DLP file when the object is no longer used. This method uses a promise to return the result.
127461847f8eSopenharmony_ci     *
127561847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
127661847f8eSopenharmony_ci     * @returns { Promise<void> } The promise returned by the function.
127761847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
127861847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
127961847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
128061847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
128161847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
128261847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
128361847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
128461847f8eSopenharmony_ci     * @since 10
128561847f8eSopenharmony_ci     */
128661847f8eSopenharmony_ci    closeDLPFile(): Promise<void>;
128761847f8eSopenharmony_ci
128861847f8eSopenharmony_ci    /**
128961847f8eSopenharmony_ci     * Closes the DLP file when the object is no longer used. This method uses an asynchronous callback to return the result.
129061847f8eSopenharmony_ci     *
129161847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_DLP_FILE
129261847f8eSopenharmony_ci     * @param { AsyncCallback<void> } callback - Indicates the callback of closeDLPFile.
129361847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission denied.
129461847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Non-system applications use system APIs.
129561847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
129661847f8eSopenharmony_ci     * @throws { BusinessError } 19100001 - Invalid parameter value.
129761847f8eSopenharmony_ci     * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
129861847f8eSopenharmony_ci     * @throws { BusinessError } 19100011 - The system ability works abnormally.
129961847f8eSopenharmony_ci     * @syscap SystemCapability.Security.DataLossPrevention
130061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
130161847f8eSopenharmony_ci     * @since 10
130261847f8eSopenharmony_ci     */
130361847f8eSopenharmony_ci    closeDLPFile(callback: AsyncCallback<void>): void;
130461847f8eSopenharmony_ci  }
130561847f8eSopenharmony_ci
130661847f8eSopenharmony_ci  /**
130761847f8eSopenharmony_ci   * Generates a DLP file. This method uses a promise to return the result.
130861847f8eSopenharmony_ci   *
130961847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
131061847f8eSopenharmony_ci   * @param { number } plaintextFd - Indicates the file descriptor of the file in plaintext.
131161847f8eSopenharmony_ci   * @param { number } ciphertextFd - Indicates the file descriptor of the DLP file.
131261847f8eSopenharmony_ci   * @param { DLPProperty } property - Indicates the property of the DLP file.
131361847f8eSopenharmony_ci   * @returns { Promise<DLPFile> } Returns the {@link DLPFile}.
131461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
131561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
131661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
131761847f8eSopenharmony_ci   *     2. Incorrect parameter types.
131861847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
131961847f8eSopenharmony_ci   * @throws { BusinessError } 19100002 - Credential task error.
132061847f8eSopenharmony_ci   * @throws { BusinessError } 19100003 - Credential task time out.
132161847f8eSopenharmony_ci   * @throws { BusinessError } 19100004 - Credential service error.
132261847f8eSopenharmony_ci   * @throws { BusinessError } 19100005 - Credential authentication server error.
132361847f8eSopenharmony_ci   * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
132461847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
132561847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
132661847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
132761847f8eSopenharmony_ci   * @since 10
132861847f8eSopenharmony_ci   */
132961847f8eSopenharmony_ci  function generateDLPFile(plaintextFd: number, ciphertextFd: number, property: DLPProperty): Promise<DLPFile>;
133061847f8eSopenharmony_ci
133161847f8eSopenharmony_ci  /**
133261847f8eSopenharmony_ci   * Generates a DLP file. This method uses an asynchronous callback to return the result.
133361847f8eSopenharmony_ci   *
133461847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
133561847f8eSopenharmony_ci   * @param { number } plaintextFd - Indicates the file descriptor of the file in plaintext.
133661847f8eSopenharmony_ci   * @param { number } ciphertextFd - Indicates the file descriptor of the DLP file.
133761847f8eSopenharmony_ci   * @param { DLPProperty } property - Indicates the property of the DLP file.
133861847f8eSopenharmony_ci   * @param { AsyncCallback<DLPFile> } callback - Indicates the callback of generateDLPFile.
133961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
134061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
134161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
134261847f8eSopenharmony_ci   *     2. Incorrect parameter types.
134361847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
134461847f8eSopenharmony_ci   * @throws { BusinessError } 19100002 - Credential task error.
134561847f8eSopenharmony_ci   * @throws { BusinessError } 19100003 - Credential task time out.
134661847f8eSopenharmony_ci   * @throws { BusinessError } 19100004 - Credential service error.
134761847f8eSopenharmony_ci   * @throws { BusinessError } 19100005 - Credential authentication server error.
134861847f8eSopenharmony_ci   * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
134961847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
135061847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
135161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
135261847f8eSopenharmony_ci   * @since 10
135361847f8eSopenharmony_ci   */
135461847f8eSopenharmony_ci  function generateDLPFile(
135561847f8eSopenharmony_ci    plaintextFd: number,
135661847f8eSopenharmony_ci    ciphertextFd: number,
135761847f8eSopenharmony_ci    property: DLPProperty,
135861847f8eSopenharmony_ci    callback: AsyncCallback<DLPFile>
135961847f8eSopenharmony_ci  ): void;
136061847f8eSopenharmony_ci
136161847f8eSopenharmony_ci  /**
136261847f8eSopenharmony_ci   * Opens a DLP file. This method uses a promise to return the result.
136361847f8eSopenharmony_ci   *
136461847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
136561847f8eSopenharmony_ci   * @param { number } ciphertextFd - Indicates the file descriptor of the DLP file to open.
136661847f8eSopenharmony_ci   * @param { string } appId - Indicates the app ID of the application which opens the DLP file.
136761847f8eSopenharmony_ci   * @returns { Promise<DLPFile> } Returns the {@link DLPFile}.
136861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
136961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
137061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
137161847f8eSopenharmony_ci   *     2. Incorrect parameter types.
137261847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
137361847f8eSopenharmony_ci   * @throws { BusinessError } 19100002 - Credential task error.
137461847f8eSopenharmony_ci   * @throws { BusinessError } 19100003 - Credential task time out.
137561847f8eSopenharmony_ci   * @throws { BusinessError } 19100004 - Credential service error.
137661847f8eSopenharmony_ci   * @throws { BusinessError } 19100005 - Credential authentication server error.
137761847f8eSopenharmony_ci   * @throws { BusinessError } 19100008 - The file is not a DLP file.
137861847f8eSopenharmony_ci   * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
137961847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
138061847f8eSopenharmony_ci   * @throws { BusinessError } 19100018 - Not authorized application.
138161847f8eSopenharmony_ci   * @throws { BusinessError } 19100019 - The DLP file has expired.
138261847f8eSopenharmony_ci   * @throws { BusinessError } 19100020 - No network connection.
138361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
138461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
138561847f8eSopenharmony_ci   * @since 11
138661847f8eSopenharmony_ci   */
138761847f8eSopenharmony_ci  function openDLPFile(ciphertextFd: number, appId: string): Promise<DLPFile>;
138861847f8eSopenharmony_ci
138961847f8eSopenharmony_ci  /**
139061847f8eSopenharmony_ci   * Opens a DLP file. This method uses an asynchronous callback to return the result.
139161847f8eSopenharmony_ci   *
139261847f8eSopenharmony_ci   * @permission ohos.permission.ACCESS_DLP_FILE
139361847f8eSopenharmony_ci   * @param { number } ciphertextFd - Indicates the file descriptor of the DLP file to open.
139461847f8eSopenharmony_ci   * @param { string } appId - Indicates the app ID of the application which opens the DLP file.
139561847f8eSopenharmony_ci   * @param { AsyncCallback<DLPFile> } callback - Indicates the callback of openDLPFile.
139661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
139761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
139861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
139961847f8eSopenharmony_ci   *     2. Incorrect parameter types.
140061847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
140161847f8eSopenharmony_ci   * @throws { BusinessError } 19100002 - Credential task error.
140261847f8eSopenharmony_ci   * @throws { BusinessError } 19100003 - Credential task time out.
140361847f8eSopenharmony_ci   * @throws { BusinessError } 19100004 - Credential service error.
140461847f8eSopenharmony_ci   * @throws { BusinessError } 19100005 - Credential authentication server error.
140561847f8eSopenharmony_ci   * @throws { BusinessError } 19100008 - The file is not a DLP file.
140661847f8eSopenharmony_ci   * @throws { BusinessError } 19100009 - Failed to operate the DLP file.
140761847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
140861847f8eSopenharmony_ci   * @throws { BusinessError } 19100018 - Not authorized application.
140961847f8eSopenharmony_ci   * @throws { BusinessError } 19100019 - The DLP file has expired.
141061847f8eSopenharmony_ci   * @throws { BusinessError } 19100020 - No network connection.
141161847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
141261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
141361847f8eSopenharmony_ci   * @since 11
141461847f8eSopenharmony_ci   */
141561847f8eSopenharmony_ci  function openDLPFile(ciphertextFd: number, appId: string, callback: AsyncCallback<DLPFile>): void;
141661847f8eSopenharmony_ci
141761847f8eSopenharmony_ci  /**
141861847f8eSopenharmony_ci   * Sets sandbox application configuration. This method uses a promise to return the result.
141961847f8eSopenharmony_ci   *
142061847f8eSopenharmony_ci   * @param { string } configInfo - Configuration of the sandbox application.
142161847f8eSopenharmony_ci   * @returns { Promise<void> } Promise used to return the result.
142261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
142361847f8eSopenharmony_ci   *     2. Incorrect parameter types.
142461847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
142561847f8eSopenharmony_ci   * @throws { BusinessError } 19100007 - No permission to call this API,
142661847f8eSopenharmony_ci   *     which is available only for non-DLP sandbox applications.
142761847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
142861847f8eSopenharmony_ci   * @throws { BusinessError } 19100018 - Not authorized application.
142961847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
143061847f8eSopenharmony_ci   * @since 11
143161847f8eSopenharmony_ci   */
143261847f8eSopenharmony_ci  function setSandboxAppConfig(configInfo: string): Promise<void>;
143361847f8eSopenharmony_ci
143461847f8eSopenharmony_ci  /**
143561847f8eSopenharmony_ci   * Cleans sandbox application configuration. This method uses a promise to return the result.
143661847f8eSopenharmony_ci   *
143761847f8eSopenharmony_ci   * @returns { Promise<void> } Promise used to return the result.
143861847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
143961847f8eSopenharmony_ci   * @throws { BusinessError } 19100007 - No permission to call this API,
144061847f8eSopenharmony_ci   *     which is available only for non-DLP sandbox applications.
144161847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
144261847f8eSopenharmony_ci   * @throws { BusinessError } 19100018 - Not authorized application.
144361847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
144461847f8eSopenharmony_ci   * @since 11
144561847f8eSopenharmony_ci   */
144661847f8eSopenharmony_ci  function cleanSandboxAppConfig(): Promise<void>;
144761847f8eSopenharmony_ci
144861847f8eSopenharmony_ci  /**
144961847f8eSopenharmony_ci   * Obtains sandbox application configuration. This method uses a promise to return the result.
145061847f8eSopenharmony_ci   *
145161847f8eSopenharmony_ci   * @returns { Promise<string> } Promise used to return the result.
145261847f8eSopenharmony_ci   * @throws { BusinessError } 19100001 - Invalid parameter value.
145361847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
145461847f8eSopenharmony_ci   * @throws { BusinessError } 19100018 - Not authorized application.
145561847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
145661847f8eSopenharmony_ci   * @since 11
145761847f8eSopenharmony_ci   */
145861847f8eSopenharmony_ci  function getSandboxAppConfig(): Promise<string>;
145961847f8eSopenharmony_ci
146061847f8eSopenharmony_ci   /**
146161847f8eSopenharmony_ci   * Checks whether the current system provides the DLP feature. This method uses a promise to return the result.
146261847f8eSopenharmony_ci   *
146361847f8eSopenharmony_ci   * @returns { Promise<boolean> } Promise used to return the result.
146461847f8eSopenharmony_ci   * @throws { BusinessError } 19100011 - The system ability works abnormally.
146561847f8eSopenharmony_ci   * @syscap SystemCapability.Security.DataLossPrevention
146661847f8eSopenharmony_ci   * @since 12
146761847f8eSopenharmony_ci   */
146861847f8eSopenharmony_ci   function isDLPFeatureProvided(): Promise<boolean>;
146961847f8eSopenharmony_ci
147061847f8eSopenharmony_ci}
147161847f8eSopenharmony_ciexport default dlpPermission;