1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[406],{1371:function(e,t,r){Promise.resolve().then(r.bind(r,9346))},9346:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return g}});var n=r(7437),s=r(3548),o=r(2633),a=r(9609),c=r(741),i=r(2959),l=r(6287),d=r(3116),u=r(22),p=r(3759),h=r(6136),f=r(5212),m=r(5781),x=r(2537),y=r(2265);function g(){let[e,t]=(0,y.useState)(null),[r,s]=(0,y.useState)(!1);return(0,n.jsxs)(u.Z,{title:"Encrypt QR Codes",children:[(0,n.jsxs)(p.E,{children:[(0,n.jsx)(j,{setQrCodeInfo:t,setIsEncrypting:s}),(0,n.jsx)(i.Z,{title:"Decrypted QR Code",isLoading:r,qrCodeInfo:e,getFileName:e=>"qr-decrypted-".concat(e.date,"-").concat(e.hint),extraInfo:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"mb-1 mt-4 text-sm",children:"Decrypted text"}),(0,n.jsx)("p",{className:"text-mono whitespace-pre-wrap break-words rounded-md border border-gray-300 bg-gray-50 p-2 text-sm shadow-sm",children:null==e?void 0:e.dataDecrypted})]})})]}),(0,n.jsx)(d.Z,{faqs:l.DW})]})}async function b(e){let{qrCodeData:t,pass:r}=e,n=(0,o.o)(t);console.info("Encrypted data:"),console.table({...n});let c=await (0,s._)(crypto,n,r),i=(0,a.te)(c,{title:n.hint});return console.info("Decrypted data:"),console.table({dataDecrypted:c}),{svgHtml:i,dataEncrypted:n,dataDecrypted:c}}function j(e){return(0,n.jsx)(x.J9,{initialValues:{image:"",pass:"",qrCodeData:""},onSubmit:async(t,r)=>{e.setQrCodeInfo(null),e.setIsEncrypting(!0),await b(t).then(e.setQrCodeInfo).catch(e=>{console.info(e),r.setErrors((0,c.e$)(e))}),e.setIsEncrypting(!1)},children:e=>{let{isValid:t,errors:r,values:{qrCodeData:s}}=e;return(0,n.jsx)(p.s,{title:"Decrypt a QR Code",hasError:"string"==typeof r,icon:(0,n.jsx)(m.Z,{className:"-mt-0.5 mr-2 h-6 w-6 text-gray-300"}),children:(0,n.jsxs)(x.l0,{className:"flex flex-1 flex-col space-y-4",children:[(0,n.jsx)(h.Z,{demoSrc:"/demo/qr-code-encrypted.png",demoDescription:"Password is 'pass-1234567890'"}),(0,n.jsx)(f.Z,{name:"pass",label:"Password",type:"password",description:"Used to encrypt the QR code. Unrecoverable if lost.",minLength:1,disabled:!s,placeholder:"hunter2"}),(0,n.jsx)("div",{className:"flex-1"}),"string"==typeof r&&(0,n.jsx)("p",{className:"text-red-500",children:r}),(0,n.jsxs)("button",{type:"submit",className:"action-button mt-1",disabled:!(s&&t),children:[(0,n.jsx)(m.Z,{className:"mr-1 h-5 w-5"}),(0,n.jsx)("span",{children:"Decrypt"})]})]})})}})}},2633:function(e,t,r){"use strict";function n(e){try{let t;try{t=JSON.parse(e)}catch(t){throw console.info("Could not parse JSON:",e),Error("Data is not valid JSON")}return function(e){if(!(e&&"object"==typeof e))throw Error("Data is not a valid object");return e.vers||(e.vers="v0"),{iv:s("iv",e),salt:s("salt",e),cipherText:s("cipherText",e),vers:s("vers",e),hint:s("hint",e),date:s("date",e)}}(t)}catch(e){throw console.info(e),Error("Data is unencrypted or in the wrong format")}}function s(e,t){return function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e&&"string"==typeof e&&e.trim().length>=t}(t))throw Error("'".concat(e,"' is not a valid string"));if(t.length<r)throw Error("'".concat(e,"' must be at least ").concat(r," chars long"));return t}(e,t[e])}r.d(t,{o:function(){return n}})}},function(e){e.O(0,[250,509,684,137,971,938,744],function(){return e(e.s=1371)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.