provider

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(kind string, p Provider)

Register adds a provider to the global registry. Panics on duplicate kind.

func Reset

func Reset()

Reset clears the registry. For testing only.

Types

type BindingMeta

type BindingMeta struct {
	ID          string
	WorkspaceID string
	Kind        string
	DisplayName string
	ServerURL   string
	PublicMeta  map[string]any
	AuthType    string
	IsDefault   bool
}

BindingMeta contains non-secret fields of a credential binding.

type DecryptedBinding

type DecryptedBinding struct {
	BindingMeta
	AuthSecret []byte // plaintext; provider interprets per its own format
}

DecryptedBinding is a binding with its auth secret decrypted.

type Provider

type Provider interface {
	// Kind returns the short identifier used in URL paths and DB rows.
	Kind() string

	// ParseUpload validates a user-uploaded config blob and returns the fields to persist.
	// AuthSecret will be AES-GCM encrypted before storage.
	ParseUpload(contentType string, raw []byte) (*UploadResult, error)

	// BuildSandboxConfig produces config artifacts to mount into a sandbox at provisioning time.
	// Pure function: no DB, no network.
	BuildSandboxConfig(
		bindings []*BindingMeta,
		proxyToken string,
		credproxyPublicURL string,
	) ([]*SandboxConfigFile, error)

	// ServeHTTP handles a proxied request from a sandbox.
	// The caller has already authenticated and decrypted the binding.
	ServeHTTP(w http.ResponseWriter, r *http.Request, b *DecryptedBinding)
}

Provider handles credential injection for a single external service kind.

func All

func All() []Provider

All returns all registered providers sorted by kind.

func Lookup

func Lookup(kind string) (Provider, error)

Lookup returns the provider for the given kind.

type Registry

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

Registry holds registered credential providers.

type SandboxConfigFile

type SandboxConfigFile struct {
	// Relative path under /var/run/agentserver/. No "..".
	SubPath string
	Mode    int32
	Content []byte

	// Env vars to set on the sandbox pod.
	EnvVars map[string]string
}

SandboxConfigFile is a file to mount into a sandbox pod.

type UploadResult

type UploadResult struct {
	DisplayName       string
	ServerURL         string
	PublicMeta        map[string]any
	AuthType          string
	AuthSecret        []byte // plaintext; will be encrypted before storage
	PendingDeviceAuth bool   // true = requires device code flow before credential is usable
}

UploadResult is returned by ParseUpload with fields to persist.

Jump to

Keyboard shortcuts

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