@@ -76,10 +76,11 @@ public class WebhookEventVerifier {
76
76
* @param rawEventBody the raw event body
77
77
* @param hexSignature the hex signature
78
78
* @return the webhook event
79
- * @throws OnfidoInvalidSignatureError the onfido exception
79
+ * @throws OnfidoInvalidSignatureError on verification error
80
+ * @throws JsonParseException on JSON parsing error
80
81
*/
81
82
public WebhookEvent readPayload(String rawEventBody, String hexSignature)
82
- throws OnfidoInvalidSignatureError {
83
+ throws OnfidoInvalidSignatureError, JsonParseException {
83
84
Mac sha256Hmac;
84
85
SecretKeySpec secretKey;
85
86
@@ -100,14 +101,10 @@ public class WebhookEventVerifier {
100
101
throw new OnfidoInvalidSignatureError(" Invalid signature for webhook event" );
101
102
}
102
103
103
- try {
104
- JsonReader jsonReader = new JsonReader(new StringReader(rawEventBody));
105
- jsonReader.setLenient(true );
104
+ JsonReader jsonReader = new JsonReader(new StringReader(rawEventBody));
105
+ jsonReader.setLenient(true);
106
106
107
- return gson.fromJson(jsonReader, WebhookEvent.class);
108
- } catch (JsonParseException e) {
109
- throw new OnfidoInvalidSignatureError(" Invalid payload for webhook event" , e);
110
- }
107
+ return gson.fromJson(jsonReader, WebhookEvent.class);
111
108
}
112
109
113
110
private String encodeHexString(byte[] byteArray) {
0 commit comments