Can Webnative be used in NodeJS?

The Webnative SDK is not currently designed to work with NodeJS out of the box.

It makes use of the browser Web Crypto API, which does not currently have an equivalent in NodeJS.

That being said, connecting to and working with the Web Native File System #wnfs from Node is possible, with your server having access to a private key through an environment variable or other secure way of accessing.

Looks like Node 15 (the latest version) has a WebCrypto implementation:

But it’s…

Stability: 1 - Experimental

1 Like

That’s going to be awesome!

Out of curiosity, does Webnative use that lacks an equivalent in the crypto module?

That sounds like a question for @icidasset. The answer is probably something like “the API is slightly different”. Fundamentally, we haven’t looked at it because we’re focused on getting this working in the browser, which is where the magic is :sparkles:

Yup that’s basically it^^ There’s not reason that this can’t work in Node. But we use WebCrypto along with a few other Browser APIs (such as IndexedDB) and just haven’t taken the time to make it work with Node yet.

There is a webcrypto npm package made by David Dias over at PL but it hasn’t been touched in a while and doesn’t actually tap use WebCrypto (it just uses crypto/crypto-browserify)


Hi! Interesting topic - looks like there is a Webcrypto polyfill here:

Might be a way to see if the SDK can be used with NodeJS <= 14.x at least for testing / demonstration purposes - especially if the end state is the inclusion of Webcrypto in Node.

1 Like