Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update shared utils in browser extension and mobile app (#896)

Leendert de Borst845f780707ab
diff --git a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts b/apps/browser-extension/src/entrypoints/contentScript/Popup.ts
index f1763e151..84ce0b835 100644
--- a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts
+++ b/apps/browser-extension/src/entrypoints/contentScript/Popup.ts
@@ -253,7 +253,7 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Creden
identityGenerator = new IdentityGeneratorEn();
break;
}
- const identity = await identityGenerator.generateRandomIdentity();
+ const identity = identityGenerator.generateRandomIdentity();
// Get password settings from background
const passwordSettingsResponse = await sendMessage('GET_PASSWORD_SETTINGS', {}, 'background') as PasswordSettingsResponse;
diff --git a/apps/browser-extension/src/utils/shared/identity-generator/index.d.ts b/apps/browser-extension/src/utils/shared/identity-generator/index.d.ts
index 26cc04a7d..f3d21e979 100644
--- a/apps/browser-extension/src/utils/shared/identity-generator/index.d.ts
+++ b/apps/browser-extension/src/utils/shared/identity-generator/index.d.ts
@@ -50,7 +50,7 @@ declare class UsernameEmailGenerator {
}
interface IIdentityGenerator {
- generateRandomIdentity(): Promise<Identity>;
+ generateRandomIdentity(): Identity;
}
/**
@@ -75,7 +75,7 @@ declare abstract class BaseIdentityGenerator implements IIdentityGenerator {
/**
* Generate a random identity.
*/
- generateRandomIdentity(): Promise<Identity>;
+ generateRandomIdentity(): Identity;
}
/**
@@ -132,4 +132,11 @@ declare class IdentityHelperUtils {
static isValidBirthDate(input: string | undefined): boolean;
}
-export { BaseIdentityGenerator, Gender, type Identity, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator };
+/**
+ * Creates a new identity generator based on the language.
+ * @param language - The language to use for generating the identity (e.g. "en", "nl").
+ * @returns A new identity generator instance.
+ */
+declare const createGenerator: (language: string) => IIdentityGenerator;
+
+export { BaseIdentityGenerator, Gender, type Identity, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator, createGenerator };
diff --git a/apps/browser-extension/src/utils/shared/identity-generator/index.js b/apps/browser-extension/src/utils/shared/identity-generator/index.js
index b2d9c662f..448eebed3 100644
--- a/apps/browser-extension/src/utils/shared/identity-generator/index.js
+++ b/apps/browser-extension/src/utils/shared/identity-generator/index.js
@@ -1,3 +1,6 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -25,7 +28,8 @@ __export(index_exports, {
IdentityGeneratorEn: () => IdentityGeneratorEn,
IdentityGeneratorNl: () => IdentityGeneratorNl,
IdentityHelperUtils: () => IdentityHelperUtils,
- UsernameEmailGenerator: () => UsernameEmailGenerator
+ UsernameEmailGenerator: () => UsernameEmailGenerator,
+ createGenerator: () => createGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -164,7 +168,7 @@ var BaseIdentityGenerator = class {
/**
* Generate a random identity.
*/
- async generateRandomIdentity() {
+ generateRandomIdentity() {
const identity = {
firstName: "",
lastName: "",
@@ -1712,6 +1716,17 @@ var IdentityHelperUtils = class {
return yearValid;
}
};
+
+// src/factories/IdentityGeneratorFactory.ts
+var createGenerator = (language) => {
+ switch (language) {
+ case "en":
+ return new IdentityGeneratorEn();
+ case "nl":
+ return new IdentityGeneratorNl();
+ }
+ throw new Error(`Unsupported language: ${language}`);
+};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BaseIdentityGenerator,
@@ -1719,6 +1734,7 @@ var IdentityHelperUtils = class {
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator
+ UsernameEmailGenerator,
+ createGenerator
});
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/browser-extension/src/utils/shared/identity-generator/index.mjs b/apps/browser-extension/src/utils/shared/identity-generator/index.mjs
index 6675da168..880296c87 100644
--- a/apps/browser-extension/src/utils/shared/identity-generator/index.mjs
+++ b/apps/browser-extension/src/utils/shared/identity-generator/index.mjs
@@ -1,3 +1,7 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
+
// src/utils/UsernameEmailGenerator.ts
var _UsernameEmailGenerator = class _UsernameEmailGenerator {
constructor() {
@@ -133,7 +137,7 @@ var BaseIdentityGenerator = class {
/**
* Generate a random identity.
*/
- async generateRandomIdentity() {
+ generateRandomIdentity() {
const identity = {
firstName: "",
lastName: "",
@@ -1681,12 +1685,24 @@ var IdentityHelperUtils = class {
return yearValid;
}
};
+
+// src/factories/IdentityGeneratorFactory.ts
+var createGenerator = (language) => {
+ switch (language) {
+ case "en":
+ return new IdentityGeneratorEn();
+ case "nl":
+ return new IdentityGeneratorNl();
+ }
+ throw new Error(`Unsupported language: ${language}`);
+};
export {
BaseIdentityGenerator,
Gender,
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator
+ UsernameEmailGenerator,
+ createGenerator
};
//# sourceMappingURL=index.mjs.map
\ No newline at end of file
diff --git a/apps/browser-extension/src/utils/shared/password-generator/index.d.ts b/apps/browser-extension/src/utils/shared/password-generator/index.d.ts
index 68297eed4..4af3336ce 100644
--- a/apps/browser-extension/src/utils/shared/password-generator/index.d.ts
+++ b/apps/browser-extension/src/utils/shared/password-generator/index.d.ts
@@ -110,4 +110,11 @@ declare class PasswordGenerator {
private addCharacterFromSet;
}
-export { PasswordGenerator, type PasswordSettings };
+/**
+ * Creates a new password generator.
+ * @param settings - The settings for the password generator.
+ * @returns A new password generator instance.
+ */
+declare const createPasswordGenerator: (settings: PasswordSettings) => PasswordGenerator;
+
+export { PasswordGenerator, type PasswordSettings, createPasswordGenerator };
diff --git a/apps/browser-extension/src/utils/shared/password-generator/index.js b/apps/browser-extension/src/utils/shared/password-generator/index.js
index d8b7448ce..121901030 100644
--- a/apps/browser-extension/src/utils/shared/password-generator/index.js
+++ b/apps/browser-extension/src/utils/shared/password-generator/index.js
@@ -1,3 +1,6 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,7 +23,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/index.ts
var index_exports = {};
__export(index_exports, {
- PasswordGenerator: () => PasswordGenerator
+ PasswordGenerator: () => PasswordGenerator,
+ createPasswordGenerator: () => createPasswordGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -230,8 +234,14 @@ var PasswordGenerator = class {
return password.substring(0, pos) + char + password.substring(pos + 1);
}
};
+
+// src/factories/PasswordGeneratorFactory.ts
+var createPasswordGenerator = (settings) => {
+ return new PasswordGenerator(settings);
+};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
- PasswordGenerator
+ PasswordGenerator,
+ createPasswordGenerator
});
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/browser-extension/src/utils/shared/password-generator/index.mjs b/apps/browser-extension/src/utils/shared/password-generator/index.mjs
index ddb5935f4..42fd90732 100644
--- a/apps/browser-extension/src/utils/shared/password-generator/index.mjs
+++ b/apps/browser-extension/src/utils/shared/password-generator/index.mjs
@@ -1,3 +1,7 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
+
// src/utils/PasswordGenerator.ts
var PasswordGenerator = class {
/**
@@ -204,7 +208,13 @@ var PasswordGenerator = class {
return password.substring(0, pos) + char + password.substring(pos + 1);
}
};
+
+// src/factories/PasswordGeneratorFactory.ts
+var createPasswordGenerator = (settings) => {
+ return new PasswordGenerator(settings);
+};
export {
- PasswordGenerator
+ PasswordGenerator,
+ createPasswordGenerator
};
//# sourceMappingURL=index.mjs.map
\ No newline at end of file
diff --git a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
index ec41b70f3..620be6a98 100644
--- a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
+++ b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
@@ -325,7 +325,7 @@ export default function AddEditCredentialScreen() : React.ReactNode {
const generateRandomUsername = async () : Promise<void> => {
try {
const { identityGenerator } = await initializeGenerators();
- const identity = await identityGenerator.generateRandomIdentity();
+ const identity = identityGenerator.generateRandomIdentity();
setValue('Username', identity.nickName);
} catch (error) {
console.error('Error generating random username:', error);
diff --git a/apps/mobile-app/utils/shared/identity-generator/index.d.ts b/apps/mobile-app/utils/shared/identity-generator/index.d.ts
index 26cc04a7d..f3d21e979 100644
--- a/apps/mobile-app/utils/shared/identity-generator/index.d.ts
+++ b/apps/mobile-app/utils/shared/identity-generator/index.d.ts
@@ -50,7 +50,7 @@ declare class UsernameEmailGenerator {
}
interface IIdentityGenerator {
- generateRandomIdentity(): Promise<Identity>;
+ generateRandomIdentity(): Identity;
}
/**
@@ -75,7 +75,7 @@ declare abstract class BaseIdentityGenerator implements IIdentityGenerator {
/**
* Generate a random identity.
*/
- generateRandomIdentity(): Promise<Identity>;
+ generateRandomIdentity(): Identity;
}
/**
@@ -132,4 +132,11 @@ declare class IdentityHelperUtils {
static isValidBirthDate(input: string | undefined): boolean;
}
-export { BaseIdentityGenerator, Gender, type Identity, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator };
+/**
+ * Creates a new identity generator based on the language.
+ * @param language - The language to use for generating the identity (e.g. "en", "nl").
+ * @returns A new identity generator instance.
+ */
+declare const createGenerator: (language: string) => IIdentityGenerator;
+
+export { BaseIdentityGenerator, Gender, type Identity, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator, createGenerator };
diff --git a/apps/mobile-app/utils/shared/identity-generator/index.js b/apps/mobile-app/utils/shared/identity-generator/index.js
index b2d9c662f..448eebed3 100644
--- a/apps/mobile-app/utils/shared/identity-generator/index.js
+++ b/apps/mobile-app/utils/shared/identity-generator/index.js
@@ -1,3 +1,6 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -25,7 +28,8 @@ __export(index_exports, {
IdentityGeneratorEn: () => IdentityGeneratorEn,
IdentityGeneratorNl: () => IdentityGeneratorNl,
IdentityHelperUtils: () => IdentityHelperUtils,
- UsernameEmailGenerator: () => UsernameEmailGenerator
+ UsernameEmailGenerator: () => UsernameEmailGenerator,
+ createGenerator: () => createGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -164,7 +168,7 @@ var BaseIdentityGenerator = class {
/**
* Generate a random identity.
*/
- async generateRandomIdentity() {
+ generateRandomIdentity() {
const identity = {
firstName: "",
lastName: "",
@@ -1712,6 +1716,17 @@ var IdentityHelperUtils = class {
return yearValid;
}
};
+
+// src/factories/IdentityGeneratorFactory.ts
+var createGenerator = (language) => {
+ switch (language) {
+ case "en":
+ return new IdentityGeneratorEn();
+ case "nl":
+ return new IdentityGeneratorNl();
+ }
+ throw new Error(`Unsupported language: ${language}`);
+};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BaseIdentityGenerator,
@@ -1719,6 +1734,7 @@ var IdentityHelperUtils = class {
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator
+ UsernameEmailGenerator,
+ createGenerator
});
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/mobile-app/utils/shared/identity-generator/index.mjs b/apps/mobile-app/utils/shared/identity-generator/index.mjs
index 6675da168..880296c87 100644
--- a/apps/mobile-app/utils/shared/identity-generator/index.mjs
+++ b/apps/mobile-app/utils/shared/identity-generator/index.mjs
@@ -1,3 +1,7 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
+
// src/utils/UsernameEmailGenerator.ts
var _UsernameEmailGenerator = class _UsernameEmailGenerator {
constructor() {
@@ -133,7 +137,7 @@ var BaseIdentityGenerator = class {
/**
* Generate a random identity.
*/
- async generateRandomIdentity() {
+ generateRandomIdentity() {
const identity = {
firstName: "",
lastName: "",
@@ -1681,12 +1685,24 @@ var IdentityHelperUtils = class {
return yearValid;
}
};
+
+// src/factories/IdentityGeneratorFactory.ts
+var createGenerator = (language) => {
+ switch (language) {
+ case "en":
+ return new IdentityGeneratorEn();
+ case "nl":
+ return new IdentityGeneratorNl();
+ }
+ throw new Error(`Unsupported language: ${language}`);
+};
export {
BaseIdentityGenerator,
Gender,
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator
+ UsernameEmailGenerator,
+ createGenerator
};
//# sourceMappingURL=index.mjs.map
\ No newline at end of file
diff --git a/apps/mobile-app/utils/shared/password-generator/index.d.ts b/apps/mobile-app/utils/shared/password-generator/index.d.ts
index 68297eed4..4af3336ce 100644
--- a/apps/mobile-app/utils/shared/password-generator/index.d.ts
+++ b/apps/mobile-app/utils/shared/password-generator/index.d.ts
@@ -110,4 +110,11 @@ declare class PasswordGenerator {
private addCharacterFromSet;
}
-export { PasswordGenerator, type PasswordSettings };
+/**
+ * Creates a new password generator.
+ * @param settings - The settings for the password generator.
+ * @returns A new password generator instance.
+ */
+declare const createPasswordGenerator: (settings: PasswordSettings) => PasswordGenerator;
+
+export { PasswordGenerator, type PasswordSettings, createPasswordGenerator };
diff --git a/apps/mobile-app/utils/shared/password-generator/index.js b/apps/mobile-app/utils/shared/password-generator/index.js
index d8b7448ce..121901030 100644
--- a/apps/mobile-app/utils/shared/password-generator/index.js
+++ b/apps/mobile-app/utils/shared/password-generator/index.js
@@ -1,3 +1,6 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,7 +23,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/index.ts
var index_exports = {};
__export(index_exports, {
- PasswordGenerator: () => PasswordGenerator
+ PasswordGenerator: () => PasswordGenerator,
+ createPasswordGenerator: () => createPasswordGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -230,8 +234,14 @@ var PasswordGenerator = class {
return password.substring(0, pos) + char + password.substring(pos + 1);
}
};
+
+// src/factories/PasswordGeneratorFactory.ts
+var createPasswordGenerator = (settings) => {
+ return new PasswordGenerator(settings);
+};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
- PasswordGenerator
+ PasswordGenerator,
+ createPasswordGenerator
});
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/mobile-app/utils/shared/password-generator/index.mjs b/apps/mobile-app/utils/shared/password-generator/index.mjs
index ddb5935f4..42fd90732 100644
--- a/apps/mobile-app/utils/shared/password-generator/index.mjs
+++ b/apps/mobile-app/utils/shared/password-generator/index.mjs
@@ -1,3 +1,7 @@
+// <auto-generated>
+// This file was automatically generated. Do not edit manually.
+
+
// src/utils/PasswordGenerator.ts
var PasswordGenerator = class {
/**
@@ -204,7 +208,13 @@ var PasswordGenerator = class {
return password.substring(0, pos) + char + password.substring(pos + 1);
}
};
+
+// src/factories/PasswordGeneratorFactory.ts
+var createPasswordGenerator = (settings) => {
+ return new PasswordGenerator(settings);
+};
export {
- PasswordGenerator
+ PasswordGenerator,
+ createPasswordGenerator
};
//# sourceMappingURL=index.mjs.map
\ No newline at end of file