isa-auth 0.2.0 → 0.2.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.
- package/.agents/skills/isa-auth-guide/SKILL.md +48 -3
- package/README.md +52 -4
- package/dist/index.d.mts +84 -27
- package/dist/index.d.ts +84 -27
- package/dist/index.js +7423 -180
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7422 -180
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/skills/isa-auth-guide/SKILL.md +32 -0
|
@@ -25,6 +25,38 @@ This skill provides full reference, architecture details, and copy-paste recipes
|
|
|
25
25
|
|
|
26
26
|
## 🚀 2. Code Recipes
|
|
27
27
|
|
|
28
|
+
### Recipe 0: Multi-Provider All-in-One Configuration (Recommended)
|
|
29
|
+
```typescript
|
|
30
|
+
import { IsaAuth } from 'isa-auth';
|
|
31
|
+
|
|
32
|
+
// 1. Initialize multiple providers simultaneously
|
|
33
|
+
const auth = new IsaAuth({
|
|
34
|
+
storage: 'memory', // Production security default
|
|
35
|
+
providers: {
|
|
36
|
+
google: { clientId: 'GOOGLE_CLIENT_ID', callbackUrl: 'https://myapp.com/callback' },
|
|
37
|
+
kakao: { clientId: 'KAKAO_JAVASCRIPT_KEY', callbackUrl: 'https://myapp.com/callback' },
|
|
38
|
+
apple: { clientId: 'com.myapp.service', callbackUrl: 'https://myapp.com/callback' },
|
|
39
|
+
github: { clientId: 'GITHUB_CLIENT_ID', callbackUrl: 'https://myapp.com/callback' },
|
|
40
|
+
passkey: { rpName: 'My Enterprise App', rpId: 'myapp.com' },
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// 2. Trigger individual provider login
|
|
45
|
+
await auth.signIn('kakao');
|
|
46
|
+
// or
|
|
47
|
+
await auth.signIn('google');
|
|
48
|
+
|
|
49
|
+
// 3. Render buttons: individual or all at once
|
|
50
|
+
auth.renderButton('github', document.getElementById('gh-slot'));
|
|
51
|
+
auth.renderAllButtons(document.getElementById('social-login-grid'), {
|
|
52
|
+
direction: 'grid', // 'grid' | 'column' | 'row'
|
|
53
|
+
gap: '12px',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// 4. Query registered providers
|
|
57
|
+
console.log(auth.getRegisteredProviders()); // ['google', 'kakao', 'apple', 'github', 'passkey']
|
|
58
|
+
```
|
|
59
|
+
|
|
28
60
|
### Recipe A: World ID (World Network / Orb Verification)
|
|
29
61
|
```typescript
|
|
30
62
|
import { IsaAuth } from 'isa-auth';
|
|
@@ -127,15 +159,28 @@ const guard = auth.createNavigationGuard({
|
|
|
127
159
|
});
|
|
128
160
|
```
|
|
129
161
|
|
|
130
|
-
### Recipe F:
|
|
162
|
+
### Recipe F: Storage Security & Development Modes
|
|
131
163
|
```typescript
|
|
132
164
|
import { IsaAuth } from 'isa-auth';
|
|
133
165
|
|
|
134
|
-
//
|
|
135
|
-
const
|
|
166
|
+
// 1. [PRODUCTION DEFAULT] Zero XSS In-Memory Storage (Recommended for SPA)
|
|
167
|
+
const secureAuth = new IsaAuth({
|
|
168
|
+
provider: 'jwt',
|
|
169
|
+
storage: 'memory', // Default! Tokens never touch localStorage.
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// 2. [PRODUCTION RECOMMENDED] HttpOnly Cookie / BFF Architecture
|
|
173
|
+
const cookieAuth = new IsaAuth({
|
|
136
174
|
provider: 'base',
|
|
137
175
|
storage: 'cookie', // CookieSessionStorageAdapter omits client JWT persistence
|
|
138
176
|
});
|
|
177
|
+
|
|
178
|
+
// 3. [LOCAL DEV ONLY] Insecure LocalStorage for F5 Refresh Convenience
|
|
179
|
+
const devAuth = new IsaAuth({
|
|
180
|
+
provider: 'google',
|
|
181
|
+
clientId: 'dev-client-id',
|
|
182
|
+
storage: 'dev_insecure_localStorage', // Explicitly warns in console that this is NOT for production!
|
|
183
|
+
});
|
|
139
184
|
```
|
|
140
185
|
|
|
141
186
|
---
|
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,21 +81,62 @@ pnpm add isa-auth
|
|
|
74
81
|
|
|
75
82
|
## 🚀 Quick Start Recipes
|
|
76
83
|
|
|
77
|
-
|
|
84
|
+
> 💡 **Developer Keys Setup**: Need help obtaining Client IDs, API Keys or configuring Redirect URIs? Check out our complete [Provider Environment Setup Guide](../../docs/ENV_SETUP.md).
|
|
85
|
+
|
|
86
|
+
### 1. Multi-Provider All-in-One Configuration (Recommended)
|
|
87
|
+
|
|
88
|
+
Manage multiple social logins, developer platforms, and Web3/Passkey authentication simultaneously in a single application instance:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { IsaAuth } from 'isa-auth';
|
|
92
|
+
|
|
93
|
+
// 1. Initialize with multiple providers at once
|
|
94
|
+
const auth = new IsaAuth({
|
|
95
|
+
storage: 'memory', // Production security default
|
|
96
|
+
providers: {
|
|
97
|
+
google: { clientId: 'GOOGLE_CLIENT_ID', callbackUrl: 'https://myapp.com/callback' },
|
|
98
|
+
kakao: { clientId: 'KAKAO_JAVASCRIPT_KEY', callbackUrl: 'https://myapp.com/callback' },
|
|
99
|
+
apple: { clientId: 'com.myapp.service', callbackUrl: 'https://myapp.com/callback' },
|
|
100
|
+
github: { clientId: 'GITHUB_CLIENT_ID', callbackUrl: 'https://myapp.com/callback' },
|
|
101
|
+
passkey: { rpName: 'My App', rpId: 'myapp.com' },
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// 2-A. Trigger a specific provider login programmatically
|
|
106
|
+
await auth.signIn('kakao');
|
|
107
|
+
// or
|
|
108
|
+
await auth.signIn('google');
|
|
109
|
+
|
|
110
|
+
// 2-B. Render individual provider button
|
|
111
|
+
auth.renderButton('github', document.getElementById('github-btn-slot'));
|
|
112
|
+
|
|
113
|
+
// 2-C. Render all buttons at once with customizable layout (grid / column / row)
|
|
114
|
+
auth.renderAllButtons(document.getElementById('social-login-container'), {
|
|
115
|
+
direction: 'grid', // 'grid' | 'column' | 'row'
|
|
116
|
+
gap: '12px',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// 3. Inspect registered providers
|
|
120
|
+
console.log(auth.getRegisteredProviders()); // ['google', 'kakao', 'apple', 'github', 'passkey']
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### 1-B. Single-Provider Configuration (Legacy & Simple Apps)
|
|
78
126
|
|
|
79
127
|
```typescript
|
|
80
128
|
import { IsaAuth } from 'isa-auth';
|
|
81
129
|
|
|
82
|
-
// Initialize with
|
|
130
|
+
// Initialize with a single provider
|
|
83
131
|
const auth = new IsaAuth({
|
|
84
132
|
provider: 'google', // 'google' | 'apple' | 'meta' | 'github' | 'discord' | 'web3' | 'world' | 'passkey'
|
|
85
133
|
clientId: 'YOUR_CLIENT_ID',
|
|
86
134
|
callbackUrl: 'https://myapp.com/auth/callback',
|
|
87
|
-
storage: '
|
|
135
|
+
storage: 'memory',
|
|
88
136
|
storagePrefix: 'myapp',
|
|
89
137
|
});
|
|
90
138
|
|
|
91
|
-
// Render
|
|
139
|
+
// Render button to a DOM container
|
|
92
140
|
auth.renderButton(document.getElementById('login-container'));
|
|
93
141
|
|
|
94
142
|
// Listen to authentication changes
|
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;
|
|
@@ -1164,10 +1167,11 @@ interface ButtonRenderInfo {
|
|
|
1164
1167
|
label?: string;
|
|
1165
1168
|
className?: string;
|
|
1166
1169
|
icon?: string;
|
|
1170
|
+
svg?: string;
|
|
1167
1171
|
style?: Partial<CSSStyleDeclaration>;
|
|
1168
1172
|
}
|
|
1169
1173
|
/**
|
|
1170
|
-
* Creates and returns a native HTMLButtonElement
|
|
1174
|
+
* Creates and returns a native HTMLButtonElement with vector icons & micro-animations
|
|
1171
1175
|
*/
|
|
1172
1176
|
declare function renderByJs(info: ButtonRenderInfo): HTMLButtonElement;
|
|
1173
1177
|
/**
|
|
@@ -1713,48 +1717,101 @@ declare function renderByVue(info: ButtonRenderInfo): {
|
|
|
1713
1717
|
* Registers custom Web Component <isa-auth-button>
|
|
1714
1718
|
*/
|
|
1715
1719
|
declare function registerWebComponent(): void;
|
|
1720
|
+
/**
|
|
1721
|
+
* TypeScript JSX IntrinsicElements Declaration for Web Component <isa-auth-button>
|
|
1722
|
+
* Eliminates "Property 'isa-auth-button' does not exist on type 'JSX.IntrinsicElements'" in React/Vue/TSX
|
|
1723
|
+
*/
|
|
1724
|
+
interface IsaAuthButtonAttributes {
|
|
1725
|
+
provider?: string;
|
|
1726
|
+
label?: string;
|
|
1727
|
+
class?: string;
|
|
1728
|
+
style?: string;
|
|
1729
|
+
'onisa-auth-click'?: (event: CustomEvent) => void;
|
|
1730
|
+
children?: any;
|
|
1731
|
+
}
|
|
1732
|
+
declare global {
|
|
1733
|
+
namespace JSX {
|
|
1734
|
+
interface IntrinsicElements {
|
|
1735
|
+
'isa-auth-button': IsaAuthButtonAttributes;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1716
1739
|
|
|
1717
1740
|
type index_ButtonRenderInfo = ButtonRenderInfo;
|
|
1741
|
+
type index_IsaAuthButtonAttributes = IsaAuthButtonAttributes;
|
|
1718
1742
|
declare const index_registerWebComponent: typeof registerWebComponent;
|
|
1719
1743
|
declare const index_renderByJs: typeof renderByJs;
|
|
1720
1744
|
declare const index_renderByReact: typeof renderByReact;
|
|
1721
1745
|
declare const index_renderByVue: typeof renderByVue;
|
|
1722
1746
|
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 };
|
|
1747
|
+
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 };
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
/**
|
|
1751
|
+
* React Type-Safe Wrapper Component for ISA-AUTH Buttons
|
|
1752
|
+
* Provides 100% TypeScript Props & Event IntelliSense
|
|
1753
|
+
*/
|
|
1754
|
+
|
|
1755
|
+
interface IsaAuthButtonProps {
|
|
1756
|
+
auth?: IsaAuth;
|
|
1757
|
+
provider: CoreProviderType;
|
|
1758
|
+
label?: string;
|
|
1759
|
+
className?: string;
|
|
1760
|
+
style?: Record<string, string | number>;
|
|
1761
|
+
onSuccess?: (user: any) => void;
|
|
1762
|
+
onError?: (error: any) => void;
|
|
1763
|
+
children?: any;
|
|
1724
1764
|
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Creates a strongly typed React Component from an IsaAuth instance
|
|
1767
|
+
*/
|
|
1768
|
+
declare function createReactAuthButton(authInstance: IsaAuth): (props: IsaAuthButtonProps) => any;
|
|
1725
1769
|
|
|
1770
|
+
interface ProviderOptionConfig {
|
|
1771
|
+
clientId?: string;
|
|
1772
|
+
callbackUrl?: string;
|
|
1773
|
+
scope?: string;
|
|
1774
|
+
extraOptions?: Record<string, any>;
|
|
1775
|
+
[key: string]: any;
|
|
1776
|
+
}
|
|
1726
1777
|
interface IsaAuthConfig {
|
|
1727
1778
|
provider?: CoreProviderType;
|
|
1728
|
-
secret?: string;
|
|
1729
1779
|
clientId?: string;
|
|
1730
1780
|
callbackUrl?: string;
|
|
1731
1781
|
scope?: string;
|
|
1782
|
+
extraOptions?: Record<string, any>;
|
|
1783
|
+
providers?: Partial<Record<CoreProviderType, ProviderOptionConfig>>;
|
|
1784
|
+
secret?: string;
|
|
1732
1785
|
storage?: StorageType;
|
|
1733
1786
|
storagePrefix?: string;
|
|
1734
|
-
extraOptions?: Record<string, any>;
|
|
1735
1787
|
}
|
|
1736
1788
|
/**
|
|
1737
1789
|
* Main unified entry point for ISA-AUTH
|
|
1790
|
+
* Supports both Single Provider and Multi-Provider unified orchestration.
|
|
1738
1791
|
*/
|
|
1739
1792
|
declare class IsaAuth {
|
|
1793
|
+
config: IsaAuthConfig;
|
|
1740
1794
|
core: AuthCore;
|
|
1741
1795
|
providerInstance: any;
|
|
1742
1796
|
authProvider: AuthProvider;
|
|
1743
1797
|
providerType: CoreProviderType;
|
|
1798
|
+
private providerInstances;
|
|
1799
|
+
private authProviders;
|
|
1744
1800
|
constructor(config?: IsaAuthConfig);
|
|
1801
|
+
private instantiateProvider;
|
|
1745
1802
|
isAuthenticated(): boolean;
|
|
1746
1803
|
getAccessToken(): string | null;
|
|
1747
|
-
getUserInfo():
|
|
1804
|
+
getUserInfo(): any;
|
|
1748
1805
|
getContext(): AuthContext;
|
|
1749
1806
|
/**
|
|
1750
|
-
* Returns
|
|
1807
|
+
* Returns category of the specified or primary provider
|
|
1751
1808
|
*/
|
|
1752
|
-
getCategory(): ProviderCategory | null;
|
|
1809
|
+
getCategory(provider?: CoreProviderType): ProviderCategory | null;
|
|
1753
1810
|
setAccessToken(token: string): void;
|
|
1754
1811
|
getRefreshToken(): string | null;
|
|
1755
1812
|
setRefreshToken(token: string): void;
|
|
1756
1813
|
updateAuthInfo<T = any>(partial: Partial<T>): T;
|
|
1757
|
-
signIn(): Promise<
|
|
1814
|
+
signIn(provider?: CoreProviderType): Promise<any>;
|
|
1758
1815
|
signOut(): void;
|
|
1759
1816
|
refresh(refreshFn: () => Promise<string>): Promise<string>;
|
|
1760
1817
|
/**
|
|
@@ -1765,7 +1822,7 @@ declare class IsaAuth {
|
|
|
1765
1822
|
* Stops automatic background token refresh
|
|
1766
1823
|
*/
|
|
1767
1824
|
stopAutoRefresh(): void;
|
|
1768
|
-
getButton(): {
|
|
1825
|
+
getButton(provider?: CoreProviderType): LoginButton | {
|
|
1769
1826
|
className: string;
|
|
1770
1827
|
onClick: () => Promise<void>;
|
|
1771
1828
|
id: string;
|
|
@@ -1776,29 +1833,29 @@ declare class IsaAuth {
|
|
|
1776
1833
|
style: Partial<CSSStyleDeclaration>;
|
|
1777
1834
|
fullWidth: boolean;
|
|
1778
1835
|
};
|
|
1779
|
-
renderButton(container?: HTMLElement | null): HTMLButtonElement | null;
|
|
1780
|
-
hasRole(role: string): boolean;
|
|
1781
|
-
hasPermission(permission: string): boolean;
|
|
1782
1836
|
/**
|
|
1783
|
-
*
|
|
1784
|
-
*
|
|
1837
|
+
* Renders button for specified provider (or primary provider if omitted)
|
|
1838
|
+
* Usage:
|
|
1839
|
+
* auth.renderButton(container); // primary provider
|
|
1840
|
+
* auth.renderButton('google', container); // specific provider
|
|
1785
1841
|
*/
|
|
1786
|
-
|
|
1842
|
+
renderButton(providerOrContainer?: CoreProviderType | HTMLElement | null, container?: HTMLElement | null): HTMLButtonElement | null;
|
|
1787
1843
|
/**
|
|
1788
|
-
*
|
|
1844
|
+
* Renders all registered provider buttons inside a container element.
|
|
1789
1845
|
*/
|
|
1846
|
+
renderAllButtons(container: HTMLElement, options?: {
|
|
1847
|
+
providers?: CoreProviderType[];
|
|
1848
|
+
direction?: 'row' | 'column' | 'grid';
|
|
1849
|
+
gap?: string;
|
|
1850
|
+
}): HTMLButtonElement[];
|
|
1851
|
+
getProviderInstance(provider?: CoreProviderType): any;
|
|
1852
|
+
getRegisteredProviders(): CoreProviderType[];
|
|
1853
|
+
hasRole(role: string): boolean;
|
|
1854
|
+
hasPermission(permission: string): boolean;
|
|
1855
|
+
can(permission: string | string[], matchAll?: boolean): boolean;
|
|
1790
1856
|
is(role: string | string[], matchAll?: boolean): boolean;
|
|
1791
|
-
/**
|
|
1792
|
-
* Evaluates guard and returns detailed GuardResult
|
|
1793
|
-
*/
|
|
1794
1857
|
evaluateGuard(options: AuthGuardOptions, customContext?: Partial<AuthContext>): Promise<GuardResult>;
|
|
1795
|
-
/**
|
|
1796
|
-
* Instant boolean guard check (backwards compatible)
|
|
1797
|
-
*/
|
|
1798
1858
|
createGuard(options: AuthGuardOptions): Promise<boolean>;
|
|
1799
|
-
/**
|
|
1800
|
-
* Creates a reusable router navigation guard
|
|
1801
|
-
*/
|
|
1802
1859
|
createNavigationGuard(options: AuthGuardOptions & {
|
|
1803
1860
|
redirectToOnUnauthenticated?: string;
|
|
1804
1861
|
redirectToOnUnauthorized?: string;
|
|
@@ -1835,4 +1892,4 @@ declare class IsaAuth {
|
|
|
1835
1892
|
subscribe(callback: (isAuthenticated: boolean) => void): void | (() => void);
|
|
1836
1893
|
}
|
|
1837
1894
|
|
|
1838
|
-
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 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 };
|
|
1895
|
+
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 IsaAuthButtonAttributes, type IsaAuthButtonProps, 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, createReactAuthButton, 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 };
|
package/dist/index.d.ts
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;
|
|
@@ -1164,10 +1167,11 @@ interface ButtonRenderInfo {
|
|
|
1164
1167
|
label?: string;
|
|
1165
1168
|
className?: string;
|
|
1166
1169
|
icon?: string;
|
|
1170
|
+
svg?: string;
|
|
1167
1171
|
style?: Partial<CSSStyleDeclaration>;
|
|
1168
1172
|
}
|
|
1169
1173
|
/**
|
|
1170
|
-
* Creates and returns a native HTMLButtonElement
|
|
1174
|
+
* Creates and returns a native HTMLButtonElement with vector icons & micro-animations
|
|
1171
1175
|
*/
|
|
1172
1176
|
declare function renderByJs(info: ButtonRenderInfo): HTMLButtonElement;
|
|
1173
1177
|
/**
|
|
@@ -1713,48 +1717,101 @@ declare function renderByVue(info: ButtonRenderInfo): {
|
|
|
1713
1717
|
* Registers custom Web Component <isa-auth-button>
|
|
1714
1718
|
*/
|
|
1715
1719
|
declare function registerWebComponent(): void;
|
|
1720
|
+
/**
|
|
1721
|
+
* TypeScript JSX IntrinsicElements Declaration for Web Component <isa-auth-button>
|
|
1722
|
+
* Eliminates "Property 'isa-auth-button' does not exist on type 'JSX.IntrinsicElements'" in React/Vue/TSX
|
|
1723
|
+
*/
|
|
1724
|
+
interface IsaAuthButtonAttributes {
|
|
1725
|
+
provider?: string;
|
|
1726
|
+
label?: string;
|
|
1727
|
+
class?: string;
|
|
1728
|
+
style?: string;
|
|
1729
|
+
'onisa-auth-click'?: (event: CustomEvent) => void;
|
|
1730
|
+
children?: any;
|
|
1731
|
+
}
|
|
1732
|
+
declare global {
|
|
1733
|
+
namespace JSX {
|
|
1734
|
+
interface IntrinsicElements {
|
|
1735
|
+
'isa-auth-button': IsaAuthButtonAttributes;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1716
1739
|
|
|
1717
1740
|
type index_ButtonRenderInfo = ButtonRenderInfo;
|
|
1741
|
+
type index_IsaAuthButtonAttributes = IsaAuthButtonAttributes;
|
|
1718
1742
|
declare const index_registerWebComponent: typeof registerWebComponent;
|
|
1719
1743
|
declare const index_renderByJs: typeof renderByJs;
|
|
1720
1744
|
declare const index_renderByReact: typeof renderByReact;
|
|
1721
1745
|
declare const index_renderByVue: typeof renderByVue;
|
|
1722
1746
|
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 };
|
|
1747
|
+
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 };
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
/**
|
|
1751
|
+
* React Type-Safe Wrapper Component for ISA-AUTH Buttons
|
|
1752
|
+
* Provides 100% TypeScript Props & Event IntelliSense
|
|
1753
|
+
*/
|
|
1754
|
+
|
|
1755
|
+
interface IsaAuthButtonProps {
|
|
1756
|
+
auth?: IsaAuth;
|
|
1757
|
+
provider: CoreProviderType;
|
|
1758
|
+
label?: string;
|
|
1759
|
+
className?: string;
|
|
1760
|
+
style?: Record<string, string | number>;
|
|
1761
|
+
onSuccess?: (user: any) => void;
|
|
1762
|
+
onError?: (error: any) => void;
|
|
1763
|
+
children?: any;
|
|
1724
1764
|
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Creates a strongly typed React Component from an IsaAuth instance
|
|
1767
|
+
*/
|
|
1768
|
+
declare function createReactAuthButton(authInstance: IsaAuth): (props: IsaAuthButtonProps) => any;
|
|
1725
1769
|
|
|
1770
|
+
interface ProviderOptionConfig {
|
|
1771
|
+
clientId?: string;
|
|
1772
|
+
callbackUrl?: string;
|
|
1773
|
+
scope?: string;
|
|
1774
|
+
extraOptions?: Record<string, any>;
|
|
1775
|
+
[key: string]: any;
|
|
1776
|
+
}
|
|
1726
1777
|
interface IsaAuthConfig {
|
|
1727
1778
|
provider?: CoreProviderType;
|
|
1728
|
-
secret?: string;
|
|
1729
1779
|
clientId?: string;
|
|
1730
1780
|
callbackUrl?: string;
|
|
1731
1781
|
scope?: string;
|
|
1782
|
+
extraOptions?: Record<string, any>;
|
|
1783
|
+
providers?: Partial<Record<CoreProviderType, ProviderOptionConfig>>;
|
|
1784
|
+
secret?: string;
|
|
1732
1785
|
storage?: StorageType;
|
|
1733
1786
|
storagePrefix?: string;
|
|
1734
|
-
extraOptions?: Record<string, any>;
|
|
1735
1787
|
}
|
|
1736
1788
|
/**
|
|
1737
1789
|
* Main unified entry point for ISA-AUTH
|
|
1790
|
+
* Supports both Single Provider and Multi-Provider unified orchestration.
|
|
1738
1791
|
*/
|
|
1739
1792
|
declare class IsaAuth {
|
|
1793
|
+
config: IsaAuthConfig;
|
|
1740
1794
|
core: AuthCore;
|
|
1741
1795
|
providerInstance: any;
|
|
1742
1796
|
authProvider: AuthProvider;
|
|
1743
1797
|
providerType: CoreProviderType;
|
|
1798
|
+
private providerInstances;
|
|
1799
|
+
private authProviders;
|
|
1744
1800
|
constructor(config?: IsaAuthConfig);
|
|
1801
|
+
private instantiateProvider;
|
|
1745
1802
|
isAuthenticated(): boolean;
|
|
1746
1803
|
getAccessToken(): string | null;
|
|
1747
|
-
getUserInfo():
|
|
1804
|
+
getUserInfo(): any;
|
|
1748
1805
|
getContext(): AuthContext;
|
|
1749
1806
|
/**
|
|
1750
|
-
* Returns
|
|
1807
|
+
* Returns category of the specified or primary provider
|
|
1751
1808
|
*/
|
|
1752
|
-
getCategory(): ProviderCategory | null;
|
|
1809
|
+
getCategory(provider?: CoreProviderType): ProviderCategory | null;
|
|
1753
1810
|
setAccessToken(token: string): void;
|
|
1754
1811
|
getRefreshToken(): string | null;
|
|
1755
1812
|
setRefreshToken(token: string): void;
|
|
1756
1813
|
updateAuthInfo<T = any>(partial: Partial<T>): T;
|
|
1757
|
-
signIn(): Promise<
|
|
1814
|
+
signIn(provider?: CoreProviderType): Promise<any>;
|
|
1758
1815
|
signOut(): void;
|
|
1759
1816
|
refresh(refreshFn: () => Promise<string>): Promise<string>;
|
|
1760
1817
|
/**
|
|
@@ -1765,7 +1822,7 @@ declare class IsaAuth {
|
|
|
1765
1822
|
* Stops automatic background token refresh
|
|
1766
1823
|
*/
|
|
1767
1824
|
stopAutoRefresh(): void;
|
|
1768
|
-
getButton(): {
|
|
1825
|
+
getButton(provider?: CoreProviderType): LoginButton | {
|
|
1769
1826
|
className: string;
|
|
1770
1827
|
onClick: () => Promise<void>;
|
|
1771
1828
|
id: string;
|
|
@@ -1776,29 +1833,29 @@ declare class IsaAuth {
|
|
|
1776
1833
|
style: Partial<CSSStyleDeclaration>;
|
|
1777
1834
|
fullWidth: boolean;
|
|
1778
1835
|
};
|
|
1779
|
-
renderButton(container?: HTMLElement | null): HTMLButtonElement | null;
|
|
1780
|
-
hasRole(role: string): boolean;
|
|
1781
|
-
hasPermission(permission: string): boolean;
|
|
1782
1836
|
/**
|
|
1783
|
-
*
|
|
1784
|
-
*
|
|
1837
|
+
* Renders button for specified provider (or primary provider if omitted)
|
|
1838
|
+
* Usage:
|
|
1839
|
+
* auth.renderButton(container); // primary provider
|
|
1840
|
+
* auth.renderButton('google', container); // specific provider
|
|
1785
1841
|
*/
|
|
1786
|
-
|
|
1842
|
+
renderButton(providerOrContainer?: CoreProviderType | HTMLElement | null, container?: HTMLElement | null): HTMLButtonElement | null;
|
|
1787
1843
|
/**
|
|
1788
|
-
*
|
|
1844
|
+
* Renders all registered provider buttons inside a container element.
|
|
1789
1845
|
*/
|
|
1846
|
+
renderAllButtons(container: HTMLElement, options?: {
|
|
1847
|
+
providers?: CoreProviderType[];
|
|
1848
|
+
direction?: 'row' | 'column' | 'grid';
|
|
1849
|
+
gap?: string;
|
|
1850
|
+
}): HTMLButtonElement[];
|
|
1851
|
+
getProviderInstance(provider?: CoreProviderType): any;
|
|
1852
|
+
getRegisteredProviders(): CoreProviderType[];
|
|
1853
|
+
hasRole(role: string): boolean;
|
|
1854
|
+
hasPermission(permission: string): boolean;
|
|
1855
|
+
can(permission: string | string[], matchAll?: boolean): boolean;
|
|
1790
1856
|
is(role: string | string[], matchAll?: boolean): boolean;
|
|
1791
|
-
/**
|
|
1792
|
-
* Evaluates guard and returns detailed GuardResult
|
|
1793
|
-
*/
|
|
1794
1857
|
evaluateGuard(options: AuthGuardOptions, customContext?: Partial<AuthContext>): Promise<GuardResult>;
|
|
1795
|
-
/**
|
|
1796
|
-
* Instant boolean guard check (backwards compatible)
|
|
1797
|
-
*/
|
|
1798
1858
|
createGuard(options: AuthGuardOptions): Promise<boolean>;
|
|
1799
|
-
/**
|
|
1800
|
-
* Creates a reusable router navigation guard
|
|
1801
|
-
*/
|
|
1802
1859
|
createNavigationGuard(options: AuthGuardOptions & {
|
|
1803
1860
|
redirectToOnUnauthenticated?: string;
|
|
1804
1861
|
redirectToOnUnauthorized?: string;
|
|
@@ -1835,4 +1892,4 @@ declare class IsaAuth {
|
|
|
1835
1892
|
subscribe(callback: (isAuthenticated: boolean) => void): void | (() => void);
|
|
1836
1893
|
}
|
|
1837
1894
|
|
|
1838
|
-
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 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 };
|
|
1895
|
+
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 IsaAuthButtonAttributes, type IsaAuthButtonProps, 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, createReactAuthButton, 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 };
|