envoy: refactor gpg_update_tty