We should have a new type called Topic that accepts either a string, content, or data, and encodes the topic as a base64 url encoded string.
HOWEVER, push services only accept 32-character topics, so if the data is larger than 32 encoded bytes (24 source bytes?), it should be hashed first, then encoded and trimmed.
From a security point of view, perhaps it should always be hashed? The only important thing is that the topics are consistent. I don't think the service worker even sees them, so perhaps this can all be done transparently?
https://datatracker.ietf.org/doc/html/rfc8030#section-5.4
We should have a new type called Topic that accepts either a string, content, or data, and encodes the topic as a base64 url encoded string.
HOWEVER, push services only accept 32-character topics, so if the data is larger than 32 encoded bytes (24 source bytes?), it should be hashed first, then encoded and trimmed.
From a security point of view, perhaps it should always be hashed? The only important thing is that the topics are consistent. I don't think the service worker even sees them, so perhaps this can all be done transparently?
https://datatracker.ietf.org/doc/html/rfc8030#section-5.4