fix: pass utf8 as 2nd argument when reading private key from file using `fs.readFileSync`

This commit is contained in:
Gregor 2019-01-10 09:50:07 -08:00 committed by Gregor Martynus
parent 301fc4775a
commit cc5b80b31e
1 changed files with 1 additions and 1 deletions

View File

@ -43,7 +43,7 @@ export function findPrivateKey (filepath?: string): Buffer | string | null {
}
if (process.env.PRIVATE_KEY_PATH) {
if (fs.existsSync(process.env.PRIVATE_KEY_PATH)) {
return fs.readFileSync(process.env.PRIVATE_KEY_PATH)
return fs.readFileSync(process.env.PRIVATE_KEY_PATH, 'utf8')
} else {
throw new Error(`Private key does not exists at path: ${process.env.PRIVATE_KEY_PATH}. Please check to ensure that the PRIVATE_KEY_PATH is correct.`)
}