@@ -266,18 +266,31 @@ <h3>Payment streaming</h3>
266266 < li > Let |result:OutgoingPaymentResult| be the result of [=send a create outgoing payment request=]
267267 with |userWallet|'s {{UserWallet/walletAddressDetails}}, |session|'s {{Session/incomingPaymentId}},
268268 |amountValue|, and |userWalletGrant|.</ li >
269+ < li > If |result| is {{OutgoingPaymentResult/"token-invalid"}}:
270+ < ol >
271+ < li > Let |rotatedAccessToken:AccessToken| be the result of [=send a rotate access token request=]
272+ with |userWalletGrant|.</ li >
273+ < li > If |rotatedAccessToken| is failure:
274+ < ol >
275+ < li > [=Revoke user wallet credentials=].</ li >
276+ < li > Return.</ li >
277+ </ ol >
278+ </ li >
279+ < li > Set |userWalletGrant|'s {{Grant/access_token}} to |rotatedAccessToken|.</ li >
280+ < li > Run [=update grant access token=] with |rotatedAccessToken|.</ li >
281+ < li > Set |result| to the result of [=send a create outgoing payment request=]
282+ with |userWallet|'s {{UserWallet/walletAddressDetails}}, |session|'s {{Session/incomingPaymentId}},
283+ |amountValue|, and |userWalletGrant|.</ li >
284+ </ ol >
285+ </ li >
269286 < li > If |result| is {{OutgoingPaymentResult/"success"}}:
270287 < ol >
271288 < li > [=Fire monetization event=] given |session|, |amount|, and |userWallet|.</ li >
272289 < li > [=Schedule payment streaming tick=].</ li >
273290 < li > Return.</ li >
274291 </ ol >
275292 </ li >
276- < li > Otherwise:
277- < ol >
278- < li > TODO: Handle token rotation and other failure cases.</ li >
279- </ ol >
280- </ li >
293+ < li > [=Revoke user wallet credentials=].</ li >
281294 </ ol >
282295 </ div >
283296
@@ -321,5 +334,29 @@ <h3>Payment streaming</h3>
321334 </ ol >
322335 < p class ="note "> For example, < code > convert scaled amount to decimal(100, 2)</ code > returns < code > "1.00"</ code > .</ p >
323336 </ div >
337+
338+ < div class ="algorithm ">
339+ < p > To < dfn > revoke user wallet credentials</ dfn > , run these steps:</ p >
340+ < ol >
341+ < li > Run [=update grant access token=] with the empty string.</ li >
342+ < li > For each |session| in the [=active sessions list=]:
343+ < ol >
344+ < li > Remove |session| from the [=active sessions list=].</ li >
345+ </ ol >
346+ </ li >
347+ < li > Set the [=current session iterator=] to the [=end iterator=].</ li >
348+ </ ol >
349+ < aside class ="note ">
350+ < p >
351+ Revoking credentials clears the access token but preserves other user wallet information
352+ (wallet address, auth keys). This allows the user interface to display a "Reconnect" prompt
353+ rather than requiring the user to set up their wallet again from scratch.
354+ </ p >
355+ < p >
356+ All active monetization sessions are terminated since payments can no longer be made.
357+ </ p >
358+ </ aside >
359+ </ div >
360+
324361 </ section >
325362</ section >
0 commit comments