{"_id":"@eleven-am/launchpad-auth","_rev":"2-9ac7aaa72f503b7b8c4637591b778c6c","name":"@eleven-am/launchpad-auth","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@eleven-am/launchpad-auth","version":"0.1.0","keywords":["authentication","oauth","passkey","webauthn","2fa","totp","launchpad"],"author":{"name":"eleven-am"},"license":"MIT","_id":"@eleven-am/launchpad-auth@0.1.0","maintainers":[{"name":"eleven-am","email":"maixperiyon@gmail.com"}],"dist":{"shasum":"e6364457b0020d2cb9bc987bd16d2ef127f2744c","tarball":"https://registry.npmjs.org/@eleven-am/launchpad-auth/-/launchpad-auth-0.1.0.tgz","fileCount":8,"integrity":"sha512-OprclGsU2xA5ByAVT7QxPAQEvv15GD8W0CxOvBb4D8/C7c6ZzXE4MAxoSeR4yEOzfTnPB5B98TrFAFtbXcIYag==","signatures":[{"sig":"MEUCIQCdlXomL/gpmT7Re3/R0J9aj8VBrTf9pXdmnuXVzwH5wQIgQG8shwUaFyJElJDaPzXYNjBvfSW7nTPXwX3APThEjsI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":106051},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"90dec539b714147195d25f7c3ad763e5f7b47272","scripts":{"test":"vitest run","build":"tsup","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"eleven-am","email":"maixperiyon@gmail.com"},"_npmVersion":"11.4.2","description":"TypeScript SDK for integrating Launchpad authentication into client applications","directories":{},"_nodeVersion":"22.17.0","dependencies":{"@simplewebauthn/browser":"^10.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^2.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/launchpad-auth_0.1.0_1769969319097_0.47632606562194746","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@eleven-am/launchpad-auth","version":"0.1.1","description":"TypeScript SDK for integrating Launchpad authentication into client applications","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup","test":"vitest run","test:watch":"vitest","prepublishOnly":"npm run build"},"keywords":["authentication","oauth","passkey","webauthn","2fa","totp","launchpad"],"author":{"name":"eleven-am"},"license":"MIT","publishConfig":{"access":"public"},"dependencies":{"@simplewebauthn/browser":"^10.0.0"},"devDependencies":{"typescript":"^5.0.0","tsup":"^8.0.0","vitest":"^2.0.0"},"_id":"@eleven-am/launchpad-auth@0.1.1","gitHead":"ef4dececb3fde89dc3fd53e5cf9f5071c1b99f0e","_nodeVersion":"22.17.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-lA2EWxIyOiXk2b7Tn4yFjWPixiZl4gv3GvNc956HC150imuZxPQ8ozzMEYYefx1VKS4P6bxPVh//SZS8VdWn4w==","shasum":"58bd5b74a216aea52ab7bdc2050f5d3e9ce087ca","tarball":"https://registry.npmjs.org/@eleven-am/launchpad-auth/-/launchpad-auth-0.1.1.tgz","fileCount":8,"unpackedSize":107908,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDdYxXtnchKMtdhqwPitdGpSLpkRmOGds6YWEShCuJXSQIgdnTJjVZcBdSUUyiTJkpwgUjERqFDeDCl8fHt9yjs0Mc="}]},"_npmUser":{"name":"eleven-am","email":"maixperiyon@gmail.com"},"directories":{},"maintainers":[{"name":"eleven-am","email":"maixperiyon@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/launchpad-auth_0.1.1_1769970759405_0.7061855844857097"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-01T18:08:39.022Z","modified":"2026-02-01T18:32:39.670Z","0.1.0":"2026-02-01T18:08:39.259Z","0.1.1":"2026-02-01T18:32:39.554Z"},"author":{"name":"eleven-am"},"license":"MIT","keywords":["authentication","oauth","passkey","webauthn","2fa","totp","launchpad"],"description":"TypeScript SDK for integrating Launchpad authentication into client applications","maintainers":[{"name":"eleven-am","email":"maixperiyon@gmail.com"}],"readme":"# @eleven-am/launchpad-auth\n\nTypeScript SDK for integrating Launchpad authentication into client applications.\n\n## Installation\n\n```bash\nnpm install @eleven-am/launchpad-auth\n```\n\n## Quick Start\n\n```typescript\nimport { LaunchpadAuth } from '@eleven-am/launchpad-auth'\n\nconst auth = new LaunchpadAuth({\n  baseUrl: 'https://auth.myapp.com'\n})\n\n// Sign up\nconst { user } = await auth.signUp({\n  email: 'user@example.com',\n  password: 'password123',\n  name: 'John Doe'\n})\n\n// Sign in\nconst result = await auth.signIn({ email, password })\nif ('twoFactorRequired' in result) {\n  const { user } = await auth.verifyLoginCode(result.challengeToken, code)\n} else {\n  console.log('Logged in as', result.user.email)\n}\n\n// Check auth state\nif (auth.isAuthenticated()) {\n  console.log(auth.getUser())\n}\n```\n\n## Configuration\n\n```typescript\ninterface LaunchpadAuthConfig {\n  baseUrl: string                                    // Launchpad server URL\n  storage?: 'localStorage' | 'memory' | TokenStorage // Token storage (default: localStorage)\n  onTokenChange?: (token: string | null) => void     // Token change callback\n}\n```\n\n## API Reference\n\n### Email/Password Authentication\n\n```typescript\n// Sign up a new user\nauth.signUp({ email, password, name? }): Promise<AuthResult>\n\n// Sign in an existing user\nauth.signIn({ email, password }): Promise<AuthResult | TwoFactorChallenge>\n\n// Sign out the current user\nauth.signOut(): void\n\n// Request password reset email\nauth.forgotPassword(email): Promise<void>\n\n// Reset password with token\nauth.resetPassword({ token, password }): Promise<void>\n```\n\n### OAuth Authentication\n\n```typescript\n// Get available OAuth providers\nauth.getProviders(): Promise<string[]>\n\n// Start OAuth flow (redirects browser)\nauth.beginOAuth(provider, redirectUri?): void\n\n// Handle OAuth callback (call on redirect page)\nauth.handleOAuthCallback(): AuthResult\n```\n\n### Two-Factor Authentication\n\n```typescript\n// Enable 2FA for current user\nauth.enable2FA(): Promise<TwoFactorSetup>\n\n// Verify and activate 2FA\nauth.verify2FA(code): Promise<void>\n\n// Disable 2FA\nauth.disable2FA(code): Promise<void>\n\n// Complete login with 2FA code\nauth.verifyLoginCode(challengeToken, code): Promise<AuthResult>\n\n// Complete login with backup code\nauth.verifyBackupCode(challengeToken, code): Promise<AuthResult>\n\n// Regenerate backup codes\nauth.regenerateBackupCodes(code): Promise<string[]>\n```\n\n### Passkey (WebAuthn) Authentication\n\n```typescript\n// Check if passkeys are supported\nauth.isPasskeySupported(): boolean\n\n// Register a new passkey (requires authentication)\nauth.registerPasskey(name?): Promise<void>\n\n// List user's passkeys (requires authentication)\nauth.listPasskeys(): Promise<Passkey[]>\n\n// Delete a passkey (requires authentication)\nauth.deletePasskey(id): Promise<void>\n\n// Start passkey authentication (requires challengeToken from sign-in)\nauth.beginPasskeyAuth(challengeToken): Promise<PasskeyChallenge>\n\n// Complete passkey authentication\nauth.completePasskeyAuth(challenge): Promise<AuthResult>\n```\n\n### Token Management\n\n```typescript\n// Get current JWT token\nauth.getToken(): string | null\n\n// Get current user (decoded from token)\nauth.getUser(): User | null\n\n// Check if user is authenticated\nauth.isAuthenticated(): boolean\n\n// Subscribe to auth state changes (returns unsubscribe function)\nauth.onAuthStateChange(callback): () => void\n```\n\n## Types\n\n```typescript\ninterface AuthResult {\n  token: string\n  user: User\n}\n\ninterface User {\n  id: string\n  email: string\n  name: string\n  emailVerified: boolean\n  provider: string\n}\n\ninterface TwoFactorChallenge {\n  twoFactorRequired: true\n  challengeToken: string\n}\n\ninterface TwoFactorSetup {\n  secret: string\n  qrCodeUrl: string\n  backupCodes: string[]\n}\n\ninterface PasskeyChallenge {\n  challengeToken: string\n  options: PublicKeyCredentialRequestOptions\n}\n\ninterface Passkey {\n  id: string\n  name: string\n  createdAt: string\n}\n```\n\n## Error Handling\n\nThe SDK throws typed errors for different failure scenarios:\n\n```typescript\nimport {\n  LaunchpadError,\n  AuthenticationError,\n  ValidationError,\n  NetworkError\n} from '@eleven-am/launchpad-auth'\n\ntry {\n  await auth.signIn({ email, password })\n} catch (error) {\n  if (error instanceof AuthenticationError) {\n    console.log('Invalid credentials')\n  } else if (error instanceof ValidationError) {\n    console.log('Invalid input:', error.message)\n  } else if (error instanceof NetworkError) {\n    console.log('Network error:', error.message)\n  }\n}\n```\n\n## Custom Storage\n\nImplement the `TokenStorage` interface for custom storage solutions:\n\n```typescript\ninterface TokenStorage {\n  get(): string | null\n  set(token: string): void\n  remove(): void\n}\n\n// Example: Cookie storage\nconst cookieStorage: TokenStorage = {\n  get: () => document.cookie.match(/token=([^;]+)/)?.[1] ?? null,\n  set: (token) => { document.cookie = `token=${token}; path=/` },\n  remove: () => { document.cookie = 'token=; expires=Thu, 01 Jan 1970' }\n}\n\nconst auth = new LaunchpadAuth({\n  baseUrl: 'https://auth.myapp.com',\n  storage: cookieStorage\n})\n```\n\n## Auth State Subscription\n\nSubscribe to authentication state changes:\n\n```typescript\nconst unsubscribe = auth.onAuthStateChange((user) => {\n  if (user) {\n    console.log('User logged in:', user.email)\n  } else {\n    console.log('User logged out')\n  }\n})\n\n// Later, to stop listening\nunsubscribe()\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}