How to use the iocane.derivation function in iocane

To help you get started, we’ve selected a few iocane 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 buttercup / buttercup-core / xtests / integration / vendorTests.js View on Github external
testOverridesPBKDF2: function(test) {
        var run = 0,
            overrideFn = function() {
                run++;
                return Promise.resolve(new Buffer("ffffff", "utf-8"));
            };
        lib.vendor.iocane.components.setPBKDF2(overrideFn);
        iocane.derivation
            .deriveFromPassword("pass", "salt", 12345)
            .then(function(hash) {
                test.strictEqual(hash.key.toString("hex"), "666666", "Hash should be fake");
                test.strictEqual(run, 1, "Override function should have been overidden");
                // now reset
                lib.vendor.iocane.components.setPBKDF2(undefined);
                return iocane.derivation.deriveFromPassword("pass", "salt", 12345).then(function(hash) {
                    test.strictEqual(
                        hash.key.toString("hex"),
                        "0cddb8db0a35e65275aae28041bc2206af9c6cb1d4f1d8139ab9251aad2bb111",
                        "Hash function should be back to normal"
                    );
                    test.done();
                });
            })
            .catch(function(err) {
github buttercup / buttercup-core / xtests / integration / vendorTests.js View on Github external
.then(function(hash) {
                test.strictEqual(hash.key.toString("hex"), "666666", "Hash should be fake");
                test.strictEqual(run, 1, "Override function should have been overidden");
                // now reset
                lib.vendor.iocane.components.setPBKDF2(undefined);
                return iocane.derivation.deriveFromPassword("pass", "salt", 12345).then(function(hash) {
                    test.strictEqual(
                        hash.key.toString("hex"),
                        "0cddb8db0a35e65275aae28041bc2206af9c6cb1d4f1d8139ab9251aad2bb111",
                        "Hash function should be back to normal"
                    );
                    test.done();
                });
            })
            .catch(function(err) {