Skip to content

Commit a76f59d

Browse files
authored
Merge pull request #430 from Authenticator-Extension/dev
6.0.1
2 parents 0eeaef4 + 229aa24 commit a76f59d

File tree

9 files changed

+57
-28
lines changed

9 files changed

+57
-28
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
## Available for Chrome, Firefox, and Microsoft Edge
66

7-
[<img src="https://raw.githubusercontent.com/wiki/Authenticator-Extension/Authenticator/readme-images/chrome-web-store.png" title="Chrome Web Store" width="170" height="48" />](https://chrome.google.com/webstore/detail/authenticator/bhghoamapcdpbohphigoooaddinpkbai) [<img src="https://raw.githubusercontent.com/wiki/Authenticator-Extension/Authenticator/readme-images/firefox-add-ons.png" title="Firefox Add-ons" width="170" height="48" />](https://addons.mozilla.org/en-US/firefox/addon/auth-helper?src=external-github) [<img src="https://raw.githubusercontent.com/wiki/Authenticator-Extension/Authenticator/readme-images/microsoft-store.png" title="Microsoft Store" height="48">](https://www.microsoft.com/store/apps/9P0FD39WFFMK?ocid=badge)
7+
[<img src="https://raw.githubusercontent.com/wiki/Authenticator-Extension/Authenticator/readme-images/chrome-web-store.png" title="Chrome Web Store" width="170" height="48" />](https://chrome.google.com/webstore/detail/authenticator/bhghoamapcdpbohphigoooaddinpkbai) [<img src="https://raw.githubusercontent.com/wiki/Authenticator-Extension/Authenticator/readme-images/firefox-add-ons.png" title="Firefox Add-ons" width="170" height="48" />](https://addons.mozilla.org/en-US/firefox/addon/auth-helper?src=external-github) [<img src="https://raw.githubusercontent.com/wiki/Authenticator-Extension/Authenticator/readme-images/microsoft-store.png" title="Microsoft Store" height="48">](https://microsoftedge.microsoft.com/addons/detail/ocglkepbibnalbgmbachknglpdipeoio)
88

99
## Build Setup
1010

_locales/da/messages.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extName": {
3-
"message": "Log ind",
3+
"message": "Autentificering",
44
"description": "Extension Name."
55
},
66
"extShortName": {
@@ -322,4 +322,4 @@
322322
"invalid": {
323323
"message": "Ugyldigt"
324324
}
325-
}
325+
}

