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

Method getQuote

sdk/js/src/index.ts:259–276  ·  view source on GitHub ↗
(report_data: string | Buffer | Uint8Array)

Source from the content-addressed store, hash-verified

257 }
258
259 async getQuote(report_data: string | Buffer | Uint8Array): Promise<GetQuoteResponse> {
260 let hex = to_hex(report_data)
261 if (hex.length > 128) {
262 throw new Error(`Report data is too large, it should be less than 64 bytes.`)
263 }
264 const payload = JSON.stringify({ report_data: hex })
265 const result = await send_rpc_request<GetQuoteResponse>(this.endpoint, '/GetQuote', payload)
266 if ('error' in result) {
267 const err = result['error'] as string
268 throw new Error(err)
269 }
270 Object.defineProperty(result, 'replayRtmrs', {
271 get: () => () => reply_rtmrs(JSON.parse(result.event_log) as EventLog[]),
272 enumerable: true,
273 configurable: false,
274 })
275 return Object.freeze(result)
276 }
277
278 async attest(report_data: string | Buffer | Uint8Array): Promise<AttestResponse> {
279 let hex = to_hex(report_data)

Callers 3

mainFunction · 0.95
tdxQuoteMethod · 0.95
index.test.tsFile · 0.80

Calls 3

to_hexFunction · 0.85
reply_rtmrsFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected