We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f9a2e1c commit 5cb007cCopy full SHA for 5cb007c
lib/verify-stream.js
@@ -79,7 +79,12 @@ function jwsDecode(jwsSig, opts) {
79
80
function VerifyStream(opts) {
81
opts = opts || {};
82
- var secretOrKey = opts.secret||opts.publicKey||opts.key;
+ var secretOrKey = opts.secret;
83
+ secretOrKey = secretOrKey == null ? opts.publicKey : secretOrKey;
84
+ secretOrKey = secretOrKey == null ? opts.key : secretOrKey;
85
+ if (/^hs/i.test(opts.algorithm) === true && secretOrKey == null) {
86
+ throw new TypeError('secret must be a string or buffer or a KeyObject')
87
+ }
88
var secretStream = new DataStream(secretOrKey);
89
this.readable = true;
90
this.algorithm = opts.algorithm;
0 commit comments