-
-
Notifications
You must be signed in to change notification settings - Fork 479
/
loader.go
46 lines (37 loc) · 815 Bytes
/
loader.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package cli
import (
"context"
"fmt"
"os"
"github.com/gopasspw/gopass/internal/backend"
"github.com/gopasspw/gopass/pkg/debug"
"github.com/gopasspw/gopass/pkg/fsutil"
)
const (
name = "gpgcli"
)
func init() {
backend.RegisterCrypto(backend.GPGCLI, name, &loader{})
}
type loader struct{}
// New implements backend.CryptoLoader.
func (l loader) New(ctx context.Context) (backend.Crypto, error) {
debug.Log("Using Crypto Backend: %s", name)
return New(ctx, Config{
Umask: fsutil.Umask(),
Args: GPGOpts(),
Binary: os.Getenv("GOPASS_GPG_BINARY"),
})
}
func (l loader) Handles(s backend.Storage) error {
if s.Exists(context.TODO(), IDFile) {
return nil
}
return fmt.Errorf("not supported")
}
func (l loader) Priority() int {
return 1
}
func (l loader) String() string {
return name
}