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 16 /** 17 * @file 18 * @kit BasicServicesKit 19 */ 20 21 import { AsyncCallback, Callback } from './@ohos.base'; 22 23 /** 24 * xts_device_attest authResult information 25 * 26 * @namespace deviceAttest 27 * @syscap SystemCapability.XTS.DeviceAttest 28 * @since 9 29 */ 30 declare namespace deviceAttest { 31 /** 32 * Obtains the AttestResultInfo object. 33 * 34 * @param { AsyncCallback<AttestResultInfo> } callback Indicates the callback containing the AttestResultInfo object. 35 * @throws { BusinessError } 202 - This api is system api, Please use the system application to call this api. 36 * @throws { BusinessError } 401 - Input parameters wrong, the number of parameters is incorrect, 37 or the type of parameters is incorrect. 38 * @throws { BusinessError } 20000001 - System service exception, please try again or reboot your device. 39 * @syscap SystemCapability.XTS.DeviceAttest 40 * @systemapi Hide this for inner system use. 41 * @since 9 42 */ 43 function getAttestStatus(callback: AsyncCallback<AttestResultInfo>): void; 44 45 /** 46 * Obtains the AttestResultInfo object. 47 * 48 * @returns { Promise<AttestResultInfo> } Returns that the AttestResultInfo object is returned in Promise mode. 49 * @throws { BusinessError } 202 - This api is system api, Please use the system application to call this api. 50 * @throws { BusinessError } 401 - Input parameters wrong, the number of parameters is incorrect, 51 or the type of parameters is incorrect. 52 * @throws { BusinessError } 20000001 - System service exception, please try again or reboot your device. 53 * @syscap SystemCapability.XTS.DeviceAttest 54 * @systemapi Hide this for inner system use. 55 * @since 9 56 */ 57 function getAttestStatus(): Promise<AttestResultInfo>; 58 59 /** 60 * Obtains the AttestResultInfo object. 61 * 62 * @returns { AttestResultInfo } Obtains the AttestResultInfo object synchronously. 63 * @throws { BusinessError } 202 - This api is system api, Please use the system application to call this api. 64 * @throws { BusinessError } 401 - Input parameters wrong, the number of parameters is incorrect, 65 or the type of parameters is incorrect. 66 * @throws { BusinessError } 20000001 - System service exception, please try again or reboot your device. 67 * @syscap SystemCapability.XTS.DeviceAttest 68 * @systemapi Hide this for inner system use. 69 * @since 9 70 */ 71 function getAttestStatusSync(): AttestResultInfo; 72 73 /** 74 * Device attest result information. 75 * 76 * @interface AttestResultInfo 77 * @syscap SystemCapability.XTS.DeviceAttest 78 * @systemapi Hide this for inner system use. 79 * @since 9 80 */ 81 export interface AttestResultInfo { 82 83 /** 84 * Result of the device hardware information authentication. 85 * 86 * @type { number } 87 * @syscap SystemCapability.XTS.DeviceAttest 88 * @systemapi Hide this for inner system use. 89 * @since 9 90 */ 91 authResult: number; 92 93 /** 94 * Result of the device software information authentication. 95 * 96 * @type { number } 97 * @syscap SystemCapability.XTS.DeviceAttest 98 * @systemapi Hide this for inner system use. 99 * @since 9 100 */ 101 softwareResult: number; 102 103 /** 104 * Software result detail array that includes versionId, patchLevel, 105 * rootHash and a reserved space. 106 * 107 * @type { Array<number> } 108 * @syscap SystemCapability.XTS.DeviceAttest 109 * @systemapi Hide this for inner system use. 110 * @since 9 111 */ 112 softwareResultDetail: Array<number>; 113 114 /** 115 * Credential sent from the cloud. 116 * 117 * @type { string } 118 * @syscap SystemCapability.XTS.DeviceAttest 119 * @systemapi Hide this for inner system use. 120 * @since 9 121 */ 122 ticket: string; 123 } 124 } 125 126 export default deviceAttest;