public static function createUserCookies(NetworkSigner $signer, $network_key = null) { if (isset($this->api_key)) { $cookies_to_set = array(); $cookies = array(); $cookies['user'] = $user; $cookies['session_key'] = $session_key; $sig = $signer->sign($cookies, $this->secret); foreach ($cookies as $name => $val) { $cookies_to_set[($network_key !== null ? $network_key : '') . $this->api_key . '_' . $name] = $val; } $cookies_to_set[($network_key !== null ? $network_key : '') . $this->api_key] = $sig; } }
public static function verifySignature(NetworkSigner $signer, $params, $secret, $signature) { $signer->sign($params, $secret) == $signature; }