Skip to content

Commit

Permalink
Merge pull request #430 from Authenticator-Extension/dev
Browse files Browse the repository at this point in the history
6.0.1
  • Loading branch information
mymindstorm authored Feb 3, 2020
2 parents 0eeaef4 + 229aa24 commit a76f59d
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Available for Chrome, Firefox, and Microsoft Edge

[<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)
[<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)

## Build Setup

Expand Down
4 changes: 2 additions & 2 deletions _locales/da/messages.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extName": {
"message": "Log ind",
"message": "Autentificering",
"description": "Extension Name."
},
"extShortName": {
Expand Down Expand Up @@ -322,4 +322,4 @@
"invalid": {
"message": "Ugyldigt"
}
}
}
2 changes: 1 addition & 1 deletion manifest-chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "__MSG_extName__",
"short_name": "__MSG_extShortName__",
"version": "6.0.0",
"version": "6.0.1",
"default_locale": "en",
"description": "__MSG_extDesc__",
"icons": {
Expand Down
2 changes: 1 addition & 1 deletion manifest-firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "__MSG_extName__",
"short_name": "__MSG_extShortName__",
"version": "6.0.0",
"version": "6.0.1",
"default_locale": "en",
"description": "__MSG_extDesc__",
"applications": {
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/components/Popup/SetPasswordPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export default Vue.extend({
},
methods: {
async removePassphrase() {
this.$store.commit("currentView/changeView", "LoadingPage");
await this.$store.dispatch("accounts/changePassphrase", "");
this.$store.commit("notification/alert", this.i18n.updateSuccess);
this.$store.commit("style/hideInfo");
return;
},
async changePassphrase() {
Expand All @@ -58,6 +60,7 @@ export default Vue.extend({
return;
}
this.$store.commit("currentView/changeView", "LoadingPage");
await this.$store.dispatch("accounts/changePassphrase", this.phrase);
this.$store.commit("notification/alert", this.i18n.updateSuccess);
this.$store.commit("style/hideInfo");
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/otp.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ interface IOTPEntry {
update(): Promise<void>;
next(): Promise<void>;
applyEncryption(encryption: IEncryption): void;
changeEncryption(encryption: IEncryption): Promise<void>;
changeEncryption(encryption: IEncryption): void;
delete(): Promise<void>;
generate(): void;
genUUID(): Promise<void>;
genUUID(): void;
}

interface IEncryption {
Expand Down
10 changes: 4 additions & 6 deletions src/models/otp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class OTPEntry implements IOTPEntry {
return;
}

async changeEncryption(encryption: Encryption) {
changeEncryption(encryption: Encryption) {
if (!this.secret) {
return;
}
Expand All @@ -94,8 +94,6 @@ export class OTPEntry implements IOTPEntry {
} else {
this.encSecret = null;
}

await this.update();
return;
}

Expand Down Expand Up @@ -130,10 +128,10 @@ export class OTPEntry implements IOTPEntry {
return;
}

async genUUID() {
await this.delete();
genUUID() {
// await this.delete();
this.hash = uuid();
await this.create();
// await this.create();
}

generate() {
Expand Down
48 changes: 38 additions & 10 deletions src/store/Accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,27 @@ export class Accounts implements IModule {
return;
}

// store key
await BrowserStorage.set({
key: { enc: encKey, hash: encKeyHash }
});
// change entry encryption to key and remove old hash
let oldKeys: string[] = [];
for (const entry of state.state.entries) {
await entry.changeEncryption(
new Encryption(wordArray.toString())
);
await entry.genUUID();
oldKeys.push(entry.hash);
entry.genUUID();
}

// store key
await BrowserStorage.set({
key: { enc: encKey, hash: encKeyHash }
});
await EntryStorage.set(state.state.entries);
await new Promise(resolve => {
BrowserStorage.remove(oldKeys, () => {
resolve();
});
});

state.state.encryption.updateEncryptionPassword(
wordArray.toString()
);
Expand Down Expand Up @@ -320,16 +329,34 @@ export class Accounts implements IModule {
return;
}

// store key
await BrowserStorage.set({
key: { enc: encKey, hash: encKeyHash }
});
// change entry encryption and regen hash
let removeHashes: string[] = [];
for (const entry of state.state.entries) {
await entry.changeEncryption(
new Encryption(wordArray.toString())
);
await entry.genUUID();
// if not uuidv4 regen
if (
/[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}/i.test(
entry.hash
)
) {
removeHashes.push(entry.hash);
entry.genUUID();
}
}

// store key
await BrowserStorage.set({
key: { enc: encKey, hash: encKeyHash }
});
await EntryStorage.set(state.state.entries);
if (removeHashes.length) {
await new Promise(resolve => {
BrowserStorage.remove(removeHashes, () => {
resolve();
});
});
}

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

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

Expand Down

0 comments on commit a76f59d

Please sign in to comment.