File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -208,7 +208,20 @@ class CoCreateLazyLoader {
208
208
name = name [ 3 ] || name [ 2 ] || name [ 1 ]
209
209
210
210
// TODO: webhook secert could be a key pair
211
- const webhookSecret = data . apis [ environment ] . webhooks [ name ] ;
211
+ let webhookSecret , webhookObject
212
+ const webhook = data . apis [ environment ] . webhooks [ name ] ;
213
+ if ( ! webhook )
214
+ throw new Error ( `Webhook ${ name } is not defined` ) ;
215
+ else if ( typeof webhook === 'string' )
216
+ webhookSecret = webhook
217
+ else if ( webhook . webhookSecret ) {
218
+ webhookSecret = webhook . webhookSecret
219
+ webhookObject = webhook . webhookObject
220
+ // TODO: webhook could conatin $crud to get get webhook data
221
+ } else
222
+ throw new Error ( `Webhook secret ${ name } is not defined` ) ;
223
+
224
+ // const webhookSecret = data.apis[environment].webhooks[name];
212
225
if ( webhookSecret !== req . headers [ name ] )
213
226
throw new Error ( `Webhook secret failed for ${ name } . Unauthorized access attempt.` ) ;
214
227
You can’t perform that action at this time.
0 commit comments