paulmillr / noble-ciphers

Audited & minimal JS implementation of Salsa20, ChaCha and AES
https://paulmillr.com/noble
MIT License
214 stars 8 forks source link

The standalone file `noble-ciphers.js` is no longer available #29

Closed tmarkovski closed 9 months ago

tmarkovski commented 9 months ago

Is this intentional? As of 0.5.0 this file is not part of the release assets. We've been using it to prototype some projects quickly and it's quite convenient for direct browser use. Is there an alternative?

paulmillr commented 9 months ago

just forgot to do it. ideally a github action would do it but not sure how to set it up https://github.com/paulmillr/noble-ciphers/releases/tag/0.5.1

tmarkovski commented 9 months ago

Thank you. If you can share the exact way to build it, I can contribute an action to do it with a release trigger.

paulmillr commented 9 months ago

cd build; npm i; npm run build

tmarkovski commented 9 months ago

Weird. I tried that, but I get this error which complains the path is not exported, even though it seems that it is. Might be my NPM version (10.2.4).

> npx esbuild --bundle input.js --outfile=noble-ciphers.js --global-name=nobleCiphers

✘ [ERROR] Could not resolve "@noble/ciphers/webcrypto/utils"

    input.js:6:28:
      6 │ import { randomBytes } from '@noble/ciphers/webcrypto/utils';
        ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The path "./webcrypto/utils" is not exported by package "@noble/ciphers":

    node_modules/@noble/ciphers/package.json:41:13:
      41 │   "exports": {
         ╵              ^

  You can mark the path "@noble/ciphers/webcrypto/utils" as external to exclude it from the bundle,
  which will remove this error.

Edit: It appears adding the following to package.json fixed it.

"./webcrypto/utils": {
      "types": "./webcrypto.d.ts",
      "import": "./esm/webcrypto.js",
      "default": "./webcrypto.js"
    }
paulmillr commented 9 months ago

fixed in d771ec0

tmarkovski commented 9 months ago

Cheers, thanks for the quick response.