jeudi 10 novembre 2016

My javascript isn't running using the KeybasePGP api

I'm very new to Javascript, I scowered the internet for around an hour, before coming to this website. I'm using the keybase pgp api to generate a pgp key online. This code is supposed to output the pgp key to the browser console, and it's not working at all. I don't even think that the code is running, I put a test console log at the beginning of the script, and it didn't run at all. The console is just blank, no errors or anything. Thank you so much! Sorry if it's formatted badly, I've never done this before.

<?php



?>


<script src="kbpgp-2.0.8.js">
var F = kbpgp["const"].openpgp;

var opts = {
  userid: "User McTester (Born 1979) <user@example.com>",
  primary: {
    nbits: 4096,
    flags: F.certify_keys | F.sign_data | F.auth | F.encrypt_comm | F.encrypt_storage,
    expire_in: 0  // never expire
  },
  subkeys: [
    {
      nbits: 2048,
      flags: F.sign_data,
      expire_in: 86400 * 365 * 8 // 8 years
    }, {
      nbits: 2048,
      flags: F.encrypt_comm | F.encrypt_storage,
      expire_in: 86400 * 365 * 8
    }
  ]
};

kbpgp.KeyManager.generate(opts, function(err, alice) {
  if (!err) {
    // sign alice's subkeys
    alice.sign({}, function(err) {
      console.log(alice);
      // export demo; dump the private with a passphrase
      alice.export_pgp_private ({
        passphrase: 'booyeah!'
      }, function(err, pgp_private) {
        console.log("private key: ", priv);
      });
      alice.export_pgp_public({}, function(err, pgp_public) {
        console.log("public key: ", pgp_public);
      });
    });
  }
});

</script>




Aucun commentaire:

Enregistrer un commentaire