paulmillr / noble-secp256k1

Fastest 4KB JS implementation of secp256k1 signatures and ECDH
https://paulmillr.com/noble
MIT License
757 stars 114 forks source link

Is possible to detect Cloudflare workers or add browser target? #77

Closed aazf closed 1 year ago

aazf commented 1 year ago

In Cloudflare Workers or some cloud functions them use WebCrypto instead crypto. But when use npm install @noble/secp256k1, the default is use crypto not WebCrypto.

So is possible to detect the runtime or add browser module compile?

https://github.com/panva/jose/blob/main/package.json#L95 https://github.com/panva/jose/blob/main/package.json#L120

Thanks

paulmillr commented 1 year ago

Of course. You can write a code that detects it and submit a pull request with tests.

aazf commented 1 year ago

Of course. You can write a code that detects it and submit a pull request with tests.

Done.