feat: adding new way to use Random.org api to generate seed phrase

This commit is contained in:
LC mac
2026-02-13 01:05:13 +08:00
parent 9cc74005f2
commit cf6299a510
3 changed files with 391 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ import Footer from './components/Footer';
import { SeedBlender } from './components/SeedBlender';
import CameraEntropy from './components/CameraEntropy';
import DiceEntropy from './components/DiceEntropy';
import RandomOrgEntropy from './components/RandomOrgEntropy';
import { InteractionEntropy } from './lib/interactionEntropy';
import AudioEntropy from './AudioEntropy';
@@ -78,7 +79,7 @@ function App() {
const [isNetworkBlocked, setIsNetworkBlocked] = useState(false);
// Entropy generation states
const [entropySource, setEntropySource] = useState<'camera' | 'dice' | 'audio' | null>(null);
const [entropySource, setEntropySource] = useState<'camera' | 'dice' | 'audio' | 'randomorg' | null>(null);
const [entropyStats, setEntropyStats] = useState<any>(null);
const interactionEntropyRef = useRef(new InteractionEntropy());
@@ -770,6 +771,16 @@ function App() {
</div>
</div>
</button>
<button onClick={() => setEntropySource('randomorg')} className="w-full p-4 bg-[#16213e] border-2 border-[#00f0ff]/50 rounded-lg hover:bg-[#1a1a2e] hover:border-[#00f0ff] hover:shadow-[0_0_20px_rgba(0,240,255,0.3)] transition-all text-left">
<div className="flex items-center gap-3">
<Dices size={24} className="text-[#00f0ff]" />
<div>
<p className="text-sm font-bold text-[#00f0ff]">🌐 Random.org D6</p>
<p className="text-[10px] text-[#6ef3f7]">Manual entropy via random.org</p>
</div>
</div>
</button>
</div>
<div className="flex items-start gap-2 p-3 bg-[#16213e] border border-[#00f0ff]/30 rounded-lg">
@@ -824,6 +835,17 @@ function App() {
/>
)}
{/* Random.org Entropy Component */}
{entropySource === 'randomorg' && !generatedSeed && (
<RandomOrgEntropy
key={`randomorg-${resetCounter}`}
wordCount={seedWordCount}
onEntropyGenerated={handleEntropyGenerated}
onCancel={() => setEntropySource(null)}
interactionEntropy={interactionEntropyRef.current}
/>
)}
{/* Generated Seed Display + Destination Selector */}
{generatedSeed && (
<div className="space-y-4">