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
3.6 KiB
1 lines
3.6 KiB
var b=Object.defineProperty;var _=(t,e,s)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var p=(t,e,s)=>_(t,typeof e!="symbol"?e+"":e,s);import{V as g,a9 as w,e as x,M as D,C as A,_ as C,g as k,h as u,j as i,i as P,k as I,l as E,F as O,z as $,x as l,p as f,t as F}from"./index-BLqts8WY.js";import{aC as V,aF as T,aG as B,aD as N,aE as S}from"./index-MyY_xqVN.js";import"./index-CsfPLOYu.js";var j=Object.defineProperty,H=Object.getOwnPropertyDescriptor,M=(t,e,s,o)=>{for(var n=o>1?void 0:o?H(e,s):e,c=t.length-1,r;c>=0;c--)(r=t[c])&&(n=(o?r(e,s,n):r(n))||n);return o&&n&&j(e,s,n),n};let h=class extends g{constructor(){super(...arguments);p(this,"derivationPath",V);p(this,"didArrays",[]);p(this,"selectedArrayFirstDid","")}async mounted(){const e=await T(),s={};e.forEach(o=>{const n=s[o.mnemonic]||[];s[o.mnemonic]=n.concat([o.did])}),this.didArrays=Object.values(s),this.selectedArrayFirstDid=this.didArrays[0][0]}onCancelClick(){this.$router.back()}switchAccount(e){this.selectedArrayFirstDid=e}async incrementDerivation(){const e=this.didArrays.find(d=>d[0]===this.selectedArrayFirstDid)||[],s=await w,o=await s.accounts.where("did").anyOf(...e).toArray(),n=o[0];o.slice(1).forEach(d=>{d.derivationPath>n.derivationPath&&(n.derivationPath=d.derivationPath)});const c=B(n.derivationPath),r=n.mnemonic,[a,v,y]=N(r,c),m=S(a,y,v,c);try{await s.accounts.add({dateCreated:new Date().toISOString(),derivationPath:c,did:m.did,identity:JSON.stringify(m),mnemonic:r,publicKeyHex:m.keys[0].publicKeyHex}),await x.open(),await x.settings.update(D,{activeDid:m.did}),this.$router.push({name:"account"})}catch(d){console.error("Error saving mnemonic & updating settings:",d)}}};h=M([A({components:{}})],h);const K={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},R={id:"ViewBreadcrumb",class:"mb-8"},G={class:"text-lg text-center font-light relative px-7"},L={key:0},W={class:"mb-4"},z=["onClick"],J={class:"overflow-hidden"},U={class:"text-sm text-slate-500 truncate"},Y={class:"mt-8"},q={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"};function Q(t,e,s,o,n,c){const r=k("fa");return l(),u("section",K,[i("div",R,[i("h1",G,[i("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"},[P(r,{icon:"chevron-left"})]),e[3]||(e[3]=I(" Derive from Existing Identity "))])]),i("div",null,[e[4]||(e[4]=i("p",{class:"text-center text-xl mb-4 font-light"}," Will increment the maximum known derivation path from the existing seed. ",-1)),t.didArrays.length>1?(l(),u("p",L," Choose existing DIDs from same seed phrase to compute derivation. ")):E("",!0),i("ul",W,[(l(!0),u(O,null,$(t.didArrays,a=>(l(),u("li",{class:"block bg-slate-100 rounded-md flex items-center px-4 py-3 mb-2",key:a[0],onClick:v=>t.switchAccount(a[0])},[a[0]==t.selectedArrayFirstDid?(l(),f(r,{key:0,icon:"circle",class:"fa-fw text-blue-400 text-xl mr-3"})):(l(),f(r,{key:1,icon:"circle",class:"fa-fw text-slate-400 text-xl mr-3"})),i("span",J,[i("div",U,[i("code",null,F(a.join(",")),1)])])],8,z))),128))])]),i("div",Y,[i("div",q,[i("button",{onClick:e[1]||(e[1]=a=>t.incrementDerivation()),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"}," Increment and Import "),i("button",{onClick:e[2]||(e[2]=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 se=C(h,[["render",Q]]);export{se as default};
|
|
|