(report_data: string | Buffer | Uint8Array)
| 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) |
no test coverage detected