Expand description
The Web Push test vectors the workspace shares.
These are not decorative constants. RFC8291_UA_PUBLIC and
RFC8291_AUTH_SECRET are RFC 8291 Appendix A’s user agent: a real
point on the P-256 curve and a real 16-byte auth secret, so a
subscription built from them is one the adapter accepts and a body
encrypted to them can be opened again with RFC8291_UA_PRIVATE. A
made-up p256dh is refused — which is the point of the checks that use
them, and the reason a test cannot simply invent a value.
They used to be copied into crates/adapter-webpush,
crates/adapter-apns, crates/cli and crates/cli-acceptance, each
with a comment saying it was “the same one” another crate used and
nothing making that true. crates/cli-acceptance/tests/vector_guard.rs
now fails the build if any source outside this module writes one of
them down again.
Constants§
- RFC8291_
AUTH_ SECRET - RFC 8291 Appendix A: the subscription’s 16-byte
authsecret. - RFC8291_
PLAINTEXT - RFC 8291 §5: the plaintext the published example encrypts.
- RFC8291_
UA_ PRIVATE - RFC 8291 Appendix A: the user agent’s private key. Only a test has this — it is what lets the decrypt side of a round trip exist.
- RFC8291_
UA_ PUBLIC - RFC 8291 Appendix A: the user agent’s public key — the
p256dha browser puts insubscription.keys, base64url of the 65-byte uncompressed P-256 point. - TEST_
P256_ PEM - A throwaway P-256 private key in PKCS#8 PEM, generated for these tests only — not an Apple, Google or Mozilla key.
- TEST_
VAPID_ SUBJECT - A
mailto:VAPID subject (RFC 8292 §2.1). - WEB_
PUSH_ ENDPOINT - A Web Push endpoint of the shape a browser hands over: an origin plus a long, subscription-specific path. Whoever holds the whole thing can push to that browser, which is what makes it credential material.
- WEB_
PUSH_ ENDPOINT_ CAPABILITY - The subscription-specific part of
WEB_PUSH_ENDPOINT’s path: the bearer capability, and so the string a test asserts is absent from output. Distinctive on purpose — it cannot be matched by accident. - WEB_
PUSH_ ORIGIN - The push service origin of
WEB_PUSH_ENDPOINT— what a VAPID token claims as itsaud, and the most a report may print of an endpoint.
Functions§
- web_
push_ subscription_ json - The subscription exactly as
JSON.stringify(subscription)gives it — the shape an operator pastes intofz push send --recipient.