node-snapchat icon indicating copy to clipboard operation
node-snapchat copied to clipboard

Add story support

Open lucasad opened this issue 11 years ago • 3 comments

We just need to figure out how to decrypt the data with node/openssl. In php it's MCRYPT_RIJNDAEL_128 in CBC mode.

lucasad avatar Dec 12 '13 01:12 lucasad

Been trying to crack this with Node too. The equivalent so far for the php MCRYPT_RIJNDAEL_128 is aes-256-cbc with the key and IV. I can't seem to get a working, unencrypted image though.

adriancooney avatar Oct 01 '14 01:10 adriancooney

oh, i got it working, I'll add it in a new branch

lucasad avatar Oct 01 '14 01:10 lucasad

function get_story(url, iv, key, output_stream) {
    var iv = new Buffer(iv, 'base64');
    var key = new Buffer(key, 'base64');
    https.get(url), function(blob) {
        try {
        if(blob.statusCode==200)
            return blob.pipe(crypto.createDecipheriv('aes-256-cbc', key, iv))
                       .pipe(output_stream);
        } catch(error) {
          // openssl error, if not caught, process exits
        }
    });
}

should work with both blob and thumb. blob can be mp4 video, jpeg image, or zip of png image overlay and mp4 video

lucasad avatar Oct 01 '14 01:10 lucasad