Manage key updates from a particular channel
Inheritance: extends BlueprintGear
Example #1
0
 /**
  * @route notary/verify
  */
 public function verify()
 {
     // Input validation
     if (empty($_POST['challenge'])) {
         \Airship\json_response(['status' => 'error', 'message' => 'Expected a challenge=something HTTP POST parameter.']);
     }
     if (!\is_string($_POST['challenge'])) {
         \Airship\json_response(['status' => 'error', 'message' => 'Challenge must be a string.']);
     }
     if (Binary::safeStrlen($_POST['challenge']) < 20) {
         \Airship\json_response(['status' => 'error', 'message' => 'Challenge is too short. Continuum should be generating a long random nonce.']);
     }
     try {
         list($update, $signature) = $this->chanUp->verifyUpdate($this->sk, $_POST['challenge']);
         \Airship\json_response(['status' => 'OK', 'response' => $update, 'signature' => $signature]);
     } catch (\Exception $ex) {
         \Airship\json_response(['status' => 'error', 'message' => $ex->getMessage()]);
     }
 }