Promise can succeed or fail. Always handle the error as well.

Maybe you could put computing of SHA256 into testPDF, which would then return it in as an argument to the callback.