@xtr-dev/rondevu-client 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,9 +77,9 @@ export declare class RondevuService {
77
77
  */
78
78
  getPublicKey(): string | null;
79
79
  /**
80
- * Check if username has been claimed
80
+ * Check if username has been claimed (checks with server)
81
81
  */
82
- isUsernameClaimed(): boolean;
82
+ isUsernameClaimed(): Promise<boolean>;
83
83
  /**
84
84
  * Access to underlying API for advanced operations
85
85
  */
@@ -63,7 +63,8 @@ export class RondevuService {
63
63
  const check = await this.api.checkUsername(this.username);
64
64
  if (!check.available) {
65
65
  // Verify it's claimed by us
66
- if (check.owner === this.keypair.publicKey) {
66
+ const owner = check.owner || check.publicKey;
67
+ if (owner === this.keypair.publicKey) {
67
68
  this.usernameClaimed = true;
68
69
  return;
69
70
  }
@@ -123,10 +124,24 @@ export class RondevuService {
123
124
  return this.keypair?.publicKey || null;
124
125
  }
125
126
  /**
126
- * Check if username has been claimed
127
+ * Check if username has been claimed (checks with server)
127
128
  */
128
- isUsernameClaimed() {
129
- return this.usernameClaimed;
129
+ async isUsernameClaimed() {
130
+ if (!this.keypair) {
131
+ return false;
132
+ }
133
+ try {
134
+ const check = await this.api.checkUsername(this.username);
135
+ // Username is claimed if it's not available and owned by our public key
136
+ const claimed = !check.available && (check.owner === this.keypair.publicKey || check.publicKey === this.keypair.publicKey);
137
+ // Update internal flag to match server state
138
+ this.usernameClaimed = claimed;
139
+ return claimed;
140
+ }
141
+ catch (err) {
142
+ console.error('Failed to check username claim status:', err);
143
+ return false;
144
+ }
130
145
  }
131
146
  /**
132
147
  * Access to underlying API for advanced operations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtr-dev/rondevu-client",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "TypeScript client for Rondevu with durable WebRTC connections, automatic reconnection, and message queuing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",