Skip to content

Commit

Permalink
[Tests] handle openSSL not supporting a scheme
Browse files Browse the repository at this point in the history
Technique from #38; see #37
  • Loading branch information
ljharb committed Sep 18, 2023
1 parent d845d85 commit f5f17c2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,25 @@ fixtures.valid.rsa.forEach(function (f) {
priv = Buffer.from(f['private'], 'base64');
}

console.log(nCrypto.getHashes());
(nCrypto.getHashes().indexOf(f.scheme) >= 0 ? test : test.skip)(f.message, function (t) {
var bSign = bCrypto.createSign(f.scheme);
var nSign = nCrypto.createSign(f.scheme);
var bSign;
try {
bSign = bCrypto.createSign(f.scheme);
} catch (e) {
console.info('skipping unsupported browserify-sign scheme', f.scheme);
t.end();
return;
}

try {
var nSign = nCrypto.createSign(f.scheme);
} catch (e) {
console.info('skipping unsupported node scheme', f.scheme);
t.end();
return;
}

var bSig = bSign.update(message).sign(priv);
var nSig = nSign.update(message).sign(priv);

Expand Down

0 comments on commit f5f17c2

Please sign in to comment.