gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-wallet-webex] branch master updated: check for contr


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-webex] branch master updated: check for contract freshness
Date: Mon, 13 Feb 2017 03:28:41 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-webex.

The following commit(s) were added to refs/heads/master by this push:
     new d143ba9  check for contract freshness
d143ba9 is described below

commit d143ba95000f0b03685583fb9442863b9270e5a9
Author: Florian Dold <address@hidden>
AuthorDate: Mon Feb 13 03:28:36 2017 +0100

    check for contract freshness
---
 src/content_scripts/notify.ts | 10 ++++++++--
 src/types.ts                  |  3 +++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/content_scripts/notify.ts b/src/content_scripts/notify.ts
index 10b988c..d29e591 100644
--- a/src/content_scripts/notify.ts
+++ b/src/content_scripts/notify.ts
@@ -173,7 +173,9 @@ namespace TalerNotify {
     (detail: any, sendResponse: (msg: any) => void): void;
   }
 
-  function downloadContract(url: string): Promise<any> {
+  function downloadContract(url: string, nonce: string): Promise<any> {
+    let parsed_url = URI(url);
+    url = parsed_url.setQuery({nonce}).href();
     // FIXME: include and check nonce!
     return new Promise((resolve, reject) => {
       const contract_request = new XMLHttpRequest();
@@ -356,7 +358,11 @@ namespace TalerNotify {
         return;
       }
       if (msg.contract_url) {
-        let proposal = await downloadContract(msg.contract_url);
+        let nonce = Math.round(Math.random() * 0xFFFF).toString()
+        let proposal = await downloadContract(msg.contract_url, nonce);
+        if (proposal.data.nonce != nonce) {
+          console.error("stale contract");
+        }
         await processProposal(proposal);
         return;
       }
diff --git a/src/types.ts b/src/types.ts
index ab50c73..30e9b78 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -444,6 +444,9 @@ export class Contract {
   @Checkable.Optional(Checkable.String)
   summary?: string;
 
+  @Checkable.Optional(Checkable.String)
+  nonce?: string;
+
   @Checkable.Value(AmountJson)
   amount: AmountJson;
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]