mirror of
https://github.com/xtr-dev/rondevu-demo.git
synced 2025-12-13 11:53:23 +00:00
Update demo for unified Ed25519 authentication
- Remove all credential storage from localStorage - Remove 'register' setup step (now: init → claim → ready) - Update initialization to work without credentials - Simplify localStorage to only username and keypair - Anonymous users auto-claim during initialize() - Named users manually claim username localStorage keys: - Keep: rondevu-username, rondevu-keypair, rondevu-contacts - Remove: rondevu-chat-credentials Setup flow: - Load username/keypair from localStorage - Create Rondevu instance (auto-generates anon username if none saved) - Call initialize() (no register call) - Check if username claimed - Show claim UI if needed, or proceed to ready
This commit is contained in:
@@ -164,15 +164,18 @@ export default function App() {
|
|||||||
|
|
||||||
const parsedKeypair = savedKeypair ? JSON.parse(savedKeypair) : undefined;
|
const parsedKeypair = savedKeypair ? JSON.parse(savedKeypair) : undefined;
|
||||||
|
|
||||||
|
// Create Rondevu instance
|
||||||
|
// If no username is saved, use undefined to let Rondevu handle it
|
||||||
const service = new Rondevu({
|
const service = new Rondevu({
|
||||||
apiUrl: API_URL,
|
apiUrl: API_URL,
|
||||||
username: savedUsername || 'temp',
|
username: savedUsername,
|
||||||
keypair: parsedKeypair,
|
keypair: parsedKeypair,
|
||||||
});
|
});
|
||||||
|
|
||||||
await service.initialize();
|
await service.initialize();
|
||||||
setRondevu(service);
|
setRondevu(service);
|
||||||
|
|
||||||
|
// Check if we have a saved username and if it's claimed
|
||||||
if (savedUsername && savedKeypair) {
|
if (savedUsername && savedKeypair) {
|
||||||
console.log('[Init] Checking if username is claimed...');
|
console.log('[Init] Checking if username is claimed...');
|
||||||
const isClaimed = await service.isUsernameClaimed();
|
const isClaimed = await service.isUsernameClaimed();
|
||||||
@@ -187,6 +190,7 @@ export default function App() {
|
|||||||
setSetupStep('claim');
|
setSetupStep('claim');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// No saved username, prompt user to claim one
|
||||||
setSetupStep('claim');
|
setSetupStep('claim');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user