common: remove WriteFile and ReadAllFile (use ioutil instead)

This commit is contained in:
zelig
2015-03-25 14:58:52 +00:00
parent 23e41a57ad
commit 4ec38e3932
8 changed files with 22 additions and 92 deletions

View File

@ -9,6 +9,7 @@ import (
"crypto/sha256"
"fmt"
"io"
"io/ioutil"
"os"
"encoding/hex"
@ -139,9 +140,10 @@ func LoadECDSA(file string) (*ecdsa.PrivateKey, error) {
return ToECDSA(buf), nil
}
// SaveECDSA saves a secp256k1 private key from the given file.
// SaveECDSA saves a secp256k1 private key to the given file with restrictive
// permissions
func SaveECDSA(file string, key *ecdsa.PrivateKey) error {
return common.WriteFile(file, FromECDSA(key))
return ioutil.WriteFile(file, FromECDSA(key), 0600)
}
func GenerateKey() (*ecdsa.PrivateKey, error) {