dajiaji / hpke-js

A Hybrid Public Key Encryption (HPKE) module built on top of Web Cryptography API.
https://dajiaji.github.io/hpke-js/docs
MIT License
63 stars 9 forks source link

Add webpack sample #301

Closed OR13 closed 7 months ago

OR13 commented 7 months ago

Objective of this pull request is to show the configuration necessary for libraries written in typescript, to emit js that can be bundled, that supports hpke-js.

This pull request should help anyone encountering https://github.com/dajiaji/hpke-js/issues/302 in the future.

For example, imagine a library like:

(jose or cose)-hpke written in typescript, that uses hpke-js. Then (jose or cose)-hpke is used from node, or web applications with might use webpack.

Screenshot 2024-02-24 at 8 32 09 AM

I realize this is probably more "compiler and bundler basics", but if its easy to provide and sample that works, it may help developers consume hpke-js faster.

OR13 commented 7 months ago

I am not sure which parameters to change to resolve the issue, but I am happy to try any suggestions

OR13 commented 7 months ago

After some experiments, I was able to get this to work:

Screenshot 2024-02-24 at 9 18 53 AM

You may wish to simply close this PR, since there are no issues with your library, and this sample is perhaps not worth including, but hopefully anyone hitting these issues, may find this and save you another issue.

dajiaji commented 7 months ago

@OR13 Thanks for the PR. I've confirmed that it works properly. I'll merge this PR as I think it'll be useful for other users.