UNPKG

shuffrand

Version:

Cryptographically secure randomness and shuffling — with soul.

19 lines (17 loc) 962 B
import { CryptoStringParams } from './src.types.js'; /** * Generates a cryptographically secure random string of a specified length * from a given character set. * * @param {CryptoStringParams} [rawParams={}] - The raw parameters for random string generation. * @param {number} [rawParams.length=16] - The desired length of the random string. * @param {'alphanumeric'|'numeric'|'alpha'|'hex'|'uppercase'|'lowercase'|string} [rawParams.characterSet='alphanumeric'] - The character set to use. * @param {boolean} [rawParams.noRepeat=false] - If true, ensures no character appears more than once in the result. * @returns {string} - The cryptographically secure random string. * @throws {TypeError} - If input parameters are invalid. */ export declare function cryptoString(rawParams?: CryptoStringParams): string; /** * ... (JSDoc for calculateStringEntropy) ... */ export declare function calculateStringEntropy(params?: CryptoStringParams): number;