1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { AsyncCallback, Callback } from './@ohos.base'; 17 18/** 19 * xts_device_attest authResult information 20 * 21 * @since 9 22 * @syscap SystemCapability.XTS.DeviceAttest 23 */ 24declare namespace deviceAttest { 25 /** 26 * Obtains the AttestResultInfo object. 27 * 28 * @param callback Indicates the callback containing the AttestResultInfo object. 29 * @since 9 30 * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. 31 * @throws { BusinessError } 401 - The parameter check failed. 32 * @throws { BusinessError } 20000001 - system service exception. 33 * @systemapi 34 */ 35 function getAttestStatus(callback: AsyncCallback<AttestResultInfo>): void; 36 37 /** 38 * Obtains the AttestResultInfo object. 39 * 40 * @returns Returns that the AttestResultInfo object is returned in Promise mode. 41 * @since 9 42 * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. 43 * @throws { BusinessError } 401 - The parameter check failed. 44 * @throws { BusinessError } 20000001 - system service exception. 45 * @systemapi 46 */ 47 function getAttestStatus(): Promise<AttestResultInfo>; 48 49 /** 50 * Obtains the AttestResultInfo object. 51 * 52 * @returns Obtains the AttestResultInfo object synchronously. 53 * @since 9 54 * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. 55 * @throws { BusinessError } 401 - The parameter check failed. 56 * @throws { BusinessError } 20000001 - system service exception. 57 * @systemapi 58 */ 59 function getAttestStatusSync(): AttestResultInfo; 60 61 /** 62 * Device attest result information. 63 * @typedef AttestResultInfo 64 * @syscap SystemCapability.XTS.DeviceAttest 65 * @since 9 66 * @systemapi 67 */ 68 export interface AttestResultInfo { 69 70 /** 71 * Result of the device hardware information authentication. 72 * 73 * @type { number } 74 * @since 9 75 */ 76 authResult: number; 77 78 /** 79 * Result of the device software information authentication. 80 * 81 * @type { number } 82 * @since 9 83 */ 84 softwareResult: number; 85 86 /** 87 * Software result detail array that includes versionId, patchLevel, 88 * rootHash and a reserved space. 89 * 90 * @type { Array<number> } 91 * @since 9 92 */ 93 softwareResultDetail: Array<number>; 94 95 /** 96 * Credential sent from the cloud. 97 * 98 * @type { string } 99 * @since 9 100 */ 101 ticket: string; 102 } 103} 104 105export default deviceAttest;