{"size": 814, "ext": "js", "max_stars_repo_path": "index.1.js", "max_stars_repo_name": "cubuspl42/SandboxElectron", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "index.1.js", "max_issues_repo_name": "cubuspl42/SandboxElectron", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "index.1.js", "max_forks_repo_name": "cubuspl42/SandboxElectron", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.4375, "max_line_length": 74, "alphanum_fraction": 0.5331695332}
let keyPair = require('./keyPair.json')
let WebTorrent = require('webtorrent');
let ed = require('ed25519-supercop');
let crypto = require('crypto');

let buffPubKey = new Buffer(keyPair.publicKey, 'hex');
let buffSecKey = new Buffer(keyPair.secretKey, 'hex');
let targetID = crypto.createHash('sha1').update(buffPubKey).digest('hex');

let client = new WebTorrent();
let dht = client.dht;

dht.on('ready', function () {
    console.log('get', {
        targetID: targetID
    });
    dht.get(targetID, function (err, res) {
        if (err) {
            console.log({
                err: err
            });
        } else {
            console.log({
                res: res
            });
            if (res) {
                console.log(res.v.hello.toString('utf-8'));
            }
        }
    });
});
