TSKReportsRateLimiter.h 1020 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. TSKReportsRateLimiter.h
  3. TrustKit
  4. Copyright 2015 The TrustKit Project Authors
  5. Licensed under the MIT license, see associated LICENSE file for terms.
  6. See AUTHORS file for the list of project authors.
  7. */
  8. #import "TSKPinFailureReport.h"
  9. #if __has_feature(modules)
  10. @import Foundation;
  11. #else
  12. #import <Foundation/Foundation.h>
  13. #endif
  14. /*
  15. * Simple helper class which caches reports for 24 hours to prevent identical reports from being sent twice
  16. * during this 24 hour period.
  17. * This is best-effort as the class doesn't persist state across App restarts, so if the App
  18. * gets killed, it will start sending reports again.
  19. */
  20. @interface TSKReportsRateLimiter : NSObject
  21. /**
  22. Determine if the report should be reported or ignored due to the rate limiting policy.
  23. @param report The report to check whether or not to rate limit
  24. @return True if the report should be ignored under the rate-limiting policy that
  25. is in effect.
  26. */
  27. - (BOOL)shouldRateLimitReport:(TSKPinFailureReport * _Nonnull)report;
  28. @end