2026-01-24 22:59:20 +00:00
|
|
|
<template>
|
|
|
|
|
<div class="min-h-screen flex items-center justify-center p-4">
|
|
|
|
|
<!-- Main Glass Container -->
|
|
|
|
|
<div class="max-w-[800px] w-full relative z-10 path-glass-container">
|
2026-03-06 13:00:28 +00:00
|
|
|
<!-- Header (before DID is retrieved) -->
|
2026-01-24 22:59:20 +00:00
|
|
|
<div v-if="!generatedDid" class="text-center flex-shrink-0">
|
|
|
|
|
<h1 class="text-[26px] font-semibold text-white/96 mb-6 drop-shadow-[0_2px_6px_rgba(0,0,0,0.4)]">
|
2026-03-02 08:34:13 +00:00
|
|
|
Your node's identity
|
2026-01-24 22:59:20 +00:00
|
|
|
</h1>
|
|
|
|
|
<p class="text-[20px] text-white/75 leading-relaxed max-w-[600px] mx-auto mb-6">
|
2026-03-06 13:00:28 +00:00
|
|
|
Your node has a Decentralized Identifier (DID) for secure, passwordless authentication.
|
2026-01-24 22:59:20 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Content Area -->
|
|
|
|
|
<div class="flex flex-col items-center gap-6 mb-6">
|
2026-03-06 13:00:28 +00:00
|
|
|
<!-- Connecting state -->
|
|
|
|
|
<div v-if="!generatedDid && isGenerating" class="text-center">
|
|
|
|
|
<div class="flex items-center justify-center gap-3 mb-4">
|
|
|
|
|
<svg class="animate-spin h-6 w-6 text-white/80" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
2026-01-24 22:59:20 +00:00
|
|
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
|
|
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
|
|
|
</svg>
|
2026-03-06 13:00:28 +00:00
|
|
|
<span class="text-lg text-white/80">Connecting to your server...</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Connection failed - retry -->
|
|
|
|
|
<div v-if="!generatedDid && !isGenerating && connectionFailed" class="text-center">
|
|
|
|
|
<p class="text-white/60 text-base mb-4">{{ errorMessage }}</p>
|
|
|
|
|
<button
|
|
|
|
|
@click="fetchDid"
|
|
|
|
|
class="path-action-button path-action-button--continue"
|
|
|
|
|
>
|
|
|
|
|
Retry
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2026-01-24 22:59:20 +00:00
|
|
|
|
|
|
|
|
<!-- Generated DID Display -->
|
|
|
|
|
<div v-if="generatedDid" class="w-full max-w-[600px] space-y-4">
|
|
|
|
|
<!-- Success Message -->
|
|
|
|
|
<div class="text-center mb-6">
|
|
|
|
|
<div class="flex justify-center mb-6">
|
|
|
|
|
<div class="path-option-card cursor-default w-20 h-20 rounded-full flex items-center justify-center">
|
|
|
|
|
<svg class="w-10 h-10 text-black" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="3">
|
|
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-03-06 13:00:28 +00:00
|
|
|
<p v-if="autoAdvancing" class="text-lg text-white/80 mb-2">DID retrieved, continuing...</p>
|
|
|
|
|
<p v-else class="text-[20px] text-white/80 leading-relaxed max-w-[600px] mx-auto mb-6">
|
2026-03-02 08:34:13 +00:00
|
|
|
Your node's decentralized identifier
|
2026-01-24 22:59:20 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- DID Display Card -->
|
|
|
|
|
<div class="path-option-card cursor-default px-6 py-6">
|
|
|
|
|
<div class="text-left">
|
|
|
|
|
<h3 class="text-sm font-semibold text-white/80 mb-2 uppercase tracking-wide">Your DID</h3>
|
|
|
|
|
<div class="bg-black/40 rounded-lg p-4 mb-3 backdrop-blur-sm border border-white/10">
|
|
|
|
|
<p class="text-white/95 font-mono text-sm break-all leading-relaxed">
|
|
|
|
|
{{ generatedDid }}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="text-base text-white/60">
|
2026-03-02 08:34:13 +00:00
|
|
|
This identifier is stored securely on your node
|
2026-01-24 22:59:20 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Action Buttons -->
|
|
|
|
|
<div class="flex gap-4 max-w-[600px] mx-auto flex-shrink-0">
|
|
|
|
|
<button
|
|
|
|
|
@click="skipForNow"
|
|
|
|
|
class="path-action-button path-action-button--skip"
|
|
|
|
|
>
|
|
|
|
|
Skip
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
v-if="generatedDid"
|
|
|
|
|
@click="proceed"
|
2026-03-06 13:00:28 +00:00
|
|
|
class="path-action-button path-action-button--continue"
|
2026-01-24 22:59:20 +00:00
|
|
|
>
|
|
|
|
|
Continue
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-03-02 08:34:13 +00:00
|
|
|
import { ref, onMounted } from 'vue'
|
2026-01-24 22:59:20 +00:00
|
|
|
import { useRouter } from 'vue-router'
|
2026-02-17 15:03:34 +00:00
|
|
|
import { rpcClient } from '@/api/rpc-client'
|
2026-01-24 22:59:20 +00:00
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const generatedDid = ref<string>('')
|
|
|
|
|
const isGenerating = ref(false)
|
2026-03-06 13:00:28 +00:00
|
|
|
const connectionFailed = ref(false)
|
|
|
|
|
const autoAdvancing = ref(false)
|
2026-02-17 15:03:34 +00:00
|
|
|
const errorMessage = ref<string>('')
|
2026-01-24 22:59:20 +00:00
|
|
|
|
2026-03-02 08:34:13 +00:00
|
|
|
function storeDidState(did: string, pubkey: string) {
|
|
|
|
|
localStorage.setItem('neode_did', did)
|
|
|
|
|
localStorage.setItem('neode_did_state', JSON.stringify({ did, kid: `${did}#key-1`, pubkey }))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function fetchDid() {
|
2026-01-24 22:59:20 +00:00
|
|
|
isGenerating.value = true
|
2026-03-06 13:00:28 +00:00
|
|
|
connectionFailed.value = false
|
2026-02-17 15:03:34 +00:00
|
|
|
errorMessage.value = ''
|
2026-01-24 22:59:20 +00:00
|
|
|
|
2026-03-01 17:53:18 +00:00
|
|
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
|
|
|
try {
|
|
|
|
|
const { did, pubkey } = await rpcClient.getNodeDid()
|
|
|
|
|
generatedDid.value = did
|
2026-03-02 08:34:13 +00:00
|
|
|
storeDidState(did, pubkey)
|
2026-03-06 13:00:28 +00:00
|
|
|
autoAdvanceAfterDelay()
|
|
|
|
|
isGenerating.value = false
|
|
|
|
|
return
|
2026-03-01 17:53:18 +00:00
|
|
|
} catch (err) {
|
|
|
|
|
if (attempt < 2) {
|
|
|
|
|
await new Promise((r) => setTimeout(r, 1000 * (attempt + 1)))
|
|
|
|
|
}
|
2026-02-17 15:03:34 +00:00
|
|
|
}
|
2026-01-24 22:59:20 +00:00
|
|
|
}
|
2026-03-06 13:00:28 +00:00
|
|
|
|
2026-03-01 17:53:18 +00:00
|
|
|
isGenerating.value = false
|
2026-03-06 13:00:28 +00:00
|
|
|
connectionFailed.value = true
|
|
|
|
|
errorMessage.value = 'Could not connect to your server. Please check that it is running and try again.'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function autoAdvanceAfterDelay() {
|
|
|
|
|
autoAdvancing.value = true
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
router.push('/onboarding/backup').catch(() => {})
|
|
|
|
|
}, 2000)
|
2026-01-24 22:59:20 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-02 08:34:13 +00:00
|
|
|
onMounted(() => {
|
|
|
|
|
const cached = localStorage.getItem('neode_did')
|
|
|
|
|
if (cached && !cached.includes('...')) {
|
|
|
|
|
generatedDid.value = cached
|
2026-03-06 13:00:28 +00:00
|
|
|
} else {
|
|
|
|
|
fetchDid()
|
2026-03-02 08:34:13 +00:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2026-01-24 22:59:20 +00:00
|
|
|
function proceed() {
|
2026-03-06 13:00:28 +00:00
|
|
|
router.push('/onboarding/backup').catch(() => {})
|
2026-01-24 22:59:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function skipForNow() {
|
2026-03-01 17:53:18 +00:00
|
|
|
router.push('/onboarding/backup').catch(() => {})
|
2026-01-24 22:59:20 +00:00
|
|
|
}
|
|
|
|
|
</script>
|