Re: [w3c/push-api] Separate out the steps for creating a subscription (#254)

beverloo commented on this pull request.



> @@ -383,6 +382,35 @@
           <var>oldSubscription</var> and a <a>PushSubscription</a> instance representing the
           <a>push subscription</a> having the new keys as <var>newSubscription</var>.
         </p>
+        <p>
+          To <dfn>create a push subscription</dfn>, given an <a>PushSubscriptionOptions</a> object
+          of <var>options</var>, the <a>user agent</a> must run the following steps:
+        </p>
+        <ol>
+          <li>Let <var>subscription</var> be a new <a>push subscription</a>.
+          </li>
+          <li>Set the <code>options</code> attribute of <var>subscription</var> to be a copy of
+          <var>options</var>.
+          </li>
+          <li>Generate a new P-256 <a>ECDH</a> key pair. Store the private key in an internal slot
+          on <var>subscription</var>; this value MUST NOT be made available to applications. The
+          public key is also stored in an internal slot and can be retrieved by calling the <code>
+            getKey</code> method of the <a>PushSubscription</a> with an argument of

Yes, presumably because the \<code> block is open?

> +          </li>
+          <li>Generate a new P-256 <a>ECDH</a> key pair. Store the private key in an internal slot
+          on <var>subscription</var>; this value MUST NOT be made available to applications. The
+          public key is also stored in an internal slot and can be retrieved by calling the <code>
+            getKey</code> method of the <a>PushSubscription</a> with an argument of
+            <a data-link-for="PushEncryptionKeyName">p256dh</a>.
+          </li>
+          <li>Generate a new authentication secret, which is a sequence of octets as defined in
+          [[!WEBPUSH-ENCRYPTION]]. Store the authentication secret in an internal slot on
+          <var>subscription</var>. This key can be retrieved by calling the <code>getKey</code>
+          method of the <a>PushSubscription</a> with an argument of <a data-link-for=
+          "PushEncryptionKeyName">auth</a>.
+          </li>
+          <li>Make a request to the <a>push service</a> to create a new <a>push subscription</a>.
+          Include the <a data-link-for="PushSubscriptionOptions">applicationServerKey</a> attribute
+          of <var>options</var> when it contains a valid point on the P-256 curve.

"when it contains a valid point on the P-256 curve" -> "when it has been set"

> @@ -868,9 +885,14 @@
         is one, or <code>null</code> otherwise.
       </p>
       <p>
+        When getting the <dfn>options</dfn> attribute, the <a>user agent</a> MUST return a
+        <code><a>PushSubscriptionOptions</a></code> object representing the options associated with

No, because PSO is the object, PSOInit is the dictionary. We return PSO.

> @@ -930,7 +953,7 @@
         </li>
       </ol>
       <p>
-        The serializer for a <a>PushSubscription</a> invokes the following steps:
+        The <dfn>serializer</dfn> for a <a>PushSubscription</a> invokes the following steps:

The owning \<section> has been annotated with the `data-dfn-for` attribute, making that redundant. That doesn't work when a section contains multiple identically named attributes, as is the case with the Init dictionaries.

> @@ -383,6 +382,35 @@
           <var>oldSubscription</var> and a <a>PushSubscription</a> instance representing the
           <a>push subscription</a> having the new keys as <var>newSubscription</var>.
         </p>
+        <p>
+          To <dfn>create a push subscription</dfn>, given an <a>PushSubscriptionOptions</a> object
+          of <var>options</var>, the <a>user agent</a> must run the following steps:
+        </p>
+        <ol>
+          <li>Let <var>subscription</var> be a new <a>push subscription</a>.
+          </li>
+          <li>Set the <code>options</code> attribute of <var>subscription</var> to be a copy of
+          <var>options</var>.
+          </li>
+          <li>Generate a new P-256 <a>ECDH</a> key pair. Store the private key in an internal slot

I'm not sure how to phrase this. "as described in [[!X9.62]]"?

The actual curve parameters are defined in Section 10.2, should we refer that too?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/pull/254#discussion_r113247705

Received on Tuesday, 25 April 2017 17:02:20 UTC