How to use the libsodium-wrappers-sumo.crypto_stream_chacha20_xor function in libsodium-wrappers-sumo

To help you get started, we’ve selected a few libsodium-wrappers-sumo 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 wireapp / wire-web-packages / packages / proteus / src / main / derived / CipherKey.ts View on Github external
encrypt(plaintext: string | Uint8Array, nonce: Uint8Array): Uint8Array {
    // TODO: Re-validate if the ArrayBuffer check is needed (Prerequisite: Integration tests)
    if (plaintext instanceof ArrayBuffer && plaintext.byteLength !== undefined) {
      plaintext = new Uint8Array(plaintext);
    }

    return sodium.crypto_stream_chacha20_xor(plaintext, nonce, this.key, 'uint8array');
  }
github wireapp / wire-web-packages / packages / proteus / src / main / derived / CipherKey.ts View on Github external
encrypt(plaintext: string | Uint8Array, nonce: Uint8Array): Uint8Array {
    // TODO: Re-validate if the ArrayBuffer check is needed (Prerequisite: Integration tests)
    if (plaintext instanceof ArrayBuffer && plaintext.byteLength !== undefined) {
      plaintext = new Uint8Array(plaintext);
    }

    return sodium.crypto_stream_chacha20_xor(plaintext, nonce, this.key, 'uint8array');
  }