@totemsdk/core 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bip39.js +6 -8
  2. package/package.json +1 -1
package/dist/bip39.js CHANGED
@@ -402,16 +402,14 @@ function phraseToSeed(rawPhrase) {
402
402
  * @returns Array of 24 random BIP39 words (lowercase)
403
403
  */
404
404
  function generateWordList() {
405
+ if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
406
+ throw new Error('generateWordList: no cryptographically secure random source available. ' +
407
+ 'Seed generation requires crypto.getRandomValues (browser/Node 19+) or node:crypto.randomBytes (Node). ' +
408
+ 'Math.random() is not acceptable for key material.');
409
+ }
405
410
  const words = [];
406
411
  const randomValues = new Uint32Array(24);
407
- if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
408
- crypto.getRandomValues(randomValues);
409
- }
410
- else {
411
- for (let i = 0; i < 24; i++) {
412
- randomValues[i] = Math.floor(Math.random() * 0x100000000);
413
- }
414
- }
412
+ crypto.getRandomValues(randomValues);
415
413
  for (let i = 0; i < 24; i++) {
416
414
  const index = randomValues[i] % exports.WORD_LIST.length;
417
415
  words.push(exports.WORD_LIST[index]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totemsdk/core",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Core cryptographic primitives for Totem SDK — backed by Rust/WASM",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",