mirror of
https://github.com/getsops/sops.git
synced 2026-02-05 12:45:21 +01:00
Moved AES regex outside of function so it's only compiled once
This commit is contained in:
@@ -18,9 +18,10 @@ type EncryptedValue struct {
|
||||
datatype string
|
||||
}
|
||||
|
||||
var encre = regexp.MustCompile(`^ENC\[AES256_GCM,data:(.+),iv:(.+),tag:(.+),type:(.+)\]`)
|
||||
|
||||
func parse(value string) (*EncryptedValue, error) {
|
||||
re := regexp.MustCompile(`^ENC\[AES256_GCM,data:(.+),iv:(.+),tag:(.+),type:(.+)\]`)
|
||||
matches := re.FindStringSubmatch(value)
|
||||
matches := encre.FindStringSubmatch(value)
|
||||
if matches == nil {
|
||||
return nil, fmt.Errorf("Input string %s does not match sops' data format", value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user