@civic/auth 0.0.1-beta.2 → 0.0.1-beta.21
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/AuthProvider-Bj_Prt1x.d.ts +21 -0
- package/dist/AuthProvider-DUAoX4G9.d.mts +21 -0
- package/dist/UserProvider-CMLaYOUD.d.ts +16 -0
- package/dist/UserProvider-Cbm8MZkJ.d.mts +16 -0
- package/dist/chunk-4PLCDPEN.mjs +599 -0
- package/dist/chunk-4PLCDPEN.mjs.map +1 -0
- package/dist/chunk-5UQQYXCX.js +1 -0
- package/dist/chunk-5UQQYXCX.js.map +1 -0
- package/dist/chunk-6RFRDWIP.js +223 -0
- package/dist/chunk-6RFRDWIP.js.map +1 -0
- package/dist/chunk-7K3QN2AT.js +599 -0
- package/dist/chunk-7K3QN2AT.js.map +1 -0
- package/dist/chunk-AP4627CS.mjs +223 -0
- package/dist/chunk-AP4627CS.mjs.map +1 -0
- package/dist/chunk-CRTRMMJ7.js.map +1 -1
- package/dist/chunk-CTVJJBBA.js +118 -0
- package/dist/chunk-CTVJJBBA.js.map +1 -0
- package/dist/chunk-FHRZSX3C.js +710 -0
- package/dist/chunk-FHRZSX3C.js.map +1 -0
- package/dist/chunk-JDZPCA3P.js +173 -0
- package/dist/chunk-JDZPCA3P.js.map +1 -0
- package/dist/chunk-MK7557NR.mjs +118 -0
- package/dist/chunk-MK7557NR.mjs.map +1 -0
- package/dist/chunk-NLRREFOX.mjs +710 -0
- package/dist/chunk-NLRREFOX.mjs.map +1 -0
- package/dist/chunk-O3WGNLRO.mjs +173 -0
- package/dist/chunk-O3WGNLRO.mjs.map +1 -0
- package/dist/chunk-PMJAV4JJ.mjs +1 -0
- package/dist/chunk-PMJAV4JJ.mjs.map +1 -0
- package/dist/index.css +63 -70
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/nextjs/client.css +335 -0
- package/dist/nextjs/client.css.map +1 -0
- package/dist/nextjs/client.d.mts +12 -0
- package/dist/nextjs/client.d.ts +12 -0
- package/dist/nextjs/client.js +179 -0
- package/dist/nextjs/client.js.map +1 -0
- package/dist/nextjs/client.mjs +179 -0
- package/dist/nextjs/client.mjs.map +1 -0
- package/dist/nextjs.d.mts +67 -15
- package/dist/nextjs.d.ts +67 -15
- package/dist/nextjs.js +158 -180
- package/dist/nextjs.js.map +1 -1
- package/dist/nextjs.mjs +155 -177
- package/dist/nextjs.mjs.map +1 -1
- package/dist/react.d.mts +31 -81
- package/dist/react.d.ts +31 -81
- package/dist/react.js +35 -634
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +65 -664
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +14 -34
- package/dist/server.d.ts +14 -34
- package/dist/server.js +4 -185
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +10 -191
- package/dist/server.mjs.map +1 -1
- package/dist/storage-B2eAQNdv.d.ts +25 -0
- package/dist/storage-BJPUpxhm.d.mts +25 -0
- package/dist/types-Bqm9OCZN.d.mts +22 -0
- package/dist/types-Bqm9OCZN.d.ts +22 -0
- package/dist/types-HdCjGldB.d.mts +58 -0
- package/dist/types-HdCjGldB.d.ts +58 -0
- package/package.json +26 -17
- package/dist/chunk-5NUJ7LFF.mjs +0 -17
- package/dist/chunk-5NUJ7LFF.mjs.map +0 -1
- package/dist/chunk-KS7ERXGZ.js +0 -481
- package/dist/chunk-KS7ERXGZ.js.map +0 -1
- package/dist/chunk-NINRO7GS.js +0 -209
- package/dist/chunk-NINRO7GS.js.map +0 -1
- package/dist/chunk-NXBKSUKI.mjs +0 -481
- package/dist/chunk-NXBKSUKI.mjs.map +0 -1
- package/dist/chunk-T7HUHQ3J.mjs +0 -209
- package/dist/chunk-T7HUHQ3J.mjs.map +0 -1
- package/dist/chunk-WZLC5B4C.js +0 -17
- package/dist/chunk-WZLC5B4C.js.map +0 -1
- package/dist/index-DoDoIY_K.d.mts +0 -79
- package/dist/index-DoDoIY_K.d.ts +0 -79
package/dist/react.d.mts
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { U as UserContextType, A as AuthContextType } from './UserProvider-Cbm8MZkJ.mjs';
|
|
2
|
+
import { F as ForwardedTokens, C as Config, S as SessionData, D as DisplayMode } from './types-HdCjGldB.mjs';
|
|
3
|
+
import { RefObject, Dispatch, SetStateAction, ReactNode } from 'react';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
type AuthContextType = {
|
|
8
|
-
signIn: (displayMode?: DisplayMode) => Promise<void>;
|
|
9
|
-
isAuthenticated: boolean;
|
|
10
|
-
isLoading: boolean;
|
|
11
|
-
error: Error | null;
|
|
12
|
-
signOut: () => Promise<void>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type UserContextType$1<T extends Record<string, unknown> & JWT["payload"] = Record<string, unknown> & JWT["payload"]> = {
|
|
16
|
-
user: User<T> | null;
|
|
17
|
-
} & Omit<AuthContextType, "isAuthenticated">;
|
|
5
|
+
import { A as AuthProviderProps } from './AuthProvider-DUAoX4G9.mjs';
|
|
6
|
+
import 'oslo/jwt';
|
|
7
|
+
import 'oslo/oauth2';
|
|
18
8
|
|
|
19
9
|
type TokenContextType = {
|
|
20
10
|
accessToken: string | null;
|
|
@@ -25,79 +15,39 @@ type TokenContextType = {
|
|
|
25
15
|
error: Error | null;
|
|
26
16
|
};
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
readonly clientId: string;
|
|
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>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
type AuthProviderProps = {
|
|
70
|
-
children: ReactNode;
|
|
71
|
-
clientId: string;
|
|
72
|
-
redirectUrl?: string;
|
|
73
|
-
nonce?: string;
|
|
74
|
-
config?: Config;
|
|
75
|
-
onSignIn?: (error?: Error) => void;
|
|
76
|
-
onSignOut?: () => void;
|
|
77
|
-
authServiceImpl?: AuthSessionServiceImpl;
|
|
78
|
-
serverSideTokenExchange?: boolean;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
type CivicAuthProviderProps = Omit<AuthProviderProps, "authServiceImpl" | "serverSideTokenExchange">;
|
|
18
|
+
type CivicAuthProviderProps = Omit<AuthProviderProps, "pkceConsumer">;
|
|
82
19
|
declare const CivicAuthProvider: ({ children, ...props }: CivicAuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
83
20
|
|
|
84
|
-
|
|
85
|
-
user: User<UnknownObject> | null;
|
|
86
|
-
};
|
|
87
|
-
type NextCivicAuthProviderProps = Omit<AuthProviderProps, "clientId">;
|
|
88
|
-
declare const CivicNextAuthProvider: ({ children, ...props }: NextCivicAuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
89
|
-
declare const useNextUser: () => UserContextType;
|
|
90
|
-
|
|
91
|
-
declare const useUser: <T extends Record<string, unknown> = Record<string, never>>() => UserContextType$1<T>;
|
|
92
|
-
|
|
93
|
-
declare const useUserCookie: () => any;
|
|
21
|
+
declare const useUser: <T extends Record<string, unknown> = Record<string, never>>() => UserContextType<T>;
|
|
94
22
|
|
|
95
23
|
declare const useToken: () => TokenContextType;
|
|
96
24
|
|
|
97
25
|
declare const useAuth: () => AuthContextType;
|
|
98
26
|
|
|
27
|
+
type ConfigProviderOutput = {
|
|
28
|
+
config: Config;
|
|
29
|
+
redirectUrl: string;
|
|
30
|
+
modalIframe: boolean;
|
|
31
|
+
serverTokenExchange: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
declare const useConfig: () => ConfigProviderOutput;
|
|
35
|
+
|
|
36
|
+
type IframeProviderOutput = {
|
|
37
|
+
iframeRef: RefObject<HTMLIFrameElement> | null;
|
|
38
|
+
setAuthResponseUrl: Dispatch<SetStateAction<string | null>>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
declare const useIframe: () => IframeProviderOutput;
|
|
42
|
+
|
|
99
43
|
declare const useSession: () => SessionData;
|
|
100
44
|
|
|
45
|
+
type CivicAuthIframeContainerProps = {
|
|
46
|
+
onClose?: () => void;
|
|
47
|
+
closeOnRedirect?: boolean;
|
|
48
|
+
};
|
|
49
|
+
declare const CivicAuthIframeContainer: ({ onClose, closeOnRedirect, }: CivicAuthIframeContainerProps) => react_jsx_runtime.JSX.Element;
|
|
50
|
+
|
|
101
51
|
declare const UserButton: ({ displayMode, className, }: {
|
|
102
52
|
displayMode?: DisplayMode;
|
|
103
53
|
className?: string;
|
|
@@ -116,4 +66,4 @@ declare const NextLogOut: ({ children }: {
|
|
|
116
66
|
children: ReactNode;
|
|
117
67
|
}) => react_jsx_runtime.JSX.Element;
|
|
118
68
|
|
|
119
|
-
export {
|
|
69
|
+
export { AuthContextType, CivicAuthIframeContainer, CivicAuthProvider, type CivicAuthProviderProps, NextLogOut, SignInButton, SignOutButton, type TokenContextType, UserButton, UserContextType, useAuth, useConfig, useIframe, useSession, useToken, useUser };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { U as UserContextType, A as AuthContextType } from './UserProvider-CMLaYOUD.js';
|
|
2
|
+
import { F as ForwardedTokens, C as Config, S as SessionData, D as DisplayMode } from './types-HdCjGldB.js';
|
|
3
|
+
import { RefObject, Dispatch, SetStateAction, ReactNode } from 'react';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
type AuthContextType = {
|
|
8
|
-
signIn: (displayMode?: DisplayMode) => Promise<void>;
|
|
9
|
-
isAuthenticated: boolean;
|
|
10
|
-
isLoading: boolean;
|
|
11
|
-
error: Error | null;
|
|
12
|
-
signOut: () => Promise<void>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type UserContextType$1<T extends Record<string, unknown> & JWT["payload"] = Record<string, unknown> & JWT["payload"]> = {
|
|
16
|
-
user: User<T> | null;
|
|
17
|
-
} & Omit<AuthContextType, "isAuthenticated">;
|
|
5
|
+
import { A as AuthProviderProps } from './AuthProvider-Bj_Prt1x.js';
|
|
6
|
+
import 'oslo/jwt';
|
|
7
|
+
import 'oslo/oauth2';
|
|
18
8
|
|
|
19
9
|
type TokenContextType = {
|
|
20
10
|
accessToken: string | null;
|
|
@@ -25,79 +15,39 @@ type TokenContextType = {
|
|
|
25
15
|
error: Error | null;
|
|
26
16
|
};
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
readonly clientId: string;
|
|
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>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
type AuthProviderProps = {
|
|
70
|
-
children: ReactNode;
|
|
71
|
-
clientId: string;
|
|
72
|
-
redirectUrl?: string;
|
|
73
|
-
nonce?: string;
|
|
74
|
-
config?: Config;
|
|
75
|
-
onSignIn?: (error?: Error) => void;
|
|
76
|
-
onSignOut?: () => void;
|
|
77
|
-
authServiceImpl?: AuthSessionServiceImpl;
|
|
78
|
-
serverSideTokenExchange?: boolean;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
type CivicAuthProviderProps = Omit<AuthProviderProps, "authServiceImpl" | "serverSideTokenExchange">;
|
|
18
|
+
type CivicAuthProviderProps = Omit<AuthProviderProps, "pkceConsumer">;
|
|
82
19
|
declare const CivicAuthProvider: ({ children, ...props }: CivicAuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
83
20
|
|
|
84
|
-
|
|
85
|
-
user: User<UnknownObject> | null;
|
|
86
|
-
};
|
|
87
|
-
type NextCivicAuthProviderProps = Omit<AuthProviderProps, "clientId">;
|
|
88
|
-
declare const CivicNextAuthProvider: ({ children, ...props }: NextCivicAuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
89
|
-
declare const useNextUser: () => UserContextType;
|
|
90
|
-
|
|
91
|
-
declare const useUser: <T extends Record<string, unknown> = Record<string, never>>() => UserContextType$1<T>;
|
|
92
|
-
|
|
93
|
-
declare const useUserCookie: () => any;
|
|
21
|
+
declare const useUser: <T extends Record<string, unknown> = Record<string, never>>() => UserContextType<T>;
|
|
94
22
|
|
|
95
23
|
declare const useToken: () => TokenContextType;
|
|
96
24
|
|
|
97
25
|
declare const useAuth: () => AuthContextType;
|
|
98
26
|
|
|
27
|
+
type ConfigProviderOutput = {
|
|
28
|
+
config: Config;
|
|
29
|
+
redirectUrl: string;
|
|
30
|
+
modalIframe: boolean;
|
|
31
|
+
serverTokenExchange: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
declare const useConfig: () => ConfigProviderOutput;
|
|
35
|
+
|
|
36
|
+
type IframeProviderOutput = {
|
|
37
|
+
iframeRef: RefObject<HTMLIFrameElement> | null;
|
|
38
|
+
setAuthResponseUrl: Dispatch<SetStateAction<string | null>>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
declare const useIframe: () => IframeProviderOutput;
|
|
42
|
+
|
|
99
43
|
declare const useSession: () => SessionData;
|
|
100
44
|
|
|
45
|
+
type CivicAuthIframeContainerProps = {
|
|
46
|
+
onClose?: () => void;
|
|
47
|
+
closeOnRedirect?: boolean;
|
|
48
|
+
};
|
|
49
|
+
declare const CivicAuthIframeContainer: ({ onClose, closeOnRedirect, }: CivicAuthIframeContainerProps) => react_jsx_runtime.JSX.Element;
|
|
50
|
+
|
|
101
51
|
declare const UserButton: ({ displayMode, className, }: {
|
|
102
52
|
displayMode?: DisplayMode;
|
|
103
53
|
className?: string;
|
|
@@ -116,4 +66,4 @@ declare const NextLogOut: ({ children }: {
|
|
|
116
66
|
children: ReactNode;
|
|
117
67
|
}) => react_jsx_runtime.JSX.Element;
|
|
118
68
|
|
|
119
|
-
export {
|
|
69
|
+
export { AuthContextType, CivicAuthIframeContainer, CivicAuthProvider, type CivicAuthProviderProps, NextLogOut, SignInButton, SignOutButton, type TokenContextType, UserButton, UserContextType, useAuth, useConfig, useIframe, useSession, useToken, useUser };
|