Getting Started
Verify Security & Attestation
// verify-deployment.js const { DstackClient } = require('dstack-sdk'); async function verifyDeployment() { // Connect to dstack guest agent (default Unix socket) const client = new DstackClient(); // Get attestation quote with report data const quote = await client.getQuote('your-report-data'); console.log('Attestation Quote:', quote.quote); console.log('Event Log:', quote.event_log); // Replay RTMRs for verification const rtmrs = quote.replayRtmrs(); console.log('RTMRs:', rtmrs); // Get application info const info = await client.info(); console.log('App ID:', info.app_id); console.log('Instance ID:', info.instance_id); console.log('TCB Info:', info.tcb_info); } verifyDeployment();
version: '3' services: your-app: image: your-image volumes: - /var/run/dstack.sock:/var/run/dstack.sock ports: - "8080:8080"
# Get attestation quote curl --unix-socket /var/run/dstack.sock \ http://dstack/GetQuote \ -H "Content-Type: application/json" \ -d '{"report_data": "1234deadbeaf"}' # Get application info curl --unix-socket /var/run/dstack.sock \ http://dstack/Info
// app.js - Express.js example const express = require('express'); const { DstackClient } = require('dstack-sdk'); const app = express(); const client = new DstackClient(); // Endpoint to get attestation quote app.get('/api/attestation', async (req, res) => { try { const reportData = req.query.report_data || 'default-report-data'; const quote = await client.getQuote(reportData); res.json({ success: true, quote: quote.quote, event_log: quote.event_log, rtmrs: quote.replayRtmrs() }); } catch (error) { res.status(500).json({ success: false, error: error.message }); } }); // Endpoint to get app info app.get('/api/info', async (req, res) => { try { const info = await client.info(); res.json({ success: true, info }); } catch (error) { res.status(500).json({ success: false, error: error.message }); } }); app.listen(8080, () => { console.log('API server running on port 8080'); });
replayRtmrs()
https://<app-id>.example.com/api/attestation
https://<app-id>.example.com/api/info