vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
711 stars 178 forks source link

Run-time compatibility #245

Open dcbr opened 6 months ago

dcbr commented 6 months ago

@vbuch Let me bother you on run-time compatible of this signpdf: can this tool-kit run on edge run-time? Vercel or CloudFlare. Skimming on some example, this is nodejs run-time. Thanks much indeed.

Originally posted by @TimKieu in https://github.com/vbuch/node-signpdf/issues/230#issuecomment-2029418559

dcbr commented 6 months ago

@TimKieu Please continue this discussion here, as #230 is not relevant to it.

TimKieu commented 6 months ago

@dcbr Okay, I will try and reply here.

vbuch commented 6 months ago

@TimKieu never tried it. Not sure. In examples we use fs but you don't need that for signing. node-forge is advertised as plain JS so should be runnable anywhere. It will depend on what you want to use from our packages and what we depend on. There are many places where we reference Buffer because this was initially written for Node. So... the only way to figur this out would be to try. If you fail, you may identify what the problems are and report back here. Then it would be lovely if you created a PR. But even info would be helpful for someone else asking the same.

TimKieu commented 5 months ago

@vbuch Buffer is not compatible to edge-runtime, Please port to Uint8Array.

vbuch commented 5 months ago

@TimKieu we are absolutely welcoming PRs.

TimKieu commented 5 months ago

@vbuch I found a good solution from Winamp Webamp using https://github.com/feross/buffer AKA Buffer for Browser similar to Nodejs. Now you can replace your Nodejs Buffer by this, it should work well first, before we port other run-time libs for edge/browser.