feat: throw consistent error for invalid public key