(bootInfo: BootInfo, config: AuthConfig, deviceId: string)
| 118 | } |
| 119 | |
| 120 | private checkKmsBoot(bootInfo: BootInfo, config: AuthConfig, deviceId: string): BootResponse { |
| 121 | const mrAggregated = normalizeHex(bootInfo.mrAggregated); |
| 122 | |
| 123 | // check aggregated MR |
| 124 | const allowedMrs = config.kms.mrAggregated.map(normalizeHex); |
| 125 | if (!allowedMrs.includes(mrAggregated)) { |
| 126 | return { |
| 127 | isAllowed: false, |
| 128 | reason: 'aggregated MR not allowed', |
| 129 | gatewayAppId: config.gatewayAppId |
| 130 | }; |
| 131 | } |
| 132 | |
| 133 | // check device ID |
| 134 | if (!config.kms.allowAnyDevice) { |
| 135 | const allowedDevices = config.kms.devices.map(normalizeHex); |
| 136 | if (allowedDevices.length > 0 && !allowedDevices.includes(deviceId)) { |
| 137 | return { |
| 138 | isAllowed: false, |
| 139 | reason: 'KMS is not allowed to boot on this device', |
| 140 | gatewayAppId: config.gatewayAppId |
| 141 | }; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | return { |
| 146 | isAllowed: true, |
| 147 | reason: '', |
| 148 | gatewayAppId: config.gatewayAppId |
| 149 | }; |
| 150 | } |
| 151 | |
| 152 | private checkAppBoot(bootInfo: BootInfo, config: AuthConfig, deviceId: string): BootResponse { |
| 153 | const appId = normalizeHex(bootInfo.appId); |
no test coverage detected