MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / checkBoot

Method checkBoot

kms/auth-eth-bun/index.ts:123–166  ·  view source on GitHub ↗
(bootInfo: BootInfo, isKms: boolean)

Source from the content-addressed store, hash-verified

121 }
122
123 async checkBoot(bootInfo: BootInfo, isKms: boolean): Promise<BootResponse> {
124 // create boot info struct for contract call
125 const bootInfoStruct = {
126 appId: this.decodeHex(bootInfo.appId, 20) as Address,
127 composeHash: this.decodeHex(bootInfo.composeHash, 32),
128 instanceId: this.decodeHex(bootInfo.instanceId, 20) as Address,
129 deviceId: this.decodeHex(bootInfo.deviceId, 32),
130 mrAggregated: this.decodeHex(bootInfo.mrAggregated, 32),
131 mrSystem: this.decodeHex(bootInfo.mrSystem || '', 32),
132 osImageHash: this.decodeHex(bootInfo.osImageHash, 32),
133 tcbStatus: bootInfo.tcbStatus || '',
134 advisoryIds: bootInfo.advisoryIds || []
135 };
136
137 let response;
138 if (isKms) {
139 response = await this.client.readContract({
140 address: this.kmsContractAddr,
141 abi: DSTACK_KMS_ABI,
142 functionName: 'isKmsAllowed',
143 args: [bootInfoStruct]
144 });
145 } else {
146 response = await this.client.readContract({
147 address: this.kmsContractAddr,
148 abi: DSTACK_KMS_ABI,
149 functionName: 'isAppAllowed',
150 args: [bootInfoStruct]
151 });
152 }
153
154 const [isAllowed, reason] = response;
155 const gatewayAppId = await this.client.readContract({
156 address: this.kmsContractAddr,
157 abi: DSTACK_KMS_ABI,
158 functionName: 'gatewayAppId'
159 });
160
161 return {
162 isAllowed,
163 reason,
164 gatewayAppId: gatewayAppId as string,
165 };
166 }
167
168 async getGatewayAppId(): Promise<string> {
169 const result = await this.client.readContract({

Callers 1

index.tsFile · 0.45

Calls 1

decodeHexMethod · 0.95

Tested by

no test coverage detected