You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/WebPush/WebPushManager.swift
+9-3Lines changed: 9 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -101,9 +101,15 @@ public actor WebPushManager: Sendable {
101
101
logger:Logger,
102
102
executor:Executor
103
103
){
104
-
assert(vapidConfiguration.validityDuration <= vapidConfiguration.expirationDuration,"The validity duration must be earlier than the expiration duration since it represents when the VAPID Authorization token will be refreshed ahead of it expiring.");
105
-
assert(vapidConfiguration.expirationDuration <=.hours(24),"The expiration duration must be less than 24 hours or else push endpoints will reject messages sent to them.");
106
-
precondition(!vapidConfiguration.keys.isEmpty,"VAPID.Configuration must have keys specified.")
104
+
if vapidConfiguration.validityDuration > vapidConfiguration.expirationDuration {
105
+
assertionFailure("The validity duration must be earlier than the expiration duration since it represents when the VAPID Authorization token will be refreshed ahead of it expiring.")
106
+
logger.error("The validity duration must be earlier than the expiration duration since it represents when the VAPID Authorization token will be refreshed ahead of it expiring. Run your application server with the same configuration in debug mode to catch this.")
107
+
}
108
+
if vapidConfiguration.expirationDuration >.hours(24){
109
+
assertionFailure("The expiration duration must be less than 24 hours or else push endpoints will reject messages sent to them.")
110
+
logger.error("The expiration duration must be less than 24 hours or else push endpoints will reject messages sent to them. Run your application server with the same configuration in debug mode to catch this.")
111
+
}
112
+
precondition(!vapidConfiguration.keys.isEmpty,"VAPID.Configuration must have keys specified. Please report this as a bug with reproduction steps if encountered: https://github.com/mochidev/swift-webpush/issues.")
0 commit comments