Habari\Utils::WSSE PHP Method

WSSE() public static method

Returns an array of tokens used for WSSE authentication http://www.xml.com/pub/a/2003/12/17/dive.html http://www.sixapart.com/developers/atom/protocol/atom_authentication.html
public static WSSE ( string | array $nonce = '', string $timestamp = '' ) : array
$nonce string | array a string nonce or an existing array to add nonce parameters to
$timestamp string a timestamp
return array an array of WSSE authentication elements
    public static function WSSE($nonce = '', $timestamp = '')
    {
        $wsse = array();
        if (is_array($nonce)) {
            $wsse = $nonce;
            $nonce = '';
        }
        if ('' === $nonce) {
            $nonce = Utils::crypt(Options::get('public-GUID') . Utils::nonce());
        }
        if ('' === $timestamp) {
            $timestamp = date('c');
        }
        $user = User::identify();
        $wsse = array_merge($wsse, array('nonce' => $nonce, 'timestamp' => $timestamp, 'digest' => base64_encode(pack('H*', sha1($nonce . $timestamp . $user->password)))));
        return $wsse;
    }