verify static method
Verifies a signature against expected input and freshness window.
Implementation
static bool verify({
required String secret,
required String signature,
required String appKey,
required String userToken,
required int timestamp,
Map<String, dynamic>? raw,
bool? isPaying,
String? plan,
num? mrr,
String? currency,
int? currentEpochSeconds,
}) {
final now = currentEpochSeconds ??
(DateTime.now().toUtc().millisecondsSinceEpoch ~/ 1000);
if ((now - timestamp).abs() > freshnessSeconds) {
return false;
}
final expected = sign(
secret: secret,
appKey: appKey,
userToken: userToken,
timestamp: timestamp,
raw: raw,
isPaying: isPaying,
plan: plan,
mrr: mrr,
currency: currency,
);
return _constantTimeEquals(expected, signature.toLowerCase());
}