open-index/open-npm huggingface dataset:
npm package: @siran/auth-core
Description: This library was generated with [Nx](https://nx.dev).
Latest version: 0.14.2

# core

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build core` to build the library.

## Running unit tests

Run `nx test core` to execute the unit tests via [Vitest](https://vitest.dev/).
npm package: @siran/auth-react-sdk
Description: React authentication SDK built on top of @siran/auth-core.
Latest version: 0.1.8

# @siran/auth-react-sdk

React authentication SDK built on top of @siran/auth-core.

## Installation

```bash
npm install @siran/auth-react-sdk react react-dom
```

## Usage

### Setup the AuthProvider

```tsx
import React from 'react';
import { AuthProvider } from '@siran/auth-react-sdk';
import { createAuthEngine } from '@siran/auth-core';

const authEngine = createAuthEngine({
  // Your auth configuration here
});

function App() {
  return (
    <AuthProvider authEngine={authEngine}>
      <YourApp />
    </AuthProvider>
  );
}
```

### Using the Auth Hooks

```tsx
import { useAuth, usePasswordAuth } from '@siran/auth-react-sdk';

function Login() {
  const { user, isAuthenticated, isLoading, error } = useAuth();
  const { signIn } = usePasswordAuth();

  const handleLogin = async () => {
    await signIn('user@example.com', 'password');
  };

  if (isLoading) return <div>Loading...</div>;
  if (isAuthenticated) return <div>Welcome, {user.displayName}!</div>;

  return (
    <div>
      <button onClick={handleLogin}>Sign In</button>
      {error && <div>Error: {error}</div>}
    </div>
  );
}
```

### Protected Routes

```tsx
import { ProtectedRoute } from '@siran/auth-react-sdk';

function Dashboard() {
  return (
    <ProtectedRoute>
      <h1>Dashboard</h1>
      {/* Only visible to authenticated users */}
    </ProtectedRoute>
  );
}
```

## API Reference

### AuthProvider

Wrap your app with AuthProvider to provide authentication context.

**Props:**

- `authEngine`: An instance of AuthEngine from @siran/auth-core
- `children`: React.ReactNode

### useAuth Hook

Returns the current authentication state and auth methods.

**Returns:**

- `user`: UserAccount | null
- `isLoading`: boolean
- `isAuthenticated`: boolean
- `error`: string | null
- `authenticate(method: AuthMethod)`: Promise<AuthResult>
- `register(method: AuthMethod)`: Promise<AuthResult>
- `logout()`: Promise<void>
- `clearError()`: void

### Auth Method Hooks

- `usePasswordAuth()`: For password authentication
- `useOtpAuth()`: For OTP authentication
- `useMagicLinkAuth()`: For magic link authentication
- `useOAuthAuth()`: For OAuth authentication

Each hook provides:

- `signIn(...)`: Authenticate with method
- `signUp(...)`: Register with method
- `isLoading`: boolean
- `error`: string | null

### ProtectedRoute Component

Renders children only when user is authenticated.

**Props:**

- `children`: React.ReactNode
- `fallback?`: React.ReactNode - Shown when not authenticated

## License

MIT
npm package: @siran/chat-supabase-repo
Description: To install dependencies:
Latest version: 0.1.8

# repo

To install dependencies:

```bash
bun install
```

To run:

```bash
bun run index.ts
```

This project was created using `bun init` in bun v1.3.5. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.