UNPKG

@thgh/tunnelmole

Version:

Tunnelmole, an open source ngrok alternative. Instant public URLs for any http/https based application. Available as a command line application or as an NPM dependency for your code. Stable and maintained. Good test coverage. Works behind firewalls

21 lines (18 loc) 573 B
import { nanoid } from 'nanoid'; import { storage } from '../node-persist/storage.js'; const initialiseClientId = async () : Promise<void> => { // @todo Check for an existing client id before overwriting it with a new one const existingClientId = await getClientId(); if (!existingClientId) { const clientId = nanoid(); storage.setItem('clientId', clientId); } } const getClientId = async () : Promise<string> => { const clientId = storage.getItem('clientId'); return clientId; } export { initialiseClientId, getClientId }