How to use the stanza-shims.randomBytes function in stanza-shims

To help you get started, we’ve selected a few stanza-shims examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github legastero / stanza / src / Utils.ts View on Github external
export function uuid() {
    const buf = randomBytes(16);

    // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
    buf[6] = (buf[6] & 0x0f) | 0x40;
    buf[8] = (buf[8] & 0x3f) | 0x80;

    let i = 0;
    return [
        bth[buf[i++]],
        bth[buf[i++]],
        bth[buf[i++]],
        bth[buf[i++]],
        '-',
        bth[buf[i++]],
        bth[buf[i++]],
        '-',
        bth[buf[i++]],
github legastero / stanza / src / lib / sasl / index.ts View on Github external
export function createClientNonce(length: number = 32): string {
    return Hashes.randomBytes(length).toString('hex');
}

stanza-shims

Runtime shims used by StanzaJS for node, browsers, and React Native

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis