File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,18 @@ public function __construct(string $verificationKey)
2626 $ this ->_verificationKey = $ verificationKey ;
2727 }
2828
29- public function verifyHeaders (array $ headers ): bool
29+ /**
30+ * @param string $verificationKey
31+ *
32+ * @return WebhookParser
33+ */
34+ public function setVerificationKey (string $ verificationKey )
35+ {
36+ $ this ->_verificationKey = $ verificationKey ;
37+ return $ this ;
38+ }
39+
40+ public function verifyHeaders (array $ headers , $ verifyKey = null ): bool
3041 {
3142 //Payload Checksum
3243 $ checksum = isset ($ headers ['x-fident-checksum ' ]) ? $ headers ['x-fident-checksum ' ] : '' ;
@@ -35,7 +46,7 @@ public function verifyHeaders(array $headers): bool
3546 $ verification = isset ($ headers ['x-fident-verification ' ]) ? $ headers ['x-fident-verification ' ] : '' ;
3647
3748 //Verify the checksum + verification key matches the verification has
38- return sha1 ($ checksum . $ this ->_verificationKey ) === $ verification ;
49+ return sha1 ($ checksum . ( $ verifyKey ?? $ this ->_verificationKey ) ) === $ verification ;
3950 }
4051
4152 public function verifyWebhook (array $ headers ): bool
You can’t perform that action at this time.
0 commit comments