Skip to main content

Module github_trip

Module github_trip 

Source
Expand description

The one-trip first connect with GitHub, desktop side: the relay half.

GitHub’s install page takes no redirect_uri, so after the person installs the App and authorizes it, GitHub sends the browser to the App’s first callback URL: the cloud relay’s hosted page /github-callback. The page hands {code, installation_id, setup_action} to the relay under the SHA-256 of the install state the broker issued; this module registers that trip before the browser opens and polls for the outcome. The code goes to the broker, which holds the App’s client secret and checks the state is one this account was issued; nothing here reads it.

The poll key is the hash, never the state itself, so a poll address in a log is no use to anyone.

Enums§

Polled
What the relay answered to a poll.

Constants§

CALLBACK_PATH
Where the relay’s hosted page is, and where GitHub is told to send the browser.

Functions§

callback_uri
The address the install page’s callback lands on.
parse_poll
Reads a poll’s answer. Anything the relay should not send is read as “ask again”, never as a code.
poll_once
Ask the relay once. A network error or a server error reads as “not yet”: the caller asks again.
register
Tell the relay a trip is coming, before the browser opens (a flow nobody registered is refused).
relay_key
The relay’s key for a trip: the SHA-256 hex of the install state.