Files
archy-demo/web-dist/assets/OnboardingDid-Cr_ec55a.js

2 lines
6.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as j,o as T,O as B,c as o,a as t,G as l,D as m,N as M,r,B as _,x as z,q as a,t as V}from"./index-DnbYEqLr.js";const Y={class:"min-h-full flex items-center justify-center p-3 sm:p-4 md:p-6"},F={class:"max-w-[800px] w-full relative z-10 path-glass-container onb-scroll-container"},O={key:0,class:"text-center flex-shrink-0"},G={class:"flex flex-col items-center gap-6 mb-6"},H={key:0,class:"text-center"},L={key:0,class:"flex items-center justify-center gap-3 mb-2"},$={class:"text-sm text-white/40 font-mono tabular-nums"},E={key:1,class:"text-sm text-white/50"},P={key:2,class:"text-lg text-white/80"},q={key:1,class:"w-full max-w-[600px] space-y-4"},J={class:"path-option-card cursor-default px-6 py-6"},R={class:"text-left"},U={class:"bg-black/40 rounded-lg p-4 mb-3 backdrop-blur-sm border border-white/10 flex items-start gap-3"},W={class:"text-white/95 font-mono text-sm break-all leading-relaxed flex-1"},A=["title"],K={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},Q={key:1,class:"w-4 h-4 text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},X={key:0,class:"text-left mt-4"},Z={class:"bg-black/40 rounded-lg p-4 mb-3 backdrop-blur-sm border border-white/10 flex items-start gap-3"},ee={class:"text-white/95 font-mono text-sm break-all leading-relaxed flex-1"},te=["title"],se={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},oe={key:1,class:"w-4 h-4 text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},ae={class:"flex gap-4 max-w-[600px] mx-auto flex-shrink-0"},ne=j({__name:"OnboardingDid",setup(ie){const b=z(),n=r(""),d=r(""),c=r(!1),i=r(!1),p=r(!1),v=r(!1),k=r("0:00");let x=null,h=null,w=0;function y(){w=Date.now(),h=setInterval(()=>{const s=Math.floor((Date.now()-w)/1e3),e=Math.floor(s/60),u=s%60;k.value=`${e}:${u.toString().padStart(2,"0")}`},1e3)}function f(){x&&(clearTimeout(x),x=null),h&&(clearInterval(h),h=null)}function C(s,e){localStorage.setItem("neode_did",s),localStorage.setItem("neode_did_state",JSON.stringify({did:s,kid:`${s}#key-1`,pubkey:e}))}async function g(){i.value||(c.value=!0);try{const{did:s,pubkey:e}=await _.getNodeDid();f(),n.value=s,C(s,e),c.value=!1,i.value=!1,_.getNostrPubkey().then(({nostr_npub:u})=>{u&&(d.value=u,localStorage.setItem("neode_nostr_npub",u))}).catch(()=>{})}catch{c.value=!1,i.value||(i.value=!0,y()),x=setTimeout(g,4e3)}}T(()=>{const s=localStorage.getItem("neode_did"),e=localStorage.getItem("neode_nostr_npub");e&&(d.value=e),s&&!s.includes("...")?n.value=s:g()}),B(()=>{f()});function D(){f(),b.push("/onboarding/identity").catch(()=>{})}function I(){f(),b.push("/onboarding/identity").catch(()=>{})}function N(){n.value&&(navigator.clipboard.writeText(n.value).catch(()=>{}),p.value=!0,setTimeout(()=>{p.value=!1},2e3))}function S(){d.value&&(navigator.clipboard.writeText(d.value).catch(()=>{}),v.value=!0,setTimeout(()=>{v.value=!1},2e3))}return(s,e)=>(a(),o("div",Y,[t("div",F,[n.value?l("",!0):(a(),o("div",O,[...e[0]||(e[0]=[t("h1",{class:"text-xl sm:text-2xl md:text-[26px] font-semibold text-white/96 mb-3 sm:mb-6 drop-shadow-[0_2px_6px_rgba(0,0,0,0.4)]"}," Your node's identity ",-1),t("p",{class:"text-sm sm:text-base md:text-[20px] text-white/75 leading-relaxed max-w-[600px] mx-auto mb-4 sm:mb-6"}," Your node has a Decentralized Identifier (DID) for secure, passwordless authentication. ",-1)])])),t("div",G,[!n.value&&(c.value||i.value)?(a(),o("div",H,[e[2]||(e[2]=t("div",{class:"flex justify-center mb-4"},[t("div",{class:"w-16 h-16 rounded-full bg-white/10 flex items-center justify-center onb-lock-spin"},[t("svg",{class:"w-8 h-8 text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})])])],-1)),i.value?(a(),o("div",L,[e[1]||(e[1]=t("p",{class:"text-lg text-white/80"},"Server starting up",-1)),t("span",$,m(k.value),1)])):l("",!0),i.value?(a(),o("p",E,"This usually takes 13 minutes after first boot")):l("",!0),i.value?l("",!0):(a(),o("p",P,"Generating your identity key..."))])):l("",!0),n.value?(a(),o("div",q,[e[11]||(e[11]=M('<div class="text-center mb-6" data-v-8e98e431><div class="flex justify-center mb-6" data-v-8e98e431><div class="path-option-card cursor-default w-20 h-20 rounded-full flex items-center justify-center" data-v-8e98e431><svg class="w-10 h-10 text-black" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="3" data-v-8e98e431><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" data-v-8e98e431></path></svg></div></div><p class="text-[20px] text-white/80 leading-relaxed max-w-[600px] mx-auto mb-6" data-v-8e98e431> Your node&#39;s decentralized identifier </p></div>',1)),t("div",J,[t("div",R,[e[5]||(e[5]=t("h3",{class:"text-sm font-semibold text-white/80 mb-2 uppercase tracking-wide"},"Your DID",-1)),t("div",U,[t("p",W,m(n.value),1),t("button",{onClick:N,class:"shrink-0 p-1.5 rounded hover:bg-white/10 transition-colors text-white/50 hover:text-white/90",title:p.value?"Copied!":"Copy DID"},[p.value?(a(),o("svg",Q,[...e[4]||(e[4]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"},null,-1)])])):(a(),o("svg",K,[...e[3]||(e[3]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"},null,-1)])]))],8,A)]),e[6]||(e[6]=t("p",{class:"text-xs text-white/50 mb-3"},"For Web5, federation, and verifiable credentials",-1))]),d.value?(a(),o("div",X,[e[9]||(e[9]=t("h3",{class:"text-sm font-semibold text-white/80 mb-2 uppercase tracking-wide"},"Your Nostr ID",-1)),t("div",Z,[t("p",ee,m(d.value),1),t("button",{onClick:S,class:"shrink-0 p-1.5 rounded hover:bg-white/10 transition-colors text-white/50 hover:text-white/90",title:v.value?"Copied!":"Copy npub"},[v.value?(a(),o("svg",oe,[...e[8]||(e[8]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"},null,-1)])])):(a(),o("svg",se,[...e[7]||(e[7]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"},null,-1)])]))],8,te)]),e[10]||(e[10]=t("p",{class:"text-xs text-white/50"},"For Nostr social apps and NIP-07 signing",-1))])):l("",!0)])])):l("",!0)]),t("div",ae,[t("button",{onClick:I,class:"path-action-button path-action-button--skip"}," Skip "),n.value?(a(),o("button",{key:0,onClick:D,class:"path-action-button path-action-button--continue"}," Continue ")):l("",!0)])])]))}}),re=V(ne,[["__scopeId","data-v-8e98e431"]]);export{re as default};