tonistiigi/mega — pull request #3 by fabiux82 (2013-02-23 15:30:56+00:00)
Title: Bugfix split keys in File Class

I have tried using the library with my mega account but I had a bug in the init step invoking the mega function (with autoload option to true).
I solved the problem changing in file.js:File the param to crypto.formatKey.

This is the error output:
assert.js:102
throw new assert.AssertionError({
^
AssertionError: Trying to read beyond buffer length
at readInt32 (buffer.js:777:12)
at Buffer.readInt32BE (buffer.js:795:10)
at AES.decryptKey (/Users/fabiux/Documents/mega_example_js/node_modules/mega/lib/crypto/index.js:109:16)
at new File (/Users/fabiux/Documents/mega_example_js/node_modules/mega/lib/file.js:25:19)
at Storage._importFile (/Users/fabiux/Documents/mega_example_js/node_modules/mega/lib/storage.js:222:32)
at Array.forEach (native)
at Storage.reload.api.on.deleted (/Users/fabiux/Documents/mega_example_js/node_modules/mega/lib/storage.js:168:16)
at Request.API.request [as _callback] (/Users/fabiux/Documents/mega_example_js/node_modules/mega/lib/api.js:72:5)
at Request.init.self.callback (/Users/fabiux/Documents/mega_example_js/node_modules/mega/node_modules/request/main.js:122:22)
at Request.EventEmitter.emit (events.js:96:17)
at Request. (/Users/fabiux/Documents/mega_example_js/node_modules/mega/node_modules/request/main.js:661:16)