diff --git a/lib/initBiscuit.go b/lib/initBiscuit.go index 71785d5..5f63585 100644 --- a/lib/initBiscuit.go +++ b/lib/initBiscuit.go @@ -3,6 +3,7 @@ package lib import ( "crypto/ed25519" "crypto/rand" + "io" "io/ioutil" "os" "time" @@ -53,12 +54,21 @@ func InitGlobalBiscuit() error { break } } - var err error - PrivateKey, err = ioutil.ReadFile(filePrivateKey) + file, err := os.Open(filePrivateKey) if err != nil { return err } - PublicKey, err = ioutil.ReadFile(filePublicKey) + defer file.Close() + PrivateKey, err = io.ReadAll(file) + if err != nil { + return err + } + file, err = os.Open(filePublicKey) + if err != nil { + return err + } + defer file.Close() + PublicKey, err = io.ReadAll(file) if err != nil { return err }