[#8] Accept directly bytes from gate key file

Signed-off-by: Pavel Korotkov <pkorotkov@gmail.com>
This commit is contained in:
Pavel Korotkov 2020-08-06 19:05:15 +03:00
parent d70fe6410b
commit 1e608634e7

View file

@ -161,14 +161,5 @@ func readAndKeepBody(request *http.Request) (*bytes.Reader, error) {
} }
func LoadGateAuthPrivateKey(path string) (hcs.X25519PrivateKey, error) { func LoadGateAuthPrivateKey(path string) (hcs.X25519PrivateKey, error) {
bytes, err := ioutil.ReadFile(path) return ioutil.ReadFile(path)
if err != nil {
return nil, err
}
key := string(bytes)
privateKey, _, err := hcs.DecodeKeysFromStrings(&key, nil)
if err != nil {
return nil, err
}
return privateKey, nil
} }