blob: 738ed15323ba015c7d5a2620deabe926a3800809 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
'use strict';
const common = require('../common');
const domain = require('domain');
const assert = require('assert');
var d = domain.create();
var expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes'];
if (!common.hasCrypto) {
common.skip('missing crypto');
return;
}
const crypto = require('crypto');
d.on('error', common.mustCall(function(e) {
assert.equal(e.message, expect.shift());
}, 3));
d.run(function() {
one();
function one() {
crypto.pbkdf2('a', 'b', 1, 8, function() {
two();
throw new Error('pbkdf2');
});
}
function two() {
crypto.randomBytes(4, function() {
three();
throw new Error('randomBytes');
});
}
function three() {
crypto.pseudoRandomBytes(4, function() {
throw new Error('pseudoRandomBytes');
});
}
});
|