Skip to content

Conversation

@saschanaz
Copy link
Member

@saschanaz saschanaz commented Nov 24, 2025

Closes #396.

The current spec assumes random kinds of keys may exist, even though there has been only two kinds of keys, which is unlikely to change. Given that adds more prose for no use, this patch defines separate internal slots for each key.

Technically this change can be done without the dictionary change. I can split it if desired.

The following tasks have been completed:

  • Modified Web platform tests (N/A)

Implementation commitment:


Preview | Diff

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup! Looks good modulo a number of nits.

authentication secret in accordance with [[RFC8291]]. These slots MUST be populated when
creating the <a>push subscription</a>.
A [=push subscription=] has an associated <dfn>P-256 ECDH key pair</dfn> and an
<dfn>authentication secret</dfn> in accordance with [[RFC8291]].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to (eventually) define their types as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's somehow opaque right now. Could try byte sequences and make it always serialized. Thoughts?

I think a separate PR would be nicer for that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably best as a follow-up. It could better explain getKey and such.

authentication secret in accordance with [[RFC8291]]. These slots MUST be populated when
creating the <a>push subscription</a>.
A [=push subscription=] has an associated <dfn>P-256 ECDH key pair</dfn> and an
<dfn>authentication secret</dfn> in accordance with [[RFC8291]].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably best as a follow-up. It could better explain getKey and such.

</li>
</ol>
<li>Set |keys|["p256dh"] to the URL-safe base64 encoding without padding [[RFC4648]] of
the value as returned by {{PushSubscription/getKey("p256dh")}}, as a {{USVString}}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this isn't entirely a regression, but using the public API is not great. We should have an internal "get key" for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I took a bit of look and I think it would be nice to fix this with key types. If we make the keys always serialized, then this step can simply retrieve that without an extra algorithm.

{{PushSubscription/getKey()}} method of the {{PushSubscription}} with an argument of
{{PushEncryptionKeyName/"p256dh"}}.
<li>Set |subscription|'s [=P-256 ECDH key pair=] to the result of generating a new P-256
[=ECDH=] key pair [[ANSI-X9-62]].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If at all possible, I wonder if it's possible to link to the particular section of ANSI-X9-62 (or even if such a section exists?... I haven't checked).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I don't understand tihs. ANSI X9.62 doesn't seem to be about ECDH, it's about ECDSA per what I see. X9.63 is about ECDH. Something to fix in a separate patch?

<a>application server</a>.
<li>Otherwise:
<ol>
<li>[=/Assert=]: |name| is {{PushEncryptionKeyName/"auth"}}</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just do:

Suggested change
<li>[=/Assert=]: |name| is {{PushEncryptionKeyName/"auth"}}</li>
<li>Assert: |name| is {{PushEncryptionKeyName/"auth"}}</li>

And if that should link to WebIDL's assert, we should probably fix that in ReSpec (can't remember if it links already or not).

Copy link
Member Author

@saschanaz saschanaz Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, doesn't seem to work. Just a plaintext.

Copy link
Member

@marcoscaceres marcoscaceres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some editorial suggestions... great cleanup. Coming along nicely!

saschanaz and others added 2 commits November 28, 2025 16:52
Co-authored-by: Marcos Cáceres <marcos@marcosc.com>
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 this pull request may close these issues.

Add dictionary for the type of PushSubscriptionJSON.keys?

4 participants