lib/crypto/crypto-engine.js
function chacha20(data, key, iv) {
    return Promise.resolve().then(function() {
        var algo = new ChaCha20(new Uint8Array(key), new Uint8Array(iv));
        return ByteUtils.arrayToBuffer(algo.encrypt(new Uint8Array(data)));
    });
}
function chacha20(data, key, iv) {
    return Promise.resolve().then(function() {
        var algo = new ChaCha20(new Uint8Array(key), new Uint8Array(iv));
        return ByteUtils.arrayToBuffer(algo.encrypt(new Uint8Array(data)));
    });
}
function chacha20 ( data , key , iv ) { return Promise . resolve ( ) . then ( function ( ) { var algo = new ChaCha20 ( new Uint8Array ( key ) , new Uint8Array ( iv ) ) ; return ByteUtils . arrayToBuffer ( algo . encrypt ( new Uint8Array ( data ) ) ) ; } ) ; }
Encrypts with ChaCha20
@param {ArrayBuffer} data
@param {ArrayBuffer} key
@param {ArrayBuffer} iv
@returns {Promise.<ArrayBuffer>}
Encrypts with ChaCha20