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

Method emitEvent

sdk/js/src/index.ts:335–349  ·  view source on GitHub ↗

* Emit an event. This extends the event to RTMR3 on TDX platform. * * Requires dstack OS 0.5.0 or later. * * @param event The event name * @param payload The event data as string or Buffer or Uint8Array

(event: string, payload: string | Buffer | Uint8Array)

Source from the content-addressed store, hash-verified

333 * @param payload The event data as string or Buffer or Uint8Array
334 */
335 async emitEvent(event: string, payload: string | Buffer | Uint8Array): Promise<void> {
336 if (!event) {
337 throw new Error('Event name cannot be empty')
338 }
339
340 const hexPayload = to_hex(payload)
341 await send_rpc_request(
342 this.endpoint,
343 '/EmitEvent',
344 JSON.stringify({
345 event: event,
346 payload: hexPayload
347 })
348 )
349 }
350
351 /**
352 * Signs a payload using a derived key.

Callers

nothing calls this directly

Calls 2

send_rpc_requestFunction · 0.90
to_hexFunction · 0.85

Tested by

no test coverage detected