public class WebhookSignatureValidator extends Object
| Constructor and Description |
|---|
WebhookSignatureValidator()
Instantiates the validator with the default threshold.
|
WebhookSignatureValidator(TemporalAmount threshold)
Instantiates the validator with the provided threshold.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
validate(String requestBody,
byte[] signingSecret,
String requestSignature,
String requestTime)
Validates that the provided request payload is an authentic request that originated from Nightfall.
|
public WebhookSignatureValidator()
public WebhookSignatureValidator(TemporalAmount threshold)
threshold - the time threshold within which webhook requests should be considered valid.public boolean validate(String requestBody, byte[] signingSecret, String requestSignature, String requestTime)
requestBody - the entire, raw request payload, encoded in UTF-8.signingSecret - the signing secret used as the key for HMAC.requestSignature - the signature provided by Nightfall to compare against the locally-computed value.requestTime - the Unix timestamp of when this request was sent, i.e. the number of seconds
since the Unix epoch.NumberFormatException - if requestTime is not parsable as an integerCopyright © 2022. All rights reserved.