Gracefully handling curl / api errors.

- Handling connection failures.
- Handling operation timeouts.
- Handling user interrupts.
- Handling unknown errors.
Refactoring code.

- Handling passphrases via new Passphrase class.