Dominik Schulz 9b72a1c76c
Improve test coverage (#3077)
* [chore] Add more tests

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

* [fix] Fix most tests

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

* [fix] Fix remaining tests

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

* [fix] Fix lint issues.

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

* [fix] Fix more lint issues.

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

* [fix] Fix more lint issues.

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

* [fix] Fix the final lint issue.

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

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-03-04 13:01:01 +01:00

32 lines
555 B
Go

package ghssh
import (
"fmt"
"time"
"github.com/gopasspw/gopass/internal/cache"
)
// Cache is a disk-backed GitHub SSH public key cache.
type Cache struct {
disk *cache.OnDisk
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,
Timeout: 30 * time.Second,
}, nil
}
func (c *Cache) String() string {
return fmt.Sprintf("Github SSH key cache (OnDisk: %s)", c.disk.String())
}