@forgesworn/shamir-words 1.0.1 → 1.0.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.
- package/LICENCE +1 -1
- package/dist/index.js +1 -2
- package/package.json +1 -1
- package/src/index.ts +1 -2
package/LICENCE
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Shamir's Secret Sharing over GF(256)
|
|
2
2
|
// Split secrets into threshold-of-n shares using polynomial interpolation
|
|
3
3
|
// Shares can be encoded as BIP-39 words for human-readable exchange
|
|
4
|
-
import { randomFillSync } from 'node:crypto';
|
|
5
4
|
import { sha256 } from '@noble/hashes/sha2.js';
|
|
6
5
|
import { wordlist as BIP39_WORDLIST } from '@scure/bip39/wordlists/english.js';
|
|
7
6
|
/** O(1) word-to-index lookup, built once at module load */
|
|
@@ -141,7 +140,7 @@ export function splitSecret(secret, threshold, shares) {
|
|
|
141
140
|
const coeffs = new Uint8Array(threshold);
|
|
142
141
|
coeffs[0] = secret[byteIdx];
|
|
143
142
|
const rand = new Uint8Array(threshold - 1);
|
|
144
|
-
|
|
143
|
+
crypto.getRandomValues(rand);
|
|
145
144
|
for (let j = 1; j < threshold; j++) {
|
|
146
145
|
coeffs[j] = rand[j - 1];
|
|
147
146
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Split secrets into threshold-of-n shares using polynomial interpolation
|
|
3
3
|
// Shares can be encoded as BIP-39 words for human-readable exchange
|
|
4
4
|
|
|
5
|
-
import { randomFillSync } from 'node:crypto';
|
|
6
5
|
import { sha256 } from '@noble/hashes/sha2.js';
|
|
7
6
|
import { wordlist as BIP39_WORDLIST } from '@scure/bip39/wordlists/english.js';
|
|
8
7
|
|
|
@@ -173,7 +172,7 @@ export function splitSecret(
|
|
|
173
172
|
coeffs[0] = secret[byteIdx]!;
|
|
174
173
|
|
|
175
174
|
const rand = new Uint8Array(threshold - 1);
|
|
176
|
-
|
|
175
|
+
crypto.getRandomValues(rand);
|
|
177
176
|
for (let j = 1; j < threshold; j++) {
|
|
178
177
|
coeffs[j] = rand[j - 1]!;
|
|
179
178
|
}
|