@seamless-auth/react 0.11.0 → 0.13.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.
@@ -1,10 +0,0 @@
1
- /**
2
- * True when the browser exposes a usable WebAuthn API in a secure context.
3
- * This is the coarse gate for any passkey flow, including PRF assertions.
4
- */
5
- export declare function isWebAuthnAvailable(): boolean;
6
- /**
7
- * True when a user-verifying platform authenticator (Touch ID, Windows Hello,
8
- * and similar) can be used on this device.
9
- */
10
- export declare function isPlatformAuthenticatorAvailable(): Promise<boolean>;
@@ -1,5 +0,0 @@
1
- interface FetchWithAuthOptions {
2
- authHost?: string;
3
- }
4
- export declare const createFetchWithAuth: (opts: FetchWithAuthOptions) => (input: string, init?: RequestInit) => Promise<Response>;
5
- export {};
@@ -1,2 +0,0 @@
1
- export declare function roleGrantsAccess(grantedRole: string, requiredRole: string): boolean;
2
- export declare function hasScopedRole(grantedRoles: unknown, requiredRoles: string | string[]): boolean;
@@ -1,60 +0,0 @@
1
- import { CurrentUserResult, FinishOAuthLoginInput, FinishOAuthLoginResult, LoginStartResult, MessageResult, OAuthProvidersResult, OrganizationSwitchResult, PasskeyLoginData, StartOAuthLoginInput, StartOAuthLoginResult, StepUpPrfData, StepUpStatus } from '../client/createSeamlessAuthClient';
2
- import type { SeamlessAuthResult } from '../client/result';
3
- import { PasskeyPrfInput } from '../client/webauthnPrf';
4
- import { Credential, Organization, User } from '../types';
5
- import { SessionStoragePort } from './storage';
6
- /** Everything a UI binding renders from. Replaced wholesale on every change. */
7
- export interface AuthSessionState {
8
- user: User | null;
9
- credentials: Credential[];
10
- organizations: Organization[];
11
- activeOrganization: Organization | null;
12
- stepUpStatus: StepUpStatus | null;
13
- isAuthenticated: boolean;
14
- loading: boolean;
15
- hasSignedInBefore: boolean;
16
- }
17
- export interface AuthSessionActions {
18
- login: (identifier: string, passkeyAvailable: boolean) => Promise<SeamlessAuthResult<LoginStartResult>>;
19
- handlePasskeyLogin: () => Promise<SeamlessAuthResult<PasskeyLoginData>>;
20
- refreshSession: () => Promise<SeamlessAuthResult<CurrentUserResult>>;
21
- logout: () => Promise<SeamlessAuthResult<MessageResult>>;
22
- logoutAllSessions: () => Promise<SeamlessAuthResult<MessageResult>>;
23
- deleteUser: () => Promise<SeamlessAuthResult<MessageResult>>;
24
- updateCredential: (credential: Credential) => Promise<SeamlessAuthResult<Credential>>;
25
- deleteCredential: (credentialId: string) => Promise<SeamlessAuthResult<MessageResult>>;
26
- switchOrganization: (organizationId: string) => Promise<SeamlessAuthResult<OrganizationSwitchResult>>;
27
- listOAuthProviders: () => Promise<SeamlessAuthResult<OAuthProvidersResult>>;
28
- startOAuthLogin: (input: StartOAuthLoginInput) => Promise<SeamlessAuthResult<StartOAuthLoginResult>>;
29
- finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<FinishOAuthLoginResult>>;
30
- refreshStepUpStatus: () => Promise<SeamlessAuthResult<StepUpStatus>>;
31
- verifyStepUpWithPasskey: () => Promise<SeamlessAuthResult<StepUpStatus>>;
32
- verifyStepUpWithPasskeyPrf: (input: PasskeyPrfInput) => Promise<SeamlessAuthResult<StepUpPrfData>>;
33
- verifyStepUpWithTotp: (code: string) => Promise<SeamlessAuthResult<StepUpStatus>>;
34
- hasRole: (role: string) => boolean | undefined;
35
- hasScopedRole: (role: string | string[]) => boolean | undefined;
36
- markSignedIn: () => void;
37
- }
38
- /**
39
- * Framework-agnostic session store.
40
- *
41
- * `getState` and `subscribe` are the shape React's `useSyncExternalStore` wants,
42
- * and they adapt directly to a Vue ref or an Angular observable, so bindings stay
43
- * thin instead of each reimplementing this state machine.
44
- */
45
- export interface AuthSession {
46
- getState: () => AuthSessionState;
47
- subscribe: (listener: () => void) => () => void;
48
- actions: AuthSessionActions;
49
- destroy: () => void;
50
- }
51
- export interface AuthSessionOptions {
52
- apiHost: string;
53
- storage?: SessionStoragePort;
54
- /**
55
- * When false, a previous sign-in is still recorded but never surfaced, so a UI
56
- * cannot branch on it.
57
- */
58
- detectPreviousSignIn?: boolean;
59
- }
60
- export declare function createAuthSession(options: AuthSessionOptions): AuthSession;
@@ -1,17 +0,0 @@
1
- /**
2
- * The session store's only browser dependency, expressed as a port so the store
3
- * itself stays framework and environment agnostic. Implementations never throw:
4
- * private browsing and disabled storage are normal, and neither is a reason to
5
- * fail an auth flow.
6
- */
7
- export interface SessionStoragePort {
8
- get(key: string): string | null;
9
- set(key: string, value: string): void;
10
- }
11
- export declare function createMemoryStorage(): SessionStoragePort;
12
- export declare function createBrowserStorage(): SessionStoragePort;
13
- /**
14
- * Browser storage where there is a `localStorage`, memory otherwise. The memory
15
- * fallback is what keeps the store usable during server-side rendering.
16
- */
17
- export declare function createDefaultStorage(): SessionStoragePort;
package/dist/types.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { CredentialResponse, MeUser, Organization as OrganizationShape, OrganizationMembership as OrganizationMembershipShape } from '@seamless-auth/types';
2
- export type User = MeUser;
3
- export type OrganizationMembership = OrganizationMembershipShape;
4
- export type Organization = OrganizationShape;
5
- export type Credential = CredentialResponse;