You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
4.7 KiB
1 lines
4.7 KiB
var w=Object.defineProperty;var x=(t,e,s)=>e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var n=(t,e,s)=>x(t,typeof e!="symbol"?e+"":e,s);import{V as y,A as f,f as E,a9 as A,e as h,M as P,C,_ as S,g as k,h as u,j as o,i as I,k as m,m as c,s as g,o as T,l as v,x as p}from"./index-BLqts8WY.js";import{aC as O,G as V,aD as $,aE as N}from"./index-MyY_xqVN.js";import"./index-CsfPLOYu.js";var _=Object.defineProperty,D=Object.getOwnPropertyDescriptor,R=(t,e,s,r)=>{for(var i=r>1?void 0:r?D(e,s):e,l=t.length-1,d;l>=0;l--)(d=t[l])&&(i=(r?d(e,s,i):d(i))||i);return r&&i&&_(e,s,i),i};let b=class extends y{constructor(){super(...arguments);n(this,"TEST_USER_0_MNEMONIC","rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage");n(this,"UPORT_DERIVATION_PATH","m/7696500'/0'/0'/0'");n(this,"AppString",f);n(this,"$notify");n(this,"apiServer","");n(this,"address","");n(this,"derivationPath",O);n(this,"mnemonic","");n(this,"numAccounts",0);n(this,"privateHex","");n(this,"publicHex","");n(this,"showAdvanced",!1);n(this,"shouldErase",!1)}async created(){this.numAccounts=await V();const s=await E();this.apiServer=s.apiServer||""}onCancelClick(){this.$router.back()}isNotProdServer(){return this.apiServer!==f.PROD_ENDORSER_API_SERVER}async fromMnemonic(){const s=this.mnemonic.trim().toLowerCase();try{[this.address,this.privateHex,this.publicHex]=$(s,this.derivationPath);const r=N(this.address,this.publicHex,this.privateHex,this.derivationPath),i=await A;this.shouldErase&&await i.accounts.clear(),await i.accounts.add({dateCreated:new Date().toISOString(),derivationPath:this.derivationPath,did:r.did,identity:JSON.stringify(r),mnemonic:s,publicKeyHex:r.keys[0].publicKeyHex}),await h.open(),await h.settings.update(P,{activeDid:r.did}),this.$router.push({name:"account"})}catch(r){console.error("Error saving mnemonic & updating settings:",r),r=="Error: invalid mnemonic"?this.$notify({group:"alert",type:"danger",title:"Invalid Mnemonic",text:"Please check your mnemonic and try again."},-1):this.$notify({group:"alert",type:"danger",title:"Error",text:"Got an error creating that identifier."},-1)}}};b=R([C({components:{}})],b);const H={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},M={id:"ViewBreadcrumb",class:"mb-8"},U={class:"text-lg text-center font-light relative px-7"},B={key:0},j={class:"ml-4"},F={key:0,class:"mt-4"},G={key:1,class:"mt-4 text-blue-500"},K={class:"mt-8"},L={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"};function J(t,e,s,r,i,l){const d=k("fa");return p(),u("section",H,[o("div",M,[o("h1",U,[o("button",{onClick:e[0]||(e[0]=a=>t.$router.go(-1)),class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1"},[I(d,{icon:"chevron-left"})]),e[9]||(e[9]=m(" Import Existing Identifier "))])]),e[13]||(e[13]=o("p",{class:"text-center text-xl mb-4 font-light"}," Enter your seed phrase below to import your identifier on this device. ",-1)),c(o("textarea",{id:"seed-input",type:"text",placeholder:"Seed Phrase",class:"block w-full rounded border border-slate-400 mb-4 px-3 py-2","onUpdate:modelValue":e[1]||(e[1]=a=>t.mnemonic=a)},null,512),[[g,t.mnemonic]]),o("h3",{class:"text-sm uppercase font-semibold mb-3",onClick:e[2]||(e[2]=a=>t.showAdvanced=!t.showAdvanced)}," Advanced "),t.showAdvanced?(p(),u("div",B,[e[12]||(e[12]=m(" Enter a custom derivation path ")),c(o("input",{type:"text",class:"block w-full rounded border border-slate-400 mb-2 px-3 py-2","onUpdate:modelValue":e[3]||(e[3]=a=>t.derivationPath=a)},null,512),[[g,t.derivationPath]]),o("span",j,[e[10]||(e[10]=m(" For previous uPort or Endorser users, ")),o("a",{onClick:e[4]||(e[4]=a=>t.derivationPath=t.UPORT_DERIVATION_PATH),class:"text-blue-500"}," click here to use that value. ")]),t.numAccounts==1?(p(),u("div",F,[c(o("input",{type:"checkbox",class:"mr-2","onUpdate:modelValue":e[5]||(e[5]=a=>t.shouldErase=a)},null,512),[[T,t.shouldErase]]),e[11]||(e[11]=o("label",null,"Erase the previous identifier.",-1))])):v("",!0),t.isNotProdServer()?(p(),u("div",G,[o("button",{onClick:e[6]||(e[6]=a=>t.mnemonic=t.TEST_USER_0_MNEMONIC)}," Use mnemonic for Test User #0 ")])):v("",!0)])):v("",!0),o("div",K,[o("div",L,[o("button",{onClick:e[7]||(e[7]=a=>t.fromMnemonic()),class:"block w-full text-center text-lg font-bold uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md"}," Import "),o("button",{onClick:e[8]||(e[8]=a=>t.onCancelClick()),type:"button",class:"block w-full text-center text-md uppercase bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md"}," Cancel ")])])])}const X=S(b,[["render",J]]);export{X as default};
|
|
|