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)
| 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) |
| 42 | func 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. |
no test coverage detected