@passkeyme/auth 1.3.0 → 2.0.0

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/index.js CHANGED
@@ -263,7 +263,7 @@ class ErrorHandler {
263
263
  * API Client for Passkeyme authentication services
264
264
  */
265
265
  class PasskeymeApiClient {
266
- constructor(appId, baseUrl = "https://auth.passkeyme.com", debug = false) {
266
+ constructor(appId, baseUrl, debug = false) {
267
267
  this.appId = appId;
268
268
  this.baseUrl = baseUrl.replace(/\/$/, ""); // Remove trailing slash
269
269
  this.debug = debug;
@@ -323,7 +323,7 @@ class PasskeymeApiClient {
323
323
  * Get authentication configuration for the app
324
324
  */
325
325
  async getConfig() {
326
- const backendConfig = await this.request(`/api/${this.appId}/config`);
326
+ const backendConfig = await this.request(`${this.baseUrl}/api/auth/${this.appId}/config`);
327
327
  // Map backend response to SDK format
328
328
  return {
329
329
  appId: backendConfig.app_id,
@@ -346,7 +346,7 @@ class PasskeymeApiClient {
346
346
  */
347
347
  async startOAuth(provider, redirectUri) {
348
348
  const params = new URLSearchParams({ redirect_uri: redirectUri });
349
- const url = `${this.baseUrl}/auth/${this.appId}/oauth/${provider}/start?${params}`;
349
+ const url = `${this.baseUrl}/api/auth/${this.appId}/oauth/${provider}/start?${params}`;
350
350
  this.log("OAuth start URL:", url);
351
351
  return url;
352
352
  }
@@ -354,7 +354,7 @@ class PasskeymeApiClient {
354
354
  * Start passkey authentication
355
355
  */
356
356
  async startPasskeyAuth(username) {
357
- return this.request(`/auth/${this.appId}/passkey/start`, {
357
+ return this.request(`/api/auth/${this.appId}/passkey/start`, {
358
358
  method: "POST",
359
359
  body: JSON.stringify({ username }),
360
360
  });
@@ -363,7 +363,7 @@ class PasskeymeApiClient {
363
363
  * Complete passkey authentication
364
364
  */
365
365
  async completePasskeyAuth(credential, redirectUri) {
366
- return this.request(`/auth/${this.appId}/passkey/complete`, {
366
+ return this.request(`/api/auth/${this.appId}/passkey/complete`, {
367
367
  method: "POST",
368
368
  body: JSON.stringify({ credential, redirect_uri: redirectUri }),
369
369
  });
@@ -372,7 +372,7 @@ class PasskeymeApiClient {
372
372
  * Login with username/password
373
373
  */
374
374
  async loginWithPassword(username, password, redirectUri) {
375
- return this.request(`/auth/${this.appId}/password/login`, {
375
+ return this.request(`/api/auth/${this.appId}/login`, {
376
376
  method: "POST",
377
377
  body: JSON.stringify({
378
378
  username,
@@ -385,7 +385,7 @@ class PasskeymeApiClient {
385
385
  * Handle OAuth callback
386
386
  */
387
387
  async handleOAuthCallback(code, state) {
388
- return this.request(`/auth/${this.appId}/oauth/callback`, {
388
+ return this.request(`/api/auth/${this.appId}/oauth/callback`, {
389
389
  method: "POST",
390
390
  body: JSON.stringify({ code, state }),
391
391
  });
@@ -399,7 +399,7 @@ class PasskeymeApiClient {
399
399
  token: token,
400
400
  app_id: this.appId,
401
401
  });
402
- const response = (await this.request(`/auth/verify-token?${params.toString()}`, {
402
+ const response = (await this.request(`${this.baseUrl}/api/auth/verify-token?${params.toString()}`, {
403
403
  method: "GET",
404
404
  }));
405
405
  if (!response.valid) {
@@ -426,7 +426,7 @@ class PasskeymeApiClient {
426
426
  * Refresh access token
427
427
  */
428
428
  async refreshToken(refreshToken) {
429
- return this.request("/auth/refresh-token", {
429
+ return this.request("/api/auth/refresh-token", {
430
430
  method: "POST",
431
431
  body: JSON.stringify({ refresh_token: refreshToken }),
432
432
  });
@@ -435,13 +435,13 @@ class PasskeymeApiClient {
435
435
  * Get JWKS for token verification
436
436
  */
437
437
  async getJWKS() {
438
- return this.request("/auth/jwks");
438
+ return this.request("/api/auth/jwks");
439
439
  }
440
440
  /**
441
441
  * Exchange authorization code for tokens (hosted auth callback)
442
442
  */
443
443
  async exchangeCodeForTokens(code, redirectUri) {
444
- const result = await this.request("/auth/callback", {
444
+ const result = await this.request("/api/auth/callback", {
445
445
  method: "POST",
446
446
  body: JSON.stringify({
447
447
  code,