manifest-chrome.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "__MSG_extName__",
44
"short_name": "__MSG_extShortName__",
5-
"version": "6.0.0",
5+
"version": "6.0.1",
66
"default_locale": "en",
77
"description": "__MSG_extDesc__",
88
"icons": {

manifest-firefox.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "__MSG_extName__",
44
"short_name": "__MSG_extShortName__",
5-
"version": "6.0.0",
5+
"version": "6.0.1",
66
"default_locale": "en",
77
"description": "__MSG_extDesc__",
88
"applications": {

package-lock.json

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Popup/SetPasswordPage.vue

+3
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ export default Vue.extend({
4444
},
4545
methods: {
4646
async removePassphrase() {
47+
this.$store.commit("currentView/changeView", "LoadingPage");
4748
await this.$store.dispatch("accounts/changePassphrase", "");
4849
this.$store.commit("notification/alert", this.i18n.updateSuccess);
50+
this.$store.commit("style/hideInfo");
4951
return;
5052
},
5153
async changePassphrase() {
@@ -58,6 +60,7 @@ export default Vue.extend({
5860
return;
5961
}
6062
63+
this.$store.commit("currentView/changeView", "LoadingPage");
6164
await this.$store.dispatch("accounts/changePassphrase", this.phrase);
6265
this.$store.commit("notification/alert", this.i18n.updateSuccess);
6366
this.$store.commit("style/hideInfo");

src/definitions/otp.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ interface IOTPEntry {
1313
update(): Promise<void>;
1414
next(): Promise<void>;
1515
applyEncryption(encryption: IEncryption): void;
16-
changeEncryption(encryption: IEncryption): Promise<void>;
16+
changeEncryption(encryption: IEncryption): void;
1717
delete(): Promise<void>;
1818
generate(): void;
19-
genUUID(): Promise<void>;
19+
genUUID(): void;
2020
}
2121

2222
interface IEncryption {

src/models/otp.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class OTPEntry implements IOTPEntry {
8484
return;
8585
}
8686

87-
async changeEncryption(encryption: Encryption) {
87+
changeEncryption(encryption: Encryption) {
8888
if (!this.secret) {
8989
return;
9090
}
@@ -94,8 +94,6 @@ export class OTPEntry implements IOTPEntry {
9494
} else {
9595
this.encSecret = null;
9696
}
97-
98-
await this.update();
9997
return;
10098
}
10199

@@ -130,10 +128,10 @@ export class OTPEntry implements IOTPEntry {
130128
return;
131129
}
132130

133-
async genUUID() {
134-
await this.delete();
131+
genUUID() {
132+
// await this.delete();
135133
this.hash = uuid();
136-
await this.create();
134+
// await this.create();
137135
}
138136

139137
generate() {

src/store/Accounts.ts

+38-10
Original file line numberDiff line numberDiff line change
@@ -233,18 +233,27 @@ export class Accounts implements IModule {
233233
return;
234234
}
235235

236-
// store key
237-
await BrowserStorage.set({
238-
key: { enc: encKey, hash: encKeyHash }
239-
});
240236
// change entry encryption to key and remove old hash
237+
let oldKeys: string[] = [];
241238
for (const entry of state.state.entries) {
242239
await entry.changeEncryption(
243240
new Encryption(wordArray.toString())
244241
);
245-
await entry.genUUID();
242+
oldKeys.push(entry.hash);
243+
entry.genUUID();
246244
}
247245

246+
// store key
247+
await BrowserStorage.set({
248+
key: { enc: encKey, hash: encKeyHash }
249+
});
250+
await EntryStorage.set(state.state.entries);
251+
await new Promise(resolve => {
252+
BrowserStorage.remove(oldKeys, () => {
253+
resolve();
254+
});
255+
});
256+
248257
state.state.encryption.updateEncryptionPassword(
249258
wordArray.toString()
250259
);
@@ -320,16 +329,34 @@ export class Accounts implements IModule {
320329
return;
321330
}
322331

323-
// store key
324-
await BrowserStorage.set({
325-
key: { enc: encKey, hash: encKeyHash }
326-
});
327332
// change entry encryption and regen hash
333+
let removeHashes: string[] = [];
328334
for (const entry of state.state.entries) {
329335
await entry.changeEncryption(
330336
new Encryption(wordArray.toString())
331337
);
332-
await entry.genUUID();
338+
// if not uuidv4 regen
339+
if (
340+
/[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}/i.test(
341+
entry.hash
342+
)
343+
) {
344+
removeHashes.push(entry.hash);
345+
entry.genUUID();
346+
}
347+
}
348+
349+
// store key
350+
await BrowserStorage.set({
351+
key: { enc: encKey, hash: encKeyHash }
352+
});
353+
await EntryStorage.set(state.state.entries);
354+
if (removeHashes.length) {
355+
await new Promise(resolve => {
356+
BrowserStorage.remove(removeHashes, () => {
357+
resolve();
358+
});
359+
});
333360
}
334361

335362
state.state.encryption.updateEncryptionPassword(
@@ -351,6 +378,7 @@ export class Accounts implements IModule {
351378
for (const entry of state.state.entries) {
352379
await entry.changeEncryption(new Encryption(""));
353380
}
381+
await EntryStorage.set(state.state.entries);
354382

355383
state.state.encryption.updateEncryptionPassword("");
356384

0 commit comments

Comments
 (0)