credential

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package credential resolves secret values in the config, such as channel tokens and tool API keys.

Supported formats:

  • Plaintext: "sk-abc123" → returned as-is
  • File ref: "file://filename.key" → content read from configDir/filename.key
  • Empty: "" → returned as-is (a provider that needs no key)

Index

Constants

View Source
const FileScheme = "file://"

FileScheme prefixes a reference to a file, beside the config, that holds the value.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolver

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

Resolver resolves raw credential strings from config secret fields. File references are resolved relative to the directory of the config file.

func NewResolver

func NewResolver(configDir string) *Resolver

NewResolver returns a Resolver that resolves file:// references relative to configDir (typically filepath.Dir of the config file path).

func (*Resolver) Resolve

func (r *Resolver) Resolve(raw string) (string, error)

Resolve returns the actual credential value for raw:

  • "" → "" (no error; a provider that needs no key)
  • "file://name.key" → trimmed content of configDir/name.key
  • anything else → raw unchanged (plaintext credential)

Jump to

Keyboard shortcuts

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