node.js and wordpress sessions

For a leetle project, I needed a way to validate a wordpress session from node.js. Wordpress uses a somewhat complicated session system, with HMACs and using part of password salt, and was unable to find a ready puzzle piece for the purpose. So I wrote my own.

The result is a javascript module. Sample usage:

var wps = require('wpsess');
var vdtor = new wps.Validator('/path/to/my/wp-config.php');
vdtor.validate('value_of_my_logged_in_cookie', function (err, username) {
    if (err)
        console.log('Authentication failed: ' + err);
        console.log('Logged in user: ' + username);

It is way from perfect, but it works well enough for me.