Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update mobile app shared core libs (#776)
Leendert de Borst4b572fa650c5
diff --git a/apps/mobile-app/utils/dist/core/identity-generator/index.d.ts b/apps/mobile-app/utils/dist/core/identity-generator/index.d.tsindex 0622ddd0d..2e6235283 100644--- a/apps/mobile-app/utils/dist/core/identity-generator/index.d.ts+++ b/apps/mobile-app/utils/dist/core/identity-generator/index.d.ts@@ -399,20 +399,6 @@ declare function convertAgeRangeToBirthdateOptions(ageRange: string): IBirthdate* @returns Array of ISO language codes (e.g. ["da", "de", "en", ...]).*/declare function getAvailableLanguages(): string[];-/**- * Maps a UI language code to an identity generator language code.- * If no explicit match is found, returns null to indicate no preference.- *- * @param uiLanguageCode - The UI language code (e.g., "en", "en-US", "nl-NL", "de-DE", "fr")- * @returns The matching identity generator language code or null if no match- *- * @example- * mapUiLanguageToIdentityLanguage("en-US") // returns "en"- * mapUiLanguageToIdentityLanguage("nl") // returns "nl"- * mapUiLanguageToIdentityLanguage("de-CH") // returns "de"- * mapUiLanguageToIdentityLanguage("ja") // returns null (no Japanese identity generator)- */-declare function mapUiLanguageToIdentityLanguage(uiLanguageCode: string | null | undefined): string | null;/*** Creates a new identity generator based on the language.@@ -429,4 +415,4 @@ declare const CreateIdentityGenerator: (language: string) => IdentityGenerator;*/declare const CreateUsernameEmailGenerator: () => UsernameEmailGenerator;-export { CreateIdentityGenerator, CreateUsernameEmailGenerator, Gender, type IAgeRangeOption, type IBirthdateOptions, type IDecadeFirstnames, type IIdentityGenerator, type Identity, IdentityGenerator, IdentityGeneratorDa, IdentityGeneratorDe, IdentityGeneratorEn, IdentityGeneratorEs, IdentityGeneratorFa, IdentityGeneratorFr, IdentityGeneratorIt, IdentityGeneratorNl, IdentityGeneratorRo, IdentityGeneratorSv, IdentityGeneratorUr, IdentityHelperUtils, UsernameEmailGenerator, convertAgeRangeToBirthdateOptions, getAvailableAgeRanges, getAvailableLanguages, mapUiLanguageToIdentityLanguage };+export { CreateIdentityGenerator, CreateUsernameEmailGenerator, Gender, type IAgeRangeOption, type IBirthdateOptions, type IDecadeFirstnames, type IIdentityGenerator, type Identity, IdentityGenerator, IdentityGeneratorDa, IdentityGeneratorDe, IdentityGeneratorEn, IdentityGeneratorEs, IdentityGeneratorFa, IdentityGeneratorFr, IdentityGeneratorIt, IdentityGeneratorNl, IdentityGeneratorRo, IdentityGeneratorSv, IdentityGeneratorUr, IdentityHelperUtils, UsernameEmailGenerator, convertAgeRangeToBirthdateOptions, getAvailableAgeRanges, getAvailableLanguages };diff --git a/apps/mobile-app/utils/dist/core/identity-generator/index.js b/apps/mobile-app/utils/dist/core/identity-generator/index.jsindex a4f3c5090..41780e57d 100644--- a/apps/mobile-app/utils/dist/core/identity-generator/index.js+++ b/apps/mobile-app/utils/dist/core/identity-generator/index.js@@ -42,8 +42,7 @@ __export(index_exports, {UsernameEmailGenerator: () => UsernameEmailGenerator,convertAgeRangeToBirthdateOptions: () => convertAgeRangeToBirthdateOptions,getAvailableAgeRanges: () => getAvailableAgeRanges,- getAvailableLanguages: () => getAvailableLanguages,- mapUiLanguageToIdentityLanguage: () => mapUiLanguageToIdentityLanguage+ getAvailableLanguages: () => getAvailableLanguages});module.exports = __toCommonJS(index_exports);@@ -11763,43 +11762,21 @@ function convertAgeRangeToBirthdateOptions(ageRange) {}// src/utils/LanguageProvider.ts-var LANGUAGE_DEFS = [- { value: "da", alternativeCodes: ["da-DK"] },- { value: "de", alternativeCodes: ["de-DE", "de-AT", "de-CH", "de-LU", "de-LI"] },- { value: "en", alternativeCodes: ["en-US", "en-GB", "en-CA", "en-AU", "en-NZ", "en-IE", "en-ZA", "en-SG", "en-IN"] },- { value: "es", alternativeCodes: ["es-ES", "es-MX", "es-AR", "es-CO", "es-CL", "es-PE", "es-VE", "es-EC", "es-GT", "es-CU", "es-BO", "es-DO", "es-HN", "es-PY", "es-SV", "es-NI", "es-CR", "es-PA", "es-UY", "es-PR"] },- { value: "fr", alternativeCodes: ["fr-FR", "fr-CA", "fr-BE", "fr-CH", "fr-LU", "fr-MC"] },- { value: "it", alternativeCodes: ["it-IT", "it-CH", "it-SM", "it-VA"] },- { value: "nl", alternativeCodes: ["nl-NL", "nl-BE"] },- { value: "ro", alternativeCodes: ["ro-RO", "ro-MD"] },- { value: "sv", alternativeCodes: ["sv-SE", "sv-FI"] },- { value: "ur", alternativeCodes: ["ur-PK", "ur-IN"] },- { value: "fa", alternativeCodes: ["fa-IR", "fa-AF"] }+var SUPPORTED_LANGUAGE_CODES = [+ "da",+ "de",+ "en",+ "es",+ "fr",+ "it",+ "nl",+ "ro",+ "sv",+ "ur",+ "fa"];function getAvailableLanguages() {- return LANGUAGE_DEFS.map((lang) => lang.value);-}-function mapUiLanguageToIdentityLanguage(uiLanguageCode) {- if (!uiLanguageCode) {- return null;- }- const normalizedCode = uiLanguageCode.toLowerCase();- const exactMatch = LANGUAGE_DEFS.find((lang) => lang.value.toLowerCase() === normalizedCode);- if (exactMatch) {- return exactMatch.value;- }- const alternativeMatch = LANGUAGE_DEFS.find(- (lang) => lang.alternativeCodes?.some((code) => code.toLowerCase() === normalizedCode)- );- if (alternativeMatch) {- return alternativeMatch.value;- }- const baseCode = normalizedCode.split("-")[0];- const baseMatch = LANGUAGE_DEFS.find((lang) => lang.value.toLowerCase() === baseCode);- if (baseMatch) {- return baseMatch.value;- }- return null;+ return [...SUPPORTED_LANGUAGE_CODES];}// src/factories/IdentityGeneratorFactory.ts@@ -11858,6 +11835,5 @@ var CreateUsernameEmailGenerator = () => {UsernameEmailGenerator,convertAgeRangeToBirthdateOptions,getAvailableAgeRanges,- getAvailableLanguages,- mapUiLanguageToIdentityLanguage+ getAvailableLanguages});diff --git a/apps/mobile-app/utils/dist/core/identity-generator/index.mjs b/apps/mobile-app/utils/dist/core/identity-generator/index.mjsindex c19ae5b4e..5d4cb295a 100644--- a/apps/mobile-app/utils/dist/core/identity-generator/index.mjs+++ b/apps/mobile-app/utils/dist/core/identity-generator/index.mjs@@ -11718,43 +11718,21 @@ function convertAgeRangeToBirthdateOptions(ageRange) {}// src/utils/LanguageProvider.ts-var LANGUAGE_DEFS = [- { value: "da", alternativeCodes: ["da-DK"] },- { value: "de", alternativeCodes: ["de-DE", "de-AT", "de-CH", "de-LU", "de-LI"] },- { value: "en", alternativeCodes: ["en-US", "en-GB", "en-CA", "en-AU", "en-NZ", "en-IE", "en-ZA", "en-SG", "en-IN"] },- { value: "es", alternativeCodes: ["es-ES", "es-MX", "es-AR", "es-CO", "es-CL", "es-PE", "es-VE", "es-EC", "es-GT", "es-CU", "es-BO", "es-DO", "es-HN", "es-PY", "es-SV", "es-NI", "es-CR", "es-PA", "es-UY", "es-PR"] },- { value: "fr", alternativeCodes: ["fr-FR", "fr-CA", "fr-BE", "fr-CH", "fr-LU", "fr-MC"] },- { value: "it", alternativeCodes: ["it-IT", "it-CH", "it-SM", "it-VA"] },- { value: "nl", alternativeCodes: ["nl-NL", "nl-BE"] },- { value: "ro", alternativeCodes: ["ro-RO", "ro-MD"] },- { value: "sv", alternativeCodes: ["sv-SE", "sv-FI"] },- { value: "ur", alternativeCodes: ["ur-PK", "ur-IN"] },- { value: "fa", alternativeCodes: ["fa-IR", "fa-AF"] }+var SUPPORTED_LANGUAGE_CODES = [+ "da",+ "de",+ "en",+ "es",+ "fr",+ "it",+ "nl",+ "ro",+ "sv",+ "ur",+ "fa"];function getAvailableLanguages() {- return LANGUAGE_DEFS.map((lang) => lang.value);-}-function mapUiLanguageToIdentityLanguage(uiLanguageCode) {- if (!uiLanguageCode) {- return null;- }- const normalizedCode = uiLanguageCode.toLowerCase();- const exactMatch = LANGUAGE_DEFS.find((lang) => lang.value.toLowerCase() === normalizedCode);- if (exactMatch) {- return exactMatch.value;- }- const alternativeMatch = LANGUAGE_DEFS.find(- (lang) => lang.alternativeCodes?.some((code) => code.toLowerCase() === normalizedCode)- );- if (alternativeMatch) {- return alternativeMatch.value;- }- const baseCode = normalizedCode.split("-")[0];- const baseMatch = LANGUAGE_DEFS.find((lang) => lang.value.toLowerCase() === baseCode);- if (baseMatch) {- return baseMatch.value;- }- return null;+ return [...SUPPORTED_LANGUAGE_CODES];}// src/factories/IdentityGeneratorFactory.ts@@ -11812,6 +11790,5 @@ export {UsernameEmailGenerator,convertAgeRangeToBirthdateOptions,getAvailableAgeRanges,- getAvailableLanguages,- mapUiLanguageToIdentityLanguage+ getAvailableLanguages};diff --git a/apps/mobile-app/utils/dist/core/models/defaults/index.d.ts b/apps/mobile-app/utils/dist/core/models/defaults/index.d.tsindex 2c5e628a2..e9380650f 100644--- a/apps/mobile-app/utils/dist/core/models/defaults/index.d.ts+++ b/apps/mobile-app/utils/dist/core/models/defaults/index.d.ts@@ -22,8 +22,8 @@ declare const MIN_WORD_COUNT = 3;declare const MAX_WORD_COUNT = 10;/**- * Generic, cross-platform language reference: maps a two-letter ISO 639-1 code to a flag and a- * native display label.+ * Generic, cross-platform language reference: maps a two-letter ISO 639-1 code to a flag, a native+ * display label, and the alternative locale codes (BCP-47 region variants) that map onto it*//*** Display metadata for a single language.@@ -35,12 +35,14 @@ interface ILanguageInfo {flag: string;/** Native display label. */label: string;+ /** Alternative locale codes (BCP-47 language-region tags) that map onto this language. */+ alternativeCodes?: string[];}/** Default ISO language code used as the universal fallback. */declare const DEFAULT_LANGUAGE_CODE = "en";/**- * Known languages keyed by ISO 639-1 code, with a flag and native label.- * Covers the AliasVault app UI languages so this list can be reused beyond a single feature.+ * Known languages keyed by ISO 639-1 code, with a flag, native label, and the region-variant locale+ * codes that map onto each.*/declare const LANGUAGES: ILanguageInfo[];/**@@ -56,14 +58,32 @@ declare function normalizeLanguageCode(code: string | null | undefined): string;* @returns The flag + label info for the code.*/declare function getLanguageInfo(code: string): ILanguageInfo;+/**+ * Match an app/UI/browser locale to one of a feature's available ISO codes, using the region-variant+ * alternative codes from {@link LANGUAGES} (e.g. 'en-GB' -> 'en', 'de-CH' -> 'de'). Matching order:+ * exact match against an available code, then the alternative-code table, then the base language code+ * (the part before the '-'). Returns null when nothing matches, so callers can decide their own+ * fallback (e.g. "no preference" vs. a concrete default).+ *+ * @param appLanguage The app/UI/browser language tag (e.g. 'en', 'en-US', 'nl-BE').+ * @param availableCodes The codes the feature actually supports.+ * @returns The matching available code (in its original casing) or null if none matched.+ *+ * @example+ * matchAvailableLanguage('en-US', ['en', 'nl']) // 'en'+ * matchAvailableLanguage('de-CH', ['de', 'en']) // 'de'+ * matchAvailableLanguage('ja', ['en', 'nl']) // null+ */+declare function matchAvailableLanguage(appLanguage: string | null | undefined, availableCodes: string[]): string | null;/*** Resolve a default language code for an app/UI language, restricted to a set of available codes- * (e.g. the Diceware wordlist languages returned by the Rust core). Returns the app language when it- * is available, otherwise the first available code, otherwise English.- * @param appLanguage The app/UI language tag.+ * (e.g. the Diceware wordlist languages returned by the Rust core, or the identity generator's+ * supported languages). Uses {@link matchAvailableLanguage} (region-variant aware), then falls back+ * to the first available code, otherwise English.+ * @param appLanguage The app/UI/browser language tag.* @param availableCodes The codes the feature actually supports.* @returns The resolved ISO code.*/declare function resolveDefaultLanguage(appLanguage: string | null | undefined, availableCodes: string[]): string;-export { DEFAULT_LANGUAGE_CODE, DEFAULT_PASSWORD_LENGTH, DEFAULT_WORD_COUNT, type ILanguageInfo, LANGUAGES, MAX_PASSWORD_LENGTH, MAX_WORD_COUNT, MIN_PASSWORD_LENGTH, MIN_WORD_COUNT, getLanguageInfo, normalizeLanguageCode, resolveDefaultLanguage };+export { DEFAULT_LANGUAGE_CODE, DEFAULT_PASSWORD_LENGTH, DEFAULT_WORD_COUNT, type ILanguageInfo, LANGUAGES, MAX_PASSWORD_LENGTH, MAX_WORD_COUNT, MIN_PASSWORD_LENGTH, MIN_WORD_COUNT, getLanguageInfo, matchAvailableLanguage, normalizeLanguageCode, resolveDefaultLanguage };diff --git a/apps/mobile-app/utils/dist/core/models/defaults/index.js b/apps/mobile-app/utils/dist/core/models/defaults/index.jsindex cc870c2f8..9c2b09b1e 100644--- a/apps/mobile-app/utils/dist/core/models/defaults/index.js+++ b/apps/mobile-app/utils/dist/core/models/defaults/index.js@@ -13,24 +13,24 @@ var MAX_WORD_COUNT = 10;// src/defaults/Languages.tsvar DEFAULT_LANGUAGE_CODE = "en";var LANGUAGES = [- { code: "en", flag: "\u{1F1FA}\u{1F1F8}", label: "English" },- { code: "nl", flag: "\u{1F1F3}\u{1F1F1}", label: "Nederlands" },- { code: "de", flag: "\u{1F1E9}\u{1F1EA}", label: "Deutsch" },- { code: "fr", flag: "\u{1F1EB}\u{1F1F7}", label: "Fran\xE7ais" },- { code: "es", flag: "\u{1F1EA}\u{1F1F8}", label: "Espa\xF1ol" },- { code: "it", flag: "\u{1F1EE}\u{1F1F9}", label: "Italiano" },- { code: "da", flag: "\u{1F1E9}\u{1F1F0}", label: "Dansk" },- { code: "fi", flag: "\u{1F1EB}\u{1F1EE}", label: "Suomi" },- { code: "he", flag: "\u{1F1EE}\u{1F1F1}", label: "\u05E2\u05D1\u05E8\u05D9\u05EA" },- { code: "pl", flag: "\u{1F1F5}\u{1F1F1}", label: "Polski" },- { code: "pt", flag: "\u{1F1E7}\u{1F1F7}", label: "Portugu\xEAs Brasileiro" },- { code: "ro", flag: "\u{1F1F7}\u{1F1F4}", label: "Rom\xE2n\u0103" },- { code: "ru", flag: "\u{1F1F7}\u{1F1FA}", label: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439" },- { code: "sv", flag: "\u{1F1F8}\u{1F1EA}", label: "Svenska" },- { code: "uk", flag: "\u{1F1FA}\u{1F1E6}", label: "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430" },- { code: "zh", flag: "\u{1F1E8}\u{1F1F3}", label: "\u7B80\u4F53\u4E2D\u6587" },- { code: "ur", flag: "\u{1F1F5}\u{1F1F0}", label: "\u0627\u0631\u062F\u0648" },- { code: "fa", flag: "\u{1F1EE}\u{1F1F7}", label: "\u0641\u0627\u0631\u0633\u06CC" }+ { code: "en", flag: "\u{1F1FA}\u{1F1F8}", label: "English", alternativeCodes: ["en-US", "en-GB", "en-CA", "en-AU", "en-NZ", "en-IE", "en-ZA", "en-SG", "en-IN"] },+ { code: "nl", flag: "\u{1F1F3}\u{1F1F1}", label: "Nederlands", alternativeCodes: ["nl-NL", "nl-BE"] },+ { code: "de", flag: "\u{1F1E9}\u{1F1EA}", label: "Deutsch", alternativeCodes: ["de-DE", "de-AT", "de-CH", "de-LU", "de-LI"] },+ { code: "fr", flag: "\u{1F1EB}\u{1F1F7}", label: "Fran\xE7ais", alternativeCodes: ["fr-FR", "fr-CA", "fr-BE", "fr-CH", "fr-LU", "fr-MC"] },+ { code: "es", flag: "\u{1F1EA}\u{1F1F8}", label: "Espa\xF1ol", alternativeCodes: ["es-ES", "es-MX", "es-AR", "es-CO", "es-CL", "es-PE", "es-VE", "es-EC", "es-GT", "es-CU", "es-BO", "es-DO", "es-HN", "es-PY", "es-SV", "es-NI", "es-CR", "es-PA", "es-UY", "es-PR"] },+ { code: "it", flag: "\u{1F1EE}\u{1F1F9}", label: "Italiano", alternativeCodes: ["it-IT", "it-CH", "it-SM", "it-VA"] },+ { code: "da", flag: "\u{1F1E9}\u{1F1F0}", label: "Dansk", alternativeCodes: ["da-DK"] },+ { code: "fi", flag: "\u{1F1EB}\u{1F1EE}", label: "Suomi", alternativeCodes: ["fi-FI"] },+ { code: "he", flag: "\u{1F1EE}\u{1F1F1}", label: "\u05E2\u05D1\u05E8\u05D9\u05EA", alternativeCodes: ["he-IL"] },+ { code: "pl", flag: "\u{1F1F5}\u{1F1F1}", label: "Polski", alternativeCodes: ["pl-PL"] },+ { code: "pt", flag: "\u{1F1E7}\u{1F1F7}", label: "Portugu\xEAs Brasileiro", alternativeCodes: ["pt-BR", "pt-PT"] },+ { code: "ro", flag: "\u{1F1F7}\u{1F1F4}", label: "Rom\xE2n\u0103", alternativeCodes: ["ro-RO", "ro-MD"] },+ { code: "ru", flag: "\u{1F1F7}\u{1F1FA}", label: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439", alternativeCodes: ["ru-RU", "ru-BY", "ru-KZ", "ru-UA"] },+ { code: "sv", flag: "\u{1F1F8}\u{1F1EA}", label: "Svenska", alternativeCodes: ["sv-SE", "sv-FI"] },+ { code: "uk", flag: "\u{1F1FA}\u{1F1E6}", label: "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430", alternativeCodes: ["uk-UA"] },+ { code: "zh", flag: "\u{1F1E8}\u{1F1F3}", label: "\u7B80\u4F53\u4E2D\u6587", alternativeCodes: ["zh-CN", "zh-SG", "zh-Hans", "zh-TW", "zh-HK", "zh-MO", "zh-Hant"] },+ { code: "ur", flag: "\u{1F1F5}\u{1F1F0}", label: "\u0627\u0631\u062F\u0648", alternativeCodes: ["ur-PK", "ur-IN"] },+ { code: "fa", flag: "\u{1F1EE}\u{1F1F7}", label: "\u0641\u0627\u0631\u0633\u06CC", alternativeCodes: ["fa-IR", "fa-AF"] }];function normalizeLanguageCode(code) {return (code ?? "").slice(0, 2).toLowerCase();@@ -40,12 +40,31 @@ function getLanguageInfo(code) {const match = LANGUAGES.find((l) => l.code === iso);return match ?? { code, flag: "\u{1F310}", label: code };}-function resolveDefaultLanguage(appLanguage, availableCodes) {- const iso = normalizeLanguageCode(appLanguage);- if (availableCodes.some((c) => c.toLowerCase() === iso)) {- return iso;+function matchAvailableLanguage(appLanguage, availableCodes) {+ if (!appLanguage) {+ return null;+ }+ const lower = appLanguage.toLowerCase();+ const exact = availableCodes.find((c) => c.toLowerCase() === lower);+ if (exact) {+ return exact;+ }+ const altEntry = LANGUAGES.find((l) => l.alternativeCodes?.some((ac) => ac.toLowerCase() === lower));+ if (altEntry) {+ const altMatch = availableCodes.find((c) => c.toLowerCase() === altEntry.code.toLowerCase());+ if (altMatch) {+ return altMatch;+ }}- return availableCodes[0] ?? DEFAULT_LANGUAGE_CODE;+ const base = normalizeLanguageCode(appLanguage);+ const baseMatch = availableCodes.find((c) => c.toLowerCase() === base);+ if (baseMatch) {+ return baseMatch;+ }+ return null;+}+function resolveDefaultLanguage(appLanguage, availableCodes) {+ return matchAvailableLanguage(appLanguage, availableCodes) ?? availableCodes[0] ?? DEFAULT_LANGUAGE_CODE;}-export { DEFAULT_LANGUAGE_CODE, DEFAULT_PASSWORD_LENGTH, DEFAULT_WORD_COUNT, LANGUAGES, MAX_PASSWORD_LENGTH, MAX_WORD_COUNT, MIN_PASSWORD_LENGTH, MIN_WORD_COUNT, getLanguageInfo, normalizeLanguageCode, resolveDefaultLanguage };+export { DEFAULT_LANGUAGE_CODE, DEFAULT_PASSWORD_LENGTH, DEFAULT_WORD_COUNT, LANGUAGES, MAX_PASSWORD_LENGTH, MAX_WORD_COUNT, MIN_PASSWORD_LENGTH, MIN_WORD_COUNT, getLanguageInfo, matchAvailableLanguage, normalizeLanguageCode, resolveDefaultLanguage };