1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-15 00:35:14 +00:00

feat: store keys as JWK on disk (#339)

Co-authored-by: Kyle Mendell <kmendell@ofkm.us>
This commit is contained in:
Alessandro (Ale) Segala
2025-03-18 13:08:33 -07:00
committed by GitHub
parent e9b2d981b7
commit a7c9741802
10 changed files with 1207 additions and 174 deletions

View File

@@ -78,3 +78,15 @@ func SaveFile(file *multipart.FileHeader, dst string) error {
_, err = io.Copy(out, src)
return err
}
// FileExists returns true if a file exists on disk and is a regular file
func FileExists(path string) (bool, error) {
s, err := os.Stat(path)
if err != nil {
if os.IsNotExist(err) {
err = nil
}
return false, err
}
return !s.IsDir(), nil
}