@civic/auth 0.0.1-beta.4 → 0.0.1-beta.5
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/README.md +26 -0
- package/dist/{chunk-NQPMNXBL.mjs → chunk-EAANLFR5.mjs} +4 -10
- package/dist/chunk-EAANLFR5.mjs.map +1 -0
- package/dist/{chunk-3UIVD6NR.mjs → chunk-EGFTMH5S.mjs} +11 -65
- package/dist/chunk-EGFTMH5S.mjs.map +1 -0
- package/dist/{chunk-T47HULF6.js → chunk-KCSGIIPA.js} +21 -75
- package/dist/chunk-KCSGIIPA.js.map +1 -0
- package/dist/{chunk-WPISYQG3.js → chunk-MVO4UZ2A.js} +5 -11
- package/dist/chunk-MVO4UZ2A.js.map +1 -0
- package/dist/chunk-PMDIR5XE.mjs +502 -0
- package/dist/chunk-PMDIR5XE.mjs.map +1 -0
- package/dist/chunk-YNLXRD5L.js +502 -0
- package/dist/chunk-YNLXRD5L.js.map +1 -0
- package/dist/{index-DoDoIY_K.d.mts → index-Bfi0hVMZ.d.mts} +5 -26
- package/dist/{index-DoDoIY_K.d.ts → index-Bfi0hVMZ.d.ts} +5 -26
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/nextjs.d.mts +2 -3
- package/dist/nextjs.d.ts +2 -3
- package/dist/nextjs.js +21 -35
- package/dist/nextjs.js.map +1 -1
- package/dist/nextjs.mjs +7 -21
- package/dist/nextjs.mjs.map +1 -1
- package/dist/react.d.mts +29 -47
- package/dist/react.d.ts +29 -47
- package/dist/react.js +278 -487
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +300 -509
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +2 -7
- package/dist/server.d.ts +2 -7
- package/dist/server.js +4 -3
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +4 -3
- package/package.json +1 -1
- package/dist/chunk-3UIVD6NR.mjs.map +0 -1
- package/dist/chunk-KBDRDCE5.mjs +0 -239
- package/dist/chunk-KBDRDCE5.mjs.map +0 -1
- package/dist/chunk-NQPMNXBL.mjs.map +0 -1
- package/dist/chunk-OLT5HB3G.js +0 -239
- package/dist/chunk-OLT5HB3G.js.map +0 -1
- package/dist/chunk-T47HULF6.js.map +0 -1
- package/dist/chunk-WPISYQG3.js.map +0 -1
package/dist/react.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JWT } from 'oslo/jwt';
|
|
2
|
-
import { D as DisplayMode, U as User, F as ForwardedTokens,
|
|
2
|
+
import { D as DisplayMode, U as User, F as ForwardedTokens, C as Config, S as SessionData, a as UnknownObject } from './index-Bfi0hVMZ.js';
|
|
3
|
+
import { ReactNode, RefObject, Dispatch, SetStateAction } from 'react';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import
|
|
5
|
-
import { OAuth2Client } from 'oslo/oauth2';
|
|
5
|
+
import 'oslo/oauth2';
|
|
6
6
|
|
|
7
7
|
type AuthContextType = {
|
|
8
8
|
signIn: (displayMode?: DisplayMode) => Promise<void>;
|
|
@@ -25,45 +25,8 @@ type TokenContextType = {
|
|
|
25
25
|
error: Error | null;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
readonly redirectUrl: string;
|
|
31
|
-
readonly oauthServer: string;
|
|
32
|
-
readonly inputEndpoints?: Partial<Endpoints> | undefined;
|
|
33
|
-
private endpoints;
|
|
34
|
-
private oauth2Client;
|
|
35
|
-
private userInfoService;
|
|
36
|
-
private codeVerifier;
|
|
37
|
-
private refreshTokenTimeout;
|
|
38
|
-
constructor(clientId: string, redirectUrl: string, oauthServer: string, inputEndpoints?: Partial<Endpoints> | undefined);
|
|
39
|
-
protected getCodeVerifier(): string;
|
|
40
|
-
getUserInfoService(): Promise<UserInfoService>;
|
|
41
|
-
protected getEndpoints(): Promise<Endpoints>;
|
|
42
|
-
protected getOauth2Client(): Promise<OAuth2Client>;
|
|
43
|
-
getSessionData(): SessionData;
|
|
44
|
-
updateSessionData(data: Partial<SessionData>): void;
|
|
45
|
-
getUser(): User<UnknownObject> | null;
|
|
46
|
-
setUser(data: User<UnknownObject> | null): void;
|
|
47
|
-
clearSessionData(): void;
|
|
48
|
-
getAuthorizationUrlWithChallenge(state: string, scopes: string[]): Promise<URL>;
|
|
49
|
-
getAuthorizationUrl(scopes: string[], displayMode: DisplayMode, nonce?: string): Promise<string>;
|
|
50
|
-
loadAuthorizationUrl(authorizationURL: string, displayMode: DisplayMode): void;
|
|
51
|
-
init(): Promise<this>;
|
|
52
|
-
logout(): Promise<void>;
|
|
53
|
-
determineDisplayMode(displayMode: DisplayMode): DisplayMode;
|
|
54
|
-
signIn(displayMode: DisplayMode, scopes: string[], nonce: string): Promise<void>;
|
|
55
|
-
tokenExchange(responseUrl: string): Promise<SessionData>;
|
|
56
|
-
private setupTokenRefresh;
|
|
57
|
-
refreshToken(): Promise<SessionData>;
|
|
58
|
-
getUserInfo<T extends UnknownObject>(): Promise<User<T> | null>;
|
|
59
|
-
/**
|
|
60
|
-
* Uses the jose library to validate a JWT token using the OAuth JWKS endpoint
|
|
61
|
-
* @returns {Promise<jose.JWTPayload>}
|
|
62
|
-
* @throws {Error} if the token is invalid
|
|
63
|
-
* @param tokens
|
|
64
|
-
*/
|
|
65
|
-
validateTokens(tokens: OIDCTokenResponseBody): Promise<ParsedTokens>;
|
|
66
|
-
validateExistingSession(): Promise<SessionData>;
|
|
28
|
+
interface PKCEConsumer {
|
|
29
|
+
getCodeChallenge(): Promise<string>;
|
|
67
30
|
}
|
|
68
31
|
|
|
69
32
|
type AuthProviderProps = {
|
|
@@ -74,11 +37,16 @@ type AuthProviderProps = {
|
|
|
74
37
|
config?: Config;
|
|
75
38
|
onSignIn?: (error?: Error) => void;
|
|
76
39
|
onSignOut?: () => void;
|
|
77
|
-
|
|
78
|
-
|
|
40
|
+
pkceConsumer?: PKCEConsumer;
|
|
41
|
+
modalIframe?: boolean;
|
|
79
42
|
};
|
|
80
43
|
|
|
81
|
-
type
|
|
44
|
+
type SessionProviderOutput = SessionData & {
|
|
45
|
+
iframeRef: RefObject<HTMLIFrameElement> | null;
|
|
46
|
+
setAuthResponseUrl: Dispatch<SetStateAction<string | null>>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
type CivicAuthProviderProps = Omit<AuthProviderProps, "pkceConsumer">;
|
|
82
50
|
declare const CivicAuthProvider: ({ children, ...props }: CivicAuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
83
51
|
|
|
84
52
|
type UserContextType = {
|
|
@@ -96,7 +64,21 @@ declare const useToken: () => TokenContextType;
|
|
|
96
64
|
|
|
97
65
|
declare const useAuth: () => AuthContextType;
|
|
98
66
|
|
|
99
|
-
declare const useSession: () =>
|
|
67
|
+
declare const useSession: () => SessionProviderOutput;
|
|
68
|
+
|
|
69
|
+
type ConfigProviderOutput = {
|
|
70
|
+
config: Config;
|
|
71
|
+
redirectUrl: string;
|
|
72
|
+
modalIframe: boolean;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
declare const useConfig: () => ConfigProviderOutput;
|
|
76
|
+
|
|
77
|
+
type CivicAuthIframeContainerProps = {
|
|
78
|
+
onClose?: () => void;
|
|
79
|
+
closeOnRedirect?: boolean;
|
|
80
|
+
};
|
|
81
|
+
declare const CivicAuthIframeContainer: ({ onClose, closeOnRedirect, }: CivicAuthIframeContainerProps) => react_jsx_runtime.JSX.Element;
|
|
100
82
|
|
|
101
83
|
declare const UserButton: ({ displayMode, className, }: {
|
|
102
84
|
displayMode?: DisplayMode;
|
|
@@ -116,4 +98,4 @@ declare const NextLogOut: ({ children }: {
|
|
|
116
98
|
children: ReactNode;
|
|
117
99
|
}) => react_jsx_runtime.JSX.Element;
|
|
118
100
|
|
|
119
|
-
export { type AuthContextType, CivicAuthProvider, type CivicAuthProviderProps, CivicNextAuthProvider, type NextCivicAuthProviderProps, NextLogOut, SignInButton, SignOutButton, type TokenContextType, UserButton, type UserContextType$1 as UserContextType, useAuth, useNextUser, useSession, useToken, useUser, useUserCookie };
|
|
101
|
+
export { type AuthContextType, CivicAuthIframeContainer, CivicAuthProvider, type CivicAuthProviderProps, CivicNextAuthProvider, type NextCivicAuthProviderProps, NextLogOut, SignInButton, SignOutButton, type TokenContextType, UserButton, type UserContextType$1 as UserContextType, useAuth, useConfig, useNextUser, useSession, useToken, useUser, useUserCookie };
|