(bootInfo: BootInfo, isKms: boolean)
| 32 | } |
| 33 | |
| 34 | async checkBoot(bootInfo: BootInfo, isKms: boolean): Promise<BootResponse> { |
| 35 | // Create boot info struct for contract call |
| 36 | const bootInfoStruct = { |
| 37 | appId: this.decodeHex(bootInfo.appId, 20), |
| 38 | instanceId: this.decodeHex(bootInfo.instanceId, 20), |
| 39 | composeHash: this.decodeHex(bootInfo.composeHash, 32), |
| 40 | deviceId: this.decodeHex(bootInfo.deviceId, 32), |
| 41 | mrSystem: this.decodeHex(bootInfo.mrSystem, 32), |
| 42 | mrAggregated: this.decodeHex(bootInfo.mrAggregated, 32), |
| 43 | osImageHash: this.decodeHex(bootInfo.osImageHash, 32), |
| 44 | tcbStatus: bootInfo.tcbStatus, |
| 45 | advisoryIds: bootInfo.advisoryIds |
| 46 | }; |
| 47 | let response; |
| 48 | if (isKms) { |
| 49 | response = await this.kmsContract.isKmsAllowed(bootInfoStruct); |
| 50 | } else { |
| 51 | response = await this.kmsContract.isAppAllowed(bootInfoStruct); |
| 52 | } |
| 53 | const [isAllowed, reason] = response; |
| 54 | const gatewayAppId = await this.kmsContract.gatewayAppId(); |
| 55 | return { |
| 56 | isAllowed, |
| 57 | reason, |
| 58 | gatewayAppId, |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | async getGatewayAppId(): Promise<string> { |
| 63 | return await this.kmsContract.gatewayAppId(); |
no test coverage detected