-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Feature Request
Presently, the SDK only works in Node.js environment.
The Web Monetization extension does a lot of things to make it work in browser, which could be avoided (polyfill Node.js crypto, fs, etc. APIs, override ED curves as Chrome doesn't support them yet).
Similarly, we're trying to deploy a worker on Cloudflare that uses the SDK, but we faced issues even with nodejs_compat flag as not all things are implemented there.
Describe the solution you'd like
Make the SDK (and its dependencies) use Web Platform APIs, which are supported in most runtimes (e.g. crypto.subtle instead of node:crypto, TextEncoder vs Buffer).
Also, avoid fs APIs. They're used presently for reading key from filesystem, but users can provide key themselves too by reading file themselves in their runtime supported manner (related: #5).
Also, we have YAML schema's loaded when validateResponses: true (the default). This caused issues in a default Next.js setup during a hackathon. We set validateResponses: false in extension as well to avoid this issue (The schemas could've been converted to JSON and then imported perhaps, removing runtime YAML dependency as well; and can be bundled if needed by users easily).
Ideally, I'd like this SDK becoming lightweight, and that works across different JS runtimes. There's also a tech team goal I added for this year for this.
Describe alternatives you've considered
Keep polyfilling 😢
Metadata
Metadata
Assignees
Labels
Type
Projects
Status