UNPKG

autogram-sdk

Version:
2 lines 838 B
import{a as l,c as d}from"./chunk-TGXHGPME.mjs";import"./chunk-AKHFOAFL.mjs";import"./chunk-JFEJ4PVF.mjs";import{d as i}from"./chunk-EHCYI2EK.mjs";function s(){return i(this,null,function*(){let o=yield d.init(new l,()=>{}),t=document.createElement("input");t.type="file",t.addEventListener("change",p=>i(this,null,function*(){var a;let e=(a=t.files)==null?void 0:a[0];if(!e)return;let c=yield o.sign({content:yield e.text(),filename:e.name},{level:"XAdES_BASELINE_B",container:"ASiC_E"},e.type,!0);console.log(c);let n=document.createElement("a"),r=new Blob([c.content],{type:"text/plain"}),m=URL.createObjectURL(r);n.href=m,n.download=`${e.name}.asice`,n.text=`Download ${n.download}`,document.body.appendChild(n)})),document.body.appendChild(t)})}s().then(()=>console.log("done"),o=>console.error(o)); //# sourceMappingURL=demo.mjs.map