@xtr-dev/rondevu-client 0.12.0 → 0.12.2
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.
- package/dist/api.d.ts +3 -1
- package/dist/rondevu-service.d.ts +2 -2
- package/dist/rondevu-service.js +18 -4
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -152,7 +152,9 @@ export declare class RondevuAPI {
|
|
|
152
152
|
*/
|
|
153
153
|
checkUsername(username: string): Promise<{
|
|
154
154
|
available: boolean;
|
|
155
|
-
|
|
155
|
+
publicKey?: string;
|
|
156
|
+
claimedAt?: number;
|
|
157
|
+
expiresAt?: number;
|
|
156
158
|
}>;
|
|
157
159
|
/**
|
|
158
160
|
* Claim a username (requires Ed25519 signature)
|
|
@@ -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
|
*/
|
package/dist/rondevu-service.js
CHANGED
|
@@ -63,7 +63,7 @@ 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.
|
|
66
|
+
if (check.publicKey === this.keypair.publicKey) {
|
|
67
67
|
this.usernameClaimed = true;
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
@@ -123,10 +123,24 @@ export class RondevuService {
|
|
|
123
123
|
return this.keypair?.publicKey || null;
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
* Check if username has been claimed
|
|
126
|
+
* Check if username has been claimed (checks with server)
|
|
127
127
|
*/
|
|
128
|
-
isUsernameClaimed() {
|
|
129
|
-
|
|
128
|
+
async isUsernameClaimed() {
|
|
129
|
+
if (!this.keypair) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
const check = await this.api.checkUsername(this.username);
|
|
134
|
+
// Username is claimed if it's not available and owned by our public key
|
|
135
|
+
const claimed = !check.available && check.publicKey === this.keypair.publicKey;
|
|
136
|
+
// Update internal flag to match server state
|
|
137
|
+
this.usernameClaimed = claimed;
|
|
138
|
+
return claimed;
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
console.error('Failed to check username claim status:', err);
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
130
144
|
}
|
|
131
145
|
/**
|
|
132
146
|
* Access to underlying API for advanced operations
|
package/package.json
CHANGED