Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VapidExpiration option is unused #73

Open
sometimes-i-send-pull-requests opened this issue Jan 31, 2025 · 0 comments · May be fixed by #74
Open

VapidExpiration option is unused #73

sometimes-i-send-pull-requests opened this issue Jan 31, 2025 · 0 comments · May be fixed by #74

Comments

@sometimes-i-send-pull-requests

webpush.Options has a dedicated VapidExpiration field documented as:

	VapidExpiration time.Time  // optional expiration for VAPID JWT token (defaults to now + 12 hours)

It was introduced in #45. SendNotificationWithContext passes it into getVAPIDAuthorizationHeader, and in #45, getVAPIDAuthorizationHeader used it when forming the exp claim. However, what looks to have been a faulty merge conflict resolution in #46 seems to have reverted the change in getVAPIDAuthorizationHeader, leaving expiration unused:

 	token := jwt.NewWithClaims(jwt.SigningMethodES256, jwt.MapClaims{
-		"aud": fmt.Sprintf("%s://%s", subURL.Scheme, subURL.Host),
-		"exp": expiration.Unix(),
-		"sub": fmt.Sprintf("mailto:%s", subscriber),
+		"aud": subURL.Scheme + "://" + subURL.Host,
+		"exp": time.Now().Add(time.Hour * 12).Unix(),
+		"sub": "mailto:" + subscriber,
 	})

As a result, the VAPID JWT expiration is always now+12 hours, even when explicitly set otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant