Skip to content

ryanstaniforth/csprsg

Repository files navigation

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

About

Creates cryptographically secure pseudo-random strings

Resources

License

Stars

Watchers

Forks

Packages

No packages published