Git Product home page Git Product logo

Comments (6)

mcarrickscott avatar mcarrickscott commented on July 21, 2024

Thanks for finding those bugs!

What you suggest would be useful, but while we would certainly welcome a node.js package, we could not commit to maintaining it.

Mike

from core.

CryptoMathician avatar CryptoMathician commented on July 21, 2024

You are welcome and thank you for your fast response!

It seems to me that there isn't much to do to support Node.js. I am not sure how it will be for npm platform (I didn't it before), but for this repository to support Node.js there is not much to do (as I know in this moment of writing this). I did the following:

  • added export of the classes (prototypes) to every file e.g. for fp.js
if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
    module.exports = {
        FP: FP
    };
}
  • added a index.js with the following code
    module.exports.CTX = require('./amcl-js/ctx');

  • added package.json(for simplicity with the following stub)

  "name": "<name>",
  "version": "3.X.X",
  "description": "<description>",
  "main": "<path>/index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "<Author Name>",
  "license": "<some licence>"
}

Afterm them I used in my React project `npm install ' and was able to use the node package with your Javascript code with

const CTX = require("pesto-client").CTX;
let ctxBls12461 = new CTX('BLS12461');

As of my understanding and testing it should be possible with these changes that the code is usable in Javascript as before and it is possible in another Javascript files as functions from a library in plain Javascript. Additionally a person is able to build a npm package locally and can use it in Node.js or React projects (I don't know much about AngularJS, but maybe also there - I didn't tested it yet).

from core.

mcarrickscott avatar mcarrickscott commented on July 21, 2024

If you put together a Pull Request, and if it doesn't break anything, we will approve it. Unfortunately we don't have a JS expert on the team at the moment, so I cannot be of much help.

Mike

from core.

CryptoMathician avatar CryptoMathician commented on July 21, 2024

Ok. Let me do some tests and if everything works fine I can do a Pull Request and you or some of the contributors can double check it, such that there exist no side effects, which maybe I am not aware of. Thank you! I will let you know, when I am done with the tests.

Pascal

from core.

mcarrickscott avatar mcarrickscott commented on July 21, 2024

OK that's fine

from core.

CryptoMathician avatar CryptoMathician commented on July 21, 2024

Pull Request + Merge done.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.