<commit_before>define([
    '/common/rpc.js',
    '/bower_components/tweetnacl/nacl-fast.min.js'
], function (Rpc) {
    var Nacl = window.nacl;

    var create = function (network, proxy, cb) {
        if (!network) { return void cb('INVALID_NETWORK'); }
        if (!proxy) { return void cb('INVALID_PROXY'); }

        var edPrivate = proxy.edPrivate;
        var edPublic = proxy.edPublic;

        if (!(edPrivate && edPublic)) { return void cb('INVALID_KEYS'); }

        Rpc.create(network, edPrivate, edPublic, function (e, rpc) {
            if (e) { return void cb(e); }

            var exp = {};

            // expose the supplied publicKey as an identifier
            exp.publicKey = edPublic;

            // expose the RPC module's raw 'send' command
            exp.send = rpc.send;

            // you can ask the server to pin a particular channel for you
            exp.pin = function (channel, cb) {
                rpc.send('PIN', channel, cb);
            };

            // you can also ask to unpin a particular channel
            exp.unpin = function (channel, cb) {
                rpc.send('UNPIN', channel, cb);
            };

            // This implementation must match that on the server
            // it's used for a checksum
            exp.hashChannelList = function (list) {
                return Nacl.util.encodeBase64(Nacl.hash(Nacl.util
                    .decodeUTF8(JSON.stringify(list))));
            };

            // ask the server what it thinks your hash is
            exp.getServerHash = function (cb) {
                rpc.send('GET_HASH', edPublic, function (e, hash) {
                    cb(e, hash[0]);
                });
            };

            // if local and remote hashes don't match, send a reset
            exp.reset = function (list, cb) {
                rpc.send('RESET', list, cb);
            };

            // get the total stored size of a channel's patches (in bytes)
            exp.getFileSize = function (file, cb) {
                rpc.send('GET_FILE_SIZE', file, cb);
            };<commit_msg>make reset return the hash, not an array with containing it<commit_after>define([
    '/common/rpc.js',
    '/bower_components/tweetnacl/nacl-fast.min.js'
], function (Rpc) {
    var Nacl = window.nacl;

    var create = function (network, proxy, cb) {
        if (!network) { return void cb('INVALID_NETWORK'); }
        if (!proxy) { return void cb('INVALID_PROXY'); }

        var edPrivate = proxy.edPrivate;
        var edPublic = proxy.edPublic;

        if (!(edPrivate && edPublic)) { return void cb('INVALID_KEYS'); }

        Rpc.create(network, edPrivate, edPublic, function (e, rpc) {
            if (e) { return void cb(e); }

            var exp = {};

            // expose the supplied publicKey as an identifier
            exp.publicKey = edPublic;

            // expose the RPC module's raw 'send' command
            exp.send = rpc.send;

            // you can ask the server to pin a particular channel for you
            exp.pin = function (channel, cb) {
                rpc.send('PIN', channel, cb);
            };

            // you can also ask to unpin a particular channel
            exp.unpin = function (channel, cb) {
                rpc.send('UNPIN', channel, cb);
            };

            // This implementation must match that on the server
            // it's used for a checksum
            exp.hashChannelList = function (list) {
                return Nacl.util.encodeBase64(Nacl.hash(Nacl.util
                    .decodeUTF8(JSON.stringify(list))));
            };

            // ask the server what it thinks your hash is
            exp.getServerHash = function (cb) {
                rpc.send('GET_HASH', edPublic, function (e, hash) {
                    cb(e, hash[0]);
                });
            };

            // if local and remote hashes don't match, send a reset
            exp.reset = function (list, cb) {
                rpc.send('RESET', list, function (e, response) {
                    cb(e, response[0]);
                });
            };

            // get the total stored size of a channel's patches (in bytes)
            exp.getFileSize = function (file, cb) {
                rpc.send('GET_FILE_SIZE', file, cb);
            };
{'fraction_non_alphanumeric': 0.11416589002795899, 'fraction_numerical': 0.002096924510717614, 'mean_word_length': 1.584587597832631, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3266529', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1141, 'n_words': 364}