15bbf6e98Sopenharmony_ci/*
25bbf6e98Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
35bbf6e98Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
45bbf6e98Sopenharmony_ci * you may not use this file except in compliance with the License.
55bbf6e98Sopenharmony_ci * You may obtain a copy of the License at
65bbf6e98Sopenharmony_ci *
75bbf6e98Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
85bbf6e98Sopenharmony_ci *
95bbf6e98Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
105bbf6e98Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
115bbf6e98Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
125bbf6e98Sopenharmony_ci * See the License for the specific language governing permissions and
135bbf6e98Sopenharmony_ci * limitations under the License.
145bbf6e98Sopenharmony_ci */
155bbf6e98Sopenharmony_ci
165bbf6e98Sopenharmony_ciimport { AsyncCallback, Callback } from './@ohos.base';
175bbf6e98Sopenharmony_ci
185bbf6e98Sopenharmony_ci/**
195bbf6e98Sopenharmony_ci * xts_device_attest authResult information
205bbf6e98Sopenharmony_ci *
215bbf6e98Sopenharmony_ci * @since 9
225bbf6e98Sopenharmony_ci * @syscap SystemCapability.XTS.DeviceAttest
235bbf6e98Sopenharmony_ci */
245bbf6e98Sopenharmony_cideclare namespace deviceAttest {
255bbf6e98Sopenharmony_ci    /**
265bbf6e98Sopenharmony_ci     * Obtains the AttestResultInfo object.
275bbf6e98Sopenharmony_ci     *
285bbf6e98Sopenharmony_ci     * @param callback Indicates the callback containing the AttestResultInfo object.
295bbf6e98Sopenharmony_ci     * @since 9
305bbf6e98Sopenharmony_ci     * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
315bbf6e98Sopenharmony_ci     * @throws { BusinessError } 401 - The parameter check failed.
325bbf6e98Sopenharmony_ci     * @throws { BusinessError } 20000001 -  system service exception.
335bbf6e98Sopenharmony_ci     * @systemapi
345bbf6e98Sopenharmony_ci     */
355bbf6e98Sopenharmony_ci    function getAttestStatus(callback: AsyncCallback<AttestResultInfo>) : void;
365bbf6e98Sopenharmony_ci
375bbf6e98Sopenharmony_ci    /**
385bbf6e98Sopenharmony_ci     * Obtains the AttestResultInfo object.
395bbf6e98Sopenharmony_ci     *
405bbf6e98Sopenharmony_ci     * @returns Returns that the AttestResultInfo object is returned in Promise mode.
415bbf6e98Sopenharmony_ci     * @since 9
425bbf6e98Sopenharmony_ci     * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
435bbf6e98Sopenharmony_ci     * @throws { BusinessError } 401 - The parameter check failed.
445bbf6e98Sopenharmony_ci     * @throws { BusinessError } 20000001 -  system service exception.
455bbf6e98Sopenharmony_ci     * @systemapi
465bbf6e98Sopenharmony_ci     */
475bbf6e98Sopenharmony_ci    function getAttestStatus() : Promise<AttestResultInfo>;
485bbf6e98Sopenharmony_ci
495bbf6e98Sopenharmony_ci    /**
505bbf6e98Sopenharmony_ci     * Obtains the AttestResultInfo object.
515bbf6e98Sopenharmony_ci     *
525bbf6e98Sopenharmony_ci     * @returns Obtains the AttestResultInfo object synchronously.
535bbf6e98Sopenharmony_ci     * @since 9
545bbf6e98Sopenharmony_ci     * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
555bbf6e98Sopenharmony_ci     * @throws { BusinessError } 401 - The parameter check failed.
565bbf6e98Sopenharmony_ci     * @throws { BusinessError } 20000001 -  system service exception.
575bbf6e98Sopenharmony_ci     * @systemapi
585bbf6e98Sopenharmony_ci     */
595bbf6e98Sopenharmony_ci    function getAttestStatusSync() : AttestResultInfo;
605bbf6e98Sopenharmony_ci
615bbf6e98Sopenharmony_ci    /**
625bbf6e98Sopenharmony_ci     * Device attest result information.
635bbf6e98Sopenharmony_ci     * @typedef AttestResultInfo
645bbf6e98Sopenharmony_ci     * @syscap SystemCapability.XTS.DeviceAttest
655bbf6e98Sopenharmony_ci     * @since 9
665bbf6e98Sopenharmony_ci     * @systemapi
675bbf6e98Sopenharmony_ci     */
685bbf6e98Sopenharmony_ci    export interface AttestResultInfo {
695bbf6e98Sopenharmony_ci
705bbf6e98Sopenharmony_ci        /**
715bbf6e98Sopenharmony_ci         * Result of the device hardware information authentication.
725bbf6e98Sopenharmony_ci         *
735bbf6e98Sopenharmony_ci         * @type { number }
745bbf6e98Sopenharmony_ci         * @since 9
755bbf6e98Sopenharmony_ci         */
765bbf6e98Sopenharmony_ci        authResult : number;
775bbf6e98Sopenharmony_ci
785bbf6e98Sopenharmony_ci        /**
795bbf6e98Sopenharmony_ci         * Result of the device software information authentication.
805bbf6e98Sopenharmony_ci         *
815bbf6e98Sopenharmony_ci         * @type { number }
825bbf6e98Sopenharmony_ci         * @since 9
835bbf6e98Sopenharmony_ci         */
845bbf6e98Sopenharmony_ci        softwareResult : number;
855bbf6e98Sopenharmony_ci
865bbf6e98Sopenharmony_ci        /**
875bbf6e98Sopenharmony_ci         * Software result detail array that includes versionId, patchLevel,
885bbf6e98Sopenharmony_ci         * rootHash and a reserved space.
895bbf6e98Sopenharmony_ci         *
905bbf6e98Sopenharmony_ci         * @type { Array<number> }
915bbf6e98Sopenharmony_ci         * @since 9
925bbf6e98Sopenharmony_ci         */
935bbf6e98Sopenharmony_ci        softwareResultDetail : Array<number>;
945bbf6e98Sopenharmony_ci
955bbf6e98Sopenharmony_ci        /**
965bbf6e98Sopenharmony_ci         * Credential sent from the cloud.
975bbf6e98Sopenharmony_ci         *
985bbf6e98Sopenharmony_ci         * @type { string }
995bbf6e98Sopenharmony_ci         * @since 9
1005bbf6e98Sopenharmony_ci         */
1015bbf6e98Sopenharmony_ci        ticket : string;
1025bbf6e98Sopenharmony_ci    }
1035bbf6e98Sopenharmony_ci}
1045bbf6e98Sopenharmony_ci
1055bbf6e98Sopenharmony_ciexport default deviceAttest;