@@ -44,14 +44,26 @@ export interface TcbInfo {
4444 rtmr1 : string
4545 rtmr2 : string
4646 rtmr3 : string
47+ app_compose : string
4748 event_log : EventLog [ ]
4849}
4950
50- export interface InfoResponse {
51+ export type TcbInfoV03x = TcbInfo & {
52+ rootfs_hash : string
53+ }
54+
55+ export type TcbInfoV05x = TcbInfo & {
56+ mr_aggregated : string
57+ os_image_hash : string
58+ compose_hash : string
59+ device_id : string
60+ }
61+
62+ export interface InfoResponse < VersionTcbInfo extends TcbInfo > {
5163 app_id : string
5264 instance_id : string
5365 app_cert : string
54- tcb_info : TcbInfo
66+ tcb_info : VersionTcbInfo
5567 app_name : string
5668 device_id : string
5769 os_image_hash ?: string // Optional: empty if OS image is not measured by KMS
@@ -132,7 +144,7 @@ export interface TlsKeyOptions {
132144 usageClientAuth ?: boolean ;
133145}
134146
135- export class DstackClient {
147+ export class DstackClient < T extends TcbInfo = TcbInfoV05x > {
136148 protected endpoint : string
137149
138150 constructor ( endpoint : string | undefined = undefined ) {
@@ -210,11 +222,11 @@ export class DstackClient {
210222 return Object . freeze ( result )
211223 }
212224
213- async info ( ) : Promise < InfoResponse > {
214- const result = await send_rpc_request < Omit < InfoResponse , 'tcb_info' > & { tcb_info : string } > ( this . endpoint , '/Info' , '{}' )
225+ async info ( ) : Promise < InfoResponse < T > > {
226+ const result = await send_rpc_request < Omit < InfoResponse < TcbInfo > , 'tcb_info' > & { tcb_info : string } > ( this . endpoint , '/Info' , '{}' )
215227 return Object . freeze ( {
216228 ...result ,
217- tcb_info : JSON . parse ( result . tcb_info ) as TcbInfo ,
229+ tcb_info : JSON . parse ( result . tcb_info ) as T ,
218230 } )
219231 }
220232
@@ -283,7 +295,7 @@ export class DstackClient {
283295 }
284296}
285297
286- export class TappdClient extends DstackClient {
298+ export class TappdClient extends DstackClient < TcbInfoV03x > {
287299 constructor ( endpoint : string | undefined = undefined ) {
288300 if ( endpoint === undefined ) {
289301 if ( process . env . TAPPD_SIMULATOR_ENDPOINT ) {
0 commit comments