feat: BIP-39 master seed for unified key derivation
Replace fragmented random key generation with a single 24-word BIP-39 mnemonic that deterministically derives all node keys: Ed25519 (DID), secp256k1 (Nostr/Bitcoin), BIP-84 xprv (Bitcoin Core), and LND aezeed entropy. New onboarding flow: seed generate → word verification → identity naming. Restore path enabled via 24-word entry. Includes seed RPC handlers, mock backend support, LND/Bitcoin Core wallet-from-seed integration, and UI polish across settings and discover views. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
5da9e217e6
commit
19dcfd4f31
@@ -29,40 +29,11 @@
|
||||
tabindex="0"
|
||||
role="button"
|
||||
class="text-white/50 hover:text-white/80 underline text-sm cursor-pointer mt-4 block text-center onb-cta"
|
||||
@click="showRestore = true"
|
||||
@keydown.enter="showRestore = true"
|
||||
@click="goToRestore"
|
||||
@keydown.enter="goToRestore"
|
||||
>
|
||||
Restore from backup
|
||||
Restore from seed phrase
|
||||
</a>
|
||||
|
||||
<!-- Restore Panel -->
|
||||
<div v-if="showRestore" class="mt-6 glass-card px-6 py-6 text-left">
|
||||
<h3 class="text-sm font-semibold text-white/80 mb-3 uppercase tracking-wide">Restore Identity from Backup</h3>
|
||||
<input
|
||||
type="file"
|
||||
accept=".json"
|
||||
class="block w-full text-sm text-white/60 file:mr-4 file:py-2 file:px-4 file:rounded file:border-0 file:text-sm file:bg-white/10 file:text-white/80 hover:file:bg-white/20 mb-3"
|
||||
@change="onFileSelect"
|
||||
/>
|
||||
<input
|
||||
v-model="passphrase"
|
||||
type="password"
|
||||
placeholder="Backup passphrase"
|
||||
class="w-full px-4 py-2 bg-white/10 border border-white/20 rounded-lg text-white text-sm focus:outline-none focus:border-white/40 mb-3"
|
||||
/>
|
||||
<p v-if="restoreError" class="text-red-400 text-xs mb-2">{{ restoreError }}</p>
|
||||
<p v-if="restoreSuccess" class="text-green-400 text-xs mb-2">Identity restored successfully!</p>
|
||||
<div class="flex gap-3">
|
||||
<button class="glass-button text-sm px-4 py-2" @click="showRestore = false">Cancel</button>
|
||||
<button
|
||||
class="glass-button text-sm px-4 py-2"
|
||||
:disabled="!restoreFile || !passphrase || restoreLoading"
|
||||
@click="performRestore"
|
||||
>
|
||||
{{ restoreLoading ? 'Restoring...' : 'Restore' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,7 +43,6 @@
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import AnimatedLogo from '@/components/AnimatedLogo.vue'
|
||||
import { rpcClient } from '@/api/rpc-client'
|
||||
import { playNavSound } from '@/composables/useNavSounds'
|
||||
|
||||
const router = useRouter()
|
||||
@@ -90,49 +60,9 @@ function goToOptions() {
|
||||
router.push('/onboarding/path').catch(() => {})
|
||||
}
|
||||
|
||||
// Restore from backup
|
||||
const showRestore = ref(false)
|
||||
const restoreFile = ref<Record<string, unknown> | null>(null)
|
||||
const passphrase = ref('')
|
||||
const restoreLoading = ref(false)
|
||||
const restoreError = ref('')
|
||||
const restoreSuccess = ref(false)
|
||||
|
||||
function onFileSelect(e: Event) {
|
||||
const target = e.target as HTMLInputElement
|
||||
const file = target.files?.[0]
|
||||
if (!file) return
|
||||
const reader = new FileReader()
|
||||
reader.onload = () => {
|
||||
try {
|
||||
restoreFile.value = JSON.parse(reader.result as string)
|
||||
restoreError.value = ''
|
||||
} catch {
|
||||
restoreError.value = 'Invalid backup file format'
|
||||
restoreFile.value = null
|
||||
}
|
||||
}
|
||||
reader.readAsText(file)
|
||||
}
|
||||
|
||||
async function performRestore() {
|
||||
if (!restoreFile.value || !passphrase.value) return
|
||||
restoreLoading.value = true
|
||||
restoreError.value = ''
|
||||
try {
|
||||
await rpcClient.call({
|
||||
method: 'backup.restore-identity',
|
||||
params: { backup: restoreFile.value, passphrase: passphrase.value },
|
||||
})
|
||||
restoreSuccess.value = true
|
||||
setTimeout(() => {
|
||||
router.push('/onboarding/did')
|
||||
}, 1500)
|
||||
} catch (err) {
|
||||
restoreError.value = err instanceof Error ? err.message : 'Restore failed'
|
||||
} finally {
|
||||
restoreLoading.value = false
|
||||
}
|
||||
function goToRestore() {
|
||||
playNavSound('action')
|
||||
router.push('/onboarding/seed-restore').catch(() => {})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user