Keybase: s/id/username (#5165)
This commit is contained in:
parent
b58558ea4e
commit
488dd0e563
|
@ -252,12 +252,12 @@ $ solana-validator-info publish ~/validator-keypair.json <VALIDATOR_NAME> <VALID
|
||||||
```
|
```
|
||||||
Optional fields for VALIDATOR_INFO_ARGS:
|
Optional fields for VALIDATOR_INFO_ARGS:
|
||||||
* Website
|
* Website
|
||||||
* Keybase ID
|
* Keybase Username
|
||||||
* Details
|
* Details
|
||||||
|
|
||||||
##### Keybase
|
##### Keybase
|
||||||
|
|
||||||
Including a Keybase ID allows client applications (like the Solana Network
|
Including a Keybase username allows client applications (like the Solana Network
|
||||||
Explorer) to automatically pull in your validator public profile, including
|
Explorer) to automatically pull in your validator public profile, including
|
||||||
cryptographic proofs, brand identity, etc. To connect your validator pubkey with
|
cryptographic proofs, brand identity, etc. To connect your validator pubkey with
|
||||||
Keybase:
|
Keybase:
|
||||||
|
@ -266,8 +266,8 @@ Keybase:
|
||||||
2. Add your validator **identity pubkey** to Keybase:
|
2. Add your validator **identity pubkey** to Keybase:
|
||||||
* Create an empty file on your local computer called `validator-<PUBKEY>`
|
* Create an empty file on your local computer called `validator-<PUBKEY>`
|
||||||
* In Keybase, navigate to the Files section, and upload your pubkey file to
|
* In Keybase, navigate to the Files section, and upload your pubkey file to
|
||||||
a `solana` subdirectory in your public folder: `/keybase/public/<KEYBASE_ID>/solana`
|
a `solana` subdirectory in your public folder: `/keybase/public/<KEYBASE_USERNAME>/solana`
|
||||||
* To check your pubkey, ensure you can successfully browse to
|
* To check your pubkey, ensure you can successfully browse to
|
||||||
`https://keybase.pub/<KEYBASE_ID>/solana/validator-<PUBKEY>`
|
`https://keybase.pub/<KEYBASE_USERNAME>/solana/validator-<PUBKEY>`
|
||||||
3. Add or update your `solana-validator-info` with your Keybase ID. The CLI will
|
3. Add or update your `solana-validator-info` with your Keybase username. The
|
||||||
verify the `validator-<PUBKEY>` file
|
CLI will verify the `validator-<PUBKEY>` file
|
||||||
|
|
|
@ -17,8 +17,8 @@ use std::process::exit;
|
||||||
|
|
||||||
pub const MAX_SHORT_FIELD_LENGTH: usize = 70;
|
pub const MAX_SHORT_FIELD_LENGTH: usize = 70;
|
||||||
pub const MAX_LONG_FIELD_LENGTH: usize = 300;
|
pub const MAX_LONG_FIELD_LENGTH: usize = 300;
|
||||||
pub const MAX_VALIDATOR_INFO: u64 = 570;
|
pub const MAX_VALIDATOR_INFO: u64 = 576;
|
||||||
pub const JSON_RPC_URL: &str = "https://api.testnet.solana.com/";
|
pub const JSON_RPC_URL: &str = "https://api.testnet.solana.com:8899";
|
||||||
|
|
||||||
// Config account key: Va1idator1nfo111111111111111111111111111111
|
// Config account key: Va1idator1nfo111111111111111111111111111111
|
||||||
pub const REGISTER_CONFIG_KEY: [u8; 32] = [
|
pub const REGISTER_CONFIG_KEY: [u8; 32] = [
|
||||||
|
@ -103,23 +103,23 @@ fn check_details_length(string: String) -> Result<(), String> {
|
||||||
|
|
||||||
fn verify_keybase(
|
fn verify_keybase(
|
||||||
validator_pubkey: &Pubkey,
|
validator_pubkey: &Pubkey,
|
||||||
keybase_id: &Value,
|
keybase_username: &Value,
|
||||||
) -> Result<(), Box<dyn error::Error>> {
|
) -> Result<(), Box<dyn error::Error>> {
|
||||||
if let Some(keybase_id) = keybase_id.as_str() {
|
if let Some(keybase_username) = keybase_username.as_str() {
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"https://keybase.pub/{}/solana/validator-{:?}",
|
"https://keybase.pub/{}/solana/validator-{:?}",
|
||||||
keybase_id, validator_pubkey
|
keybase_username, validator_pubkey
|
||||||
);
|
);
|
||||||
let client = Client::new();
|
let client = Client::new();
|
||||||
if client.head(&url).send()?.status().is_success() {
|
if client.head(&url).send()?.status().is_success() {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(format!("keybase_id could not be confirmed at: {}. Please add this pubkey file to your keybase profile to connect", url))?
|
Err(format!("keybase_username could not be confirmed at: {}. Please add this pubkey file to your keybase profile to connect", url))?
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Err(format!(
|
Err(format!(
|
||||||
"keybase_id could not be parsed as String: {}",
|
"keybase_username could not be parsed as String: {}",
|
||||||
keybase_id
|
keybase_username
|
||||||
))?
|
))?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,10 +136,10 @@ fn parse_args(matches: &ArgMatches<'_>) -> Value {
|
||||||
if let Some(details) = matches.value_of("details") {
|
if let Some(details) = matches.value_of("details") {
|
||||||
map.insert("details".to_string(), Value::String(details.to_string()));
|
map.insert("details".to_string(), Value::String(details.to_string()));
|
||||||
}
|
}
|
||||||
if let Some(keybase_id) = matches.value_of("keybase_id") {
|
if let Some(keybase_username) = matches.value_of("keybase_username") {
|
||||||
map.insert(
|
map.insert(
|
||||||
"keybaseId".to_string(),
|
"keybaseUsername".to_string(),
|
||||||
Value::String(keybase_id.to_string()),
|
Value::String(keybase_username.to_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Value::Object(map)
|
Value::Object(map)
|
||||||
|
@ -218,13 +218,13 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
.help("Validator website url"),
|
.help("Validator website url"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("keybase_id")
|
Arg::with_name("keybase_username")
|
||||||
.short("k")
|
.short("k")
|
||||||
.long("keybase")
|
.long("keybase")
|
||||||
.value_name("STRING")
|
.value_name("STRING")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.validator(is_short_field)
|
.validator(is_short_field)
|
||||||
.help("Validator Keybase id"),
|
.help("Validator Keybase username"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("details")
|
Arg::with_name("details")
|
||||||
|
@ -294,7 +294,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
// Prepare validator info
|
// Prepare validator info
|
||||||
let keys = vec![(id(), false), (validator_keypair.pubkey(), true)];
|
let keys = vec![(id(), false), (validator_keypair.pubkey(), true)];
|
||||||
let validator_info = parse_args(&matches);
|
let validator_info = parse_args(&matches);
|
||||||
if let Some(string) = validator_info.get("keybaseId") {
|
if let Some(string) = validator_info.get("keybaseUsername") {
|
||||||
verify_keybase(&validator_keypair.pubkey(), &string)?;
|
verify_keybase(&validator_keypair.pubkey(), &string)?;
|
||||||
}
|
}
|
||||||
let validator_string = serde_json::to_string(&validator_info)?;
|
let validator_string = serde_json::to_string(&validator_info)?;
|
||||||
|
@ -426,12 +426,16 @@ mod tests {
|
||||||
let matches = App::new("test")
|
let matches = App::new("test")
|
||||||
.arg(Arg::with_name("name").short("n").takes_value(true))
|
.arg(Arg::with_name("name").short("n").takes_value(true))
|
||||||
.arg(Arg::with_name("website").short("w").takes_value(true))
|
.arg(Arg::with_name("website").short("w").takes_value(true))
|
||||||
.arg(Arg::with_name("keybase_id").short("k").takes_value(true))
|
.arg(
|
||||||
|
Arg::with_name("keybase_username")
|
||||||
|
.short("k")
|
||||||
|
.takes_value(true),
|
||||||
|
)
|
||||||
.arg(Arg::with_name("details").short("d").takes_value(true))
|
.arg(Arg::with_name("details").short("d").takes_value(true))
|
||||||
.get_matches_from(vec!["test", "-n", "Alice", "-k", "464bb0f2956f7e83"]);
|
.get_matches_from(vec!["test", "-n", "Alice", "-k", "alice_keybase"]);
|
||||||
let expected = json!({
|
let expected = json!({
|
||||||
"name": "Alice",
|
"name": "Alice",
|
||||||
"keybaseId": "464bb0f2956f7e83",
|
"keybaseUsername": "alice_keybase",
|
||||||
});
|
});
|
||||||
assert_eq!(parse_args(&matches), expected);
|
assert_eq!(parse_args(&matches), expected);
|
||||||
}
|
}
|
||||||
|
@ -496,7 +500,10 @@ mod tests {
|
||||||
"website".to_string(),
|
"website".to_string(),
|
||||||
Value::String(max_short_string.clone()),
|
Value::String(max_short_string.clone()),
|
||||||
);
|
);
|
||||||
info.insert("keybaseId".to_string(), Value::String(max_short_string));
|
info.insert(
|
||||||
|
"keybaseUsername".to_string(),
|
||||||
|
Value::String(max_short_string),
|
||||||
|
);
|
||||||
info.insert("details".to_string(), Value::String(max_long_string));
|
info.insert("details".to_string(), Value::String(max_long_string));
|
||||||
let info_string = serde_json::to_string(&Value::Object(info)).unwrap();
|
let info_string = serde_json::to_string(&Value::Object(info)).unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue