aboutsummaryrefslogtreecommitdiff
path: root/file/names.go
diff options
context:
space:
mode:
Diffstat (limited to 'file/names.go')
-rw-r--r--file/names.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/file/names.go b/file/names.go
index f8bfa58..6846097 100644
--- a/file/names.go
+++ b/file/names.go
@@ -3,6 +3,7 @@ package file
import (
"errors"
"path/filepath"
+ "strings"
)
var ErrNames = errors.New("please use naming scheme of keyname.pub and keyname.sec")
@@ -22,3 +23,15 @@ func PubName(encFile string) string {
ext := filepath.Ext(encFile)
return filepath.Base(encFile[:len(ext)-1] + ".pub")
}
+
+const verifyWith = "verify with "
+
+func PubFile(comment string) (string, bool) {
+ if strings.HasPrefix(comment, verifyWith) {
+ file := comment[len(verifyWith):]
+ if strings.HasSuffix(file, ".pub") {
+ return file, true
+ }
+ }
+ return "", false
+}