File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,7 @@ class HmacValidator {
35
35
*/
36
36
public calculateHmac ( data : string | NotificationRequestItem , key : string ) : string {
37
37
const dataString = typeof data !== "string" ? this . getDataToSign ( data ) : data ;
38
- const rawKey = Buffer . from ( key , "hex" ) ;
39
- return createHmac ( HmacValidator . HMAC_SHA256_ALGORITHM , rawKey ) . update ( dataString , "utf8" ) . digest ( "base64" ) ;
38
+ return this . calculateHmacSignature ( dataString , key ) ;
40
39
}
41
40
42
41
/**
@@ -131,6 +130,13 @@ class HmacValidator {
131
130
return [ ...keys , ...values ] . join ( HmacValidator . DATA_SEPARATOR ) ;
132
131
}
133
132
}
133
+
134
+ public calculateHmacSignature ( data : string , key : string ) : string {
135
+ const rawKey = Buffer . from ( key , "hex" ) ;
136
+ return createHmac ( HmacValidator . HMAC_SHA256_ALGORITHM , rawKey ) . update ( data , "utf8" ) . digest ( "base64" ) ;
137
+ }
138
+
134
139
}
135
140
141
+
136
142
export default HmacValidator ;
You can’t perform that action at this time.
0 commit comments