mirror of
https://github.com/kccleoc/seedpgp-web.git
synced 2026-03-06 17:37:51 +08:00
- Implement cv25519 PGP encryption/decryption - Add Base45 encoding with CRC16 integrity checks - Create SEEDPGP1 frame format for QR codes - Support BIP39 passphrase flag indicator - Add comprehensive test suite with Trezor BIP39 vectors - 15 passing tests covering all core functionality
32 lines
836 B
TypeScript
32 lines
836 B
TypeScript
import { useEffect, useState } from 'react';
|
|
import QRCode from 'qrcode';
|
|
|
|
interface QrDisplayProps {
|
|
value: string;
|
|
}
|
|
|
|
export const QrDisplay: React.FC<QrDisplayProps> = ({ value }) => {
|
|
const [dataUrl, setDataUrl] = useState<string>('');
|
|
|
|
useEffect(() => {
|
|
if (value) {
|
|
QRCode.toDataURL(value, {
|
|
errorCorrectionLevel: 'Q',
|
|
type: 'image/png',
|
|
width: 512,
|
|
margin: 2,
|
|
})
|
|
.then(setDataUrl)
|
|
.catch(console.error);
|
|
}
|
|
}, [value]);
|
|
|
|
if (!dataUrl) return null;
|
|
|
|
return (
|
|
<div className="flex items-center justify-center p-4 bg-white rounded-xl border-2 border-slate-200">
|
|
<img src={dataUrl} alt="SeedPGP QR Code" className="w-64 h-64" />
|
|
</div>
|
|
);
|
|
};
|