161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023 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 BasicServicesKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport { AsyncCallback, Callback } from './@ohos.base';
2261847f8eSopenharmony_ci
2361847f8eSopenharmony_ci/**
2461847f8eSopenharmony_ci * xts_device_attest authResult information
2561847f8eSopenharmony_ci *
2661847f8eSopenharmony_ci * @namespace deviceAttest
2761847f8eSopenharmony_ci * @syscap SystemCapability.XTS.DeviceAttest
2861847f8eSopenharmony_ci * @since 9
2961847f8eSopenharmony_ci */
3061847f8eSopenharmony_cideclare namespace deviceAttest {
3161847f8eSopenharmony_ci  /**
3261847f8eSopenharmony_ci   * Obtains the AttestResultInfo object.
3361847f8eSopenharmony_ci   *
3461847f8eSopenharmony_ci   * @param { AsyncCallback<AttestResultInfo> } callback Indicates the callback containing the AttestResultInfo object.
3561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - This api is system api, Please use the system application to call this api.
3661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Input parameters wrong, the number of parameters is incorrect,
3761847f8eSopenharmony_ci                or the type of parameters is incorrect.
3861847f8eSopenharmony_ci   * @throws { BusinessError } 20000001 - System service exception, please try again or reboot your device.
3961847f8eSopenharmony_ci   * @syscap SystemCapability.XTS.DeviceAttest
4061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
4161847f8eSopenharmony_ci   * @since 9
4261847f8eSopenharmony_ci   */
4361847f8eSopenharmony_ci  function getAttestStatus(callback: AsyncCallback<AttestResultInfo>): void;
4461847f8eSopenharmony_ci
4561847f8eSopenharmony_ci  /**
4661847f8eSopenharmony_ci   * Obtains the AttestResultInfo object.
4761847f8eSopenharmony_ci   *
4861847f8eSopenharmony_ci   * @returns { Promise<AttestResultInfo> } Returns that the AttestResultInfo object is returned in Promise mode.
4961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - This api is system api, Please use the system application to call this api.
5061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Input parameters wrong, the number of parameters is incorrect,
5161847f8eSopenharmony_ci                or the type of parameters is incorrect.
5261847f8eSopenharmony_ci   * @throws { BusinessError } 20000001 - System service exception, please try again or reboot your device.
5361847f8eSopenharmony_ci   * @syscap SystemCapability.XTS.DeviceAttest
5461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
5561847f8eSopenharmony_ci   * @since 9
5661847f8eSopenharmony_ci   */
5761847f8eSopenharmony_ci  function getAttestStatus(): Promise<AttestResultInfo>;
5861847f8eSopenharmony_ci
5961847f8eSopenharmony_ci  /**
6061847f8eSopenharmony_ci   * Obtains the AttestResultInfo object.
6161847f8eSopenharmony_ci   *
6261847f8eSopenharmony_ci   * @returns { AttestResultInfo } Obtains the AttestResultInfo object synchronously.
6361847f8eSopenharmony_ci   * @throws { BusinessError } 202 - This api is system api, Please use the system application to call this api.
6461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Input parameters wrong, the number of parameters is incorrect,
6561847f8eSopenharmony_ci                or the type of parameters is incorrect.
6661847f8eSopenharmony_ci   * @throws { BusinessError } 20000001 - System service exception, please try again or reboot your device.
6761847f8eSopenharmony_ci   * @syscap SystemCapability.XTS.DeviceAttest
6861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
6961847f8eSopenharmony_ci   * @since 9
7061847f8eSopenharmony_ci   */
7161847f8eSopenharmony_ci  function getAttestStatusSync(): AttestResultInfo;
7261847f8eSopenharmony_ci
7361847f8eSopenharmony_ci  /**
7461847f8eSopenharmony_ci   * Device attest result information.
7561847f8eSopenharmony_ci   *
7661847f8eSopenharmony_ci   * @interface AttestResultInfo
7761847f8eSopenharmony_ci   * @syscap SystemCapability.XTS.DeviceAttest
7861847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
7961847f8eSopenharmony_ci   * @since 9
8061847f8eSopenharmony_ci   */
8161847f8eSopenharmony_ci  export interface AttestResultInfo {
8261847f8eSopenharmony_ci
8361847f8eSopenharmony_ci    /**
8461847f8eSopenharmony_ci     * Result of the device hardware information authentication.
8561847f8eSopenharmony_ci     *
8661847f8eSopenharmony_ci     * @type { number }
8761847f8eSopenharmony_ci     * @syscap SystemCapability.XTS.DeviceAttest
8861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
8961847f8eSopenharmony_ci     * @since 9
9061847f8eSopenharmony_ci     */
9161847f8eSopenharmony_ci    authResult: number;
9261847f8eSopenharmony_ci
9361847f8eSopenharmony_ci    /**
9461847f8eSopenharmony_ci     * Result of the device software information authentication.
9561847f8eSopenharmony_ci     *
9661847f8eSopenharmony_ci     * @type { number }
9761847f8eSopenharmony_ci     * @syscap SystemCapability.XTS.DeviceAttest
9861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
9961847f8eSopenharmony_ci     * @since 9
10061847f8eSopenharmony_ci     */
10161847f8eSopenharmony_ci    softwareResult: number;
10261847f8eSopenharmony_ci
10361847f8eSopenharmony_ci    /**
10461847f8eSopenharmony_ci     * Software result detail array that includes versionId, patchLevel,
10561847f8eSopenharmony_ci     * rootHash and a reserved space.
10661847f8eSopenharmony_ci     *
10761847f8eSopenharmony_ci     * @type { Array<number> }
10861847f8eSopenharmony_ci     * @syscap SystemCapability.XTS.DeviceAttest
10961847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
11061847f8eSopenharmony_ci     * @since 9
11161847f8eSopenharmony_ci     */
11261847f8eSopenharmony_ci    softwareResultDetail: Array<number>;
11361847f8eSopenharmony_ci
11461847f8eSopenharmony_ci    /**
11561847f8eSopenharmony_ci     * Credential sent from the cloud.
11661847f8eSopenharmony_ci     *
11761847f8eSopenharmony_ci     * @type { string }
11861847f8eSopenharmony_ci     * @syscap SystemCapability.XTS.DeviceAttest
11961847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
12061847f8eSopenharmony_ci     * @since 9
12161847f8eSopenharmony_ci     */
12261847f8eSopenharmony_ci    ticket: string;
12361847f8eSopenharmony_ci  }
12461847f8eSopenharmony_ci}
12561847f8eSopenharmony_ci
12661847f8eSopenharmony_ciexport default deviceAttest;