Javascript runtime call


Hi I would like to add a third party javascript library to my c3 package. Here is my configuration

“name”: “myPackage”,
“description”: “Hello world”,
“author”: “The c3 users”,
“dependencies”: [“xxx”],
“runtime”: {
“js-sha256”: {
“language”: “JS”,
“runtime”: “NODE_JS”,
“repositories”: [“”]

here “js-sha256” is the third party javascript package. A testing call is sha256(‘11111’). However, console returns “sha256 is not defined”.
I know the language is “JS”, and runtime is “NODE_JS”, but I am not sure what is “repositories”. Can someone give an example how to call javascript runtime?

1 Like

Package dependencies are specified in package.json

Your runtime definition is off, please use something along those lines:

  "name": "myPackage",
  "runtimes": {
    "nodejs-hash": {
      "language": "JavaScript",
      "runtime": "Node.js",
      "modules": {
        "jssha": "^2.3.1"

then to use it:

type MyType {
  hashSomethingToSha256: function(text: !string) : !string