Skip to content

fix: strengthen seed generation with crypto.getRandomValues()#229

Open
fyllepo wants to merge 1 commit intoqubic:devfrom
fyllepo:fix/use-crypto-random-for-seed-generation
Open

fix: strengthen seed generation with crypto.getRandomValues()#229
fyllepo wants to merge 1 commit intoqubic:devfrom
fyllepo:fix/use-crypto-random-for-seed-generation

Conversation

@fyllepo
Copy link

@fyllepo fyllepo commented Feb 12, 2026

Hey! Noticed that seedGen() in CreateVaultComponent uses Math.random() for generating wallet seeds. Swapped it out for crypto.getRandomValues() which pulls from the OS entropy pool — much better fit for a wallet context.

Also extracted the logic into src/app/utils/seed.utils.ts so it's reusable and testable, with a spec file covering length, character set, uniqueness, and that it's actually calling the crypto API.

Note: the existing Karma test runner seems to have a bootstrapping issue (fails before any tests execute), so the spec couldn't be verified locally — but the build passes clean.

Small change, just the one function. Happy to adjust if needed!

Upgrade seedGen() to use the Web Crypto API for generating wallet
seeds, providing cryptographically secure randomness via the OS
entropy pool.

Extract seed generation into a reusable utility with tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant