Dominik Schulz f58454452f
Increase test coverage (#2461)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-10 23:05:33 +01:00

35 lines
651 B
Go

package ghssh
import (
"fmt"
"time"
"github.com/google/go-github/github"
"github.com/gopasspw/gopass/internal/cache"
)
// Cache is a disk-backed GitHub SSH public key cache.
type Cache struct {
disk *cache.OnDisk
client *github.Client
Timeout time.Duration
}
// New creates a new github cache.
func New() (*Cache, error) {
cDir, err := cache.NewOnDisk("github-ssh", 6*time.Hour)
if err != nil {
return nil, err
}
return &Cache{
disk: cDir,
client: github.NewClient(nil),
Timeout: 30 * time.Second,
}, nil
}
func (c *Cache) String() string {
return fmt.Sprintf("Github SSH key cache (OnDisk: %s)", c.disk.String())
}