Implement onboarding reset functionality and enhance backup features
- Added a new method to reset the onboarding state, allowing users to re-initiate the onboarding process. - Integrated backup creation functionality, enabling users to create encrypted backups of their node identity. - Updated API endpoints to handle onboarding reset and backup creation requests. - Enhanced UI components to support the new onboarding reset and backup features, including error handling and user feedback. - Introduced new dependencies for cryptographic operations and data encoding.
This commit is contained in:
@@ -693,6 +693,12 @@ app.post('/rpc/v1', (req, res) => {
|
||||
return res.json({ result: userState.onboardingComplete })
|
||||
}
|
||||
|
||||
case 'auth.resetOnboarding': {
|
||||
userState.onboardingComplete = false
|
||||
console.log('[Auth] Onboarding reset')
|
||||
return res.json({ result: true })
|
||||
}
|
||||
|
||||
case 'node.did': {
|
||||
const mockDid = 'did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH'
|
||||
const mockPubkey = 'a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456'
|
||||
@@ -705,6 +711,32 @@ app.post('/rpc/v1', (req, res) => {
|
||||
return res.json({ result: { nostr_pubkey: 'mock-nostr-pubkey-hex' } })
|
||||
}
|
||||
|
||||
case 'node.signChallenge': {
|
||||
const { challenge } = params || {}
|
||||
const mockSig = Buffer.from(`mock-sig-${challenge || 'challenge'}`).toString('hex')
|
||||
return res.json({ result: { signature: mockSig } })
|
||||
}
|
||||
|
||||
case 'node.createBackup': {
|
||||
const { passphrase } = params || {}
|
||||
if (!passphrase) {
|
||||
return res.json({ error: { code: -32602, message: 'Missing passphrase' } })
|
||||
}
|
||||
const mockDid = 'did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH'
|
||||
const mockPubkey = 'a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456'
|
||||
return res.json({
|
||||
result: {
|
||||
version: 1,
|
||||
did: mockDid,
|
||||
pubkey: mockPubkey,
|
||||
kid: `${mockDid}#key-1`,
|
||||
encrypted: true,
|
||||
blob: Buffer.from(`mock-encrypted-backup-${passphrase}`).toString('base64'),
|
||||
timestamp: new Date().toISOString(),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
case 'auth.login': {
|
||||
const { password } = params
|
||||
|
||||
|
||||
Reference in New Issue
Block a user