File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,13 @@ const maybeEmitDeprecationWarning = getDeprecationWarningEmitter(
8787 } ,
8888) ;
8989
90+ const maybeEmitHMACMultipleDigestDeprecationWarning =
91+ getDeprecationWarningEmitter (
92+ 'DEP0208' ,
93+ 'Calling hmac.digest() multiple times without re-initialization is ' +
94+ 'deprecated and will throw an error in a future version.' ,
95+ ) ;
96+
9097function Hash ( algorithm , options ) {
9198 if ( ! new . target )
9299 return new Hash ( algorithm , options ) ;
@@ -186,6 +193,7 @@ Hmac.prototype.digest = function digest(outputEncoding) {
186193 const state = this [ kState ] ;
187194
188195 if ( state [ kFinalized ] ) {
196+ maybeEmitHMACMultipleDigestDeprecationWarning ( ) ;
189197 const buf = Buffer . from ( '' ) ;
190198 if ( outputEncoding && outputEncoding !== 'buffer' )
191199 return buf . toString ( outputEncoding ) ;
You can’t perform that action at this time.
0 commit comments