Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
682 changes: 632 additions & 50 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import reactPlugin from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import prettier from 'eslint-config-prettier';
import licenseHeader from 'eslint-plugin-license-header';

export default [
js.configs.recommended,
Expand All @@ -24,6 +25,7 @@ export default [
react: reactPlugin,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
'license-header': licenseHeader,
},
settings: {
react: { version: 'detect' },
Expand All @@ -34,6 +36,8 @@ export default [
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],

'license-header/header': ['error', './resources/license-header.js'],
},
},
{
Expand Down
233 changes: 69 additions & 164 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@seamless-auth/react",
"version": "0.0.8",
"version": "0.0.9",
"description": "A drop-in authentication solution for modern React applications.",
"type": "module",
"exports": {
Expand Down Expand Up @@ -60,7 +60,7 @@
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-terser": "^1.0.0",
"@rollup/plugin-typescript": "^11.1.6",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.0",
Expand Down Expand Up @@ -90,6 +90,7 @@
},
"dependencies": {
"@simplewebauthn/browser": "^13.1.0",
"eslint-plugin-license-header": "^0.9.0",
"libphonenumber-js": "^1.12.7",
"ts-node": "^10.9.2"
},
Expand Down
5 changes: 5 additions & 0 deletions resources/license-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/
6 changes: 6 additions & 0 deletions src/AuthProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { InternalAuthProvider } from '@/context/InternalAuthContext';
import React, {
createContext,
Expand Down Expand Up @@ -190,7 +196,7 @@

useEffect(() => {
validateToken();
}, []);

Check warning on line 199 in src/AuthProvider.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useEffect has a missing dependency: 'validateToken'. Either include it or remove the dependency array

useEffect(() => {
if (user && isAuthenticated) {
Expand Down
6 changes: 6 additions & 0 deletions src/AuthRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { Navigate, Route, Routes } from 'react-router-dom';

import Login from '@/views/Login';
Expand Down
6 changes: 6 additions & 0 deletions src/components/AuthFallbackOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import React from 'react';
import { isValidEmail, isValidPhoneNumber } from '../utils';

Expand Down
6 changes: 6 additions & 0 deletions src/components/DeviceNameModal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import React, { useState } from 'react';
import styles from '@/styles/deviceNameModal.module.css';

Expand Down
6 changes: 6 additions & 0 deletions src/components/MagicLinkSent.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import React, { useEffect, useState } from 'react';
import { useAuth } from '@/AuthProvider';
import { useInternalAuth } from '@/context/InternalAuthContext';
Expand Down Expand Up @@ -84,7 +90,7 @@
}, 5000);

return () => clearInterval(interval);
}, [apiHost, validateToken, navigate]);

Check warning on line 93 in src/components/MagicLinkSent.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useEffect has a missing dependency: 'fetchWithAuth'. Either include it or remove the dependency array

return (
<div className={styles.container}>
Expand Down
6 changes: 6 additions & 0 deletions src/components/OtpInput.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import React, { useRef } from 'react';
import styles from '@/styles/otpInput.module.css';

Expand Down
6 changes: 6 additions & 0 deletions src/components/TermsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import React, { useEffect, useRef } from 'react';

import styles from '@/styles/termsModal.module.css';
Expand Down
6 changes: 6 additions & 0 deletions src/components/phoneInput.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { AsYouType, parsePhoneNumberFromString } from 'libphonenumber-js';
import { useEffect, useState } from 'react';

Expand Down
6 changes: 6 additions & 0 deletions src/context/InternalAuthContext.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { createContext, Dispatch, ReactNode, SetStateAction, useContext } from 'react';

interface InternalAuthContextType {
Expand Down
6 changes: 6 additions & 0 deletions src/fetchWithAuth.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

export type AuthMode = 'web' | 'server';

interface FetchWithAuthOptions {
Expand Down
6 changes: 6 additions & 0 deletions src/hooks/usePreviousSignIn.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { useEffect, useState } from 'react';

export function usePreviousSignIn(storageKey = 'seamlessauth_seen') {
Expand Down
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { AuthContextType, AuthProvider, useAuth, Credential, User } from '@/AuthProvider';
import { AuthRoutes } from '@/AuthRoutes';
export { AuthProvider, AuthRoutes, useAuth };
Expand Down
6 changes: 6 additions & 0 deletions src/styles/index.css.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

declare module '*.css' {
const content: Record<string, string>;
export default content;
Expand Down
6 changes: 6 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import parsePhoneNumberFromString from 'libphonenumber-js';

/**
Expand Down
6 changes: 6 additions & 0 deletions src/views/EmailRegistration.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { useAuth } from '@/AuthProvider';
import React, { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
Expand Down
6 changes: 6 additions & 0 deletions src/views/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { startAuthentication } from '@simplewebauthn/browser';
import { useAuth } from '@/AuthProvider';
import PhoneInputWithCountryCode from '@/components/phoneInput';
Expand Down
6 changes: 6 additions & 0 deletions src/views/PassKeyLogin.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { startAuthentication } from '@simplewebauthn/browser';
import { useAuth } from '@/AuthProvider';
import { useInternalAuth } from '@/context/InternalAuthContext';
Expand Down
6 changes: 6 additions & 0 deletions src/views/PassKeyRegistration.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import {
type RegistrationResponseJSON,
startRegistration,
Expand Down
6 changes: 6 additions & 0 deletions src/views/PhoneRegistration.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { useAuth } from '@/AuthProvider';
import React, { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
Expand Down
6 changes: 6 additions & 0 deletions src/views/VerifyMagicLink.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/

import { useAuth } from '@/AuthProvider';
import React, { useEffect, useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
Expand Down
Loading