Skip to content

Commit f5f17c2

Browse files
committedSep 18, 2023
[Tests] handle openSSL not supporting a scheme
Technique from #38; see #37
1 parent d845d85 commit f5f17c2

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed
 

‎test/index.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,25 @@ fixtures.valid.rsa.forEach(function (f) {
2828
priv = Buffer.from(f['private'], 'base64');
2929
}
3030

31+
console.log(nCrypto.getHashes());
3132
(nCrypto.getHashes().indexOf(f.scheme) >= 0 ? test : test.skip)(f.message, function (t) {
32-
var bSign = bCrypto.createSign(f.scheme);
33-
var nSign = nCrypto.createSign(f.scheme);
33+
var bSign;
34+
try {
35+
bSign = bCrypto.createSign(f.scheme);
36+
} catch (e) {
37+
console.info('skipping unsupported browserify-sign scheme', f.scheme);
38+
t.end();
39+
return;
40+
}
41+
42+
try {
43+
var nSign = nCrypto.createSign(f.scheme);
44+
} catch (e) {
45+
console.info('skipping unsupported node scheme', f.scheme);
46+
t.end();
47+
return;
48+
}
49+
3450
var bSig = bSign.update(message).sign(priv);
3551
var nSig = nSign.update(message).sign(priv);
3652

0 commit comments

Comments
 (0)
Please sign in to comment.