Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions section/algorithms.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ <h3>Outgoing payment and quote grant request</h3>
</dl>
</li>
<li>
Run the [=generate an HTTP message signature=] algorithm on the <var>request</var>.
Run the [=generate an HTTP message signature=] algorithm on |request|.
</li>
<li>
Let |grant| be null.
Expand All @@ -185,7 +185,7 @@ <h3>Outgoing payment and quote grant request</h3>
</ol>
</div>



<aside class="example" title="Grant request JSON payload">
<p>This payload has the type {{GrantRequest}}.</p>
Expand Down Expand Up @@ -276,13 +276,14 @@ <h3>Continue grant request</h3>
</dl>
</li>
<li>
Run the [=generate an HTTP message signature=] algorithm on the <var>request</var>.
Run the [=generate an HTTP message signature=] algorithm on |request| with |accessToken|.
</li>
<li>
Let <var>grant</var> be null.
Let |grant| be null.
</li>
<li>
Perform a [=fetch request=] with <var>request</var> and with <var>processResponseConsumeBody</var> set to the following steps, given a [=response=] <var>response</var> with [=response/body=] <var>responseBody</var>:
Perform a [=fetch request=] with |request| and with |processResponseConsumeBody| set to the following steps,
given a [=response=] |response| with [=response/body=] |responseBody|:
<ol>
<li>
Let <var>json</var> be the result of [=extract the JSON fetch response=] from <var>response</var> and <var>responseBody</var>.
Expand Down Expand Up @@ -333,7 +334,7 @@ <h3>Cancel grant request</h3>
<dd>"follow"</dd>
<dt>[=request/client=]</dt>
<dd>null</dd>
<<dt>{{RequestInit/window}}</dt>
<dt>{{RequestInit/window}}</dt>
<dd>null</dd>
<dt>[=request/service-workers mode=]</dt>
<dd>"none"</dd>
Expand All @@ -346,10 +347,10 @@ <h3>Cancel grant request</h3>
</dl>
</li>
<li>
Run the [=generate an HTTP message signature=] algorithm on the <var>request</var>.
Run the [=generate an HTTP message signature=] algorithm on |request| with |accessToken|.
</li>
<li>
Perform a [=fetch request=] with <var>request</var>, given a [=response=]:
Perform a [=fetch request=] with |request|, given a [=response=]:
<ol>
<li>
If {{"NetworkError"}} is thrown, notify the user that the browser could not cancel the grant.
Expand Down
16 changes: 12 additions & 4 deletions section/authentication.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,11 @@ <h3>Generating an Ed25519 key pair</h3>

<section>
<h3>HTTP message signatures</h3>
<p>User agents MUST create HTTP message signatures for authenticated Open Payments requests using the Ed25519 key pair. The following algorithm defines signature construction.</p>
<p>User agents MUST create HTTP message signatures for authenticated Open Payments requests using the Ed25519 key pair.
The following algorithm defines signature construction.</p>
<div class="algorithm">
To <dfn>generate an HTTP message signature</dfn>, given
an HTTP <var data-type="request">request</var>:
To <dfn>generate an HTTP message signature</dfn>, given an HTTP <var data-type="request">request</var>
and an optional GNAP authorization |accessToken:DOMString|:
<ol>
<li>Let |authKeys:AuthKeys?| be the result of the [=get auth keys=] algorithm.</li>
<li>If |authKeys| is null, then fail.</li>
Expand Down Expand Up @@ -231,7 +232,14 @@ <h3>HTTP message signatures</h3>
with parameters</a> to describe the <a data-cite="RFC9421#section-1.1-7.17">covered components</a>
for the signature.</li>
<li>Let |components| initial value be `<<"@method", "@target-uri">>`.</li>
<li>If <var>request</var>'s headers include `Authorization`, append `"authorization"` to |components|.</li>
<li>If |accessToken| is given, then:
<ol>
<li>[=header list/Append=] an `Authorization` header whose value is the concatenation of
the literal string `GNAP`, a single U+0020 SPACE character, and |accessToken|
(that is, `GNAP` + " " + |accessToken|).</li>
<li>Append `"authorization"` to |components|.</li>
</ol>
</li>
<li>If <var>request</var>'s body is not `null`, append `"content-length"` and `"content-digest"`; if a `Content-Type` header will be sent, also append `"content-type"`.</li>
<li>Header field names in |components| MUST be lowercase.</li>
<li>Set |components|'s <a data-cite="RFC8941#param">parameters</a> to include
Expand Down
21 changes: 11 additions & 10 deletions section/connecting-a-wallet.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ <h3>Terms</h3>

<section class="algorithm">
<h3>Connecting a wallet</h3>
<p>The user can initiate the wallet setup from the [=setup page=].</p>
<p>To process the wallet setup, given a string |walletAddress:DOMString| (the [=wallet address=] provided by the user), a number |budget:number| (the budget that the user wants to use for Web Monetization) and a boolean |renewMonthly: boolean| (an option to renew the budget every month):</p>

<p>The user can initiate the wallet setup from the [=setup page=]. The [=setup page=] provides
UI that lets the user: (1) enter a [=wallet address=]; (2) specify an initial spending budget;
(3) optionally enable automatic monthly renewal; and (4) after authentication {{ Storage/keys }} generation,
view and copy the newly generated public key so it can be registered with the connected wallet
for client identification.</p>

<p>To <b><em>process the wallet setup</em></b>, given a string |walletAddress:DOMString| (the [=wallet address=] provided by the user),
a number |budget:number| (the budget that the user wants to use for Web Monetization) and
a boolean |renewMonthly: boolean| (an option to renew the budget every month):</p>
<ol>
<li>
Let |walletAddressDetails:WalletAddressDetails| be the result of the [=send a wallet address request=] algorithm on |walletAddress|.
Expand Down Expand Up @@ -98,15 +106,8 @@ <h3>Connecting a wallet</h3>
</ol>
</li>
<li>
If |finalizedGrant| is not null, [=save grant details in the storage=].
If |finalizedGrant| is not null, run the [=store grant credentials=] algorithm with |finalizedGrant|.
</li>
</ol>

<div>
<p>To <dfn>save grant details in the storage</dfn> for a |grant:Grant|, TODO.</p>
<p class="issue">
We need to save the grants continue URI + access_token (used to remove the grant if the user wants to disconnect their wallet), acesss token and its manage url.
</p>
</div>
</section>
</section>