-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp_patch.diff
More file actions
50 lines (50 loc) · 1.28 KB
/
Copy pathtemp_patch.diff
File metadata and controls
50 lines (50 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
*** Begin Patch
*** Update File: js/emma-web-vault.js
@@
- const key = await crypto.subtle.deriveKey(
- {
- name: 'PBKDF2'
- salt: salt
- iterations: 250000
- hash: 'SHA-256'
- },
- keyMaterial,
- { name: 'AES-GCM', length: 256 },
- false
- ['decrypt']
- );
-
- // Decrypt the data (EXACT same as extension)
- const decrypted = await crypto.subtle.decrypt(
- { name: 'AES-GCM', iv: iv },
- key,
- encrypted
- );
+ const attempt = async (iterations) => {
+ const key = await crypto.subtle.deriveKey(
+ {
+ name: 'PBKDF2',
+ salt: salt,
+ iterations,
+ hash: 'SHA-256'
+ },
+ keyMaterial,
+ { name: 'AES-GCM', length: 256 },
+ false,
+ ['decrypt']
+ );
+ return await crypto.subtle.decrypt(
+ { name: 'AES-GCM', iv: iv },
+ key,
+ encrypted
+ );
+ };
+
+ // Try extension standard first (250k iterations), then fall back to older 100k iteration files
+ let decrypted;
+ try {
+ decrypted = await attempt(250000);
+ } catch (err) {
+ decrypted = await attempt(100000);
+ }
*** End Patch