MCPcopy Create free account
hub / github.com/conforma/cli / KeyFromKeyRef

Function KeyFromKeyRef

internal/utils/key_resolver.go:42–47  ·  view source on GitHub ↗

KeyFromKeyRef resolves a key from either a file path or a Kubernetes secret reference. This provides a unified interface for both public and private key resolution. Supported formats: - File path: "/path/to/key.pem" - Kubernetes secret: "k8s://namespace/secret-name/key-field" (explicit key field) -

(ctx context.Context, keyRef string, fs afero.Fs)

Source from the content-addressed store, hash-verified

40// - Kubernetes secret: "k8s://namespace/secret-name/key-field" (explicit key field)
41// - Kubernetes secret: "k8s://namespace/secret-name" (auto-select if single key exists)
42func KeyFromKeyRef(ctx context.Context, keyRef string, fs afero.Fs) ([]byte, error) {
43 if strings.HasPrefix(keyRef, "k8s://") {
44 return keyFromKubernetesSecret(ctx, keyRef)
45 }
46 return keyFromFile(keyRef, fs)
47}
48
49// PublicKeyFromKeyRef resolves a public key from either a file path or a Kubernetes secret reference.
50// This provides a consistent interface with PrivateKeyFromKeyRef.

Callers 3

PublicKeyFromKeyRefFunction · 0.85
PrivateKeyFromKeyRefFunction · 0.85
PasswordFromKeyRefFunction · 0.85

Calls 2

keyFromKubernetesSecretFunction · 0.85
keyFromFileFunction · 0.85

Tested by

no test coverage detected