grafana-backuper/pkg/git/signer.go
Tom Neuber 0fb6e0b6e9
All checks were successful
continuous-integration/drone/push Build is passing
Add git functions & improve grafana functions
2024-02-16 21:56:27 +01:00

29 lines
465 B
Go

package git
import (
"os"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/ProtonMail/go-crypto/openpgp/armor"
)
func getSigner(keyFile string) (*openpgp.Entity, error) {
file, err := os.Open(keyFile)
if err != nil {
return nil, err
}
defer file.Close()
block, err := armor.Decode(file)
if err != nil {
return nil, err
}
entityList, err := openpgp.ReadKeyRing(block.Body)
if err != nil {
return nil, err
}
return entityList[0], nil
}