Files
stfs/internal/keys/check.go
2021-12-08 00:27:46 +01:00

25 lines
382 B
Go

package keys
import (
"errors"
"os"
"github.com/pojntfx/stfs/pkg/config"
)
var (
ErrKeyNotAccessible = errors.New("key not found or accessible")
)
func CheckKeyAccessible(encryptionFormat string, pathToKey string) error {
if encryptionFormat == config.NoneKey {
return nil
}
if _, err := os.Stat(pathToKey); err != nil {
return ErrKeyNotAccessible
}
return nil
}