mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-13 20:33:25 +00:00
Remove explicit claimUsername RPC handler - claiming now fully implicit
Username claiming is now handled automatically in verifyAuth() when a username doesn't exist. The separate claimUsername RPC method is no longer needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
29
src/rpc.ts
29
src/rpc.ts
@@ -150,35 +150,6 @@ const handlers: Record<string, RpcHandler> = {
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Claim a username
|
||||
*/
|
||||
async claimUsername(params, message, signature, publicKey, storage, config) {
|
||||
const { username, publicKey: paramPublicKey } = params;
|
||||
|
||||
// Validate claim
|
||||
const validation = await validateUsernameClaim(
|
||||
username,
|
||||
paramPublicKey,
|
||||
signature,
|
||||
message
|
||||
);
|
||||
|
||||
if (!validation.valid) {
|
||||
throw new Error(validation.error || 'Invalid username claim');
|
||||
}
|
||||
|
||||
// Claim the username
|
||||
const expiresAt = Date.now() + 365 * 24 * 60 * 60 * 1000; // 365 days
|
||||
await storage.claimUsername({
|
||||
username,
|
||||
publicKey: paramPublicKey,
|
||||
expiresAt,
|
||||
});
|
||||
|
||||
return { success: true, username };
|
||||
},
|
||||
|
||||
/**
|
||||
* Get service by FQN
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user