فهرست منبع

Upgrade SaltyRTC libraries to 0.10.0 (#350)

Fixes #344
Danilo Bargen 8 سال پیش
والد
کامیت
b7716cdd06
3فایلهای تغییر یافته به همراه28 افزوده شده و 15 حذف شده
  1. 23 9
      package-lock.json
  2. 3 3
      package.json
  3. 2 3
      src/services/keystore.ts

+ 23 - 9
package-lock.json

@@ -10,14 +10,14 @@
       "integrity": "sha1-ft8+rWGG7n7a2txokugdzkPw5a0="
     },
     "@saltyrtc/client": {
-      "version": "0.9.1",
-      "resolved": "https://registry.npmjs.org/@saltyrtc/client/-/client-0.9.1.tgz",
-      "integrity": "sha1-Ww7KIeZN90o0ghfX+YNIRyhiXOw="
+      "version": "0.10.0",
+      "resolved": "https://registry.npmjs.org/@saltyrtc/client/-/client-0.10.0.tgz",
+      "integrity": "sha512-WADpJAOxcDz8DmezDExPjA79z2eDLTnqazHosB9YAMhtRTeXh60ar9MV/TfBfUDQZxXlyScV26HU2KYFF3ebmQ=="
     },
     "@saltyrtc/task-webrtc": {
-      "version": "0.9.4",
-      "resolved": "https://registry.npmjs.org/@saltyrtc/task-webrtc/-/task-webrtc-0.9.4.tgz",
-      "integrity": "sha512-nEwdvhn967dreHSm0Iy5gWCI7MgJgpw3ZLTTZFB32rZDqq4mIJolMNQglJ7WjKW/hGxn3/nu0bIhNuXBGBhtQg==",
+      "version": "0.10.0",
+      "resolved": "https://registry.npmjs.org/@saltyrtc/task-webrtc/-/task-webrtc-0.10.0.tgz",
+      "integrity": "sha512-Amde0FDApkl+qWZcv70wwRIk9Sq27yoBz5buGQy4xDRrkX/+R1hS+4bTN1amSvWh8NkAUsUo7mTl2GLAMBVzvw==",
       "requires": {
         "@saltyrtc/chunked-dc": "1.0.0"
       }
@@ -987,6 +987,14 @@
       "optional": true,
       "requires": {
         "tweetnacl": "0.14.5"
+      },
+      "dependencies": {
+        "tweetnacl": {
+          "version": "0.14.5",
+          "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+          "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
+          "optional": true
+        }
       }
     },
     "beeper": {
@@ -5579,6 +5587,12 @@
           "version": "1.0.0",
           "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
           "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
+        },
+        "tweetnacl": {
+          "version": "0.14.5",
+          "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+          "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
+          "optional": true
         }
       }
     },
@@ -6121,9 +6135,9 @@
       }
     },
     "tweetnacl": {
-      "version": "0.14.5",
-      "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
-      "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.0.tgz",
+      "integrity": "sha1-cT2LgY2kIGh0C/aDhtBHnmb8ins="
     },
     "type-is": {
       "version": "1.6.15",

+ 3 - 3
package.json

@@ -25,8 +25,8 @@
   "private": true,
   "homepage": "https://threema.ch/",
   "dependencies": {
-    "@saltyrtc/client": "~0.9.1",
-    "@saltyrtc/task-webrtc": "~0.9.4",
+    "@saltyrtc/client": "^0.10.0",
+    "@saltyrtc/task-webrtc": "^0.10.0",
     "@types/angular": "~1.5.23",
     "@types/angular-material": "~1.1.43",
     "@types/angular-sanitize": "~1.3.4",
@@ -62,7 +62,7 @@
     "sdp": "~1.3.0",
     "ts-events": "^3.1.5",
     "tsify": "~2.0.1",
-    "tweetnacl": "~0.14.4",
+    "tweetnacl": "^1.0.0",
     "typescript": "~2.1.5",
     "webrtc-adapter": "~3.4.3"
   },

+ 2 - 3
src/services/keystore.ts

@@ -130,9 +130,8 @@ export class TrustedKeyStoreService {
 
         const nonce = hexToU8a(parts[0]);
         const encrypted = hexToU8a(parts[1]);
-        // TODO: Remove type cast once https://github.com/dchest/tweetnacl-js/pull/113 is merged
-        const decrypted = nacl.secretbox.open(encrypted, nonce, this.pwToKey(password)) as Uint8Array | false;
-        if (decrypted === false) {
+        const decrypted = nacl.secretbox.open(encrypted, nonce, this.pwToKey(password));
+        if (!decrypted) {
             return null;
         }