How do I generate a key pair with Web Crypto and access its keys in a Firefox AddOn?

前端 未结 1 1068
盖世英雄少女心
盖世英雄少女心 2021-01-23 15:09

I\'d like to call window.crypto.subtle.generateKey in my Firefox AddOn. Since I can not access window in main.js I create a page-worker with a

相关标签:
1条回答
  • 2021-01-23 15:55

    in main.js you can ...

    const { Cu } = require("chrome");
    Cu.importGlobalProperties(["crypto"]);
    

    then you'll have access to crypto.subtle.generateKey as well as all the other crypto goodness ... note no window

    0 讨论(0)
提交回复
热议问题