Thanks Notidart.
I think I’ve got what I’m trying to do with this code. I wanted to be able to generate RSA keys.
let { Cu, Cc, Ci } = require(‘chrome’);
Cu.importGlobalProperties([“crypto”]); // Bring in our crypto libraries
…
// Many thanks to https://github.com/diafygi/webcrypto-examples
function genKey(){
crypto.subtle.generateKey(
{
name: “RSASSA-PKCS1-v1_5”,
modulusLength: 2048,
publicExponent: new Uint8Array([0x001, 0x00, 0x01]),
hash: {name: “SHA-256”}
},
true,
[“sign”, “verify”]
)
.then(function(key){ // Returns a keypair object
return key;
})
.catch(function(err){
dump("\ngenKey() Error:" + err);
});
}
I’ve got an issue with simple storage not actually storing anything now, but I’ll start another thread for the if I can’t figure it out.
Thanks,
Andrew