diff --git a/src/auth/client.ts b/src/auth/client.ts index 0b7348b..49f55d3 100644 --- a/src/auth/client.ts +++ b/src/auth/client.ts @@ -170,9 +170,12 @@ export class AuthClient { chain_type?: "ETH" | "SOL"; }): Promise<{ access_token: string; - refresh_token: string; + refresh_token?: string; subject: string; namespace: string; + api_key?: string; + expires_in?: number; + token_type?: string; }> { const response = await this.httpClient.post("/v1/auth/verify", { wallet: params.wallet, @@ -182,10 +185,20 @@ export class AuthClient { chain_type: params.chain_type || "ETH", }); - // Automatically set the JWT + // Persist JWT this.setJwt(response.access_token); - return response; + // Persist API key if server provided it (created in verifyHandler) + if ((response as any).api_key) { + this.setApiKey((response as any).api_key); + } + + // Persist refresh token if present (optional, for silent renewal) + if ((response as any).refresh_token) { + await this.storage.set("refreshToken", (response as any).refresh_token); + } + + return response as any; } /** diff --git a/src/pubsub/client.ts b/src/pubsub/client.ts index 7cffd82..f059313 100644 --- a/src/pubsub/client.ts +++ b/src/pubsub/client.ts @@ -82,8 +82,6 @@ export class PubSubClient { dataBase64 = base64EncodeBytes(data); } - console.log("[PubSubClient] Publishing to topic:", topic); - await this.httpClient.post( "/v1/pubsub/publish", {