How to use the stanza-shims.createHash 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 / lib / sasl / index.ts View on Github external
export function H(text: Buffer, alg: string): Buffer {
    return Hashes.createHash(alg)
        .update(text)
        .digest();
}
github legastero / stanza / src / lib / sasl / index.ts View on Github external
.digest();
        const ha1 = Hashes.createHash('md5')
            .update(base)
            .update(':')
            .update(this.nonce!)
            .update(':')
            .update(cnonce);
        if (credentials.authzid) {
            ha1.update(':').update(credentials.authzid);
        }
        const dha1 = ha1.digest('hex');
        const ha2 = Hashes.createHash('md5')
            .update('AUTHENTICATE:')
            .update(uri);
        const dha2 = ha2.digest('hex');
        const digest = Hashes.createHash('md5')
            .update(dha1)
            .update(':')
            .update(this.nonce!)
            .update(':')
            .update(nc)
            .update(':')
            .update(cnonce)
            .update(':')
            .update(qop)
            .update(':')
            .update(dha2)
            .digest('hex');
        str += ',response=' + digest;
        if (this.charset === 'utf-8') {
            str += ',charset=utf-8';
        }
github legastero / stanza / src / jingle / FileTransferSession.ts View on Github external
constructor(opts = {}) {
        super();

        this.config = {
            chunkSize: 16384,
            hash: 'sha-1',
            ...opts
        };

        this.file = undefined;
        this.channel = undefined;
        this.hash = Hashes.createHash(this.config.hash);
    }
github legastero / stanza / src / helpers / LegacyEntityCapabilities.ts View on Github external
if (!identities || !features || !extensions) {
        return null;
    }

    for (const id of identities) {
        append(id);
    }
    for (const feature of features) {
        append(feature);
    }
    for (const form of extensions) {
        append(form);
    }

    return Hashes.createHash(hashName)
        .update(Buffer.concat(S))
        .digest('base64');
}

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