@smarthivelabs-devs/auth-expo 0.1.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.
- package/dist/index.d.ts +66 -0
- package/dist/index.js +186 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SmartHiveAuthConfig, SmartHiveAuthClient, AuthSession } from '@smarthivelabs-devs/auth-sdk';
|
|
3
|
+
|
|
4
|
+
interface SmartHiveExpoConfig extends Omit<SmartHiveAuthConfig, "storage"> {
|
|
5
|
+
/** Deep link redirect URI, e.g. "myapp://auth/callback" */
|
|
6
|
+
redirectUri: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Build a deep link redirect URI from your Expo app scheme.
|
|
10
|
+
* @example buildRedirectUri("myapp") → "myapp://auth/callback"
|
|
11
|
+
*/
|
|
12
|
+
declare function buildRedirectUri(scheme: string, path?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Creates an auth client that uses SecureStore for token storage and
|
|
15
|
+
* Linking.openURL for the OAuth redirect (instead of location.assign).
|
|
16
|
+
*/
|
|
17
|
+
declare function initExpoAuth(config: SmartHiveExpoConfig): SmartHiveAuthClient;
|
|
18
|
+
interface AuthContextValue {
|
|
19
|
+
client: SmartHiveAuthClient;
|
|
20
|
+
session: AuthSession | null;
|
|
21
|
+
isLoaded: boolean;
|
|
22
|
+
isSignedIn: boolean;
|
|
23
|
+
login(options?: {
|
|
24
|
+
redirectUri?: string;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
logout(): Promise<void>;
|
|
27
|
+
refreshSession(): Promise<void>;
|
|
28
|
+
getAuthorizationHeader(): Promise<Record<string, string>>;
|
|
29
|
+
authFetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
30
|
+
}
|
|
31
|
+
interface SmartHiveProviderProps extends SmartHiveExpoConfig {
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Wraps your Expo app and provides auth state to all child components.
|
|
36
|
+
* Tokens are stored in SecureStore. OAuth is handled via deep links.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <SmartHiveProvider
|
|
40
|
+
* projectId="proj_..."
|
|
41
|
+
* publishableKey="pk_..."
|
|
42
|
+
* baseUrl="https://authcore.smarthivelabs.dev/prod"
|
|
43
|
+
* redirectUri="myapp://auth/callback"
|
|
44
|
+
* >
|
|
45
|
+
* <App />
|
|
46
|
+
* </SmartHiveProvider>
|
|
47
|
+
*/
|
|
48
|
+
declare function SmartHiveProvider({ children, ...config }: SmartHiveProviderProps): react_jsx_runtime.JSX.Element;
|
|
49
|
+
declare function useAuth(): AuthContextValue;
|
|
50
|
+
declare function useSession(): AuthSession | null;
|
|
51
|
+
declare function useUser(): {} | null;
|
|
52
|
+
declare function useIsLoaded(): boolean;
|
|
53
|
+
declare function useIsSignedIn(): boolean | null;
|
|
54
|
+
declare function useAuthFetch(): (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
55
|
+
declare function useAuthorizationHeader(): () => Promise<Record<string, string>>;
|
|
56
|
+
declare function SignedIn({ children }: {
|
|
57
|
+
children: React.ReactNode;
|
|
58
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
59
|
+
declare function SignedOut({ children }: {
|
|
60
|
+
children: React.ReactNode;
|
|
61
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
62
|
+
declare function AuthLoading({ children }: {
|
|
63
|
+
children: React.ReactNode;
|
|
64
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
65
|
+
|
|
66
|
+
export { AuthLoading, SignedIn, SignedOut, type SmartHiveExpoConfig, SmartHiveProvider, type SmartHiveProviderProps, buildRedirectUri, initExpoAuth, useAuth, useAuthFetch, useAuthorizationHeader, useIsLoaded, useIsSignedIn, useSession, useUser };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// src/provider.tsx
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState
|
|
10
|
+
} from "react";
|
|
11
|
+
import { Linking } from "react-native";
|
|
12
|
+
import { AuthRequest } from "expo-auth-session";
|
|
13
|
+
import * as SecureStore from "expo-secure-store";
|
|
14
|
+
import {
|
|
15
|
+
initAuth
|
|
16
|
+
} from "@smarthivelabs-devs/auth-sdk";
|
|
17
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
18
|
+
var secureStorage = {
|
|
19
|
+
getItem: (key) => SecureStore.getItemAsync(key),
|
|
20
|
+
setItem: (key, value) => SecureStore.setItemAsync(key, value),
|
|
21
|
+
removeItem: (key) => SecureStore.deleteItemAsync(key)
|
|
22
|
+
};
|
|
23
|
+
var storageKeys = {
|
|
24
|
+
pkceVerifier: "smarthive.auth.pkce_verifier",
|
|
25
|
+
pkceState: "smarthive.auth.pkce_state"
|
|
26
|
+
};
|
|
27
|
+
function buildRedirectUri(scheme, path = "auth/callback") {
|
|
28
|
+
return `${scheme}://${path}`;
|
|
29
|
+
}
|
|
30
|
+
function normalizeBaseUrl(baseUrl) {
|
|
31
|
+
return baseUrl.replace(/\/$/, "");
|
|
32
|
+
}
|
|
33
|
+
function initExpoAuth(config) {
|
|
34
|
+
const base = initAuth({
|
|
35
|
+
...config,
|
|
36
|
+
storage: secureStorage,
|
|
37
|
+
temporaryStorage: secureStorage
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
...base,
|
|
41
|
+
async login(options) {
|
|
42
|
+
const redirectUri = options?.redirectUri ?? config.redirectUri;
|
|
43
|
+
const authBase = normalizeBaseUrl(config.authDomain ?? config.baseUrl);
|
|
44
|
+
const request = new AuthRequest({
|
|
45
|
+
clientId: config.publishableKey,
|
|
46
|
+
redirectUri,
|
|
47
|
+
responseType: "code",
|
|
48
|
+
usePKCE: true,
|
|
49
|
+
state: options?.state,
|
|
50
|
+
extraParams: {
|
|
51
|
+
project_id: config.projectId,
|
|
52
|
+
publishable_key: config.publishableKey
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const url = await request.makeAuthUrlAsync({
|
|
56
|
+
authorizationEndpoint: `${authBase}/api/auth/oauth2/authorize`
|
|
57
|
+
});
|
|
58
|
+
if (request.codeVerifier) {
|
|
59
|
+
await secureStorage.setItem(storageKeys.pkceVerifier, request.codeVerifier);
|
|
60
|
+
}
|
|
61
|
+
await secureStorage.setItem(storageKeys.pkceState, request.state);
|
|
62
|
+
await Linking.openURL(url);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
var AuthContext = createContext(null);
|
|
67
|
+
function SmartHiveProvider({ children, ...config }) {
|
|
68
|
+
const configRef = useRef(config);
|
|
69
|
+
const client = useMemo(() => initExpoAuth(configRef.current), []);
|
|
70
|
+
const [session, setSession] = useState(null);
|
|
71
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
let cancelled = false;
|
|
74
|
+
client.initialize().then(() => client.getSession()).then((s) => {
|
|
75
|
+
if (!cancelled) setSession(s);
|
|
76
|
+
}).catch(() => {
|
|
77
|
+
}).finally(() => {
|
|
78
|
+
if (!cancelled) setIsLoaded(true);
|
|
79
|
+
});
|
|
80
|
+
return () => {
|
|
81
|
+
cancelled = true;
|
|
82
|
+
};
|
|
83
|
+
}, [client]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
function handleUrl({ url }) {
|
|
86
|
+
client.handleCallback({ url }).then((s) => setSession(s)).catch(() => {
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const sub = Linking.addEventListener("url", handleUrl);
|
|
90
|
+
Linking.getInitialURL().then((url) => {
|
|
91
|
+
if (url) handleUrl({ url });
|
|
92
|
+
});
|
|
93
|
+
return () => sub.remove();
|
|
94
|
+
}, [client]);
|
|
95
|
+
const login = useCallback(
|
|
96
|
+
(options) => client.login(options),
|
|
97
|
+
[client]
|
|
98
|
+
);
|
|
99
|
+
const logout = useCallback(async () => {
|
|
100
|
+
await client.logout();
|
|
101
|
+
setSession(null);
|
|
102
|
+
}, [client]);
|
|
103
|
+
const refreshSession = useCallback(async () => {
|
|
104
|
+
setSession(await client.refreshSession());
|
|
105
|
+
}, [client]);
|
|
106
|
+
const getAuthorizationHeader = useCallback(
|
|
107
|
+
() => client.getAuthorizationHeader(),
|
|
108
|
+
[client]
|
|
109
|
+
);
|
|
110
|
+
const authFetch = useCallback(
|
|
111
|
+
(input, init) => client.fetch(input, init),
|
|
112
|
+
[client]
|
|
113
|
+
);
|
|
114
|
+
const value = useMemo(
|
|
115
|
+
() => ({
|
|
116
|
+
client,
|
|
117
|
+
session,
|
|
118
|
+
isLoaded,
|
|
119
|
+
isSignedIn: !!session,
|
|
120
|
+
login,
|
|
121
|
+
logout,
|
|
122
|
+
refreshSession,
|
|
123
|
+
getAuthorizationHeader,
|
|
124
|
+
authFetch
|
|
125
|
+
}),
|
|
126
|
+
[client, session, isLoaded, login, logout, refreshSession, getAuthorizationHeader, authFetch]
|
|
127
|
+
);
|
|
128
|
+
return /* @__PURE__ */ jsx(AuthContext.Provider, { value, children });
|
|
129
|
+
}
|
|
130
|
+
function useAuthContext() {
|
|
131
|
+
const ctx = useContext(AuthContext);
|
|
132
|
+
if (!ctx) throw new Error("useAuth must be used inside <SmartHiveProvider>.");
|
|
133
|
+
return ctx;
|
|
134
|
+
}
|
|
135
|
+
function useAuth() {
|
|
136
|
+
return useAuthContext();
|
|
137
|
+
}
|
|
138
|
+
function useSession() {
|
|
139
|
+
return useAuthContext().session;
|
|
140
|
+
}
|
|
141
|
+
function useUser() {
|
|
142
|
+
return useAuthContext().session?.user ?? null;
|
|
143
|
+
}
|
|
144
|
+
function useIsLoaded() {
|
|
145
|
+
return useAuthContext().isLoaded;
|
|
146
|
+
}
|
|
147
|
+
function useIsSignedIn() {
|
|
148
|
+
const { isLoaded, isSignedIn } = useAuthContext();
|
|
149
|
+
return isLoaded ? isSignedIn : null;
|
|
150
|
+
}
|
|
151
|
+
function useAuthFetch() {
|
|
152
|
+
return useAuthContext().authFetch;
|
|
153
|
+
}
|
|
154
|
+
function useAuthorizationHeader() {
|
|
155
|
+
return useAuthContext().getAuthorizationHeader;
|
|
156
|
+
}
|
|
157
|
+
function SignedIn({ children }) {
|
|
158
|
+
const { isLoaded, isSignedIn } = useAuthContext();
|
|
159
|
+
if (!isLoaded || !isSignedIn) return null;
|
|
160
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
161
|
+
}
|
|
162
|
+
function SignedOut({ children }) {
|
|
163
|
+
const { isLoaded, isSignedIn } = useAuthContext();
|
|
164
|
+
if (!isLoaded || isSignedIn) return null;
|
|
165
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
166
|
+
}
|
|
167
|
+
function AuthLoading({ children }) {
|
|
168
|
+
const { isLoaded } = useAuthContext();
|
|
169
|
+
return isLoaded ? null : /* @__PURE__ */ jsx(Fragment, { children });
|
|
170
|
+
}
|
|
171
|
+
export {
|
|
172
|
+
AuthLoading,
|
|
173
|
+
SignedIn,
|
|
174
|
+
SignedOut,
|
|
175
|
+
SmartHiveProvider,
|
|
176
|
+
buildRedirectUri,
|
|
177
|
+
initExpoAuth,
|
|
178
|
+
useAuth,
|
|
179
|
+
useAuthFetch,
|
|
180
|
+
useAuthorizationHeader,
|
|
181
|
+
useIsLoaded,
|
|
182
|
+
useIsSignedIn,
|
|
183
|
+
useSession,
|
|
184
|
+
useUser
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/provider.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Linking } from \"react-native\";\nimport { AuthRequest } from \"expo-auth-session\";\nimport * as SecureStore from \"expo-secure-store\";\nimport {\n initAuth,\n type AuthSession,\n type AuthStorage,\n type SmartHiveAuthClient,\n type SmartHiveAuthConfig,\n} from \"@smarthivelabs-devs/auth-sdk\";\n\n// ── Secure storage adapter ────────────────────────────────────────────────────\n\nconst secureStorage: AuthStorage = {\n getItem: (key) => SecureStore.getItemAsync(key),\n setItem: (key, value) => SecureStore.setItemAsync(key, value),\n removeItem: (key) => SecureStore.deleteItemAsync(key),\n};\n\nconst storageKeys = {\n pkceVerifier: \"smarthive.auth.pkce_verifier\",\n pkceState: \"smarthive.auth.pkce_state\"\n} as const;\n\n// ── Config ────────────────────────────────────────────────────────────────────\n\nexport interface SmartHiveExpoConfig extends Omit<SmartHiveAuthConfig, \"storage\"> {\n /** Deep link redirect URI, e.g. \"myapp://auth/callback\" */\n redirectUri: string;\n}\n\n/**\n * Build a deep link redirect URI from your Expo app scheme.\n * @example buildRedirectUri(\"myapp\") → \"myapp://auth/callback\"\n */\nexport function buildRedirectUri(scheme: string, path = \"auth/callback\"): string {\n return `${scheme}://${path}`;\n}\n\nfunction normalizeBaseUrl(baseUrl: string) {\n return baseUrl.replace(/\\/$/, \"\");\n}\n\n// ── Auth client (Expo flavour) ─────────────────────────────────────────────────\n\n/**\n * Creates an auth client that uses SecureStore for token storage and\n * Linking.openURL for the OAuth redirect (instead of location.assign).\n */\nexport function initExpoAuth(config: SmartHiveExpoConfig): SmartHiveAuthClient {\n const base = initAuth({\n ...config,\n storage: secureStorage,\n temporaryStorage: secureStorage\n } as SmartHiveAuthConfig);\n\n return {\n ...base,\n async login(options) {\n const redirectUri = options?.redirectUri ?? config.redirectUri;\n const authBase = normalizeBaseUrl(config.authDomain ?? config.baseUrl);\n const request = new AuthRequest({\n clientId: config.publishableKey,\n redirectUri,\n responseType: \"code\",\n usePKCE: true,\n state: options?.state,\n extraParams: {\n project_id: config.projectId,\n publishable_key: config.publishableKey\n }\n });\n const url = await request.makeAuthUrlAsync({\n authorizationEndpoint: `${authBase}/api/auth/oauth2/authorize`\n });\n\n if (request.codeVerifier) {\n await secureStorage.setItem(storageKeys.pkceVerifier, request.codeVerifier);\n }\n await secureStorage.setItem(storageKeys.pkceState, request.state);\n await Linking.openURL(url);\n },\n };\n}\n\n// ── Context ────────────────────────────────────────────────────────────────────\n\ninterface AuthContextValue {\n client: SmartHiveAuthClient;\n session: AuthSession | null;\n isLoaded: boolean;\n isSignedIn: boolean;\n login(options?: { redirectUri?: string }): Promise<void>;\n logout(): Promise<void>;\n refreshSession(): Promise<void>;\n getAuthorizationHeader(): Promise<Record<string, string>>;\n authFetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;\n}\n\nconst AuthContext = createContext<AuthContextValue | null>(null);\n\n// ── Provider ───────────────────────────────────────────────────────────────────\n\nexport interface SmartHiveProviderProps extends SmartHiveExpoConfig {\n children: React.ReactNode;\n}\n\n/**\n * Wraps your Expo app and provides auth state to all child components.\n * Tokens are stored in SecureStore. OAuth is handled via deep links.\n *\n * @example\n * <SmartHiveProvider\n * projectId=\"proj_...\"\n * publishableKey=\"pk_...\"\n * baseUrl=\"https://authcore.smarthivelabs.dev/prod\"\n * redirectUri=\"myapp://auth/callback\"\n * >\n * <App />\n * </SmartHiveProvider>\n */\nexport function SmartHiveProvider({ children, ...config }: SmartHiveProviderProps) {\n const configRef = useRef(config);\n const client = useMemo(() => initExpoAuth(configRef.current), []);\n\n const [session, setSession] = useState<AuthSession | null>(null);\n const [isLoaded, setIsLoaded] = useState(false);\n\n // Initial session load from SecureStore\n useEffect(() => {\n let cancelled = false;\n client\n .initialize()\n .then(() => client.getSession())\n .then((s) => { if (!cancelled) setSession(s); })\n .catch(() => {})\n .finally(() => { if (!cancelled) setIsLoaded(true); });\n return () => { cancelled = true; };\n }, [client]);\n\n // Deep link listener — catches the OAuth callback redirect back into the app\n useEffect(() => {\n function handleUrl({ url }: { url: string }) {\n client\n .handleCallback({ url })\n .then((s) => setSession(s))\n .catch(() => {});\n }\n\n const sub = Linking.addEventListener(\"url\", handleUrl);\n\n // Handle cold-start: app opened directly from the OAuth redirect URL\n Linking.getInitialURL().then((url) => {\n if (url) handleUrl({ url });\n });\n\n return () => sub.remove();\n }, [client]);\n\n const login = useCallback(\n (options?: { redirectUri?: string }) => client.login(options),\n [client]\n );\n\n const logout = useCallback(async () => {\n await client.logout();\n setSession(null);\n }, [client]);\n\n const refreshSession = useCallback(async () => {\n setSession(await client.refreshSession());\n }, [client]);\n\n const getAuthorizationHeader = useCallback(\n () => client.getAuthorizationHeader(),\n [client]\n );\n\n const authFetch = useCallback(\n (input: string | URL | Request, init?: RequestInit) => client.fetch(input, init),\n [client]\n );\n\n const value = useMemo<AuthContextValue>(\n () => ({\n client,\n session,\n isLoaded,\n isSignedIn: !!session,\n login,\n logout,\n refreshSession,\n getAuthorizationHeader,\n authFetch\n }),\n [client, session, isLoaded, login, logout, refreshSession, getAuthorizationHeader, authFetch]\n );\n\n return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;\n}\n\n// ── Hooks ──────────────────────────────────────────────────────────────────────\n\nfunction useAuthContext(): AuthContextValue {\n const ctx = useContext(AuthContext);\n if (!ctx) throw new Error(\"useAuth must be used inside <SmartHiveProvider>.\");\n return ctx;\n}\n\nexport function useAuth() { return useAuthContext(); }\nexport function useSession() { return useAuthContext().session; }\nexport function useUser() { return useAuthContext().session?.user ?? null; }\nexport function useIsLoaded() { return useAuthContext().isLoaded; }\n\nexport function useIsSignedIn() {\n const { isLoaded, isSignedIn } = useAuthContext();\n return isLoaded ? isSignedIn : null;\n}\n\nexport function useAuthFetch() {\n return useAuthContext().authFetch;\n}\n\nexport function useAuthorizationHeader() {\n return useAuthContext().getAuthorizationHeader;\n}\n\n// ── Render helpers ─────────────────────────────────────────────────────────────\n\nexport function SignedIn({ children }: { children: React.ReactNode }) {\n const { isLoaded, isSignedIn } = useAuthContext();\n if (!isLoaded || !isSignedIn) return null;\n return <>{children}</>;\n}\n\nexport function SignedOut({ children }: { children: React.ReactNode }) {\n const { isLoaded, isSignedIn } = useAuthContext();\n if (!isLoaded || isSignedIn) return null;\n return <>{children}</>;\n}\n\nexport function AuthLoading({ children }: { children: React.ReactNode }) {\n const { isLoaded } = useAuthContext();\n return isLoaded ? null : <>{children}</>;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,YAAY,iBAAiB;AAC7B;AAAA,EACE;AAAA,OAKK;AA6LE,SAkCA,UAlCA;AAzLT,IAAM,gBAA6B;AAAA,EACjC,SAAS,CAAC,QAAoB,yBAAa,GAAG;AAAA,EAC9C,SAAS,CAAC,KAAK,UAAsB,yBAAa,KAAK,KAAK;AAAA,EAC5D,YAAY,CAAC,QAAoB,4BAAgB,GAAG;AACtD;AAEA,IAAM,cAAc;AAAA,EAClB,cAAc;AAAA,EACd,WAAW;AACb;AAaO,SAAS,iBAAiB,QAAgB,OAAO,iBAAyB;AAC/E,SAAO,GAAG,MAAM,MAAM,IAAI;AAC5B;AAEA,SAAS,iBAAiB,SAAiB;AACzC,SAAO,QAAQ,QAAQ,OAAO,EAAE;AAClC;AAQO,SAAS,aAAa,QAAkD;AAC7E,QAAM,OAAO,SAAS;AAAA,IACpB,GAAG;AAAA,IACH,SAAS;AAAA,IACT,kBAAkB;AAAA,EACpB,CAAwB;AAExB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM,MAAM,SAAS;AACnB,YAAM,cAAc,SAAS,eAAe,OAAO;AACnD,YAAM,WAAW,iBAAiB,OAAO,cAAc,OAAO,OAAO;AACrE,YAAM,UAAU,IAAI,YAAY;AAAA,QAC9B,UAAU,OAAO;AAAA,QACjB;AAAA,QACA,cAAc;AAAA,QACd,SAAS;AAAA,QACT,OAAO,SAAS;AAAA,QAChB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U;AAAE,SAAO,eAAe,EAAE,SAAS,QAAQ;AAAM;AACpE,SAAS,cAAc;AAAE,SAAO,eAAe,EAAE;AAAU;AAE3D,SAAS,gBAAgB;AAC9B,QAAM,EAAE,UAAU,WAAW,IAAI,eAAe;AAChD,SAAO,WAAW,aAAa;AACjC;AAEO,SAAS,eAAe;AAC7B,SAAO,eAAe,EAAE;AAC1B;AAEO,SAAS,yBAAyB;AACvC,SAAO,eAAe,EAAE;AAC1B;AAIO,SAAS,SAAS,EAAE,SAAS,GAAkC;AACpE,QAAM,EAAE,UAAU,WAAW,IAAI,eAAe;AAChD,MAAI,CAAC,YAAY,CAAC,WAAY,QAAO;AACrC,SAAO,gCAAG,UAAS;AACrB;AAEO,SAAS,UAAU,EAAE,SAAS,GAAkC;AACrE,QAAM,EAAE,UAAU,WAAW,IAAI,eAAe;AAChD,MAAI,CAAC,YAAY,WAAY,QAAO;AACpC,SAAO,gCAAG,UAAS;AACrB;AAEO,SAAS,YAAY,EAAE,SAAS,GAAkC;AACvE,QAAM,EAAE,SAAS,IAAI,eAAe;AACpC,SAAO,WAAW,OAAO,gCAAG,UAAS;AACvC;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@smarthivelabs-devs/auth-expo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SmartHive Auth provider, hooks, and SecureStore integration for React Native / Expo",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/smarthivelabs-devs/smarthive-auth-sdk"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@smarthivelabs-devs/auth-sdk": "^0.1.0",
|
|
29
|
+
"expo-auth-session": ">=5",
|
|
30
|
+
"expo-secure-store": ">=12",
|
|
31
|
+
"react": ">=18",
|
|
32
|
+
"react-native": ">=0.73"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/react": "^18.3.18",
|
|
36
|
+
"@types/react-native": "^0.73.0",
|
|
37
|
+
"tsup": "^8.3.0",
|
|
38
|
+
"typescript": "^5.7.3",
|
|
39
|
+
"@smarthivelabs-devs/auth-sdk": "^0.1.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsup",
|
|
43
|
+
"build:watch": "tsup --watch",
|
|
44
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
45
|
+
}
|
|
46
|
+
}
|