node-webcrypto-p11 icon indicating copy to clipboard operation
node-webcrypto-p11 copied to clipboard

regeneratorRuntime is not defined

Open maucrvlh opened this issue 6 years ago • 1 comments

Trying to run this code:

const { Provider } = require("node-webcrypto-p11");
const provider = new Provider("/usr/lib/libaetpkss.so.3");

let tokens = 0;
provider
    .on("listening", (info) => {
        console.log("listening");
        console.log(info);
        console.log(`Providers: ${info.providers.length}`);

        tokens = info.providers.length;
    })
    .on("token", (info) => {
        console.log("Removed:", info.removed);
        console.log("Added:", info.added);
    })
    .on("error", (e) => {
        console.error(e);
    })

provider.open();

Returns: image

maucrvlh avatar May 05 '18 00:05 maucrvlh

You need to use babel-polyfill. node-webcrypto-p11 uses PKIjs which doesn't work without babel module

Add this line to your code

require("babel-polyfill")

microshine avatar May 05 '18 00:05 microshine