UserId = $content[1]; $instance->ProjectId = $content[2]; return $instance; } else { throw new SomethingException("HMAC did not match."); } } else { throw new SomethingException("Not enough data."); } return null; } public function WriteExternal() { $data = $this->UserId . " " . $this->ProjectId; $salt = uniqid(rand(), true); $message = $salt . " " . $data; $hmac = Utility::calculateHMAC(Keys::_SECRET,$message); $output = $message . " " . base64_encode($hmac); return base64_encode($output); } } ?>