Node v19+ Boosts Isomorphic JS with Web Crypto & ES Modules 🌐
Learn how Node v19+ introduces `globalThis` for easier isomorphic JavaScript using Web Crypto API and ES Modules.

ibgibDOTcom
113 views • Mar 30, 2023

About this video
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-browser-runner/issues/28 )
# links
* ibgib related
* ibgib ionic-gib prototype
* https://ibgib.space
* https://github.com/wraiford/ibgib/tree/master/ionic-gib
* (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/-/blob/39bc27143a6062b9a2d4c54924f1a0cc10ea6382/src/helpers/utils-helper.mts#L31
* https://gitlab.com/ibgib/helper-gib
* https://www.npmjs.com/package/@ibgib/helper-gib
* 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/encrypt-gib
* Web Crypto API
* https://www.w3.org/TR/WebCryptoAPI/
* https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API
* https://nodejs.org/api/webcrypto.html (v19 atow)
* globalThis
* browser - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
* node - https://nodejs.org/api/webcrypto.html#web-crypto-api
# 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.
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-browser-runner/issues/28 )
# links
* ibgib related
* ibgib ionic-gib prototype
* https://ibgib.space
* https://github.com/wraiford/ibgib/tree/master/ionic-gib
* (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/-/blob/39bc27143a6062b9a2d4c54924f1a0cc10ea6382/src/helpers/utils-helper.mts#L31
* https://gitlab.com/ibgib/helper-gib
* https://www.npmjs.com/package/@ibgib/helper-gib
* 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/encrypt-gib
* Web Crypto API
* https://www.w3.org/TR/WebCryptoAPI/
* https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API
* https://nodejs.org/api/webcrypto.html (v19 atow)
* globalThis
* browser - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
* node - https://nodejs.org/api/webcrypto.html#web-crypto-api
# 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.
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
113
Likes
4
Duration
9:50
Published
Mar 30, 2023