I am creating a new PHP application in which I want to interact with Keybase. First option is to use the API, but unfortunately I am running into some issues.
First step is to call the signup call. I managed to create a curl request, but I am not sure what the pwh should look like. I tried:
$fp = @fopen('/dev/urandom','rb');
if ($fp !== FALSE) {
$prBits .= @fread($fp,16);
@fclose($fp);
}
$salt = bin2hex($prBits);
$pwh = implode(unpack("H*",password_hash('MyP@ssword'.$prBits, PASSWORD_BCRYPT)));
But making the call results in:
{
"status": {
"code": 100,
"desc": "need a PDPKA5 key",
"name": "INPUT_ERROR"
},
"csrf_token": "lgHZIDA4ZjYyNzgy.....86aMrL09"
}
The complete call:
$data = [
"name" => "My Name",
"email" => "mymail@example.com",
"username" => "SomeUnusedUsername1234",
"pwh" => $pwh,
"pwh_version" => 3,
"salt" => $salt,
"invitation_id" => "000000001"
);
$dataString = json_encode($data);
$ch = curl_init('https://keybase.io/_/api/1.0/signup.json');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
Anyone got a working example or solution?