Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add keychain provider for reading text/yaml/json secrets #585

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pkg/providers/keychain/keychain_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package keychain

import (
"testing"
)

func Test_isHex(t *testing.T) {
tests := []struct {
input string
expected bool
}{
{"", true},
{"a1b2c3", true},
{"A1B2C3", true},
{"1234567890abcdef", true},
{"12345", false}, // Odd length
{"g1h2", false}, // Non-hex characters
{"!@#$", false}, // Special characters
{"abcdefg", false}, // Odd length with valid hex characters
anisimovdk marked this conversation as resolved.
Show resolved Hide resolved
{"ABCDEF", true},
{"abcdef", true},
{"1234abcd", true},
{"1234abcg", false}, // Contains 'g'
{"12 34", false}, // Contains space
{"", true}, // Empty string
}

for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
result := isHex(tt.input)
if result != tt.expected {
t.Errorf("isHex(%q) = %v; want %v", tt.input, result, tt.expected)
}
})
}
}