Argyle-Software / kyber

A rust implementation of the Kyber post-quantum KEM
https://docs.rs/pqc_kyber/
Apache License 2.0
163 stars 37 forks source link

Kyber not compiling with React #89

Open TheMagicNacho opened 1 year ago

TheMagicNacho commented 1 year ago

Issue: When using the npm package pqc-kyber within a react framework, the application will not complie.

Discussion: My current assumption is there is an issue with WASM dependencies when getting the react's webpack to compile the WASM.

Alternatively, WASM pack is not compiling from rust to WASM with the correct dependencies. Some steps I have already tried:

  1. Compile the package myself.
  2. Modify the webpack for WASM
  3. Install wasm-loader for react

Recommendation: I think if the collective group could look at this problem we could find a solution. React is one of the most popular front end frameworks, so if we could get this package work with react we could increase adoption.

This is the exact error I see:

Uncaught TypeError: wasm.keypair is not a function
    keypair pqc_kyber_bg.js:189
    App App.js:7
    React 11
    workLoop scheduler.development.js:266
    flushWork scheduler.development.js:239
    performWorkUntilDeadline scheduler.development.js:533
    js scheduler.development.js:571
    js scheduler.development.js:633
    factory react refresh:6
    Webpack 24
pqc_kyber_bg.js:189