tappd

package
v0.0.0-...-b914214 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Overview

Provides a dstack SDK Tappd client and related utilities

Author: Franco Barpp Gomes <[email protected]>

Index

Constants

View Source
const INIT_MR = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

Variables

This section is empty.

Functions

This section is empty.

Types

type DeriveKeyResponse

type DeriveKeyResponse struct {
	Key              string   `json:"key"`
	CertificateChain []string `json:"certificate_chain"`
}

Represents the response from a key derivation request.

func (*DeriveKeyResponse) ToBytes

func (d *DeriveKeyResponse) ToBytes(maxLength int) ([]byte, error)

Decodes the key to bytes, optionally truncating to maxLength. If maxLength < 0, the key is not truncated.

type EventLog

type EventLog struct {
	IMR          int    `json:"imr"`
	EventType    int    `json:"event_type"`
	Digest       string `json:"digest"`
	Event        string `json:"event"`
	EventPayload string `json:"event_payload"`
}

Represents an event log entry in the TCB info

type QuoteHashAlgorithm

type QuoteHashAlgorithm string

Represents the hash algorithm used in TDX quote generation.

const (
	SHA256    QuoteHashAlgorithm = "sha256"
	SHA384    QuoteHashAlgorithm = "sha384"
	SHA512    QuoteHashAlgorithm = "sha512"
	SHA3_256  QuoteHashAlgorithm = "sha3-256"
	SHA3_384  QuoteHashAlgorithm = "sha3-384"
	SHA3_512  QuoteHashAlgorithm = "sha3-512"
	KECCAK256 QuoteHashAlgorithm = "keccak256"
	KECCAK384 QuoteHashAlgorithm = "keccak384"
	KECCAK512 QuoteHashAlgorithm = "keccak512"
	RAW       QuoteHashAlgorithm = "raw"
)

type TappdClient

type TappdClient struct {
	// contains filtered or unexported fields
}

Handles communication with the Tappd service.

func NewTappdClient

func NewTappdClient(opts ...TappdClientOption) *TappdClient

Creates a new TappdClient instance based on the provided endpoint. If the endpoint is empty, it will use the simulator endpoint if it is set in the environment through DSTACK_SIMULATOR_ENDPOINT. Otherwise, it will use the default endpoint at /var/run/tappd.sock.

func (*TappdClient) DeriveKey

func (c *TappdClient) DeriveKey(ctx context.Context, path string) (*DeriveKeyResponse, error)

Derives a key from the Tappd service. This wraps DeriveKeyWithSubjectAndAltNames using the path as the subject and an empty altNames.

func (*TappdClient) DeriveKeyWithSubject

func (c *TappdClient) DeriveKeyWithSubject(ctx context.Context, path string, subject string) (*DeriveKeyResponse, error)

Derives a key from the Tappd service. This wraps DeriveKeyWithSubjectAndAltNames using an empty altNames.

func (*TappdClient) DeriveKeyWithSubjectAndAltNames

func (c *TappdClient) DeriveKeyWithSubjectAndAltNames(ctx context.Context, path string, subject string, altNames []string) (*DeriveKeyResponse, error)

Derives a key from the Tappd service, explicitly setting the subject and altNames.

func (*TappdClient) Info

Sends a request to get information about the Tappd instance

func (*TappdClient) TdxQuote

func (c *TappdClient) TdxQuote(ctx context.Context, reportData []byte) (*TdxQuoteResponse, error)

Sends a TDX quote request to the Tappd service using SHA512 as the report data hash algorithm.

func (*TappdClient) TdxQuoteWithHashAlgorithm

func (c *TappdClient) TdxQuoteWithHashAlgorithm(ctx context.Context, reportData []byte, hashAlgorithm QuoteHashAlgorithm) (*TdxQuoteResponse, error)

Sends a TDX quote request to the Tappd service with a specific hash report data hash algorithm. If the hash algorithm is RAW, the report data must be at most 64 bytes - if it's below that, it will be left-padded with zeros.

type TappdClientOption

type TappdClientOption func(*TappdClient)

Functional option for configuring a TappdClient.

func WithEndpoint

func WithEndpoint(endpoint string) TappdClientOption

Sets the endpoint for the TappdClient.

func WithLogger

func WithLogger(logger *slog.Logger) TappdClientOption

Sets the logger for the TappdClient

type TappdInfoResponse

type TappdInfoResponse struct {
	AppID      string  `json:"app_id"`
	InstanceID string  `json:"instance_id"`
	AppCert    string  `json:"app_cert"`
	TcbInfo    TcbInfo `json:"tcb_info"`
	AppName    string  `json:"app_name"`
}

Represents the response from an info request

type TcbInfo

type TcbInfo struct {
	Mrtd     string     `json:"mrtd"`
	Rtmr0    string     `json:"rtmr0"`
	Rtmr1    string     `json:"rtmr1"`
	Rtmr2    string     `json:"rtmr2"`
	Rtmr3    string     `json:"rtmr3"`
	EventLog []EventLog `json:"event_log"`
}

Represents the TCB information

type TdxQuoteResponse

type TdxQuoteResponse struct {
	Quote    string `json:"quote"`
	EventLog string `json:"event_log"`
}

Represents the response from a TDX quote request.

func (*TdxQuoteResponse) ReplayRTMRs

func (r *TdxQuoteResponse) ReplayRTMRs() (map[int]string, error)

Replays the RTMR history to calculate final RTMR values

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL