Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update RustCore.ts (#776)
Leendert de Borst8ded6951cc1a
diff --git a/apps/browser-extension/src/utils/RustCore.ts b/apps/browser-extension/src/utils/RustCore.tsindex 0612151de..08b06cb8f 100644--- a/apps/browser-extension/src/utils/RustCore.ts+++ b/apps/browser-extension/src/utils/RustCore.ts@@ -10,7 +10,7 @@*/import { browser } from 'wxt/browser';-import type { Item } from '@/utils/dist/core/models/vault';+import type { Item, PasswordSettings } from '@/utils/dist/core/models/vault';import { FieldKey } from '@/utils/dist/core/models/vault';import initWasm, * as core from '@/utils/dist/core/rust/aliasvault_core.js';@@ -59,6 +59,31 @@ export async function extractRootDomain(domain: string): Promise<string> {return core.extractRootDomain(domain);}+/**+ * Generate a password or passphrase from the given settings.+ *+ * The `Type` field selects the generator: `'basic'` (character-set password)+ * or `'diceware'` (wordlist passphrase). Generation runs in the Rust core.+ *+ * Seed is an optional 64-character hex string (32 bytes) that seeds the RNG for deterministic generation+ * primarily for UI comparison purposes. All normal password generation is non-deterministic.+ */+export async function generatePassword(settings: PasswordSettings, seed?: string): Promise<string> {+ await initRustCore();+ const payload = seed ? { ...settings, Seed: seed } : settings;+ return core.generatePassword(JSON.stringify(payload));+}++/**+ * Generate a random 32-byte seed as a 64-character hex string, suitable for the+ * `seed` argument of {@link generatePassword}.+ */+export function generateSeed(): string {+ const bytes = new Uint8Array(32);+ crypto.getRandomValues(bytes);+ return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');+}+/*** Filter items by URL/title for autofill. Returns at most 3 matches.*/