<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.21 (Ruby 3.3.5) -->


<!DOCTYPE rfc  [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">

<!ENTITY RFC8620 SYSTEM "https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8620.xml">
<!ENTITY RFC8030 SYSTEM "https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8030.xml">
<!ENTITY RFC8292 SYSTEM "https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8292.xml">
<!ENTITY RFC2119 SYSTEM "https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC8174 SYSTEM "https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC7515 SYSTEM "https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7515.xml">
]>


<rfc ipr="trust200902" docName="draft-ietf-jmap-webpush-vapid-05" category="std" consensus="true" submissionType="IETF">
  <front>
    <title>Use of VAPID in JMAP WebPush</title>

    <author initials="D." surname="Gultsch" fullname="Daniel Gultsch">
      <organization></organization>
      <address>
        <email>daniel@gultsch.de</email>
      </address>
    </author>

    <date year="2024" month="November" day="24"/>

    <area>Internet</area>
    <workgroup>JMAP</workgroup>
    

    <abstract>


<?line 34?>

<t>This document defines a method for JMAP servers to advertise their capability to authenticate WebPush notifications using the Voluntary Application Server Identification protocol.</t>



    </abstract>



  </front>

  <middle>


<?line 38?>

<section anchor="introduction"><name>Introduction</name>

<t>JMAP <xref target="RFC8620"/> specifies how clients can subscribe to events using a protocol that is compatible with WebPush <xref target="RFC8030"/>. Some push services require that the application server authenticates all push messages using the Voluntary Application Server Identification protocol <xref target="RFC8292"/>. To facilitate that, the client (or user agent in WebPush terminology) needs the VAPID public key of the application server to pass it along to the push service when retrieving a new endpoint.</t>

</section>
<section anchor="conventions-used-in-this-document"><name>Conventions Used in This Document</name>

<t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
"MAY", and "OPTIONAL" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.
These words may also appear in this document in
lower case as plain English words, absent their normative meanings.
<?line -8?></t>

</section>
<section anchor="discovering-support-for-vapid"><name>Discovering Support for VAPID</name>

<t>The JMAP capabilities object is returned as part of the standard JMAP session object (see Section 2 of <xref target="RFC8620"/>). Servers supporting this specification MUST add a property called "urn:ietf:params:jmap:webpush-vapid" to the capabilities object. The value of this property is an object that MUST contain the following information:</t>

<t><list style="symbols">
  <t>applicationServerKey: "String"  <vspace blankLines='1'/>
The ECDSA public key over the P-256 curve <xref target="FIPS186"/>, in uncompressed form described in <xref target="X9.62"/> Annex A (65 octets, starting with a 0x04 octet) and encoded using base64url encoding <xref target="RFC7515"/>, that the push service will use to authenticate the application server.</t>
</list></t>

</section>
<section anchor="issuing-push-notifications"><name>Issuing Push Notifications</name>

<t>Every time the server sends a push message to a PushSubscription URL it MUST authenticate the POST request using the protocol outlined in <xref target="RFC8292"/>. This includes both StateChange events and PushVerification notifications. The server MUST use the application server key that was advertised in the capabilities object at the time the PushSubscription was created.</t>

</section>
<section anchor="key-rotation"><name>Key Rotation</name>

<t>When a server needs to replace its VAPID key, it MUST update the sessionState per <xref target="RFC8620"/>. The client MUST monitor the JMAP session object for changes to the VAPID key and MUST recreate its push subscription after detecting such a change.</t>

<t>After key rotation, the server MAY continue to send push notifications for existing push subscriptions using the old application server key for a transitional period. This allows clients time to recreate their respective push subscriptions. After the transitional period (or immediately for implementations that do not have one), the server MUST destroy push subscriptions that use the old key.</t>

<t>When destroying push subscriptions that include the data type <spanx style="verb">PushSubscription</spanx>, the server MAY issue one final StateChange push notification using the old URL and application server key to notify the client of changes to the PushSubscription data type. This prompts the client to make a <spanx style="verb">PushSubscription/changes</spanx> method call. The response to this call will contain an updated sessionState, which refers to a session object that contains the new VAPID key.</t>

<t>A race condition can occur when the server updates its VAPID key after the client has refreshed the session object but before calling the PushSubscription/set method. This situation causes the server to send a PushVerification object to a push resource URL that is now associated with an outdated VAPID key. Consequently, the push service will reject the PushVerification with a 403 (Forbidden) status code, as specified in <xref target="RFC8292"/>.</t>

