@passkeyme/auth 1.3.0 → 2.0.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.
package/dist/index.esm.js CHANGED
@@ -259,7 +259,7 @@ class ErrorHandler {
259
259
  * API Client for Passkeyme authentication services
260
260
  */
261
261
  class PasskeymeApiClient {
262
- constructor(appId, baseUrl = "https://auth.passkeyme.com", debug = false) {
262
+ constructor(appId, baseUrl, debug = false) {
263
263
  this.appId = appId;
264
264
  this.baseUrl = baseUrl.replace(/\/$/, ""); // Remove trailing slash
265
265
  this.debug = debug;
@@ -319,7 +319,7 @@ class PasskeymeApiClient {
319
319
  * Get authentication configuration for the app
320
320
  */
321
321
  async getConfig() {
322
- const backendConfig = await this.request(`/api/${this.appId}/config`);
322
+ const backendConfig = await this.request(`/api/auth/${this.appId}/config`);
323
323
  // Map backend response to SDK format
324
324
  return {
325
325
  appId: backendConfig.app_id,
@@ -342,7 +342,7 @@ class PasskeymeApiClient {
342
342
  */
343
343
  async startOAuth(provider, redirectUri) {
344
344
  const params = new URLSearchParams({ redirect_uri: redirectUri });
345
- const url = `${this.baseUrl}/auth/${this.appId}/oauth/${provider}/start?${params}`;
345
+ const url = `${this.baseUrl}/api/auth/${this.appId}/oauth/${provider}/start?${params}`;
346
346
  this.log("OAuth start URL:", url);
347
347
  return url;
348
348
  }
@@ -350,7 +350,7 @@ class PasskeymeApiClient {
350
350
  * Start passkey authentication
351
351
  */
352
352
  async startPasskeyAuth(username) {
353
- return this.request(`/auth/${this.appId}/passkey/start`, {
353
+ return this.request(`/api/auth/${this.appId}/passkey/start`, {
354
354
  method: "POST",
355
355
  body: JSON.stringify({ username }),
356
356
  });
@@ -359,7 +359,7 @@ class PasskeymeApiClient {
359
359
  * Complete passkey authentication
360
360
  */
361
361
  async completePasskeyAuth(credential, redirectUri) {
362
- return this.request(`/auth/${this.appId}/passkey/complete`, {
362
+ return this.request(`/api/auth/${this.appId}/passkey/complete`, {
363
363
  method: "POST",
364
364
  body: JSON.stringify({ credential, redirect_uri: redirectUri }),
365
365
  });
@@ -368,7 +368,7 @@ class PasskeymeApiClient {
368
368
  * Login with username/password
369
369
  */
370
370
  async loginWithPassword(username, password, redirectUri) {
371
- return this.request(`/auth/${this.appId}/password/login`, {
371
+ return this.request(`/api/auth/${this.appId}/login`, {
372
372
  method: "POST",
373
373
  body: JSON.stringify({
374
374
  username,
@@ -381,7 +381,7 @@ class PasskeymeApiClient {
381
381
  * Handle OAuth callback
382
382
  */
383
383
  async handleOAuthCallback(code, state) {
384
- return this.request(`/auth/${this.appId}/oauth/callback`, {
384
+ return this.request(`/api/auth/${this.appId}/oauth/callback`, {
385
385
  method: "POST",
386
386
  body: JSON.stringify({ code, state }),
387
387
  });
@@ -395,7 +395,7 @@ class PasskeymeApiClient {
395
395
  token: token,
396
396
  app_id: this.appId,
397
397
  });
398
- const response = (await this.request(`/auth/verify-token?${params.toString()}`, {
398
+ const response = (await this.request(`/api/auth/verify-token?${params.toString()}`, {
399
399
  method: "GET",
400
400
  }));
401
401
  if (!response.valid) {
@@ -422,7 +422,7 @@ class PasskeymeApiClient {
422
422
  * Refresh access token
423
423
  */
424
424
  async refreshToken(refreshToken) {
425
- return this.request("/auth/refresh-token", {
425
+ return this.request("/api/auth/refresh-token", {
426
426
  method: "POST",
427
427
  body: JSON.stringify({ refresh_token: refreshToken }),
428
428
  });
@@ -431,13 +431,13 @@ class PasskeymeApiClient {
431
431
  * Get JWKS for token verification
432
432
  */
433
433
  async getJWKS() {
434
- return this.request("/auth/jwks");
434
+ return this.request("/api/auth/jwks");
435
435
  }
436
436
  /**
437
437
  * Exchange authorization code for tokens (hosted auth callback)
438
438
  */
439
439
  async exchangeCodeForTokens(code, redirectUri) {
440
- const result = await this.request("/auth/callback", {
440
+ const result = await this.request("/api/auth/callback", {
441
441
  method: "POST",
442
442
  body: JSON.stringify({
443
443
  code,