phalacloud

package
v0.0.0-...-ba12c5c Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package phalacloud implements the Attester and RequestPreparer interfaces for Phala Cloud's TEE attestation API (RedPill gateway).

RedPill is a multi-backend gateway that returns attestation in different formats depending on the backend model. Supported formats:

  • chutes: "attestation_type" key present → provider.ParseChutesFormat
  • dstack: "intel_quote" key present → delegates to nanogpt.ParseAttestationResponse
  • tinfoil: "format" key present → not yet supported
  • gateway: "gateway_attestation" key present → not yet supported

Phala Cloud attestation endpoint:

GET {base_url}/v1/attestation/report?model={model}&nonce={nonce}
Authorization: Bearer {api_key}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAttestationResponse

func ParseAttestationResponse(ctx context.Context, body []byte) (*attestation.RawAttestation, error)

ParseAttestationResponse detects the attestation format from the JSON body and delegates to the appropriate backend parser.

Types

type Attester

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

Attester fetches attestation data from Phala Cloud's attestation endpoint. The nonce is sent as a query parameter; the server may generate its own.

func NewAttester

func NewAttester(baseURL, apiKey string, offline ...bool) *Attester

NewAttester returns a Phala Cloud Attester configured with the given base URL and API key. Uses an extended timeout because Phala Cloud's multi-instance attestation endpoint is slow.

func (*Attester) FetchAttestation

func (a *Attester) FetchAttestation(ctx context.Context, model string, nonce attestation.Nonce) (*attestation.RawAttestation, error)

FetchAttestation fetches TEE attestation from Phala Cloud. The nonce is sent as a query parameter. Format detection is performed on the response body to delegate to the correct backend parser.

func (*Attester) SetClient

func (a *Attester) SetClient(c *http.Client)

SetClient replaces the HTTP client used for attestation fetches.

type Preparer

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

Preparer injects the Phala Cloud Authorization header into outgoing requests.

func NewPreparer

func NewPreparer(apiKey string) *Preparer

NewPreparer returns a Phala Cloud Preparer configured with the given API key.

func (*Preparer) PrepareRequest

func (p *Preparer) PrepareRequest(req *http.Request, _ http.Header, _ *e2ee.ChutesE2EE, _ bool, _ string) error

PrepareRequest injects the Authorization header into req.

Jump to

Keyboard shortcuts

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