Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_new_qrCode_imgDataURIString(fn)
{
const self = this
const fundsRequestURI = self._assumingBootedOrEquivalent__Lazy_URI__addressAsFirstPathComponent() // NOTE: creating QR code with URI w/o "//" - wider scanning support in ecosystem
// ^- since we're not booted yet but we're only calling this when we know we have all the info
const options = { errorCorrectionLevel: 'Q' } // Q: quartile: 25%
QRCode.toDataURL(
fundsRequestURI,
options,
function(err, imgDataURIString)
{
if (err) {
console.error("Error generating QR code:", err)
}
fn(err, imgDataURIString)
}
)
}
genQRCodeUrl (work) {
const url = `/works/preview/${work.id}`
QRCode.toDataURL(url, (err, url) => {
if (err) console.log(err)
this.qrcodeUrl = url
})
}
},
DisplayQR.prototype.onExecute = function() {
if (this.inputs[0] && this.value != this.getInputData(0)) {
this.value = this.getInputData(0);
if(this.value){
//console.log("QR VALUE ",this.value)
QRCode.toDataURL(this.value, {color: {
dark: '#EEE',
light: '#111',
width: this.size[0],
height: this.size[1],
}} , (err, url) => {
var image = new Image();
image.onload = ()=>{
this.qr = image
//console.log("QR SET",this.qr)
};
if(this.value){
image.src = url;
//console.log("SRC",image.src)
}
})
}
loadQRCode = () => {
const { documentId, accessToken, repositoryId } = this.props;
const { includeToken } = this.state;
let url = `${quickResponseCodeHost}/index?repo_id=${repositoryId}&id=${documentId}`;
if (includeToken) {
url += `&token=${accessToken}`;
}
QRCode.toDataURL(
url,
{ errorCorrectionLevel: 'H' },
(err: Error, quickResponseCodeData: string) => {
if (err) {
console.log(err);
}
this.setState({
quickResponseCodeData,
});
}
);
};
QRCode.toDataURL(privateKeyWIF, (err, privateKeyWIFQR) => {
QRCode.toDataURL(address, (err, addressQR) => {
fs.writeFileSync( `./paper-wallet.html`, `
<div>
<h2>Private Key WIF</h2>
<p>${privateKeyWIF}</p>
<p><img src="${privateKeyWIFQR}"></p>
</div>
<div>
<h2>Public address</h2>
<p>${address}</p>
<p><img src="${addressQR}"></p>
</div>
<div>
<p>Mnemonic: ${mnemonic}</p>
<p>HD Path: m/44'/145'/0'/0/0</p>
<p>Encoding: ${options.encoding}</p>
<p>Language: ${options.language}</p></div>
componentWillMount() {
if (this.state.isMobile) {
return;
}
QRCode.toDataURL(location.href, { margin: 1 })
.then(dataUrl => this.setState({ QRCode: dataUrl }));
}
shouldComponentUpdate(state) {
app.get('/checkout/:invoice', wrap(async (req, res) => {
const opt = req.invoice.metadata && req.invoice.metadata.checkout || {}
if (req.invoice.status == 'paid' && opt.redirect_url)
return res.redirect(opt.redirect_url)
if (req.invoice.status == 'unpaid')
res.locals.qr = await qrcode.toDataURL(`lightning:${req.invoice.payreq}`.toUpperCase(), { margin: 1 })
res.render('checkout', req.invoice)
}))
return new Promise((resolve, reject) => {
const opts = {
errorCorrectionLevel: 'H',
type: 'png',
scale: 30
}
const url = `http://ysj.tcfellow.com/card?code=${code}`
qrcode.toDataURL(url, opts, function (err, url) {
if (err) reject(err)
resolve(url)
})
})
}
function create(url, code, cb) {
"use strict";
try {
var QRCode = require("qrcode");
var urlCode = "" + url + " " + code;
QRCode.toDataURL(urlCode, function(err,url) {
cb(err, url);
});
} catch (err) {
cb(err, "<img src="\"http://www.yooter.com/images/pagenotfound.jpg\"">");
}
}
function makeQR(secret) {
secret32 = base32.stringify(base64.parse(secret))
secret32 = secret32.replace(/=+$/, "")
totp_uri = 'otpauth://totp/myGov?secret=' + secret32 + '&algorithm=SHA512'
qrcode.toDataURL(totp_uri)
.then(url => {
setStatus("Enroll this secret in your TOTP client and enter the current code");
setDetail(totp_uri + '<p><img src="' + url + '">');
showCodeForm(true);
})
.catch(err => {
setError("QR encoding error", err);
})
}
</p>