Nodev19+ enables isomorphic JavaScript with Web Crypto API and ES Modules!

Published: 30 March 2023
on channel: ibgibDOTcom
121
4

In this video, I discuss the extremely exciting `globalThis` feature implemented in Node v19+ which enables relatively simple isomorphic javascript even with the Web Crypto API! This enables us to use the execution environment's implementations without third party code required.

This boils down to exposing `globalThis.crypto.subtle` which is now supported in Node v19+ and major browsers.

I also briefly show what isomorphic unit testing looks like with Jasmine, though I'm planning on dedicating a video to that once import maps are fully supported in jasmine-browser-runner (see https://github.com/jasmine/jasmine-br... )

links

ibgib related
ibgib ionic-gib prototype
https://ibgib.space
https://github.com/wraiford/ibgib/tre...
(I am atow in the process of breaking out this code into cleaner libraries.)
helper-gib - utils and shared non-ibgib-explicit code used in ibgib libs
`hash` fn in helper-gib
https://gitlab.com/ibgib/helper-gib/-...
https://gitlab.com/ibgib/helper-gib
https://www.npmjs.com/package/@ibgib/...
encrypt-gib - encryption library using a novel (read: unproven and thus weak!) encryption algorithm that only relies on a cryptographic hash function as its only blackbox magic.
https://github.com/wraiford/encrypt-gib
https://www.npmjs.com/package/@ibgib/...
Web Crypto API
https://www.w3.org/TR/WebCryptoAPI/
https://developer.mozilla.org/en-US/d...
https://nodejs.org/api/webcrypto.html (v19 atow)
globalThis
browser - https://developer.mozilla.org/en-US/d...
node - https://nodejs.org/api/webcrypto.html...

chapters

00:00 - intro
00:30 - helper-gib isomorphic hash fn
02:42 - globalThis
03:45 - globalThis in NodeJS v19
04:35 - contrast: my previous build kluge
05:48 - isomorphic testing with jasmine
07:33 - outro attempt 1: hash-based encryption (not signatures)
08:14 - outro attempt 2: non-LTS NodeJS v19
09:30 - outro 3: have a great day

About ibgib:

This is an ibgib video, about some aspect related to ibgib technologies. In short, ibgib is a web3 metaverse protocol that I've been developing for 20+ years. OK, it's more of my obsession. Instead of assuming a single-source of truth, I've tried to instill humility in its foundations. So even though we are using cryptographic principles, we never assume what our data shows is The Truth or Knowledge. Rather, living logic can best be represented by Beliefs and their evolution over time. Inevitably, this approach leads not only to sovereign, distributed data, but also to some degree of sovereign AIs. This is our approach to metaprogramming.


On this page of the site you can watch the video online Nodev19+ enables isomorphic JavaScript with Web Crypto API and ES Modules! with a duration of hours minute second in good quality, which was uploaded by the user ibgibDOTcom 30 March 2023, share the link with friends and acquaintances, this video has already been watched 121 times on youtube and it was liked by 4 viewers. Enjoy your viewing!