Skip to content

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

Refactor to use new factory methods for identity and password generators (#896)

Leendert de Borst4c7bef2a5ae7
diff --git a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts b/apps/browser-extension/src/entrypoints/contentScript/Popup.ts
index 84ce0b835..2d00f0976 100644
--- a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts
+++ b/apps/browser-extension/src/entrypoints/contentScript/Popup.ts
@@ -2,12 +2,11 @@ import { storage } from '#imports';
import { sendMessage } from 'webext-bridge/content-script';
import { fillCredential } from '@/entrypoints/contentScript/Form';
import { filterCredentials } from '@/entrypoints/contentScript/Filter';
-import { IdentityGeneratorEn, IdentityGeneratorNl } from '@/utils/shared/identity-generator';
-import { PasswordGenerator } from '@/utils/shared/password-generator';
+import { CreateIdentityGenerator } from '@/utils/shared/identity-generator';
+import { CreatePasswordGenerator, PasswordGenerator } from '@/utils/shared/password-generator';
import { CredentialsResponse } from '@/utils/types/messaging/CredentialsResponse';
import { PasswordSettingsResponse } from '@/utils/types/messaging/PasswordSettingsResponse';
import { SqliteClient } from '@/utils/SqliteClient';
-import { BaseIdentityGenerator } from '@/utils/shared/identity-generator';
import { StringResponse } from '@/utils/types/messaging/StringResponse';
import { FormDetector } from '@/utils/formDetector/FormDetector';
import { Credential } from '@/utils/types/Credential';
@@ -243,23 +242,21 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Creden
} else {
// Generate new random identity using identity generator.
const identityLanguage = await sendMessage('GET_DEFAULT_IDENTITY_LANGUAGE', {}, 'background') as StringResponse;
- let identityGenerator: BaseIdentityGenerator;
- switch (identityLanguage.value) {
- case 'nl':
- identityGenerator = new IdentityGeneratorNl();
- break;
- case 'en':
- default:
- identityGenerator = new IdentityGeneratorEn();
- break;
- }
+ const identityGenerator = CreateIdentityGenerator(identityLanguage.value ?? 'en');
const identity = identityGenerator.generateRandomIdentity();
// Get password settings from background
const passwordSettingsResponse = await sendMessage('GET_PASSWORD_SETTINGS', {}, 'background') as PasswordSettingsResponse;
// Initialize password generator with the retrieved settings
- const passwordGenerator = new PasswordGenerator(passwordSettingsResponse.settings);
+ const passwordGenerator = CreatePasswordGenerator(passwordSettingsResponse.settings ?? {
+ Length: 12,
+ UseLowercase: true,
+ UseUppercase: true,
+ UseNumbers: true,
+ UseSpecialChars: true,
+ UseNonAmbiguousChars: true
+ });
const password = passwordGenerator.generateRandomPassword();
// Extract favicon from page and get the bytes
@@ -946,6 +943,22 @@ export async function createAliasCreationPopup(suggestedNames: string[], rootCon
}
});
+ // Get password settings from background
+ let passwordGenerator: PasswordGenerator;
+ sendMessage('GET_PASSWORD_SETTINGS', {}, 'background').then((response) => {
+ const passwordSettingsResponse = response as PasswordSettingsResponse;
+ passwordGenerator = CreatePasswordGenerator(passwordSettingsResponse.settings ?? {
+ Length: 12,
+ UseLowercase: true,
+ UseUppercase: true,
+ UseNumbers: true,
+ UseSpecialChars: true,
+ UseNonAmbiguousChars: true
+ });
+ // Generate initial password after settings are loaded
+ passwordGenerator.generateRandomPassword();
+ });
+
/**
* Generate and set password.
*/
@@ -960,15 +973,6 @@ export async function createAliasCreationPopup(suggestedNames: string[], rootCon
updateVisibilityIcon(true);
};
- // Get password settings from background
- let passwordGenerator: PasswordGenerator;
- sendMessage('GET_PASSWORD_SETTINGS', {}, 'background').then((response) => {
- const passwordSettingsResponse = response as PasswordSettingsResponse;
- passwordGenerator = new PasswordGenerator(passwordSettingsResponse.settings);
- // Generate initial password after settings are loaded
- generatePassword();
- });
-
// Handle regenerate button click
regenerateBtn.addEventListener('click', generatePassword);
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 f3d21e979..88de04a9d 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
@@ -56,7 +56,7 @@ interface IIdentityGenerator {
/**
* Base identity generator.
*/
-declare abstract class BaseIdentityGenerator implements IIdentityGenerator {
+declare abstract class IdentityGenerator implements IIdentityGenerator {
protected firstNamesMale: string[];
protected firstNamesFemale: string[];
protected lastNames: string[];
@@ -81,7 +81,7 @@ declare abstract class BaseIdentityGenerator implements IIdentityGenerator {
/**
* Identity generator for English language using English word dictionaries.
*/
-declare class IdentityGeneratorEn extends BaseIdentityGenerator {
+declare class IdentityGeneratorEn extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -99,7 +99,7 @@ declare class IdentityGeneratorEn extends BaseIdentityGenerator {
/**
* Identity generator for Dutch language using Dutch word dictionaries.
*/
-declare class IdentityGeneratorNl extends BaseIdentityGenerator {
+declare class IdentityGeneratorNl extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -137,6 +137,6 @@ declare class IdentityHelperUtils {
* @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;
+declare const CreateIdentityGenerator: (language: string) => IIdentityGenerator;
-export { BaseIdentityGenerator, Gender, type Identity, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator, createGenerator };
+export { CreateIdentityGenerator, Gender, type Identity, IdentityGenerator, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator };
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 448eebed3..a67df55d1 100644
--- a/apps/browser-extension/src/utils/shared/identity-generator/index.js
+++ b/apps/browser-extension/src/utils/shared/identity-generator/index.js
@@ -23,13 +23,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/index.ts
var index_exports = {};
__export(index_exports, {
- BaseIdentityGenerator: () => BaseIdentityGenerator,
+ CreateIdentityGenerator: () => CreateIdentityGenerator,
Gender: () => Gender,
+ IdentityGenerator: () => IdentityGenerator,
IdentityGeneratorEn: () => IdentityGeneratorEn,
IdentityGeneratorNl: () => IdentityGeneratorNl,
IdentityHelperUtils: () => IdentityHelperUtils,
- UsernameEmailGenerator: () => UsernameEmailGenerator,
- createGenerator: () => createGenerator
+ UsernameEmailGenerator: () => UsernameEmailGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -139,8 +139,8 @@ var Gender = /* @__PURE__ */ ((Gender2) => {
return Gender2;
})(Gender || {});
-// src/implementations/base/BaseIdentityGenerator.ts
-var BaseIdentityGenerator = class {
+// src/implementations/base/IdentityGenerator.ts
+var IdentityGenerator = class {
/**
* Constructor.
*/
@@ -983,7 +983,7 @@ var lastnames_default = [
];
// src/implementations/IdentityGeneratorEn.ts
-var IdentityGeneratorEn = class extends BaseIdentityGenerator {
+var IdentityGeneratorEn = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1647,7 +1647,7 @@ var lastnames_default2 = [
];
// src/implementations/IdentityGeneratorNl.ts
-var IdentityGeneratorNl = class extends BaseIdentityGenerator {
+var IdentityGeneratorNl = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1718,7 +1718,7 @@ var IdentityHelperUtils = class {
};
// src/factories/IdentityGeneratorFactory.ts
-var createGenerator = (language) => {
+var CreateIdentityGenerator = (language) => {
switch (language) {
case "en":
return new IdentityGeneratorEn();
@@ -1729,12 +1729,12 @@ var createGenerator = (language) => {
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
- BaseIdentityGenerator,
+ CreateIdentityGenerator,
Gender,
+ IdentityGenerator,
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator,
- createGenerator
+ UsernameEmailGenerator
});
//# 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 880296c87..b77d669f6 100644
--- a/apps/browser-extension/src/utils/shared/identity-generator/index.mjs
+++ b/apps/browser-extension/src/utils/shared/identity-generator/index.mjs
@@ -108,8 +108,8 @@ var Gender = /* @__PURE__ */ ((Gender2) => {
return Gender2;
})(Gender || {});
-// src/implementations/base/BaseIdentityGenerator.ts
-var BaseIdentityGenerator = class {
+// src/implementations/base/IdentityGenerator.ts
+var IdentityGenerator = class {
/**
* Constructor.
*/
@@ -952,7 +952,7 @@ var lastnames_default = [
];
// src/implementations/IdentityGeneratorEn.ts
-var IdentityGeneratorEn = class extends BaseIdentityGenerator {
+var IdentityGeneratorEn = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1616,7 +1616,7 @@ var lastnames_default2 = [
];
// src/implementations/IdentityGeneratorNl.ts
-var IdentityGeneratorNl = class extends BaseIdentityGenerator {
+var IdentityGeneratorNl = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1687,7 +1687,7 @@ var IdentityHelperUtils = class {
};
// src/factories/IdentityGeneratorFactory.ts
-var createGenerator = (language) => {
+var CreateIdentityGenerator = (language) => {
switch (language) {
case "en":
return new IdentityGeneratorEn();
@@ -1697,12 +1697,12 @@ var createGenerator = (language) => {
throw new Error(`Unsupported language: ${language}`);
};
export {
- BaseIdentityGenerator,
+ CreateIdentityGenerator,
Gender,
+ IdentityGenerator,
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator,
- createGenerator
+ UsernameEmailGenerator
};
//# 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 4af3336ce..723e4f172 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
@@ -115,6 +115,6 @@ declare class PasswordGenerator {
* @param settings - The settings for the password generator.
* @returns A new password generator instance.
*/
-declare const createPasswordGenerator: (settings: PasswordSettings) => PasswordGenerator;
+declare const CreatePasswordGenerator: (settings: PasswordSettings) => PasswordGenerator;
-export { PasswordGenerator, type PasswordSettings, createPasswordGenerator };
+export { CreatePasswordGenerator, PasswordGenerator, type PasswordSettings };
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 121901030..6e52660a9 100644
--- a/apps/browser-extension/src/utils/shared/password-generator/index.js
+++ b/apps/browser-extension/src/utils/shared/password-generator/index.js
@@ -23,8 +23,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/index.ts
var index_exports = {};
__export(index_exports, {
- PasswordGenerator: () => PasswordGenerator,
- createPasswordGenerator: () => createPasswordGenerator
+ CreatePasswordGenerator: () => CreatePasswordGenerator,
+ PasswordGenerator: () => PasswordGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -236,12 +236,12 @@ var PasswordGenerator = class {
};
// src/factories/PasswordGeneratorFactory.ts
-var createPasswordGenerator = (settings) => {
+var CreatePasswordGenerator = (settings) => {
return new PasswordGenerator(settings);
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
- PasswordGenerator,
- createPasswordGenerator
+ CreatePasswordGenerator,
+ PasswordGenerator
});
//# 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 42fd90732..225109cce 100644
--- a/apps/browser-extension/src/utils/shared/password-generator/index.mjs
+++ b/apps/browser-extension/src/utils/shared/password-generator/index.mjs
@@ -210,11 +210,11 @@ var PasswordGenerator = class {
};
// src/factories/PasswordGeneratorFactory.ts
-var createPasswordGenerator = (settings) => {
+var CreatePasswordGenerator = (settings) => {
return new PasswordGenerator(settings);
};
export {
- PasswordGenerator,
- createPasswordGenerator
+ CreatePasswordGenerator,
+ PasswordGenerator
};
//# 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 620be6a98..69f992c0b 100644
--- a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
+++ b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx
@@ -17,8 +17,8 @@ import emitter from '@/utils/EventEmitter';
import { FaviconExtractModel } from '@/utils/types/webapi/FaviconExtractModel';
import { AliasVaultToast } from '@/components/Toast';
import { useVaultMutate } from '@/hooks/useVaultMutate';
-import { IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, BaseIdentityGenerator } from '@/utils/shared/identity-generator';
-import { PasswordGenerator } from '@/utils/shared/password-generator';
+import { CreateIdentityGenerator, IdentityHelperUtils, IIdentityGenerator } from '@/utils/shared/identity-generator';
+import { CreatePasswordGenerator, PasswordGenerator } from '@/utils/shared/password-generator';
import { ValidatedFormField, ValidatedFormFieldRef } from '@/components/form/ValidatedFormField';
import { credentialSchema } from '@/utils/ValidationSchema';
import LoadingOverlay from '@/components/LoadingOverlay';
@@ -133,29 +133,18 @@ export default function AddEditCredentialScreen() : React.ReactNode {
/**
* Initialize the identity and password generators with settings from user's vault.
- * @returns {identityGenerator: BaseIdentityGenerator, passwordGenerator: PasswordGenerator}
+ * @returns {identityGenerator: IIdentityGenerator, passwordGenerator: PasswordGenerator}
*/
- const initializeGenerators = useCallback(async () : Promise<{ identityGenerator: BaseIdentityGenerator, passwordGenerator: PasswordGenerator }> => {
+ const initializeGenerators = useCallback(async () : Promise<{ identityGenerator: IIdentityGenerator, passwordGenerator: PasswordGenerator }> => {
// Get default identity language from database
const identityLanguage = await dbContext.sqliteClient!.getDefaultIdentityLanguage();
// Initialize identity generator based on language
- let identityGenerator: BaseIdentityGenerator;
- switch (identityLanguage) {
- case 'nl':
- identityGenerator = new IdentityGeneratorNl();
- break;
- case 'en':
- default:
- identityGenerator = new IdentityGeneratorEn();
- break;
- }
+ const identityGenerator = CreateIdentityGenerator(identityLanguage);
- // Get password settings from database
+ // Initialize password generator with settings from vault
const passwordSettings = await dbContext.sqliteClient!.getPasswordSettings();
-
- // Initialize password generator with settings
- const passwordGenerator = new PasswordGenerator(passwordSettings);
+ const passwordGenerator = CreatePasswordGenerator(passwordSettings);
return { identityGenerator, passwordGenerator };
}, [dbContext.sqliteClient]);
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 f3d21e979..88de04a9d 100644
--- a/apps/mobile-app/utils/shared/identity-generator/index.d.ts
+++ b/apps/mobile-app/utils/shared/identity-generator/index.d.ts
@@ -56,7 +56,7 @@ interface IIdentityGenerator {
/**
* Base identity generator.
*/
-declare abstract class BaseIdentityGenerator implements IIdentityGenerator {
+declare abstract class IdentityGenerator implements IIdentityGenerator {
protected firstNamesMale: string[];
protected firstNamesFemale: string[];
protected lastNames: string[];
@@ -81,7 +81,7 @@ declare abstract class BaseIdentityGenerator implements IIdentityGenerator {
/**
* Identity generator for English language using English word dictionaries.
*/
-declare class IdentityGeneratorEn extends BaseIdentityGenerator {
+declare class IdentityGeneratorEn extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -99,7 +99,7 @@ declare class IdentityGeneratorEn extends BaseIdentityGenerator {
/**
* Identity generator for Dutch language using Dutch word dictionaries.
*/
-declare class IdentityGeneratorNl extends BaseIdentityGenerator {
+declare class IdentityGeneratorNl extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -137,6 +137,6 @@ declare class IdentityHelperUtils {
* @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;
+declare const CreateIdentityGenerator: (language: string) => IIdentityGenerator;
-export { BaseIdentityGenerator, Gender, type Identity, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator, createGenerator };
+export { CreateIdentityGenerator, Gender, type Identity, IdentityGenerator, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator };
diff --git a/apps/mobile-app/utils/shared/identity-generator/index.js b/apps/mobile-app/utils/shared/identity-generator/index.js
index 448eebed3..a67df55d1 100644
--- a/apps/mobile-app/utils/shared/identity-generator/index.js
+++ b/apps/mobile-app/utils/shared/identity-generator/index.js
@@ -23,13 +23,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/index.ts
var index_exports = {};
__export(index_exports, {
- BaseIdentityGenerator: () => BaseIdentityGenerator,
+ CreateIdentityGenerator: () => CreateIdentityGenerator,
Gender: () => Gender,
+ IdentityGenerator: () => IdentityGenerator,
IdentityGeneratorEn: () => IdentityGeneratorEn,
IdentityGeneratorNl: () => IdentityGeneratorNl,
IdentityHelperUtils: () => IdentityHelperUtils,
- UsernameEmailGenerator: () => UsernameEmailGenerator,
- createGenerator: () => createGenerator
+ UsernameEmailGenerator: () => UsernameEmailGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -139,8 +139,8 @@ var Gender = /* @__PURE__ */ ((Gender2) => {
return Gender2;
})(Gender || {});
-// src/implementations/base/BaseIdentityGenerator.ts
-var BaseIdentityGenerator = class {
+// src/implementations/base/IdentityGenerator.ts
+var IdentityGenerator = class {
/**
* Constructor.
*/
@@ -983,7 +983,7 @@ var lastnames_default = [
];
// src/implementations/IdentityGeneratorEn.ts
-var IdentityGeneratorEn = class extends BaseIdentityGenerator {
+var IdentityGeneratorEn = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1647,7 +1647,7 @@ var lastnames_default2 = [
];
// src/implementations/IdentityGeneratorNl.ts
-var IdentityGeneratorNl = class extends BaseIdentityGenerator {
+var IdentityGeneratorNl = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1718,7 +1718,7 @@ var IdentityHelperUtils = class {
};
// src/factories/IdentityGeneratorFactory.ts
-var createGenerator = (language) => {
+var CreateIdentityGenerator = (language) => {
switch (language) {
case "en":
return new IdentityGeneratorEn();
@@ -1729,12 +1729,12 @@ var createGenerator = (language) => {
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
- BaseIdentityGenerator,
+ CreateIdentityGenerator,
Gender,
+ IdentityGenerator,
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator,
- createGenerator
+ UsernameEmailGenerator
});
//# 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 880296c87..b77d669f6 100644
--- a/apps/mobile-app/utils/shared/identity-generator/index.mjs
+++ b/apps/mobile-app/utils/shared/identity-generator/index.mjs
@@ -108,8 +108,8 @@ var Gender = /* @__PURE__ */ ((Gender2) => {
return Gender2;
})(Gender || {});
-// src/implementations/base/BaseIdentityGenerator.ts
-var BaseIdentityGenerator = class {
+// src/implementations/base/IdentityGenerator.ts
+var IdentityGenerator = class {
/**
* Constructor.
*/
@@ -952,7 +952,7 @@ var lastnames_default = [
];
// src/implementations/IdentityGeneratorEn.ts
-var IdentityGeneratorEn = class extends BaseIdentityGenerator {
+var IdentityGeneratorEn = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1616,7 +1616,7 @@ var lastnames_default2 = [
];
// src/implementations/IdentityGeneratorNl.ts
-var IdentityGeneratorNl = class extends BaseIdentityGenerator {
+var IdentityGeneratorNl = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1687,7 +1687,7 @@ var IdentityHelperUtils = class {
};
// src/factories/IdentityGeneratorFactory.ts
-var createGenerator = (language) => {
+var CreateIdentityGenerator = (language) => {
switch (language) {
case "en":
return new IdentityGeneratorEn();
@@ -1697,12 +1697,12 @@ var createGenerator = (language) => {
throw new Error(`Unsupported language: ${language}`);
};
export {
- BaseIdentityGenerator,
+ CreateIdentityGenerator,
Gender,
+ IdentityGenerator,
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator,
- createGenerator
+ UsernameEmailGenerator
};
//# 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 4af3336ce..723e4f172 100644
--- a/apps/mobile-app/utils/shared/password-generator/index.d.ts
+++ b/apps/mobile-app/utils/shared/password-generator/index.d.ts
@@ -115,6 +115,6 @@ declare class PasswordGenerator {
* @param settings - The settings for the password generator.
* @returns A new password generator instance.
*/
-declare const createPasswordGenerator: (settings: PasswordSettings) => PasswordGenerator;
+declare const CreatePasswordGenerator: (settings: PasswordSettings) => PasswordGenerator;
-export { PasswordGenerator, type PasswordSettings, createPasswordGenerator };
+export { CreatePasswordGenerator, PasswordGenerator, type PasswordSettings };
diff --git a/apps/mobile-app/utils/shared/password-generator/index.js b/apps/mobile-app/utils/shared/password-generator/index.js
index 121901030..6e52660a9 100644
--- a/apps/mobile-app/utils/shared/password-generator/index.js
+++ b/apps/mobile-app/utils/shared/password-generator/index.js
@@ -23,8 +23,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/index.ts
var index_exports = {};
__export(index_exports, {
- PasswordGenerator: () => PasswordGenerator,
- createPasswordGenerator: () => createPasswordGenerator
+ CreatePasswordGenerator: () => CreatePasswordGenerator,
+ PasswordGenerator: () => PasswordGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -236,12 +236,12 @@ var PasswordGenerator = class {
};
// src/factories/PasswordGeneratorFactory.ts
-var createPasswordGenerator = (settings) => {
+var CreatePasswordGenerator = (settings) => {
return new PasswordGenerator(settings);
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
- PasswordGenerator,
- createPasswordGenerator
+ CreatePasswordGenerator,
+ PasswordGenerator
});
//# 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 42fd90732..225109cce 100644
--- a/apps/mobile-app/utils/shared/password-generator/index.mjs
+++ b/apps/mobile-app/utils/shared/password-generator/index.mjs
@@ -210,11 +210,11 @@ var PasswordGenerator = class {
};
// src/factories/PasswordGeneratorFactory.ts
-var createPasswordGenerator = (settings) => {
+var CreatePasswordGenerator = (settings) => {
return new PasswordGenerator(settings);
};
export {
- PasswordGenerator,
- createPasswordGenerator
+ CreatePasswordGenerator,
+ PasswordGenerator
};
//# sourceMappingURL=index.mjs.map
\ No newline at end of file
diff --git a/apps/server/AliasVault.Client/Services/JsInteropService.cs b/apps/server/AliasVault.Client/Services/JsInteropService.cs
index bc84d9082..b8ca541c2 100644
--- a/apps/server/AliasVault.Client/Services/JsInteropService.cs
+++ b/apps/server/AliasVault.Client/Services/JsInteropService.cs
@@ -305,7 +305,7 @@ public sealed class JsInteropService(IJSRuntime jsRuntime)
}
}
- var generatorInstance = await _identityGeneratorModule.InvokeAsync<IJSObjectReference>("createGenerator", language);
+ var generatorInstance = await _identityGeneratorModule.InvokeAsync<IJSObjectReference>("CreateIdentityGenerator", language);
var result = await generatorInstance.InvokeAsync<IdentityGeneratorResult>("generateRandomIdentity");
return result;
@@ -335,7 +335,7 @@ public sealed class JsInteropService(IJSRuntime jsRuntime)
}
}
- var generatorInstance = await _passwordGeneratorModule.InvokeAsync<IJSObjectReference>("createPasswordGenerator", settings);
+ var generatorInstance = await _passwordGeneratorModule.InvokeAsync<IJSObjectReference>("CreatePasswordGenerator", settings);
var result = await generatorInstance.InvokeAsync<string>("generateRandomPassword");
diff --git a/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.d.ts b/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.d.ts
index f3d21e979..88de04a9d 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.d.ts
+++ b/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.d.ts
@@ -56,7 +56,7 @@ interface IIdentityGenerator {
/**
* Base identity generator.
*/
-declare abstract class BaseIdentityGenerator implements IIdentityGenerator {
+declare abstract class IdentityGenerator implements IIdentityGenerator {
protected firstNamesMale: string[];
protected firstNamesFemale: string[];
protected lastNames: string[];
@@ -81,7 +81,7 @@ declare abstract class BaseIdentityGenerator implements IIdentityGenerator {
/**
* Identity generator for English language using English word dictionaries.
*/
-declare class IdentityGeneratorEn extends BaseIdentityGenerator {
+declare class IdentityGeneratorEn extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -99,7 +99,7 @@ declare class IdentityGeneratorEn extends BaseIdentityGenerator {
/**
* Identity generator for Dutch language using Dutch word dictionaries.
*/
-declare class IdentityGeneratorNl extends BaseIdentityGenerator {
+declare class IdentityGeneratorNl extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -137,6 +137,6 @@ declare class IdentityHelperUtils {
* @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;
+declare const CreateIdentityGenerator: (language: string) => IIdentityGenerator;
-export { BaseIdentityGenerator, Gender, type Identity, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator, createGenerator };
+export { CreateIdentityGenerator, Gender, type Identity, IdentityGenerator, IdentityGeneratorEn, IdentityGeneratorNl, IdentityHelperUtils, UsernameEmailGenerator };
diff --git a/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.js b/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.js
index 448eebed3..a67df55d1 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.js
+++ b/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.js
@@ -23,13 +23,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/index.ts
var index_exports = {};
__export(index_exports, {
- BaseIdentityGenerator: () => BaseIdentityGenerator,
+ CreateIdentityGenerator: () => CreateIdentityGenerator,
Gender: () => Gender,
+ IdentityGenerator: () => IdentityGenerator,
IdentityGeneratorEn: () => IdentityGeneratorEn,
IdentityGeneratorNl: () => IdentityGeneratorNl,
IdentityHelperUtils: () => IdentityHelperUtils,
- UsernameEmailGenerator: () => UsernameEmailGenerator,
- createGenerator: () => createGenerator
+ UsernameEmailGenerator: () => UsernameEmailGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -139,8 +139,8 @@ var Gender = /* @__PURE__ */ ((Gender2) => {
return Gender2;
})(Gender || {});
-// src/implementations/base/BaseIdentityGenerator.ts
-var BaseIdentityGenerator = class {
+// src/implementations/base/IdentityGenerator.ts
+var IdentityGenerator = class {
/**
* Constructor.
*/
@@ -983,7 +983,7 @@ var lastnames_default = [
];
// src/implementations/IdentityGeneratorEn.ts
-var IdentityGeneratorEn = class extends BaseIdentityGenerator {
+var IdentityGeneratorEn = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1647,7 +1647,7 @@ var lastnames_default2 = [
];
// src/implementations/IdentityGeneratorNl.ts
-var IdentityGeneratorNl = class extends BaseIdentityGenerator {
+var IdentityGeneratorNl = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1718,7 +1718,7 @@ var IdentityHelperUtils = class {
};
// src/factories/IdentityGeneratorFactory.ts
-var createGenerator = (language) => {
+var CreateIdentityGenerator = (language) => {
switch (language) {
case "en":
return new IdentityGeneratorEn();
@@ -1729,12 +1729,12 @@ var createGenerator = (language) => {
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
- BaseIdentityGenerator,
+ CreateIdentityGenerator,
Gender,
+ IdentityGenerator,
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator,
- createGenerator
+ UsernameEmailGenerator
});
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.mjs b/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.mjs
index 880296c87..b77d669f6 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.mjs
+++ b/apps/server/AliasVault.Client/wwwroot/js/shared/identity-generator/index.mjs
@@ -108,8 +108,8 @@ var Gender = /* @__PURE__ */ ((Gender2) => {
return Gender2;
})(Gender || {});
-// src/implementations/base/BaseIdentityGenerator.ts
-var BaseIdentityGenerator = class {
+// src/implementations/base/IdentityGenerator.ts
+var IdentityGenerator = class {
/**
* Constructor.
*/
@@ -952,7 +952,7 @@ var lastnames_default = [
];
// src/implementations/IdentityGeneratorEn.ts
-var IdentityGeneratorEn = class extends BaseIdentityGenerator {
+var IdentityGeneratorEn = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1616,7 +1616,7 @@ var lastnames_default2 = [
];
// src/implementations/IdentityGeneratorNl.ts
-var IdentityGeneratorNl = class extends BaseIdentityGenerator {
+var IdentityGeneratorNl = class extends IdentityGenerator {
/**
* Get the male first names.
*/
@@ -1687,7 +1687,7 @@ var IdentityHelperUtils = class {
};
// src/factories/IdentityGeneratorFactory.ts
-var createGenerator = (language) => {
+var CreateIdentityGenerator = (language) => {
switch (language) {
case "en":
return new IdentityGeneratorEn();
@@ -1697,12 +1697,12 @@ var createGenerator = (language) => {
throw new Error(`Unsupported language: ${language}`);
};
export {
- BaseIdentityGenerator,
+ CreateIdentityGenerator,
Gender,
+ IdentityGenerator,
IdentityGeneratorEn,
IdentityGeneratorNl,
IdentityHelperUtils,
- UsernameEmailGenerator,
- createGenerator
+ UsernameEmailGenerator
};
//# sourceMappingURL=index.mjs.map
\ No newline at end of file
diff --git a/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.d.ts b/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.d.ts
index 4af3336ce..723e4f172 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.d.ts
+++ b/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.d.ts
@@ -115,6 +115,6 @@ declare class PasswordGenerator {
* @param settings - The settings for the password generator.
* @returns A new password generator instance.
*/
-declare const createPasswordGenerator: (settings: PasswordSettings) => PasswordGenerator;
+declare const CreatePasswordGenerator: (settings: PasswordSettings) => PasswordGenerator;
-export { PasswordGenerator, type PasswordSettings, createPasswordGenerator };
+export { CreatePasswordGenerator, PasswordGenerator, type PasswordSettings };
diff --git a/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.js b/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.js
index 121901030..6e52660a9 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.js
+++ b/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.js
@@ -23,8 +23,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
// src/index.ts
var index_exports = {};
__export(index_exports, {
- PasswordGenerator: () => PasswordGenerator,
- createPasswordGenerator: () => createPasswordGenerator
+ CreatePasswordGenerator: () => CreatePasswordGenerator,
+ PasswordGenerator: () => PasswordGenerator
});
module.exports = __toCommonJS(index_exports);
@@ -236,12 +236,12 @@ var PasswordGenerator = class {
};
// src/factories/PasswordGeneratorFactory.ts
-var createPasswordGenerator = (settings) => {
+var CreatePasswordGenerator = (settings) => {
return new PasswordGenerator(settings);
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
- PasswordGenerator,
- createPasswordGenerator
+ CreatePasswordGenerator,
+ PasswordGenerator
});
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.mjs b/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.mjs
index 42fd90732..225109cce 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.mjs
+++ b/apps/server/AliasVault.Client/wwwroot/js/shared/password-generator/index.mjs
@@ -210,11 +210,11 @@ var PasswordGenerator = class {
};
// src/factories/PasswordGeneratorFactory.ts
-var createPasswordGenerator = (settings) => {
+var CreatePasswordGenerator = (settings) => {
return new PasswordGenerator(settings);
};
export {
- PasswordGenerator,
- createPasswordGenerator
+ CreatePasswordGenerator,
+ PasswordGenerator
};
//# sourceMappingURL=index.mjs.map
\ No newline at end of file
diff --git a/shared/identity-generator/src/factories/IdentityGeneratorFactory.ts b/shared/identity-generator/src/factories/IdentityGeneratorFactory.ts
index 293301bf7..68237cfce 100644
--- a/shared/identity-generator/src/factories/IdentityGeneratorFactory.ts
+++ b/shared/identity-generator/src/factories/IdentityGeneratorFactory.ts
@@ -7,7 +7,7 @@ import { IIdentityGenerator } from "src/interfaces/IIdentityGenerator";
* @param language - The language to use for generating the identity (e.g. "en", "nl").
* @returns A new identity generator instance.
*/
-export const createGenerator = (language: string): IIdentityGenerator => {
+export const CreateIdentityGenerator = (language: string): IIdentityGenerator => {
switch (language) {
case 'en':
return new IdentityGeneratorEn();
diff --git a/shared/identity-generator/src/implementations/IdentityGeneratorEn.ts b/shared/identity-generator/src/implementations/IdentityGeneratorEn.ts
index ea0843859..2c161af13 100644
--- a/shared/identity-generator/src/implementations/IdentityGeneratorEn.ts
+++ b/shared/identity-generator/src/implementations/IdentityGeneratorEn.ts
@@ -1,4 +1,4 @@
-import { BaseIdentityGenerator } from "./base/BaseIdentityGenerator";
+import { IdentityGenerator } from "./base/IdentityGenerator";
import maleNames from '../dictionaries/en/firstnames_male';
import femaleNames from '../dictionaries/en/firstnames_female';
import lastNames from '../dictionaries/en/lastnames';
@@ -6,7 +6,7 @@ import lastNames from '../dictionaries/en/lastnames';
/**
* Identity generator for English language using English word dictionaries.
*/
-export class IdentityGeneratorEn extends BaseIdentityGenerator {
+export class IdentityGeneratorEn extends IdentityGenerator {
/**
* Get the male first names.
*/
diff --git a/shared/identity-generator/src/implementations/IdentityGeneratorNl.ts b/shared/identity-generator/src/implementations/IdentityGeneratorNl.ts
index 8159e53db..75eb059a0 100644
--- a/shared/identity-generator/src/implementations/IdentityGeneratorNl.ts
+++ b/shared/identity-generator/src/implementations/IdentityGeneratorNl.ts
@@ -1,4 +1,4 @@
-import { BaseIdentityGenerator } from "./base/BaseIdentityGenerator";
+import { IdentityGenerator } from "./base/IdentityGenerator";
import maleNames from '../dictionaries/nl/firstnames_male';
import femaleNames from '../dictionaries/nl/firstnames_female';
import lastNames from '../dictionaries/nl/lastnames';
@@ -6,7 +6,7 @@ import lastNames from '../dictionaries/nl/lastnames';
/**
* Identity generator for Dutch language using Dutch word dictionaries.
*/
-export class IdentityGeneratorNl extends BaseIdentityGenerator {
+export class IdentityGeneratorNl extends IdentityGenerator {
/**
* Get the male first names.
*/
diff --git a/shared/identity-generator/src/implementations/base/BaseIdentityGenerator.ts b/shared/identity-generator/src/implementations/base/IdentityGenerator.ts
similarity index 96%
rename from shared/identity-generator/src/implementations/base/BaseIdentityGenerator.ts
rename to shared/identity-generator/src/implementations/base/IdentityGenerator.ts
index 85f8da97f..30803df44 100644
--- a/shared/identity-generator/src/implementations/base/BaseIdentityGenerator.ts
+++ b/shared/identity-generator/src/implementations/base/IdentityGenerator.ts
@@ -6,7 +6,7 @@ import { Identity } from '../../types/Identity';
/**
* Base identity generator.
*/
-export abstract class BaseIdentityGenerator implements IIdentityGenerator {
+export abstract class IdentityGenerator implements IIdentityGenerator {
protected firstNamesMale: string[] = [];
protected firstNamesFemale: string[] = [];
protected lastNames: string[] = [];
diff --git a/shared/identity-generator/src/index.ts b/shared/identity-generator/src/index.ts
index 59c216d22..426201cf0 100644
--- a/shared/identity-generator/src/index.ts
+++ b/shared/identity-generator/src/index.ts
@@ -3,6 +3,6 @@ export * from './types/Identity';
export * from './types/Gender';
export * from './implementations/IdentityGeneratorEn';
export * from './implementations/IdentityGeneratorNl';
-export * from './implementations/base/BaseIdentityGenerator';
+export * from './implementations/base/IdentityGenerator';
export * from './utils/IdentityHelperUtils';
export * from './factories/IdentityGeneratorFactory';
diff --git a/shared/password-generator/src/factories/PasswordGeneratorFactory.ts b/shared/password-generator/src/factories/PasswordGeneratorFactory.ts
index e9e0fc939..d15a611c8 100644
--- a/shared/password-generator/src/factories/PasswordGeneratorFactory.ts
+++ b/shared/password-generator/src/factories/PasswordGeneratorFactory.ts
@@ -6,6 +6,6 @@ import { PasswordGenerator } from "src/utils/PasswordGenerator";
* @param settings - The settings for the password generator.
* @returns A new password generator instance.
*/
-export const createPasswordGenerator = (settings: PasswordSettings): PasswordGenerator => {
+export const CreatePasswordGenerator = (settings: PasswordSettings): PasswordGenerator => {
return new PasswordGenerator(settings);
};