csquared / fernet.js

Javascript implementation of Fernet symmetric encryption https://github.com/kr/fernet-spec
MIT License
72 stars 29 forks source link

Browser-usable code? #19

Open josephernest opened 4 years ago

josephernest commented 4 years ago

Hello, I see that fernet.js (as well as fernetBrowser.js) contains require, etc. so this won't be accepted by the browsers if I just do

<script src="fernetBrowser.js"></script>

and copy the fernetBrowser.js file...

Could you just add a few lines in the README to explain how to "compile" / "transpile" / "pack" (?) the code (if needed?), and which tools are required for that.

Thank you in advance.

dikaso commented 4 months ago

You need to import browser version of package like this:

import fernet from 'fernet/fernetBrowser';