csprsg

Creates cryptographically secure pseudo random strings

Usage no npm install needed!

<script type="module">
  import csprsg from 'https://cdn.skypack.dev/csprsg';
</script>

README

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
    }
})();