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

Method attest

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

Source from the content-addressed store, hash-verified

276 }
277
278 async attest(report_data: string | Buffer | Uint8Array): Promise<AttestResponse> {
279 let hex = to_hex(report_data)
280 if (hex.length > 128) {
281 throw new Error(`Report data is too large, it should be less than 64 bytes.`)
282 }
283 const payload = JSON.stringify({ report_data: hex })
284 const result = await send_rpc_request<{ attestation: string }>(this.endpoint, '/Attest', payload)
285 if ('error' in (result as any)) {
286 const err = (result as any)['error'] as string
287 throw new Error(err)
288 }
289 return Object.freeze({
290 __name__: 'AttestResponse',
291 attestation: result.attestation as Hex,
292 })
293 }
294
295 async info(): Promise<InfoResponse<T>> {
296 const result = await send_rpc_request<Omit<InfoResponse<TcbInfo>, 'tcb_info'> & { tcb_info: string }>(this.endpoint, '/Info', '{}')

Callers 1

index.test.tsFile · 0.45

Calls 1

to_hexFunction · 0.85

Tested by

no test coverage detected