mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-15 05:13:23 +00:00
Send publicKey in RPC requests for implicit username claiming
Updated client to send publicKey in all authenticated RPC requests, enabling server-side implicit username claiming. Changes: - Added publicKey field to RpcRequest interface - Added publicKey to all authenticated RPC method calls - Removed username claiming requirement from publishService() - Auto-mark username as claimed after successful publish Users no longer need to call claimUsername() before publishing services. The server will automatically claim the username on the first authenticated request. 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -167,18 +167,13 @@ export class Rondevu {
|
||||
|
||||
/**
|
||||
* Publish a service with automatic signature generation
|
||||
* Username will be automatically claimed on first publish if not already claimed
|
||||
*/
|
||||
async publishService(options: PublishServiceOptions): Promise<Service> {
|
||||
if (!this.keypair) {
|
||||
throw new Error('Not initialized. Call initialize() first.')
|
||||
}
|
||||
|
||||
if (!this.usernameClaimed) {
|
||||
throw new Error(
|
||||
'Username not claimed. Call claimUsername() first or the server will reject the service.'
|
||||
)
|
||||
}
|
||||
|
||||
const { serviceFqn, offers, ttl } = options
|
||||
|
||||
// Generate signature for service publication
|
||||
@@ -194,8 +189,13 @@ export class Rondevu {
|
||||
ttl,
|
||||
}
|
||||
|
||||
// Publish to server
|
||||
return await this.getAPI().publishService(serviceRequest)
|
||||
// Publish to server (server will auto-claim username if needed)
|
||||
const result = await this.getAPI().publishService(serviceRequest)
|
||||
|
||||
// Mark username as claimed after successful publish
|
||||
this.usernameClaimed = true
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// ============================================
|
||||
|
||||
Reference in New Issue
Block a user