/*
    ! /services/idgen.js – Central Unique ID-Generator
    ? This module will create unique ids using crypto
*/

// % import nodejs dependencies
const crypto = require('crypto');

// $ create a new unique id
const generate = () => crypto.randomBytes(32).toString('hex'); // simple id generator
const generatePrefixed = (prefix) => `${prefix}_${generate()}`; // prefixed id generator

// § export id-generator module
module.exports = { generate, generatePrefixed };