isa-auth 0.2.1 → 0.2.3
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 +60 -0
- package/dist/index.d.mts +190 -22
- package/dist/index.d.ts +190 -22
- package/dist/index.js +8151 -339
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8149 -339
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
> **A Unified, Framework-Agnostic Frontend Authentication Suite**
|
|
4
4
|
> Supporting Multi-Provider OAuth (Google, Apple, Meta, Line, Kakao, Naver), Developer (GitHub, Discord), Web3 (SIWE), Identity (World ID Orb, Passkey WebAuthn), Reactive Store, Axios/Fetch Interceptors, and RBAC/ABAC Guards.
|
|
5
5
|
|
|
6
|
+
[](https://yoonjonglyu.github.io/isa-auth/)
|
|
7
|
+
[](https://www.npmjs.com/package/isa-auth)
|
|
6
8
|
[](https://opensource.org/licenses/MIT)
|
|
7
9
|
[](https://www.typescriptlang.org/)
|
|
8
10
|
[](https://swc.rs/)
|
|
@@ -10,6 +12,11 @@
|
|
|
10
12
|
|
|
11
13
|
---
|
|
12
14
|
|
|
15
|
+
> 🎮 **Try the Live Interactive Demo**: [https://yoonjonglyu.github.io/isa-auth/](https://yoonjonglyu.github.io/isa-auth/)
|
|
16
|
+
> Experience 11 authentication providers, real-time reactive store visualization, dynamic button layouts, and wildcard RBAC guard checks directly in your browser without any setup!
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
13
20
|
## 🌟 Why ISA AUTH?
|
|
14
21
|
|
|
15
22
|
Modern web applications frequently require diverse authentication methods — from global platforms (Google, Apple, Meta) and local portals (Kakao, Naver, Line) to developer communities (GitHub, Discord), decentralized Web3 wallets (SIWE), and next-generation biometric/identity systems (**World ID Orb & Passkey**).
|
|
@@ -74,6 +81,8 @@ pnpm add isa-auth
|
|
|
74
81
|
|
|
75
82
|
## 🚀 Quick Start Recipes
|
|
76
83
|
|
|
84
|
+
> 💡 **Developer Keys Setup**: Need help obtaining Client IDs, API Keys or configuring Redirect URIs? Check out our complete [Provider Environment Setup Guide](https://github.com/yoonjonglyu/isa-auth/blob/main/docs/ENV_SETUP.md).
|
|
85
|
+
|
|
77
86
|
### 1. Multi-Provider All-in-One Configuration (Recommended)
|
|
78
87
|
|
|
79
88
|
Manage multiple social logins, developer platforms, and Web3/Passkey authentication simultaneously in a single application instance:
|
|
@@ -320,6 +329,57 @@ const devAuth = new IsaAuth({
|
|
|
320
329
|
|
|
321
330
|
---
|
|
322
331
|
|
|
332
|
+
### 8. OAuth Callback & Popup Bridge (`IsaAuth.handleCallback`)
|
|
333
|
+
|
|
334
|
+
Handle redirect and popup callbacks in your `/callback` route with a single line:
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
import { IsaAuth } from 'isa-auth';
|
|
338
|
+
|
|
339
|
+
// In your /callback page (e.g., /pages/callback.tsx or /app/callback/page.tsx)
|
|
340
|
+
// Parses ?code=... or #access_token=..., notifies opener window via postMessage, and closes popup.
|
|
341
|
+
const result = IsaAuth.handleCallback();
|
|
342
|
+
console.log('Received auth callback:', result);
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### 9. Modern React Hook: `useIsaAuth`
|
|
346
|
+
|
|
347
|
+
```tsx
|
|
348
|
+
import React from 'react';
|
|
349
|
+
import { IsaAuth, useIsaAuth, createReactAuthButton } from 'isa-auth';
|
|
350
|
+
|
|
351
|
+
const auth = new IsaAuth({
|
|
352
|
+
providers: {
|
|
353
|
+
google: { clientId: 'GOOGLE_CLIENT_ID' },
|
|
354
|
+
github: { clientId: 'GITHUB_CLIENT_ID' },
|
|
355
|
+
},
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
const IsaAuthButton = createReactAuthButton(auth, React);
|
|
359
|
+
|
|
360
|
+
export function UserProfile() {
|
|
361
|
+
const { isAuthenticated, user, token, signIn, signOut } = useIsaAuth(auth, React);
|
|
362
|
+
|
|
363
|
+
if (!isAuthenticated) {
|
|
364
|
+
return (
|
|
365
|
+
<div>
|
|
366
|
+
<IsaAuthButton provider="google" />
|
|
367
|
+
<IsaAuthButton provider="github" />
|
|
368
|
+
</div>
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return (
|
|
373
|
+
<div>
|
|
374
|
+
<h3>Welcome, {user?.name || user?.email}</h3>
|
|
375
|
+
<button onClick={() => signOut()}>Sign Out</button>
|
|
376
|
+
</div>
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
323
383
|
## 🤖 Bundled Agent Skill
|
|
324
384
|
|
|
325
385
|
This package comes pre-packaged with an AI Agent Skill under:
|
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ interface LoginButtonConfig {
|
|
|
5
5
|
style?: Partial<CSSStyleDeclaration>;
|
|
6
6
|
text?: string;
|
|
7
7
|
icon?: string;
|
|
8
|
+
svg?: string;
|
|
8
9
|
fullWidth?: boolean;
|
|
9
10
|
}
|
|
10
11
|
interface LoginButtonProps {
|
|
@@ -20,6 +21,7 @@ declare class LoginButton {
|
|
|
20
21
|
readonly config: LoginButtonConfig;
|
|
21
22
|
constructor(props: LoginButtonProps);
|
|
22
23
|
private getDefaultText;
|
|
24
|
+
private getProviderBrandStyle;
|
|
23
25
|
private getDefaultStyle;
|
|
24
26
|
private mergeStyles;
|
|
25
27
|
getButtonClass(): string;
|
|
@@ -27,7 +29,8 @@ declare class LoginButton {
|
|
|
27
29
|
id: string;
|
|
28
30
|
type: AuthButtonType;
|
|
29
31
|
provider: ButtonProviderType;
|
|
30
|
-
|
|
32
|
+
svg: string;
|
|
33
|
+
icon: string | undefined;
|
|
31
34
|
text: string;
|
|
32
35
|
style: Partial<CSSStyleDeclaration>;
|
|
33
36
|
fullWidth: boolean;
|
|
@@ -49,18 +52,42 @@ declare global {
|
|
|
49
52
|
google?: any;
|
|
50
53
|
}
|
|
51
54
|
}
|
|
55
|
+
interface GoogleAuthOptions {
|
|
56
|
+
clientId: string;
|
|
57
|
+
callback?: (token: string) => string | Promise<string>;
|
|
58
|
+
scope?: string;
|
|
59
|
+
autoPrompt?: boolean;
|
|
60
|
+
redirectUri?: string;
|
|
61
|
+
isPopup?: boolean;
|
|
62
|
+
onSuccess?: (userOrToken: any) => void;
|
|
63
|
+
onFail?: (error: any) => void;
|
|
64
|
+
}
|
|
52
65
|
declare class GoogleAuthProvider implements AuthProvider$1 {
|
|
53
66
|
private clientId;
|
|
54
|
-
private callback
|
|
55
|
-
|
|
67
|
+
private callback?;
|
|
68
|
+
private scope;
|
|
69
|
+
private autoPrompt;
|
|
70
|
+
private redirectUri?;
|
|
71
|
+
private isPopup;
|
|
72
|
+
private onSuccess?;
|
|
73
|
+
private onFail?;
|
|
74
|
+
private idToken;
|
|
75
|
+
private accessToken;
|
|
76
|
+
private userInfo;
|
|
77
|
+
private tokenClient;
|
|
78
|
+
private pendingSignIn;
|
|
79
|
+
constructor(options: GoogleAuthOptions | {
|
|
56
80
|
clientId: string;
|
|
57
|
-
callback
|
|
81
|
+
callback?: (token: string) => string | Promise<string>;
|
|
58
82
|
});
|
|
59
83
|
loadGoogleSdk(): Promise<void>;
|
|
60
84
|
init(): Promise<void>;
|
|
61
|
-
|
|
85
|
+
handleCredentialResponse(credential: string): void;
|
|
86
|
+
promptOneTap(): void;
|
|
87
|
+
renderGoogleButton(parent: HTMLElement, options?: any): void;
|
|
88
|
+
signIn(): Promise<void>;
|
|
62
89
|
signOut(): void;
|
|
63
|
-
getAccessToken(): Promise<
|
|
90
|
+
getAccessToken(): Promise<string | null>;
|
|
64
91
|
getUserInfo(): Promise<any>;
|
|
65
92
|
}
|
|
66
93
|
|
|
@@ -76,6 +103,7 @@ interface AppleAuthOptions {
|
|
|
76
103
|
state?: string;
|
|
77
104
|
nonce?: string;
|
|
78
105
|
usePopup?: boolean;
|
|
106
|
+
responseMode?: 'form_post' | 'fragment' | 'query';
|
|
79
107
|
onSuccess?: (response: any) => void;
|
|
80
108
|
onFail?: (error: any) => void;
|
|
81
109
|
}
|
|
@@ -84,8 +112,10 @@ declare class AppleAuthProvider implements AuthProvider$1 {
|
|
|
84
112
|
private redirectURI;
|
|
85
113
|
private scope;
|
|
86
114
|
private state?;
|
|
115
|
+
private lastState?;
|
|
87
116
|
private nonce?;
|
|
88
117
|
private usePopup;
|
|
118
|
+
private responseMode?;
|
|
89
119
|
private onSuccess?;
|
|
90
120
|
private onFail?;
|
|
91
121
|
private idToken;
|
|
@@ -93,10 +123,13 @@ declare class AppleAuthProvider implements AuthProvider$1 {
|
|
|
93
123
|
constructor(options: AppleAuthOptions);
|
|
94
124
|
loadAppleSdk(): Promise<void>;
|
|
95
125
|
init(): Promise<void>;
|
|
126
|
+
buildAuthUrl(): string;
|
|
96
127
|
signIn(): Promise<void>;
|
|
97
128
|
signOut(): void;
|
|
98
129
|
getAccessToken(): Promise<string | null>;
|
|
99
130
|
getUserInfo(): Promise<any>;
|
|
131
|
+
setToken(token: string): void;
|
|
132
|
+
setUser(user: any): void;
|
|
100
133
|
}
|
|
101
134
|
|
|
102
135
|
declare global {
|
|
@@ -120,6 +153,7 @@ declare class MetaAuthProvider implements AuthProvider$1 {
|
|
|
120
153
|
private redirectUri?;
|
|
121
154
|
private scope;
|
|
122
155
|
private isPopup;
|
|
156
|
+
private lastState?;
|
|
123
157
|
private onSuccess?;
|
|
124
158
|
private onFail?;
|
|
125
159
|
private accessToken;
|
|
@@ -127,14 +161,15 @@ declare class MetaAuthProvider implements AuthProvider$1 {
|
|
|
127
161
|
constructor(options: MetaAuthOptions);
|
|
128
162
|
loadFacebookSdk(): Promise<void>;
|
|
129
163
|
init(): Promise<void>;
|
|
130
|
-
|
|
164
|
+
buildAuthUrl(): string;
|
|
165
|
+
signIn(): Promise<void>;
|
|
131
166
|
signOut(): void;
|
|
167
|
+
fetchUserInfo(): Promise<any>;
|
|
132
168
|
getAccessToken(): Promise<string | null>;
|
|
133
169
|
getUserInfo(): Promise<any>;
|
|
134
170
|
setToken(token: string): void;
|
|
135
171
|
setUser(user: any): void;
|
|
136
172
|
}
|
|
137
|
-
declare const FacebookAuthProvider: typeof MetaAuthProvider;
|
|
138
173
|
|
|
139
174
|
declare global {
|
|
140
175
|
interface Window {
|
|
@@ -143,24 +178,37 @@ declare global {
|
|
|
143
178
|
}
|
|
144
179
|
interface KakaoAuthOptions {
|
|
145
180
|
javascriptKey: string;
|
|
181
|
+
restApiKey?: string;
|
|
146
182
|
redirectUri?: string;
|
|
147
183
|
scope?: string;
|
|
184
|
+
isPopup?: boolean;
|
|
185
|
+
state?: string;
|
|
148
186
|
onSuccess?: (authObj: any) => void;
|
|
149
187
|
onFail?: (error: any) => void;
|
|
150
188
|
}
|
|
151
189
|
declare class KakaoAuthProvider implements AuthProvider$1 {
|
|
152
190
|
private javascriptKey;
|
|
191
|
+
private restApiKey?;
|
|
153
192
|
private redirectUri?;
|
|
154
193
|
private scope?;
|
|
194
|
+
private isPopup;
|
|
195
|
+
private state?;
|
|
196
|
+
private lastState?;
|
|
155
197
|
private onSuccess?;
|
|
156
198
|
private onFail?;
|
|
199
|
+
private accessToken;
|
|
200
|
+
private userInfo;
|
|
157
201
|
constructor(options: KakaoAuthOptions);
|
|
202
|
+
buildAuthUrl(): string;
|
|
158
203
|
loadKakaoSdk(): Promise<void>;
|
|
159
204
|
init(): Promise<void>;
|
|
160
|
-
signIn(): void
|
|
205
|
+
signIn(): Promise<void>;
|
|
161
206
|
signOut(): void;
|
|
207
|
+
fetchUserInfo(): Promise<any>;
|
|
162
208
|
getAccessToken(): Promise<string | null>;
|
|
163
209
|
getUserInfo(): Promise<any>;
|
|
210
|
+
setToken(token: string): void;
|
|
211
|
+
setUser(user: any): void;
|
|
164
212
|
}
|
|
165
213
|
|
|
166
214
|
declare global {
|
|
@@ -171,24 +219,40 @@ declare global {
|
|
|
171
219
|
interface NaverAuthOptions {
|
|
172
220
|
clientId: string;
|
|
173
221
|
callbackUrl: string;
|
|
222
|
+
responseType?: 'code' | 'token';
|
|
174
223
|
isPopup?: boolean;
|
|
224
|
+
state?: string;
|
|
225
|
+
useLegacySdk?: boolean;
|
|
175
226
|
loginButtonId?: string;
|
|
176
227
|
callbackHandle?: (status: boolean) => void;
|
|
228
|
+
onSuccess?: (response: any) => void;
|
|
229
|
+
onFail?: (error: any) => void;
|
|
177
230
|
}
|
|
178
231
|
declare class NaverAuthProvider implements AuthProvider$1 {
|
|
179
232
|
private clientId;
|
|
180
233
|
private callbackUrl;
|
|
234
|
+
private responseType;
|
|
181
235
|
private isPopup;
|
|
182
|
-
private
|
|
236
|
+
private state?;
|
|
237
|
+
private lastState?;
|
|
238
|
+
private useLegacySdk;
|
|
239
|
+
private loginButtonId?;
|
|
183
240
|
private callbackHandle?;
|
|
241
|
+
private onSuccess?;
|
|
242
|
+
private onFail?;
|
|
184
243
|
private naverLoginInstance;
|
|
244
|
+
private accessToken;
|
|
245
|
+
private userInfo;
|
|
185
246
|
constructor(options: NaverAuthOptions);
|
|
186
|
-
|
|
247
|
+
buildAuthUrl(): string;
|
|
248
|
+
loadLegacySdk(): Promise<void>;
|
|
187
249
|
init(): Promise<void>;
|
|
188
|
-
signIn(): void
|
|
250
|
+
signIn(): Promise<void>;
|
|
189
251
|
signOut(): void;
|
|
190
252
|
getAccessToken(): Promise<string | null>;
|
|
191
253
|
getUserInfo(): Promise<any>;
|
|
254
|
+
setToken(token: string): void;
|
|
255
|
+
setUser(user: any): void;
|
|
192
256
|
}
|
|
193
257
|
|
|
194
258
|
interface LineAuthOptions {
|
|
@@ -207,6 +271,7 @@ declare class LineAuthProvider implements AuthProvider$1 {
|
|
|
207
271
|
private callbackUrl;
|
|
208
272
|
private scope;
|
|
209
273
|
private state?;
|
|
274
|
+
private lastState?;
|
|
210
275
|
private nonce?;
|
|
211
276
|
private isPopup;
|
|
212
277
|
private botPrompt?;
|
|
@@ -251,6 +316,7 @@ declare class GithubAuthProvider implements AuthProvider$1 {
|
|
|
251
316
|
private scope;
|
|
252
317
|
private isPopup;
|
|
253
318
|
private state?;
|
|
319
|
+
private lastState?;
|
|
254
320
|
private usePkce;
|
|
255
321
|
private onSuccess?;
|
|
256
322
|
private onFail?;
|
|
@@ -285,6 +351,7 @@ declare class DiscordAuthProvider implements AuthProvider$1 {
|
|
|
285
351
|
private scope;
|
|
286
352
|
private isPopup;
|
|
287
353
|
private state?;
|
|
354
|
+
private lastState?;
|
|
288
355
|
private usePkce;
|
|
289
356
|
private prompt?;
|
|
290
357
|
private onSuccess?;
|
|
@@ -447,6 +514,7 @@ declare class PasskeyAuthProvider implements AuthProvider$1 {
|
|
|
447
514
|
challenge?: Uint8Array;
|
|
448
515
|
userName?: string;
|
|
449
516
|
userId?: string;
|
|
517
|
+
authenticatorAttachment?: 'platform' | 'cross-platform';
|
|
450
518
|
}): Promise<any>;
|
|
451
519
|
/**
|
|
452
520
|
* Performs Passkey authentication (navigator.credentials.get)
|
|
@@ -462,6 +530,10 @@ declare class PasskeyAuthProvider implements AuthProvider$1 {
|
|
|
462
530
|
* OAuth 2.0 PKCE (Proof Key for Code Exchange) utilities
|
|
463
531
|
* Compatible with modern browser Web Crypto API.
|
|
464
532
|
*/
|
|
533
|
+
/**
|
|
534
|
+
* Generates a cryptographically random state/nonce string.
|
|
535
|
+
*/
|
|
536
|
+
declare function generateRandomState(length?: number): string;
|
|
465
537
|
/**
|
|
466
538
|
* Generates a cryptographically random code verifier string (43~128 chars).
|
|
467
539
|
*/
|
|
@@ -485,16 +557,47 @@ interface BuildAuthorizeUrlOptions {
|
|
|
485
557
|
* Builds an OAuth 2.0 authorization URL
|
|
486
558
|
*/
|
|
487
559
|
declare function buildAuthorizeUrl(options: BuildAuthorizeUrlOptions): string;
|
|
488
|
-
|
|
489
|
-
* Parses query params from OAuth redirect callback URL
|
|
490
|
-
*/
|
|
491
|
-
declare function parseOAuthCallback(urlOrSearch?: string): {
|
|
560
|
+
interface OAuthCallbackResult {
|
|
492
561
|
code?: string;
|
|
493
562
|
state?: string;
|
|
494
563
|
error?: string;
|
|
495
564
|
error_description?: string;
|
|
496
565
|
token?: string;
|
|
497
|
-
|
|
566
|
+
access_token?: string;
|
|
567
|
+
id_token?: string;
|
|
568
|
+
token_type?: string;
|
|
569
|
+
expires_in?: string;
|
|
570
|
+
[key: string]: string | undefined;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Parses query and hash params from OAuth redirect callback URL or browser location
|
|
574
|
+
*/
|
|
575
|
+
declare function parseOAuthCallback(urlOrSearch?: string): OAuthCallbackResult;
|
|
576
|
+
interface HandleOAuthCallbackOptions {
|
|
577
|
+
targetOrigin?: string;
|
|
578
|
+
closePopup?: boolean;
|
|
579
|
+
storageKey?: string;
|
|
580
|
+
urlOrSearch?: string;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Handles the OAuth redirect or popup callback.
|
|
584
|
+
* If running inside a popup (window.opener exists), communicates the payload back to the opener via postMessage.
|
|
585
|
+
* Automatically parses both query string and hash fragment.
|
|
586
|
+
*/
|
|
587
|
+
declare function handleOAuthCallback(options?: HandleOAuthCallbackOptions): OAuthCallbackResult;
|
|
588
|
+
/**
|
|
589
|
+
* Opens a centered popup window for OAuth authorization.
|
|
590
|
+
*/
|
|
591
|
+
declare function openOAuthPopup(url: string, title?: string, width?: number, height?: number): Window | null;
|
|
592
|
+
interface WaitForPopupOptions {
|
|
593
|
+
timeoutMs?: number;
|
|
594
|
+
expectedOrigin?: string;
|
|
595
|
+
expectedState?: string;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Waits for a message from an OAuth popup window or detects if it was closed.
|
|
599
|
+
*/
|
|
600
|
+
declare function waitForOAuthPopupMessage(popup: Window | null, timeoutMsOrOptions?: number | WaitForPopupOptions): Promise<OAuthCallbackResult>;
|
|
498
601
|
|
|
499
602
|
declare const identityProviders: {
|
|
500
603
|
world: typeof WorldAuthProvider;
|
|
@@ -1052,6 +1155,7 @@ declare function clearStoreSession(): void;
|
|
|
1052
1155
|
|
|
1053
1156
|
interface AuthCoreProps {
|
|
1054
1157
|
providerType?: CoreProviderType;
|
|
1158
|
+
serviceType?: AuthServiceType;
|
|
1055
1159
|
secret?: string;
|
|
1056
1160
|
storage?: StorageType;
|
|
1057
1161
|
storagePrefix?: string;
|
|
@@ -1061,7 +1165,7 @@ declare class AuthCore {
|
|
|
1061
1165
|
private button;
|
|
1062
1166
|
private serviceInstance;
|
|
1063
1167
|
lifecycle: AuthLifecycleManager;
|
|
1064
|
-
constructor({ providerType, secret, storage, storagePrefix, }?: AuthCoreProps);
|
|
1168
|
+
constructor({ providerType, serviceType: explicitServiceType, secret, storage, storagePrefix, }?: AuthCoreProps);
|
|
1065
1169
|
getService(): AuthBaseService | JwtService;
|
|
1066
1170
|
getProvider(): typeof GoogleAuthProvider | typeof AppleAuthProvider | typeof MetaAuthProvider | typeof KakaoAuthProvider | typeof NaverAuthProvider | typeof LineAuthProvider | typeof GithubAuthProvider | typeof DiscordAuthProvider | typeof Web3AuthProvider | typeof WorldAuthProvider | typeof PasskeyAuthProvider | null;
|
|
1067
1171
|
getButton(): LoginButton | null;
|
|
@@ -1164,10 +1268,11 @@ interface ButtonRenderInfo {
|
|
|
1164
1268
|
label?: string;
|
|
1165
1269
|
className?: string;
|
|
1166
1270
|
icon?: string;
|
|
1271
|
+
svg?: string;
|
|
1167
1272
|
style?: Partial<CSSStyleDeclaration>;
|
|
1168
1273
|
}
|
|
1169
1274
|
/**
|
|
1170
|
-
* Creates and returns a native HTMLButtonElement
|
|
1275
|
+
* Creates and returns a native HTMLButtonElement with vector icons & micro-animations
|
|
1171
1276
|
*/
|
|
1172
1277
|
declare function renderByJs(info: ButtonRenderInfo): HTMLButtonElement;
|
|
1173
1278
|
/**
|
|
@@ -1713,15 +1818,71 @@ declare function renderByVue(info: ButtonRenderInfo): {
|
|
|
1713
1818
|
* Registers custom Web Component <isa-auth-button>
|
|
1714
1819
|
*/
|
|
1715
1820
|
declare function registerWebComponent(): void;
|
|
1821
|
+
/**
|
|
1822
|
+
* TypeScript JSX IntrinsicElements Declaration for Web Component <isa-auth-button>
|
|
1823
|
+
* Eliminates "Property 'isa-auth-button' does not exist on type 'JSX.IntrinsicElements'" in React/Vue/TSX
|
|
1824
|
+
*/
|
|
1825
|
+
interface IsaAuthButtonAttributes {
|
|
1826
|
+
provider?: string;
|
|
1827
|
+
label?: string;
|
|
1828
|
+
class?: string;
|
|
1829
|
+
style?: string;
|
|
1830
|
+
'onisa-auth-click'?: (event: CustomEvent) => void;
|
|
1831
|
+
children?: any;
|
|
1832
|
+
}
|
|
1833
|
+
declare global {
|
|
1834
|
+
namespace JSX {
|
|
1835
|
+
interface IntrinsicElements {
|
|
1836
|
+
'isa-auth-button': IsaAuthButtonAttributes;
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1716
1840
|
|
|
1717
1841
|
type index_ButtonRenderInfo = ButtonRenderInfo;
|
|
1842
|
+
type index_IsaAuthButtonAttributes = IsaAuthButtonAttributes;
|
|
1718
1843
|
declare const index_registerWebComponent: typeof registerWebComponent;
|
|
1719
1844
|
declare const index_renderByJs: typeof renderByJs;
|
|
1720
1845
|
declare const index_renderByReact: typeof renderByReact;
|
|
1721
1846
|
declare const index_renderByVue: typeof renderByVue;
|
|
1722
1847
|
declare namespace index {
|
|
1723
|
-
export { type index_ButtonRenderInfo as ButtonRenderInfo, index_registerWebComponent as registerWebComponent, index_renderByJs as renderByJs, index_renderByReact as renderByReact, index_renderByVue as renderByVue };
|
|
1848
|
+
export { type index_ButtonRenderInfo as ButtonRenderInfo, type index_IsaAuthButtonAttributes as IsaAuthButtonAttributes, index_registerWebComponent as registerWebComponent, index_renderByJs as renderByJs, index_renderByReact as renderByReact, index_renderByVue as renderByVue };
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* React Type-Safe Wrapper Component & Hook for ISA-AUTH
|
|
1853
|
+
* Compatible with Next.js, Vite, CRA, Remix, and standard React apps.
|
|
1854
|
+
*/
|
|
1855
|
+
|
|
1856
|
+
interface IsaAuthButtonProps {
|
|
1857
|
+
auth?: IsaAuth;
|
|
1858
|
+
provider: CoreProviderType;
|
|
1859
|
+
label?: string;
|
|
1860
|
+
className?: string;
|
|
1861
|
+
style?: Record<string, string | number>;
|
|
1862
|
+
onSuccess?: (user: any) => void;
|
|
1863
|
+
onError?: (error: any) => void;
|
|
1864
|
+
children?: any;
|
|
1724
1865
|
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Creates a strongly typed React Component from an IsaAuth instance.
|
|
1868
|
+
* Accepts optional `reactInstance` for environments where `React` is not attached to window.
|
|
1869
|
+
*/
|
|
1870
|
+
declare function createReactAuthButton(authInstance?: IsaAuth, reactInstance?: any): (props: IsaAuthButtonProps) => any;
|
|
1871
|
+
/**
|
|
1872
|
+
* React hook for reactive ISA-AUTH state subscription.
|
|
1873
|
+
* Accepts an IsaAuth instance and optional reactInstance.
|
|
1874
|
+
*/
|
|
1875
|
+
declare function useIsaAuth(auth: IsaAuth, reactInstance?: any): {
|
|
1876
|
+
isAuthenticated: any;
|
|
1877
|
+
user: any;
|
|
1878
|
+
token: any;
|
|
1879
|
+
signIn: (provider?: CoreProviderType) => Promise<any>;
|
|
1880
|
+
signOut: () => void;
|
|
1881
|
+
getAccessToken: () => string;
|
|
1882
|
+
getUserInfo: () => any;
|
|
1883
|
+
can: (permission: string | string[], matchAll?: boolean) => boolean;
|
|
1884
|
+
is: (role: string | string[], matchAll?: boolean) => boolean;
|
|
1885
|
+
};
|
|
1725
1886
|
|
|
1726
1887
|
interface ProviderOptionConfig {
|
|
1727
1888
|
clientId?: string;
|
|
@@ -1757,7 +1918,7 @@ declare class IsaAuth {
|
|
|
1757
1918
|
private instantiateProvider;
|
|
1758
1919
|
isAuthenticated(): boolean;
|
|
1759
1920
|
getAccessToken(): string | null;
|
|
1760
|
-
getUserInfo():
|
|
1921
|
+
getUserInfo(): any;
|
|
1761
1922
|
getContext(): AuthContext;
|
|
1762
1923
|
/**
|
|
1763
1924
|
* Returns category of the specified or primary provider
|
|
@@ -1769,6 +1930,12 @@ declare class IsaAuth {
|
|
|
1769
1930
|
updateAuthInfo<T = any>(partial: Partial<T>): T;
|
|
1770
1931
|
signIn(provider?: CoreProviderType): Promise<any>;
|
|
1771
1932
|
signOut(): void;
|
|
1933
|
+
/**
|
|
1934
|
+
* Handles incoming OAuth redirect or popup callbacks.
|
|
1935
|
+
* If running inside an authentication popup, communicates payload back to opener and closes popup.
|
|
1936
|
+
*/
|
|
1937
|
+
static handleCallback(options?: HandleOAuthCallbackOptions): OAuthCallbackResult;
|
|
1938
|
+
handleCallback(options?: HandleOAuthCallbackOptions): OAuthCallbackResult;
|
|
1772
1939
|
refresh(refreshFn: () => Promise<string>): Promise<string>;
|
|
1773
1940
|
/**
|
|
1774
1941
|
* Starts automatic background token refresh prior to expiration
|
|
@@ -1846,6 +2013,7 @@ declare class IsaAuth {
|
|
|
1846
2013
|
createAxios(axiosModuleOrInstance: any, options?: Partial<AuthHttpOptions>): any;
|
|
1847
2014
|
createTokenExchange(tokenEndpoint: string, options?: any): HttpTokenExchangeAdapter;
|
|
1848
2015
|
subscribe(callback: (isAuthenticated: boolean) => void): void | (() => void);
|
|
2016
|
+
watchAuthState(callback: (isAuthenticated: boolean) => void): void | (() => void);
|
|
1849
2017
|
}
|
|
1850
2018
|
|
|
1851
|
-
export { AppleAuthProvider, AuthBaseService, type AuthContext, AuthCore, type AuthFetchOptions, type AuthGuardOptions, type AuthHttpOptions, AuthProvider, type AutoRefreshOptions, CookieSessionStorageAdapter, DiscordAuthProvider, FacebookAuthProvider, GithubAuthProvider, GoogleAuthProvider, type GuardFailureReason, type GuardResult, HttpTokenExchangeAdapter, IsaAuth, type IsaAuthConfig, JwtService, KakaoAuthProvider, LineAuthProvider, LocalStorageAdapter, type MatchMode, MemoryStorageAdapter, MetaAuthProvider, NaverAuthProvider, type PasskeyAssertionResult, PasskeyAuthProvider, type ProviderCategory, type ProviderOptionConfig, type RoleHierarchyMap, SessionStorageAdapter, type StorageConfig, type StorageType, type TokenExchangeAdapter, type TokenExchangeResult, Web3AuthProvider, WorldAuthProvider, type WorldIDProofResult, type WorldVerificationLevel, applyAuthInterceptor, batch, buildAuthorizeUrl, checkPermission, checkRole, clearStoreSession, configureStorage, createAuthAxios, createAuthFetch, createAuthGuard, createNavigationGuard, decodeToken, IsaAuth as default, developerProviders, evaluateGuard, generateCodeChallenge, generateCodeVerifier, getAccessToken, getAuthInfo, getAuthState, getProviderCategory, getProvidersByCategory, getRefreshToken, getStorageAdapter, getTokenFromHeader, getTokenPayload, getTokenTimeRemaining, identityProviders, isExpiredToken, matchPermissionRule, parseOAuthCallback, index as renderers, resolveInheritedRoles, setRefreshToken, socialProviders, subscribeSelector, updateAuthInfo, web3Providers };
|
|
2019
|
+
export { AppleAuthProvider, AuthBaseService, type AuthContext, AuthCore, type AuthFetchOptions, type AuthGuardOptions, type AuthHttpOptions, AuthProvider, type AutoRefreshOptions, CookieSessionStorageAdapter, DiscordAuthProvider, MetaAuthProvider as FacebookAuthProvider, GithubAuthProvider, GoogleAuthProvider, type GuardFailureReason, type GuardResult, type HandleOAuthCallbackOptions, HttpTokenExchangeAdapter, IsaAuth, type IsaAuthButtonAttributes, type IsaAuthButtonProps, type IsaAuthConfig, JwtService, KakaoAuthProvider, LineAuthProvider, LocalStorageAdapter, type MatchMode, MemoryStorageAdapter, MetaAuthProvider, NaverAuthProvider, type OAuthCallbackResult, type PasskeyAssertionResult, PasskeyAuthProvider, type ProviderCategory, type ProviderOptionConfig, type RoleHierarchyMap, SessionStorageAdapter, type StorageConfig, type StorageType, type TokenExchangeAdapter, type TokenExchangeResult, type WaitForPopupOptions, Web3AuthProvider, WorldAuthProvider, type WorldIDProofResult, type WorldVerificationLevel, applyAuthInterceptor, batch, buildAuthorizeUrl, checkPermission, checkRole, clearStoreSession, configureStorage, createAuthAxios, createAuthFetch, createAuthGuard, createNavigationGuard, createReactAuthButton, decodeToken, IsaAuth as default, developerProviders, evaluateGuard, generateCodeChallenge, generateCodeVerifier, generateRandomState, getAccessToken, getAuthInfo, getAuthState, getProviderCategory, getProvidersByCategory, getRefreshToken, getStorageAdapter, getTokenFromHeader, getTokenPayload, getTokenTimeRemaining, handleOAuthCallback, identityProviders, isExpiredToken, matchPermissionRule, openOAuthPopup, parseOAuthCallback, index as renderers, resolveInheritedRoles, setRefreshToken, socialProviders, subscribeSelector, updateAuthInfo, useIsaAuth, waitForOAuthPopupMessage, web3Providers };
|