Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllSourceStatus ¶ added in v0.2.0
func AllSourceStatus() []string
AllSourceStatus returns a compact summary of every credential source and whether it is set / found. Useful for diagnostics.
func CredentialSource ¶ added in v0.2.0
func CredentialSource() string
CredentialSource returns the name of the credential source that would win in the LoadCredentials precedence chain, or "none" if nothing is configured.
func GetAuthHeader ¶
func GetAuthHeader(creds *Credentials) string
GetAuthHeader returns the Authorization header value for the given credentials
func RemoveCredentials ¶
func RemoveCredentials() error
RemoveCredentials removes stored credentials from all file-based stores
func SaveCredentials ¶
func SaveCredentials(creds *Credentials, store CredentialStore) error
SaveCredentials persists credentials to the specified store
Types ¶
type AuthMethod ¶
type AuthMethod string
AuthMethod represents the authentication method to use
const ( // DirectAPIKey uses a pre-computed API key hex digest sent as ApiKey header DirectAPIKey AuthMethod = "apikey" // SigV4 uses AWS Signature Version 4 for token exchange SigV4 AuthMethod = "sigv4" )
func ValidateMethod ¶
func ValidateMethod(method string) (AuthMethod, error)
ValidateMethod checks if the given string is a valid AuthMethod
type CredentialStore ¶
type CredentialStore string
CredentialStore represents where credentials are persisted
const ( StoreHome CredentialStore = "home" // ~/.vulnetix/credentials.json StoreProject CredentialStore = "project" // .vulnetix/credentials.json StoreKeyring CredentialStore = "keyring" // system keyring (stub) )
func ValidateStore ¶
func ValidateStore(store string) (CredentialStore, error)
ValidateStore checks if the given string is a valid CredentialStore
type Credentials ¶
type Credentials struct {
OrgID string `json:"org_id"`
APIKey string `json:"api_key,omitempty"` // hex digest for Direct API Key
Secret string `json:"secret,omitempty"` // secret key for SigV4
Method AuthMethod `json:"method"`
}
Credentials holds authentication credentials for the Vulnetix API
func CredentialStatus ¶
func CredentialStatus() (string, *Credentials)
CredentialStatus returns a human-readable description of the current auth state
func LoadCredentials ¶
func LoadCredentials() (*Credentials, error)
LoadCredentials loads credentials using the following precedence:
- Environment variables (VULNETIX_API_KEY + VULNETIX_ORG_ID for Direct, VVD_ORG + VVD_SECRET for SigV4)
- Project dotfile (.vulnetix/credentials.json)
- Home directory (~/.vulnetix/credentials.json)