import * as cryptoServer from 'crypto' export const useCrypto = () => { return { getRandomUUID: () => (typeof window === 'undefined') ? cryptoServer.randomBytes(16).toString('hex') // Server code : crypto.randomUUID() // Browser code } }