<t>To alleviate this problem, the client MUST check if the sessionState in the response from the PushSubscription/set method points to a session object with an applicationServerKey that matches their expectations. If there is a mismatch, the client MAY retry creating the PushSubscription. Additionally, the client MAY destroy the PushSubscription from the earlier, failed attempt.</t>

</section>
<section anchor="security-considerations"><name>Security Considerations</name>

<t>The security considerations for JMAP (<xref target="RFC8620"/>, especially Section 8.6 and Section 8.7 of that document), WebPush (<xref target="RFC8030"/>) and VAPID (<xref target="RFC8292"/>) apply to this document.</t>

</section>
<section anchor="iana-considerations"><name>IANA Considerations</name>

<section anchor="registration-of-the-jmap-capability-for-vapid"><name>Registration of the JMAP Capability for VAPID</name>

<t>This specification requests IANA to register a new capability in the JMAP Capabilities registry with the following data:</t>

<t>Capability Name: <spanx style="verb">urn:ietf:params:jmap:webpush-vapid</spanx></t>

<t>Specification document: this document</t>

<t>Intended use: common</t>

<t>Change Controller: IETF</t>

<t>Security and privacy considerations: this document, Section 6</t>

</section>
</section>


  </middle>

  <back>



    <references title='Normative References' anchor="sec-normative-references">

<reference anchor="FIPS186" target="https://doi.org/10.6028/NIST.FIPS.186-4">
  <front>
    <title>Digital Signature Standard (DSS)</title>
    <author >
      <organization>National Institute of Standards and Technology (NIST)</organization>
    </author>
    <date year="2013" month="July"/>
  </front>
  <seriesInfo name="FIPS" value="186-4"/>
</reference>
<reference anchor="X9.62" >
  <front>
    <title>Public Key Cryptography for the Financial Services Industry: The Elliptic Curve Digital Signature Algorithm (ECDSA)</title>
    <author >
      <organization>American National Standards Institute</organization>
    </author>
    <date year="2005" month="November"/>
  </front>
  <seriesInfo name="ANSI" value="X9.62-2005"/>
</reference>
&RFC8620;
&RFC8030;
&RFC8292;
&RFC2119;
&RFC8174;
&RFC7515;


    </references>





  </back>

<!-- ##markdown-source:
H4sIAAAAAAAAA6VY3XbbuBG+x1NMlRu7R1IkxXYcnp5uVdvpqhv/1LKzzV0g
YiRiTQIsAErh8dG79Fn6ZD0DgJRo2d2L5iYySQxmvvnmmwEGgwFz0uWYQO/R
IuglfJ3ezS5BKvj79fQOfsXFXWWzHhM6veEFfScMX7qBRLcc/FbwcrDBRVnZ
bLDmpRSD0WmPCe4wgclocjIYjweTE8a4QZ7ATDk0Ch3brBJvntlqUUhrpVau
LjGB2dXDZ5Zyl4B1gsnSJNBzprJuMhp9Gk16jPHKZdokDAYMQHmPLrmSmMPf
qtzZNGMAWHCZJyD887+swvOhQMaUNgV3co0JA/g8u5uPz8/oJ0CDwqVcScdz
mMuV4q4yCHPHleBGwNHlfH7c81+3Xvh/A9BmlUDvhjupFc9hpqyTrnIe0Ga9
Ba4EPGCaKZ3rVQ1HN7P5QzTYQDb+MBh9DA5xs0KXQC9zrrTJ+/dCy6E2q/fj
0fBsNDl/T6uHFMNwfH42OAl2LBqJVqqlbpyjLxLotd/889PwbNKN+a5a5DKF
X7CGC1OXTq8ML7MaltqAyxA+S8VVKgkVNGuZooWZEpV1pk7gIUO4ynNZOpnC
RWXWCIcYTvOVNtJlBRxdXVzOp/8TxmmBRqZcQYvnDsIW2S5so9PBePwGANOb
+SyBno97QJ/2GBsMBsAX1hmeOsYeMmlB6LQqUDkQuJQKLXAo0GVaeBh8MVg0
azQWnAYu1mictEgASQMpL/lC5tLV/m3lMlROptxhU0KgtJNLeiS1slBZqVYe
3a86r5TjpoZpWebxA480GpgJstMsg9Jop1OdD0MIhRQiR8beUWkZLaqUvmLM
e/v8/If7zxfnZ5PRdgu2xFQuJVrI9AbSXKJyFghkWy1sauQCyXFc++fBOd5u
By7jDqSFVBcld3KRI2yky9rY4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