How to import KJUR js files and method in script.js

please tell me the method to colabrate with some other 3rd party methods from github

Hi @ganesh1312

Welcome to the community forums :wave:

Are you referring to NodeJS library GitHub - kjur/jsrsasign: The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES and JSON Web Signature/Token in pure JavaScript.? If you can provide concrete details we can help you double-check if you would be able to import those modules.

The general mechanism to import NodeJS modules is described in the documentation: Modules. However, not all NodeJS modules can be used:

k6 is not NodeJS, nor is it a browser. Packages that rely on APIs provided by NodeJS, for instance the os and fs modules, will not work in k6. The same goes for browser-specific APIs like the window object.

What you can do will depend on the 3rd party libraries you want to use. Not all can be used with k6 at this time.

I hope this helps.


hi eyeveebe, thank you for your reply,
we need to use the sha256withECDSA signing method, so we go for that module.
but we cannot collabrate kjur and k6, we felt difficulties in this situtuation.

Hi @ganesh1312

Thanks for providing additional details.

If you are seeing issues when attempting to use KJUR it would seem this is one of the cases where some packages will not work. As mentioned above.

I discussed internally with @oleiade and @ned, and you’ll have to wait for GitHub - grafana/xk6-webcrypto: WIP implementation of the WebCrypto specification for k6 to be merged in k6/experimental. It’s the implementation of the WebCrypto API for k6.Which will most probably address this.

In terms of when we expect to release this, support for signing will probably land in version v0.45. At this time we think it’s unlikely it will make it to v0.44.

If you’d like to help, and have the resources/time to do so, we more than welcome your contributions to the signing capabilities. Support moving forward faster is always much appreciated :smile: