<commit_before>
function LobbyCtrl($scope, toaster) {
    $scope.pairCode = '';
    $scope.requests = [];
    $scope.subscribed = false;
    $scope.announceSelf = function() {
        client = DarkWallet.getClient();
        // chan tests
        if (!$scope.subscribed) {
        client.chan_subscribe("b", "announcements", function(err, data){
            if (!err) {
                $scope.subscribed = true;
            }
            console.log("channel subscribe", err, data)
        }, function(_data) {
            console.log("data for channel", _data);
            $scope.requests.push(_data);

            if(!$scope.$$phase) {
                $scope.$apply();
            }
        });
        }
        client.chan_post("b", "announcements", "hi " + $scope.pairCode, function(err, data){console.log("channel post", err, data)})
        client.chan_get("b", "announcements", function(err, data){console.log("channel get", err, data)})
        client.chan_list("b", function(err, data){console.log("channel list", err, data)})
 
    }
}<commit_msg>initial funny scheme for communication in the lobby.<commit_after>
function LobbyCtrl($scope, toaster) {
    $scope.pairCode = '';
    $scope.requests = [];
    $scope.subscribed = false;
    var SHA256 = Bitcoin.Crypto.SHA256;
    var tmpKey = Bitcoin.Key();
    $scope.announceSelf = function() {
        client = DarkWallet.getClient();
        var pairCodeHash = SHA256(SHA256($scope.pairCode)+$scope.pairCode);
        var pubKeyHash = Bitcoin.convert.bytesToHex(tmpKey.getPubKeyHash())
        var encrypted = sjcl.encrypt(pairCodeHash, pubKeyHash, {ks: 256, ts: 128});
        // chan tests
        if (!$scope.subscribed == pairCodeHash) {
            console.log("announcing", pairCodeHash, pubKeyHash, encrypted);
            client.chan_post("b", pairCodeHash, encrypted, function(err, data){
                console.log("channel post", err, data)
            });
            client.chan_subscribe("b", pairCodeHash, function(err, data){
                if (!err) {
                    $scope.subscribed = pairCodeHash;
                }
                console.log("channel subscribed", err, data)
            }, function(_data) {
                console.log("data for channel", _data);
                var decrypted = sjcl.decrypt(pairCodeHash, data);
                $scope.requests.push({data: decrypted});

                if(!$scope.$$phase) {
                    $scope.$apply();
                }
            });
        }
        /*client.chan_post("b", "announcements", "hi " + $scope.pairCode, function(err, data){console.log("channel post", err, data)})
        client.chan_get("b", "announcements", function(err, data){console.log("channel get", err, data)})
        client.chan_list("b", function(err, data){console.log("channel list", err, data)})*/
 
    }
}
{'fraction_non_alphanumeric': 0.15330520393811534, 'fraction_numerical': 0.006329113924050633, 'mean_word_length': 2.2890173410404624, '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': '3358980', 'n_tokens_mistral': 845, 'n_tokens_neox': 799, 'n_words': 162}