Initial commit
This commit is contained in:
23
src/utils/qrcode.js
Normal file
23
src/utils/qrcode.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Minimalni QR code generator pro TOTP URI.
|
||||
* Generuje QR client-side pres Canvas - zadny externi API call.
|
||||
* Pouziva qrcode npm package (nutno nainstalovat).
|
||||
*
|
||||
* Fallback: pokud canvas neni k dispozici, nic se nevykresli.
|
||||
*/
|
||||
import QRCode from 'qrcode'
|
||||
|
||||
export async function renderQR(canvas, data) {
|
||||
try {
|
||||
await QRCode.toCanvas(canvas, data, {
|
||||
width: 200,
|
||||
margin: 2,
|
||||
color: {
|
||||
dark: '#000000',
|
||||
light: '#ffffff'
|
||||
}
|
||||
})
|
||||
} catch {
|
||||
// QR render failed silently
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user