secretvm-verification-sdk
v0.1.0
Published
SecretVM quote and workload verification SDK
Readme
SecretVM Verification SDK
Minimal helpers for verifying SecretVM quotes and workloads using the same APIs as the Developer Portal.
What it does
- VerifyQuote: validates a quote and returns the artifacts link when possible (also includes
proof_of_cloud/originwhen available) - VerifyWorkload: verifies a docker-compose against a quote (optionally including dockerfile hash)
- VerifyProofOfCloud: checks proof_of_cloud via
/api/quote-parse
Install
npm install secretvm-verification-sdkFor local development in this repo:
npm run buildUsage
import { createSecretVmSdk } from 'secretvm-verification-sdk';
const sdk = createSecretVmSdk({
environment: 'production', // 'production' | 'preview'
apiKey: process.env.SECRET_AI_API_KEY,
});
const quoteResult = await sdk.VerifyQuote({ quote });
console.log(quoteResult.artifactsLink);Environment Selection
The SDK supports two environments:
- production:
https://secretai.scrtlabs.com(default) - preview:
https://preview-aidev.scrtlabs.com
You can also provide a custom baseUrl which will override the environment selection.
const sdk = createSecretVmSdk({
environment: 'preview',
});Verify workload (docker-compose + dockerfile)
const workloadResult = await sdk.VerifyWorkload({
quote,
dockerCompose: dockerComposeYaml, // string | Uint8Array | ArrayBuffer | Blob
dockerFiles: dockerfileContents, // optional; used to compute dockerFilesSha256
});
if (workloadResult.ok) {
console.log('Workload verified', workloadResult.artifactsLink);
} else {
console.error('Workload mismatch', workloadResult.error);
}Proof of Cloud
const poc = await sdk.VerifyProofOfCloud({ quoteHex });
console.log(poc.verified, poc.proof_of_cloud);VerifyQuote returns proof_of_cloud (and origin when available) from the latest
/api/quote-parse response. VerifyProofOfCloud is a convenience wrapper around the
same endpoint when you only need proof_of_cloud (plus origin/machine_id).
