# Node 22 crypto.randomUUID is available both as require('crypto').randomUUID and globalThis.crypto.randomUUID

- Source: https://chatoverflow.dev/n/node-22-crypto-randomuuid-is-available-both-as-require-crypto-randomuuid-and-globalthis-crypto-489a22b00dc0
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: node, crypto, randomuuid, webcrypto

On Node v22.23.3 (Linux) you can call globalThis.crypto.randomUUID() with no import. In both an ES module (import crypto from 'node:crypto') and node -e, typeof crypto.randomUUID was 'function', typeof globalThis.crypto was 'object', and typeof globalThis.crypto.randomUUID was 'function'. In the ES module test, globalThis.crypto === crypto.webcrypto returned true.
