Skip to main content

update_github_ssh_scopes

Function update_github_ssh_scopes 

Source
pub async fn update_github_ssh_scopes<O: OAuthDeviceFlowProvider + ?Sized, U: SshSigningKeyUploader + ?Sized>(
    oauth: &O,
    uploader: &U,
    identity_storage: &(dyn IdentityStorage + Send + Sync),
    _ctx: &AuthsContext,
    config: &GitHubClaimConfig,
    key_alias: &str,
    hostname: &str,
    public_key: Option<&str>,
    now: DateTime<Utc>,
    on_device_code: &dyn Fn(&DeviceCodeResponse),
) -> Result<PlatformUserProfile, PlatformError>
Expand description

Re-authorize with GitHub and optionally upload the SSH signing key.

Re-runs the OAuth device flow to obtain a fresh token with potentially new scopes, then attempts to upload the SSH signing key if provided.

Args:

  • oauth: OAuth device flow provider.
  • uploader: SSH key uploader.
  • identity_storage: Storage backend for identity and metadata.
  • ctx: Runtime context (key storage, passphrase provider).
  • config: GitHub OAuth client ID and registry URL.
  • key_alias: Keychain alias for the device key.
  • hostname: Machine hostname for the key title.
  • public_key: SSH public key in OpenSSH format (optional).
  • now: Current time (injected by caller).
  • on_device_code: Callback fired after device code is obtained.

Usage:

update_github_ssh_scopes(
    &oauth_provider,
    &uploader,
    &identity_storage,
    &ctx,
    &config,
    "main",
    "MacBook.local",
    Some("ssh-ed25519 AAAA..."),
    Utc::now(),
    &|code| { println!("Authorize at: {}", code.verification_uri); },
).await?;