* 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)
| 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. |
nothing calls this directly
no test coverage detected