public static function authenticateWithToken($token) {
    $pkeyResource = openssl_pkey_new(array(
      "digest_alg" => "sha256",
      "private_key_bits" => 2048
    ));

    openssl_pkey_export($pkeyResource, $generatedPrivateKey);

    $pkeyResourceDetails = openssl_pkey_get_details($pkeyResource);
    $generatedPublicKey = $pkeyResourceDetails["key"];

    $requestResult = Request::post("/g_business/v1/authentication_keys", array(
      "body" => array(
        "public_key" => $generatedPublicKey,
        "token" => $token
      )
    ));

    self::$privateKey = $generatedPrivateKey;
    self::$publicKey = $generatedPublicKey;
    self::$keyId = $requestResult->key_id;

    $returnClass = new ApiAuthentication();
    $returnClass->privateKey = $generatedPrivateKey;
    $returnClass->publicKey = $generatedPublicKey;
    $returnClass->keyId = $requestResult->key_id;
    return $returnClass;
  }
public static function authenticateWithToken($token) {
    $pkeyResource = openssl_pkey_new(array(
      "digest_alg" => "sha256",
      "private_key_bits" => 2048
    ));

    openssl_pkey_export($pkeyResource, $generatedPrivateKey);

    $pkeyResourceDetails = openssl_pkey_get_details($pkeyResource);
    $generatedPublicKey = $pkeyResourceDetails["key"];

    $requestResult = Request::post("/g_business/v1/authentication_keys", array(
      "body" => array(
        "public_key" => $generatedPublicKey,
        "token" => $token
      )
    ));

    self::$privateKey = $generatedPrivateKey;
    self::$publicKey = $generatedPublicKey;
    self::$keyId = $requestResult->key_id;

    $returnClass = new ApiAuthentication();
    $returnClass->privateKey = $generatedPrivateKey;
    $returnClass->publicKey = $generatedPublicKey;
    $returnClass->keyId = $requestResult->key_id;
    return $returnClass;
  }
public static function authenticateWithToken ( $ token ) { $ pkeyResource = openssl_pkey_new ( array ( "digest_alg" => "sha256" , "private_key_bits" => 2048 ) ) ; openssl_pkey_export ( $ pkeyResource , $ generatedPrivateKey ) ; $ pkeyResourceDetails = openssl_pkey_get_details ( $ pkeyResource ) ; $ generatedPublicKey = $ pkeyResourceDetails [ "key" ] ; $ requestResult = Request :: post ( "/g_business/v1/authentication_keys" , array ( "body" => array ( "public_key" => $ generatedPublicKey , "token" => $ token ) ) ) ; self :: $ privateKey = $ generatedPrivateKey ; self :: $ publicKey = $ generatedPublicKey ; self :: $ keyId = $ requestResult -> key_id ; $ returnClass = new ApiAuthentication ( ) ; $ returnClass -> privateKey = $ generatedPrivateKey ; $ returnClass -> publicKey = $ generatedPublicKey ; $ returnClass -> keyId = $ requestResult -> key_id ; return $ returnClass ; }
Generate new keys and authenticate with token
@param string $token
Generate new keys and authenticate with token