Extract and use privateKeyToWIF function