Documentation
¶
Index ¶
- type Client
- type ClientOption
- func WithAttestationBundleURL(attestationBundleURL string) ClientOption
- func WithBaseURL(baseURL string) ClientOption
- func WithEnclave(enclave string) ClientOption
- func WithOpenAIOptions(opts ...option.RequestOption) ClientOption
- func WithRepo(repo string) ClientOption
- func WithTransport(mode TransportMode) ClientOption
- type TransportMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client wraps the OpenAI client to provide secure inference through Tinfoil
func NewClient ¶
func NewClient(openaiOpts ...option.RequestOption) (*Client, error)
NewClient creates a new secure OpenAI client using default parameters
func NewClientWithOptions ¶ added in v0.12.11
func NewClientWithOptions(opts ...ClientOption) (*Client, error)
NewClientWithOptions creates a secure OpenAI client configured through functional options. By default it selects a router automatically, verifies against the default config repository, and uses the EHBP transport.
func NewClientWithParams ¶
func NewClientWithParams(enclave, repo string, openaiOpts ...option.RequestOption) (*Client, error)
NewClientWithParams creates a new secure OpenAI client with explicit enclave and repo parameters
func (*Client) HTTPClient ¶ added in v0.12.0
HTTPClient returns the underlying HTTP client used to reach the enclave. It re-verifies attestation automatically when the enclave rotates its key, and it is bound to the verified enclave (and the configured proxy, if any): requests to any other host, or over plain http, are refused because request headers are not encrypted. This can be used for secure, direct HTTP requests to the enclave.
func (*Client) Transport ¶ added in v0.12.11
func (c *Client) Transport() TransportMode
Transport returns the transport mode used to secure traffic to the enclave.
type ClientOption ¶ added in v0.12.11
type ClientOption func(*clientConfig)
ClientOption configures a Client created with NewClientWithOptions.
func WithAttestationBundleURL ¶ added in v0.13.0
func WithAttestationBundleURL(attestationBundleURL string) ClientOption
WithAttestationBundleURL fetches the attestation bundle from the given base URL (for example your own proxy) instead of attesting the enclave directly, so the client only needs to reach a single origin. The bundle is still verified client-side. The enclave host is taken from the verified bundle.
func WithBaseURL ¶ added in v0.13.0
func WithBaseURL(baseURL string) ClientOption
WithBaseURL routes requests through the given base URL (for example your own proxy) instead of sending them directly to the enclave. Request bodies stay encrypted end-to-end to the verified enclave; when the base URL's origin differs from the enclave's, the SDK adds the X-Tinfoil-Enclave-Url header so the proxy can forward the encrypted request to the right enclave. Only supported with the EHBP transport.
func WithEnclave ¶ added in v0.12.11
func WithEnclave(enclave string) ClientOption
WithEnclave sets the enclave host to verify and connect to. When unset, a router is selected automatically.
func WithOpenAIOptions ¶ added in v0.12.11
func WithOpenAIOptions(opts ...option.RequestOption) ClientOption
WithOpenAIOptions appends options passed through to the underlying OpenAI client.
func WithRepo ¶ added in v0.12.11
func WithRepo(repo string) ClientOption
WithRepo sets the GitHub repository used for code measurement verification.
func WithTransport ¶ added in v0.12.11
func WithTransport(mode TransportMode) ClientOption
WithTransport selects the transport mode. Defaults to TransportEHBP.
type TransportMode ¶ added in v0.12.11
type TransportMode string
TransportMode selects how the SDK secures traffic to the enclave.
const ( // TransportEHBP encrypts request bodies end-to-end with HPKE via the // Encrypted HTTP Body Protocol. Only the verified enclave can decrypt them, // so it works through proxies. This is the default. TransportEHBP TransportMode = "ehbp" // TransportTLS pins the enclave's TLS certificate. All traffic is encrypted // and terminated at the verified enclave, which requires a direct // connection (requests through a proxy will fail). TransportTLS TransportMode = "tls" )
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
chat
command
|
|
|
verifier
module
|
|
|
examples/client
command
|
|
|
examples/verifier
command
|
|
|
rootfetch
command
|
|