@fastshot/auth 1.0.1 → 1.0.2

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.
Files changed (47) hide show
  1. package/package.json +3 -4
  2. package/src/auth.ts +210 -0
  3. package/src/constants.ts +56 -0
  4. package/{dist/hooks/index.d.ts → src/hooks/index.ts} +2 -1
  5. package/src/hooks/useAppleSignIn.ts +92 -0
  6. package/src/hooks/useAuthCallback.ts +135 -0
  7. package/src/hooks/useGoogleSignIn.ts +95 -0
  8. package/{dist/index.js → src/index.ts} +42 -3
  9. package/src/types.ts +109 -0
  10. package/src/utils/deepLink.ts +76 -0
  11. package/src/utils/index.ts +14 -0
  12. package/src/utils/session.ts +45 -0
  13. package/src/utils/ticketExchange.ts +84 -0
  14. package/dist/auth.d.ts +0 -82
  15. package/dist/auth.d.ts.map +0 -1
  16. package/dist/auth.js +0 -149
  17. package/dist/constants.d.ts +0 -38
  18. package/dist/constants.d.ts.map +0 -1
  19. package/dist/constants.js +0 -48
  20. package/dist/hooks/index.d.ts.map +0 -1
  21. package/dist/hooks/index.js +0 -3
  22. package/dist/hooks/useAppleSignIn.d.ts +0 -47
  23. package/dist/hooks/useAppleSignIn.d.ts.map +0 -1
  24. package/dist/hooks/useAppleSignIn.js +0 -60
  25. package/dist/hooks/useAuthCallback.d.ts +0 -56
  26. package/dist/hooks/useAuthCallback.d.ts.map +0 -1
  27. package/dist/hooks/useAuthCallback.js +0 -97
  28. package/dist/hooks/useGoogleSignIn.d.ts +0 -49
  29. package/dist/hooks/useGoogleSignIn.d.ts.map +0 -1
  30. package/dist/hooks/useGoogleSignIn.js +0 -61
  31. package/dist/index.d.ts +0 -61
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/types.d.ts +0 -95
  34. package/dist/types.d.ts.map +0 -1
  35. package/dist/types.js +0 -1
  36. package/dist/utils/deepLink.d.ts +0 -26
  37. package/dist/utils/deepLink.d.ts.map +0 -1
  38. package/dist/utils/deepLink.js +0 -55
  39. package/dist/utils/index.d.ts +0 -4
  40. package/dist/utils/index.d.ts.map +0 -1
  41. package/dist/utils/index.js +0 -3
  42. package/dist/utils/session.d.ts +0 -7
  43. package/dist/utils/session.d.ts.map +0 -1
  44. package/dist/utils/session.js +0 -25
  45. package/dist/utils/ticketExchange.d.ts +0 -14
  46. package/dist/utils/ticketExchange.d.ts.map +0 -1
  47. package/dist/utils/ticketExchange.js +0 -54
