PeculiarVentures / node-webcrypto-p11

A WebCrypto Polyfill for Node in typescript built on PKCS#11.
MIT License
44 stars 15 forks source link

regeneratorRuntime is not defined #42

Open maucrvlh opened 6 years ago

maucrvlh commented 6 years ago

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

microshine commented 6 years ago

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")