Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 496 Bytes

README.md

File metadata and controls

31 lines (23 loc) · 496 Bytes

CSPRSG

Cryptographically Secure Pseudo Random String Generator

Built in TypeScript for node

Installing

npm install csprsg

Usage

import {
    generateSecureRandomString,
    InvalidLengthError,
    UnableToGenerateRandomness
} from 'csprsg';

(async () => {
    let s: string;
    
    try {
        s = await generateSecureRandomString(100);
    } catch (error) {
        // Handle either InvalidLengthError or UnableToGenerateRandomness
    }
})();