package/src/types.ts ADDED
@@ -0,0 +1,109 @@
1
+ import type { SupabaseClient, User, Session } from '@supabase/supabase-js';
2
+
3
+ /**
4
+ * OAuth provider type
5
+ */
6
+ export type OAuthProvider = 'google' | 'apple';
7
+
8
+ /**
9
+ * Authentication mode
10
+ * - browser: Opens system browser (recommended for most cases)
11
+ * - webview: Opens in-app WebView (may have limitations)
12
+ */
13
+ export type AuthMode = 'browser' | 'webview';
14
+
15
+ /**
16
+ * Configuration for OAuth sign-in
17
+ */
18
+ export interface SignInConfig {
19
+ /** Supabase client instance for session restoration */
20
+ supabaseClient: SupabaseClient;
21
+ /** Custom return URL (defaults to fastshot://auth/callback) */
22
+ returnTo?: string;
23
+ /** Auth mode: 'browser' (default) or 'webview' */
24
+ mode?: AuthMode;
25
+ /** Email hint for Google sign-in */
26
+ loginHint?: string;
27
+ }
28
+
29
+ /**
30
+ * Response from ticket exchange
31
+ */
32
+ export interface ExchangeTicketResponse {
33
+ access_token: string;
34
+ refresh_token: string;
35
+ token_type: string;
36
+ expires_in: number;
37
+ user: User;
38
+ }
39
+
40
+ /**
41
+ * Result from OAuth callback handling
42
+ */
43
+ export interface AuthCallbackResult {
44
+ success: boolean;
45
+ session?: Session;
46
+ user?: User;
47
+ error?: string;
48
+ }
49
+
50
+ /**
51
+ * Error types for authentication
52
+ */
53
+ export type AuthErrorType =
54
+ | 'INVALID_TICKET'
55
+ | 'EXCHANGE_FAILED'
56
+ | 'SESSION_RESTORE_FAILED'
57
+ | 'CALLBACK_ERROR'
58
+ | 'BROWSER_DISMISSED'
59
+ | 'NETWORK_ERROR'
60
+ | 'UNKNOWN_ERROR';
61
+
62
+ /**
63
+ * Authentication error with type
64
+ */
65
+ export interface AuthError {
66
+ type: AuthErrorType;
67
+ message: string;
68
+ originalError?: unknown;
69
+ }
70
+
71
+ /**
72
+ * State for auth hooks
73
+ */
74
+ export interface AuthHookState {
75
+ isLoading: boolean;
76
+ error: AuthError | null;
77
+ }
78
+
79
+ /**
80
+ * Result from useGoogleSignIn or useAppleSignIn hooks
81
+ */
82
+ export interface UseSignInResult extends AuthHookState {
83
+ signIn: () => Promise<void>;
84
+ reset: () => void;
85
+ }
86
+
87
+ /**
88
+ * Configuration for useAuthCallback hook
89
+ */
90
+ export interface UseAuthCallbackConfig {
91
+ /** Supabase client instance */
92
+ supabaseClient: SupabaseClient;
93
+ /** Callback when authentication succeeds */
94
+ onSuccess?: (result: { session: Session; user: User }) => void;
95
+ /** Callback when authentication fails */
96
+ onError?: (error: AuthError) => void;
97
+ }
98
+
99
+ /**
100
+ * Result from useAuthCallback hook
101
+ */
102
+ export interface UseAuthCallbackResult {
103
+ /** Whether callback is being processed */
104
+ isProcessing: boolean;
105
+ /** Error if callback processing failed */
106
+ error: AuthError | null;
107
+ /** Manually handle a callback URL */
108
+ handleUrl: (url: string) => Promise<AuthCallbackResult>;
109
+ }
@@ -0,0 +1,76 @@
1
+ import { AUTH_CONFIG } from '../constants';
2
+
3
+ /**
4
+ * Get the default callback URL for OAuth
5
+ */
6
+ export function getDefaultCallbackUrl(): string {
7
+ return `${AUTH_CONFIG.DEEP_LINK_SCHEME}://${AUTH_CONFIG.CALLBACK_PATH}`;
8
+ }
9
+
10
+ /**
11
+ * Parse OAuth callback URL and extract parameters
12
+ */
13
+ export function parseCallbackUrl(url: string): {
14
+ ticket?: string;
15
+ error?: string;
16
+ errorDescription?: string;
17
+ } {
18
+ try {
19
+ // Handle both URL formats:
20
+ // fastshot://auth/callback?ticket=xxx
21
+ // fastshot://auth/callback?error=xxx&error_description=xxx
22
+
23
+ // Extract query string
24
+ const queryStart = url.indexOf('?');
25
+ if (queryStart === -1) {
26
+ return {};
27
+ }
28
+
29
+ const queryString = url.substring(queryStart + 1);
30
+ const params = new URLSearchParams(queryString);
31
+
32
+ return {
33
+ ticket: params.get('ticket') || undefined,
34
+ error: params.get('error') || undefined,
35
+ errorDescription: params.get('error_description') || undefined,
36
+ };
37
+ } catch {
38
+ return {};
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Check if a URL is a valid auth callback URL
44
+ */
45
+ export function isAuthCallbackUrl(url: string): boolean {
46
+ if (!url) return false;
47
+
48
+ const expectedPrefix = `${AUTH_CONFIG.DEEP_LINK_SCHEME}://${AUTH_CONFIG.CALLBACK_PATH}`;
49
+ return url.startsWith(expectedPrefix);
50
+ }
51
+
52
+ /**
53
+ * Build the OAuth start URL
54
+ */
55
+ export function buildOAuthStartUrl(
56
+ provider: 'google' | 'apple',
57
+ params: {
58
+ tenant: string;
59
+ returnTo: string;
60
+ mode?: 'browser' | 'webview';
61
+ loginHint?: string;
62
+ }
63
+ ): string {
64
+ const endpoint = provider === 'google' ? '/v1/auth/google/start' : '/v1/auth/apple/start';
65
+ const url = new URL(endpoint, AUTH_CONFIG.AUTH_BROKER_URL);
66
+
67
+ url.searchParams.set('tenant', params.tenant);
68
+ url.searchParams.set('return_to', params.returnTo);
69
+ url.searchParams.set('mode', params.mode || 'browser');
70
+
71
+ if (params.loginHint && provider === 'google') {
72
+ url.searchParams.set('login_hint', params.loginHint);
73
+ }
74
+
75
+ return url.toString();
76
+ }
@@ -0,0 +1,14 @@
1
+ export {
2
+ getDefaultCallbackUrl,
3
+ parseCallbackUrl,
4
+ isAuthCallbackUrl,
5
+ buildOAuthStartUrl,
6
+ } from './deepLink';
7
+
8
+ export {
9
+ exchangeTicket,
10
+ createAuthError,
11
+ isAuthError,
12
+ } from './ticketExchange';
13
+
14
+ export { restoreSession } from './session';
@@ -0,0 +1,45 @@
1
+ import type { SupabaseClient, Session } from '@supabase/supabase-js';
2
+ import type { ExchangeTicketResponse, AuthError } from '../types';
3
+ import { createAuthError } from './ticketExchange';
4
+
5
+ /**
6
+ * Restore a Supabase session from exchange response
7
+ */
8
+ export async function restoreSession(
9
+ supabaseClient: SupabaseClient,
10
+ exchangeResponse: ExchangeTicketResponse
11
+ ): Promise<Session> {
12
+ try {
13
+ const { data, error } = await supabaseClient.auth.setSession({
14
+ access_token: exchangeResponse.access_token,
15
+ refresh_token: exchangeResponse.refresh_token,
16
+ });
17
+
18
+ if (error) {
19
+ throw createAuthError(
20
+ 'SESSION_RESTORE_FAILED',
21
+ `Failed to restore session: ${error.message}`,
22
+ error
23
+ );
24
+ }
25
+
26
+ if (!data.session) {
27
+ throw createAuthError(
28
+ 'SESSION_RESTORE_FAILED',
29
+ 'Session restore succeeded but no session returned'
30
+ );
31
+ }
32
+
33
+ return data.session;
34
+ } catch (error) {
35
+ if ((error as AuthError).type) {
36
+ throw error;
37
+ }
38
+
39
+ throw createAuthError(
40
+ 'SESSION_RESTORE_FAILED',
41
+ error instanceof Error ? error.message : 'Unknown error during session restore',
42
+ error
43
+ );
44
+ }
45
+ }
@@ -0,0 +1,84 @@
1
+ import { AUTH_CONFIG, AUTH_ENDPOINTS, DEFAULT_AUTH_CONFIG } from '../constants';
2
+ import type { ExchangeTicketResponse, AuthError } from '../types';
3
+
4
+ /**
5
+ * Exchange a one-time ticket for Supabase session tokens
6
+ */
7
+ export async function exchangeTicket(ticket: string): Promise<ExchangeTicketResponse> {
8
+ const url = `${AUTH_CONFIG.AUTH_BROKER_URL}${AUTH_ENDPOINTS.EXCHANGE_TICKET}`;
9
+
10
+ try {
11
+ const response = await fetch(url, {
12
+ method: 'POST',
13
+ headers: {
14
+ 'Content-Type': 'application/json',
15
+ },
16
+ body: JSON.stringify({ ticket }),
17
+ });
18
+
19
+ if (!response.ok) {
20
+ const errorData = await response.json().catch(() => ({}));
21
+
22
+ if (response.status === 401) {
23
+ throw createAuthError(
24
+ 'INVALID_TICKET',
25
+ errorData.detail || 'Invalid or expired ticket'
26
+ );
27
+ }
28
+
29
+ throw createAuthError(
30
+ 'EXCHANGE_FAILED',
31
+ errorData.detail || `Ticket exchange failed: ${response.status}`
32
+ );
33
+ }
34
+
35
+ const data: ExchangeTicketResponse = await response.json();
36
+ return data;
37
+ } catch (error) {
38
+ if (isAuthError(error)) {
39
+ throw error;
40
+ }
41
+
42
+ // Network or other errors
43
+ if (error instanceof TypeError && error.message.includes('fetch')) {
44
+ throw createAuthError(
45
+ 'NETWORK_ERROR',
46
+ 'Network error during ticket exchange. Please check your connection.',
47
+ error
48
+ );
49
+ }
50
+
51
+ throw createAuthError(
52
+ 'EXCHANGE_FAILED',
53
+ error instanceof Error ? error.message : 'Unknown error during ticket exchange',
54
+ error
55
+ );
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Create a typed auth error
61
+ */
62
+ export function createAuthError(
63
+ type: AuthError['type'],
64
+ message: string,
65
+ originalError?: unknown
66
+ ): AuthError {
67
+ return {
68
+ type,
69
+ message,
70
+ originalError,
71
+ };
72
+ }
73
+
74
+ /**
75
+ * Type guard for AuthError
76
+ */
77
+ export function isAuthError(error: unknown): error is AuthError {
78
+ return (
79
+ typeof error === 'object' &&
80
+ error !== null &&
81
+ 'type' in error &&
82
+ 'message' in error
83
+ );
84
+ }
package/dist/auth.d.ts DELETED
@@ -1,82 +0,0 @@
1
- /**
2
- * Core authentication functions for OAuth with auth-broker
3
- */
4
- import type { SupabaseClient } from '@supabase/supabase-js';
5
- import type { AuthMode, AuthCallbackResult } from './types';
6
- /**
7
- * Configuration for sign-in function
8
- */
9
- export interface SignInOptions {
10
- /** Supabase client for session restoration */
11
- supabaseClient: SupabaseClient;
12
- /** Custom return URL (defaults to fastshot://auth/callback) */
13
- returnTo?: string;
14
- /** Auth mode: 'browser' (default) or 'webview' */
15
- mode?: AuthMode;
16
- /** Email hint for Google sign-in */
17
- loginHint?: string;
18
- }
19
- /**
20
- * Sign in with Google OAuth
21
- *
22
- * Opens the system browser to initiate Google OAuth flow via auth-broker.
23
- * After successful authentication, the browser redirects back to the app.
24
- *
25
- * @example
26
- * ```typescript
27
- * import { signInWithGoogle } from '@fastshot/auth';
28
- * import { supabase } from './lib/supabase';
29
- *
30
- * await signInWithGoogle({ supabaseClient: supabase });
31
- * ```
32
- */
33
- export declare function signInWithGoogle(options: SignInOptions): Promise<void>;
34
- /**
35
- * Sign in with Apple OAuth
36
- *
37
- * Opens the system browser to initiate Apple OAuth flow via auth-broker.
38
- * After successful authentication, the browser redirects back to the app.
39
- *
40
- * @example
41
- * ```typescript
42
- * import { signInWithApple } from '@fastshot/auth';
43
- * import { supabase } from './lib/supabase';
44
- *
45
- * await signInWithApple({ supabaseClient: supabase });
46
- * ```
47
- */
48
- export declare function signInWithApple(options: SignInOptions): Promise<void>;
49
- /**
50
- * Handle OAuth callback URL and restore session
51
- *
52
- * Call this when your app receives a deep link callback from OAuth.
53
- * This function exchanges the ticket for tokens and restores the Supabase session.
54
- *
55
- * @example
56
- * ```typescript
57
- * import { handleAuthCallback } from '@fastshot/auth';
58
- * import { supabase } from './lib/supabase';
59
- * import * as Linking from 'expo-linking';
60
- *
61
- * Linking.addEventListener('url', async ({ url }) => {
62
- * const result = await handleAuthCallback(url, supabase);
63
- * if (result.success) {
64
- * console.log('Logged in as:', result.user?.email);
65
- * }
66
- * });
67
- * ```
68
- */
69
- export declare function handleAuthCallback(url: string, supabaseClient: SupabaseClient): Promise<AuthCallbackResult>;
70
- /**
71
- * Sign out from Supabase
72
- *
73
- * @example
74
- * ```typescript
75
- * import { signOut } from '@fastshot/auth';
76
- * import { supabase } from './lib/supabase';
77
- *
78
- * await signOut(supabase);
79
- * ```
80
- */
81
- export declare function signOut(supabaseClient: SupabaseClient): Promise<void>;
82
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,uBAAuB,CAAC;AAErE,OAAO,KAAK,EAEV,QAAQ,EACR,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AA2BjB;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,cAAc,EAAE,cAAc,CAAC;IAC/B,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3E;AAmCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CA8C7B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3E"}
package/dist/auth.js DELETED
@@ -1,149 +0,0 @@
1
- /**
2
- * Core authentication functions for OAuth with auth-broker
3
- */
4
- import * as WebBrowser from 'expo-web-browser';
5
- import { AUTH_CONFIG } from './constants';
6
- import { getDefaultCallbackUrl, parseCallbackUrl, isAuthCallbackUrl, buildOAuthStartUrl, exchangeTicket, restoreSession, createAuthError, } from './utils';
7
- /**
8
- * Get the project ID from environment variables
9
- */
10
- function getProjectId() {
11
- const projectId = AUTH_CONFIG.PROJECT_ID;
12
- if (!projectId) {
13
- throw createAuthError('UNKNOWN_ERROR', 'Project ID not found. Ensure EXPO_PUBLIC_PROJECT_ID is set in your .env file.');
14
- }
15
- return projectId;
16
- }
17
- /**
18
- * Sign in with Google OAuth
19
- *
20
- * Opens the system browser to initiate Google OAuth flow via auth-broker.
21
- * After successful authentication, the browser redirects back to the app.
22
- *
23
- * @example
24
- * ```typescript
25
- * import { signInWithGoogle } from '@fastshot/auth';
26
- * import { supabase } from './lib/supabase';
27
- *
28
- * await signInWithGoogle({ supabaseClient: supabase });
29
- * ```
30
- */
31
- export async function signInWithGoogle(options) {
32
- return signInWithProvider('google', options);
33
- }
34
- /**
35
- * Sign in with Apple OAuth
36
- *
37
- * Opens the system browser to initiate Apple OAuth flow via auth-broker.
38
- * After successful authentication, the browser redirects back to the app.
39
- *
40
- * @example
41
- * ```typescript
42
- * import { signInWithApple } from '@fastshot/auth';
43
- * import { supabase } from './lib/supabase';
44
- *
45
- * await signInWithApple({ supabaseClient: supabase });
46
- * ```
47
- */
48
- export async function signInWithApple(options) {
49
- return signInWithProvider('apple', options);
50
- }
51
- /**
52
- * Generic sign-in with OAuth provider
53
- */
54
- async function signInWithProvider(provider, options) {
55
- const { returnTo = getDefaultCallbackUrl(), mode = 'browser', loginHint, } = options;
56
- const projectId = getProjectId();
57
- const authUrl = buildOAuthStartUrl(provider, {
58
- tenant: projectId,
59
- returnTo,
60
- mode,
61
- loginHint,
62
- });
63
- // Open browser for OAuth flow
64
- const result = await WebBrowser.openAuthSessionAsync(authUrl, returnTo);
65
- if (result.type === 'cancel' || result.type === 'dismiss') {
66
- throw createAuthError('BROWSER_DISMISSED', 'Authentication was cancelled');
67
- }
68
- // Note: The actual session restoration happens in handleAuthCallback
69
- // which should be called when the deep link is received
70
- }
71
- /**
72
- * Handle OAuth callback URL and restore session
73
- *
74
- * Call this when your app receives a deep link callback from OAuth.
75
- * This function exchanges the ticket for tokens and restores the Supabase session.
76
- *
77
- * @example
78
- * ```typescript
79
- * import { handleAuthCallback } from '@fastshot/auth';
80
- * import { supabase } from './lib/supabase';
81
- * import * as Linking from 'expo-linking';
82
- *
83
- * Linking.addEventListener('url', async ({ url }) => {
84
- * const result = await handleAuthCallback(url, supabase);
85
- * if (result.success) {
86
- * console.log('Logged in as:', result.user?.email);
87
- * }
88
- * });
89
- * ```
90
- */
91
- export async function handleAuthCallback(url, supabaseClient) {
92
- // Check if this is an auth callback URL
93
- if (!isAuthCallbackUrl(url)) {
94
- return {
95
- success: false,
96
- error: 'Not an auth callback URL',
97
- };
98
- }
99
- const { ticket, error, errorDescription } = parseCallbackUrl(url);
100
- // Handle OAuth error from auth-broker
101
- if (error) {
102
- return {
103
- success: false,
104
- error: errorDescription || error,
105
- };
106
- }
107
- // No ticket means something went wrong
108
- if (!ticket) {
109
- return {
110
- success: false,
111
- error: 'No ticket in callback URL',
112
- };
113
- }
114
- try {
115
- // Exchange ticket for session tokens
116
- const exchangeResponse = await exchangeTicket(ticket);
117
- // Restore session to Supabase client
118
- const session = await restoreSession(supabaseClient, exchangeResponse);
119
- return {
120
- success: true,
121
- session,
122
- user: session.user,
123
- };
124
- }
125
- catch (err) {
126
- const authError = err;
127
- return {
128
- success: false,
129
- error: authError.message || 'Failed to complete authentication',
130
- };
131
- }
132
- }
133
- /**
134
- * Sign out from Supabase
135
- *
136
- * @example
137
- * ```typescript
138
- * import { signOut } from '@fastshot/auth';
139
- * import { supabase } from './lib/supabase';
140
- *
141
- * await signOut(supabase);
142
- * ```
143
- */
144
- export async function signOut(supabaseClient) {
145
- const { error } = await supabaseClient.auth.signOut();
146
- if (error) {
147
- throw createAuthError('UNKNOWN_ERROR', `Sign out failed: ${error.message}`, error);
148
- }
149
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * Auth Broker configuration
3
- * URLs are read from environment variables at runtime
4
- *
5
- * Required env vars:
6
- * - EXPO_PUBLIC_AUTH_BROKER_URL: Auth broker service URL
7
- * - EXPO_PUBLIC_PROJECT_ID: Fastshot project ID
8
- */
9
- export declare const AUTH_CONFIG: {
10
- /** Auth broker URL - must be set via EXPO_PUBLIC_AUTH_BROKER_URL */
11
- readonly AUTH_BROKER_URL: string;
12
- /** Project ID for authentication */
13
- readonly PROJECT_ID: string | undefined;
14
- /** Deep link scheme for OAuth callback */
15
- readonly DEEP_LINK_SCHEME: "fastshot";
16
- /** Callback path for OAuth */
17
- readonly CALLBACK_PATH: "auth/callback";
18
- };
19
- /**
20
- * OAuth endpoints on the auth broker
21
- */
22
- export declare const AUTH_ENDPOINTS: {
23
- readonly GOOGLE_START: "/v1/auth/google/start";
24
- readonly APPLE_START: "/v1/auth/apple/start";
25
- readonly EXCHANGE_TICKET: "/v1/auth/exchange";
26
- };
27
- /**
28
- * Supported OAuth providers
29
- */
30
- export type OAuthProvider = 'google' | 'apple';
31
- /**
32
- * Default configuration values
33
- */
34
- export declare const DEFAULT_AUTH_CONFIG: {
35
- readonly TIMEOUT: 30000;
36
- readonly MODE: "browser";
37
- };
38
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;IACtB,oEAAoE;8BAC7C,MAAM;IAG7B,oCAAoC;yBAClB,MAAM,GAAG,SAAS;IAGpC,0CAA0C;;IAE1C,8BAA8B;;CAEtB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC"}
package/dist/constants.js DELETED
@@ -1,48 +0,0 @@
1
- /**
2
- * Get environment variable with fallback
3
- * Works in both React Native (process.env.EXPO_PUBLIC_*) and Node.js environments
4
- */
5
- function getEnvVar(key, fallback) {
6
- // React Native / Expo environment
7
- if (typeof process !== 'undefined' && process.env) {
8
- return process.env[key] || fallback;
9
- }
10
- return fallback;
11
- }
12
- /**
13
- * Auth Broker configuration
14
- * URLs are read from environment variables at runtime
15
- *
16
- * Required env vars:
17
- * - EXPO_PUBLIC_AUTH_BROKER_URL: Auth broker service URL
18
- * - EXPO_PUBLIC_PROJECT_ID: Fastshot project ID
19
- */
20
- export const AUTH_CONFIG = {
21
- /** Auth broker URL - must be set via EXPO_PUBLIC_AUTH_BROKER_URL */
22
- get AUTH_BROKER_URL() {
23
- return getEnvVar('EXPO_PUBLIC_AUTH_BROKER_URL', '');
24
- },
25
- /** Project ID for authentication */
26
- get PROJECT_ID() {
27
- return getEnvVar('EXPO_PUBLIC_PROJECT_ID', '');
28
- },
29
- /** Deep link scheme for OAuth callback */
30
- DEEP_LINK_SCHEME: 'fastshot',
31
- /** Callback path for OAuth */
32
- CALLBACK_PATH: 'auth/callback',
33
- };
34
- /**
35
- * OAuth endpoints on the auth broker
36
- */
37
- export const AUTH_ENDPOINTS = {
38
- GOOGLE_START: '/v1/auth/google/start',
39
- APPLE_START: '/v1/auth/apple/start',
40
- EXCHANGE_TICKET: '/v1/auth/exchange',
41
- };
42
- /**
43
- * Default configuration values
44
- */
45
- export const DEFAULT_AUTH_CONFIG = {
46
- TIMEOUT: 30000, // 30 seconds
47
- MODE: 'browser',
48
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,3 +0,0 @@
1
- export { useGoogleSignIn } from './useGoogleSignIn';
2
- export { useAppleSignIn } from './useAppleSignIn';
3
- export { useAuthCallback } from './useAuthCallback';