MCPcopy Create free account
hub / github.com/compozy/agh / NewFileKeyProvider

Function NewFileKeyProvider

internal/vault/crypto.go:42–50  ·  view source on GitHub ↗

NewFileKeyProvider returns a non-interactive key provider backed by AGH_VAULT_KEY or a 0600 key file.

(homeDir string, lookupEnv func(string) (string, bool))

Source from the content-addressed store, hash-verified

40
41// NewFileKeyProvider returns a non-interactive key provider backed by AGH_VAULT_KEY or a 0600 key file.
42func NewFileKeyProvider(homeDir string, lookupEnv func(string) (string, bool)) KeyProvider {
43 if lookupEnv == nil {
44 lookupEnv = os.LookupEnv
45 }
46 return &fileKeyProvider{
47 path: filepath.Join(strings.TrimSpace(homeDir), "vault.key"),
48 lookupEnv: lookupEnv,
49 }
50}
51
52func (p *fileKeyProvider) Key() ([]byte, error) {
53 lookupEnv := p.lookupEnv

Calls

no outgoing calls