owenthereal / upterm

Instant Terminal Sharing
https://upterm.dev
Apache License 2.0
868 stars 56 forks source link

Support configuring GH env vars to get user's public keys #200

Closed owenthereal closed 1 year ago

owenthereal commented 1 year ago

This PR supports configuring GH env vars to get a user's public keys including GH_TOKEN/GITHUB_TOKEN, GH_ENTERPRISE_TOKEN/GITHUB_ENTERPRISE_TOKEN & GH_HOST. If the gh CLI is set up, upterm automatically adopts the GH token/host from the CLI with a fallback to public GH API calls.

Besides, this PR also enables displaying authorized keys with upterm session current, which makes it explicit that what keys are allowed to connect:

$ upterm session current
=== NIAQ8SWYKINTSYQDR7ZK
Command:                /bin/zsh
Force Command:          n/a
Host:                   ssh://uptermd.upterm.dev:22
Authorized Keys:        owenthereal:
                        - SHA256:D9RTzgSuaLQB47NIl6WKf6JrsLVJFngVwHinTSj8ScE
                        - SHA256:oD5PPCpSw7kFtb/TsHGbu+8OsjDL/CUHsxS0mUzqEms
SSH Session:            ssh niAq8sWykintsYQdR7Zk:OTE4NTc0NzZiNDA5Mjgudm0udXB0ZXJtLmludGVybmFsOjIyMjI=@uptermd.upterm.dev

This closes https://github.com/owenthereal/upterm/pull/191.