You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 28, 2023. It is now read-only.
},function(_err,_res,_resBody){// TODO: add caching layer to speed up SSR? How to invalidate products (checksum on the response BEFORE processing it)
91
102
if(_resBody&&_resBody.hits&&_resBody.hits.hits){// we're signing up all objects returned to the client to be able to validate them when (for example order)
item.sgn=hmac.sign(sgnSrc(sgnObj,item),config.objHashSecret);// for products we sign off only price and id becase only such data is getting back with orders
Copy file name to clipboardExpand all lines: src/processor/default.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,12 @@ const jwa = require('jwa');
2
2
consthmac=jwa('HS256');
3
3
4
4
classHmacProcessor{
5
-
constructor(config,entityType,indexName){
5
+
constructor(config,entityType,indexName,req,res){
6
6
this._config=config
7
7
this._entityType=entityType
8
8
this._indexName=indexName
9
+
this._req=req
10
+
this._res=res
9
11
}
10
12
11
13
process(items){
@@ -15,7 +17,9 @@ class HmacProcessor {
15
17
16
18
returnnewPromise((resolve,reject)=>{
17
19
constrs=items.map((item)=>{
18
-
item._source.sgn=hmac.sign(item._source,this._config.objHashSecret);// for products we sign off only price and id becase only such data is getting back with orders
item._source.sgn=hmac.sign(item._source,this._config.objHashSecret);// for products we sign off only price and id becase only such data is getting back with orders
item._source.sgn=hmac.sign(sgnSrc(sgnObj,item),config.objHashSecret);// for products we sign off only price and id becase only such data is getting back with orders
item._source.sgn=hmac.sign(sgnSrc(sgnObj,item),config.objHashSecret);// for products we sign off only price and id becase only such data is getting back with orders
0 commit comments