pub fn get_keys(
username: &str,
token: Option<String>,
) -> Result<Vec<String>, u16>
Expand description
Download user’s SSH keys from GitHub
Return a vector of String
containing all the user keys in the exact same order they were send
by the API.
Output keys format is the following:
<SSH_KEY> from-GH-id-<KEY_ID>
KEY_ID
is the internal GitHub key id.
§Errors
Return the response status code if it’s not a 2XX status code. Return an internal error code:
1001
if GitHub username isn’t valid code stored inINVALID_GH_USERNAME
1002
if GitHub API response could not be parsed code stored inINVALID_GH_API_RESPONSE
§Example
let token: Option<String>;
use superkeyloader_lib::github::get_keys;
let keys = get_keys("biosan", token).unwrap();
assert!(keys[0].contains(&String::from("ssh")));
assert!(keys[0].contains(&String::from(" from-GH-id-")));