@authon/shared 0.3.0 → 0.7.16
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/LICENSE +21 -0
- package/README.ko.md +11 -51
- package/README.md +78 -312
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Authon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.ko.md
CHANGED
|
@@ -2,72 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
# @authon/shared
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> Authon SDK 공유 타입 및 상수 -- 직접 사용하지 않고 프레임워크별 SDK를 설치하세요
|
|
6
6
|
|
|
7
7
|
## 설치
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install @authon/shared
|
|
11
|
-
# or
|
|
12
|
-
pnpm add @authon/shared
|
|
13
11
|
```
|
|
14
12
|
|
|
15
13
|
## 사용법
|
|
16
14
|
|
|
17
15
|
```ts
|
|
18
|
-
import type {
|
|
19
|
-
|
|
20
|
-
AuthonSession,
|
|
21
|
-
AuthTokens,
|
|
22
|
-
BrandingConfig,
|
|
23
|
-
WebhookEvent,
|
|
24
|
-
} from '@authon/shared';
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
OAUTH_PROVIDERS,
|
|
28
|
-
PROVIDER_DISPLAY_NAMES,
|
|
29
|
-
PROVIDER_COLORS,
|
|
30
|
-
WEBHOOK_EVENTS,
|
|
31
|
-
API_KEY_PREFIXES,
|
|
32
|
-
DEFAULT_BRANDING,
|
|
33
|
-
DEFAULT_SESSION_CONFIG,
|
|
34
|
-
} from '@authon/shared';
|
|
16
|
+
import type { AuthonUser, AuthTokens, OAuthProviderType } from '@authon/shared';
|
|
17
|
+
import { OAUTH_PROVIDERS, DEFAULT_BRANDING, AUDIT_EVENTS } from '@authon/shared';
|
|
35
18
|
```
|
|
36
19
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
### 타입
|
|
20
|
+
## 주요 타입
|
|
40
21
|
|
|
41
22
|
| 타입 | 설명 |
|
|
42
23
|
|------|------|
|
|
43
|
-
| `AuthonUser` | 사용자
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `OAuthProviderType` | 지원되는 OAuth 프로바이더의 유니온 타입 |
|
|
50
|
-
| `WebhookEventType` | 웹훅 이벤트 타입의 유니온 타입 |
|
|
51
|
-
| `MfaSetupResponse` | MFA 설정 결과: secret, qrCodeUri, backupCodes |
|
|
52
|
-
| `MfaStatus` | MFA 상태: enabled, backupCodesRemaining |
|
|
53
|
-
| `MfaVerifyResponse` | MFA 검증 결과: 토큰 및 사용자 정보 |
|
|
54
|
-
|
|
55
|
-
### 상수
|
|
56
|
-
|
|
57
|
-
| 상수 | 설명 |
|
|
58
|
-
|------|------|
|
|
59
|
-
| `OAUTH_PROVIDERS` | 지원되는 프로바이더 배열: google, apple, kakao, naver 등 |
|
|
60
|
-
| `PROVIDER_DISPLAY_NAMES` | 사람이 읽을 수 있는 프로바이더 이름 |
|
|
61
|
-
| `PROVIDER_COLORS` | 프로바이더별 브랜드 색상 (bg, text) |
|
|
62
|
-
| `WEBHOOK_EVENTS` | 모든 웹훅 이벤트 타입 |
|
|
63
|
-
| `API_KEY_PREFIXES` | 키 접두사: `pk_live_`, `pk_test_`, `sk_live_`, `sk_test_` |
|
|
64
|
-
| `DEFAULT_BRANDING` | 기본 브랜딩 설정 |
|
|
65
|
-
| `DEFAULT_SESSION_CONFIG` | 기본 세션 설정 (액세스 토큰 15분, 리프레시 토큰 7일) |
|
|
66
|
-
|
|
67
|
-
## 문서
|
|
68
|
-
|
|
69
|
-
[authon.dev/docs](https://authon.dev/docs)
|
|
24
|
+
| `AuthonUser` | 사용자 (id, email, displayName, avatarUrl 등) |
|
|
25
|
+
| `AuthTokens` | 토큰 쌍 (accessToken, refreshToken, expiresIn) |
|
|
26
|
+
| `OAuthProviderType` | OAuth 프로바이더 |
|
|
27
|
+
| `PasskeyCredential` | 패스키 자격증명 |
|
|
28
|
+
| `Web3Wallet` | Web3 지갑 |
|
|
29
|
+
| `BrandingConfig` | 모달 브랜딩 설정 |
|
|
70
30
|
|
|
71
31
|
## 라이선스
|
|
72
32
|
|
|
73
|
-
|
|
33
|
+
MIT
|
package/README.md
CHANGED
|
@@ -2,41 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
# @authon/shared
|
|
4
4
|
|
|
5
|
+
> Shared types and constants for all Authon SDKs
|
|
6
|
+
|
|
5
7
|
[](https://www.npmjs.com/package/@authon/shared)
|
|
6
8
|
[](../../LICENSE)
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
Internal package consumed by `@authon/js`, `@authon/react`, and all other Authon frontend SDKs. Not intended for direct application use -- install the appropriate framework SDK instead.
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
Before installing the SDK, create an Authon project and get your API keys:
|
|
15
|
+
|
|
16
|
+
1. **Create a project** at [Authon Dashboard](https://authon.dev/dashboard/overview)
|
|
17
|
+
- Click "Create Project" and enter your app name
|
|
18
|
+
- Select the authentication methods you want (Email/Password, OAuth providers, etc.)
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
2. **Get your API keys** from Project Settings → API Keys
|
|
21
|
+
- **Publishable Key** (`pk_live_...`) — use in your frontend code
|
|
22
|
+
- **Test Key** (`pk_test_...`) — for development, enables Dev Teleport
|
|
11
23
|
|
|
12
|
-
|
|
24
|
+
3. **Configure OAuth providers** (optional) in Project Settings → OAuth
|
|
25
|
+
- Add Google, Apple, GitHub, etc. with their respective Client ID and Secret
|
|
26
|
+
- Set the redirect URL to `https://api.authon.dev/v1/auth/oauth/redirect`
|
|
27
|
+
|
|
28
|
+
> **Test vs Live keys:** Use `pk_test_...` during development. Switch to `pk_live_...` before deploying to production. Test keys use a sandbox environment with no rate limits.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
13
31
|
|
|
14
32
|
```bash
|
|
15
33
|
npm install @authon/shared
|
|
16
|
-
# or
|
|
17
|
-
pnpm add @authon/shared
|
|
18
34
|
```
|
|
19
35
|
|
|
20
|
-
##
|
|
36
|
+
## Quick Start
|
|
21
37
|
|
|
22
38
|
```ts
|
|
23
39
|
import type {
|
|
24
40
|
AuthonUser,
|
|
25
|
-
AuthonSession,
|
|
26
41
|
AuthTokens,
|
|
27
|
-
|
|
28
|
-
SessionConfig,
|
|
29
|
-
WebhookEvent,
|
|
30
|
-
MfaSetupResponse,
|
|
31
|
-
MfaStatus,
|
|
42
|
+
OAuthProviderType,
|
|
32
43
|
PasskeyCredential,
|
|
33
44
|
Web3Wallet,
|
|
34
|
-
|
|
45
|
+
MfaSetupResponse,
|
|
35
46
|
SessionInfo,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
WebhookEventType,
|
|
47
|
+
BrandingConfig,
|
|
48
|
+
WebhookEvent,
|
|
49
|
+
AuthonOrganization,
|
|
40
50
|
} from '@authon/shared';
|
|
41
51
|
|
|
42
52
|
import {
|
|
@@ -47,331 +57,87 @@ import {
|
|
|
47
57
|
API_KEY_PREFIXES,
|
|
48
58
|
DEFAULT_BRANDING,
|
|
49
59
|
DEFAULT_SESSION_CONFIG,
|
|
60
|
+
AUDIT_EVENTS,
|
|
50
61
|
} from '@authon/shared';
|
|
51
62
|
```
|
|
52
63
|
|
|
53
|
-
##
|
|
54
|
-
|
|
55
|
-
### Core
|
|
56
|
-
|
|
57
|
-
#### `AuthonUser`
|
|
58
|
-
|
|
59
|
-
The authenticated user object.
|
|
60
|
-
|
|
61
|
-
```ts
|
|
62
|
-
interface AuthonUser {
|
|
63
|
-
id: string;
|
|
64
|
-
projectId: string;
|
|
65
|
-
email: string | null;
|
|
66
|
-
displayName: string | null;
|
|
67
|
-
avatarUrl: string | null;
|
|
68
|
-
phone: string | null;
|
|
69
|
-
emailVerified: boolean;
|
|
70
|
-
phoneVerified: boolean;
|
|
71
|
-
isBanned: boolean;
|
|
72
|
-
publicMetadata: Record<string, unknown> | null;
|
|
73
|
-
lastSignInAt: string | null;
|
|
74
|
-
signInCount: number;
|
|
75
|
-
createdAt: string;
|
|
76
|
-
updatedAt: string;
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
#### `AuthonSession`
|
|
81
|
-
|
|
82
|
-
An active user session record (from the server SDK).
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
interface AuthonSession {
|
|
86
|
-
id: string;
|
|
87
|
-
userId: string;
|
|
88
|
-
ipAddress: string | null;
|
|
89
|
-
userAgent: string | null;
|
|
90
|
-
deviceName: string | null;
|
|
91
|
-
lastActiveAt: string | null;
|
|
92
|
-
createdAt: string;
|
|
93
|
-
expiresAt: string;
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
#### `AuthTokens`
|
|
98
|
-
|
|
99
|
-
Token pair returned after a successful sign-in.
|
|
100
|
-
|
|
101
|
-
```ts
|
|
102
|
-
interface AuthTokens {
|
|
103
|
-
accessToken: string;
|
|
104
|
-
refreshToken: string;
|
|
105
|
-
expiresIn: number; // seconds
|
|
106
|
-
user: AuthonUser;
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
#### `SessionInfo`
|
|
111
|
-
|
|
112
|
-
Simplified session info returned to clients (used in `listSessions()`).
|
|
113
|
-
|
|
114
|
-
```ts
|
|
115
|
-
interface SessionInfo {
|
|
116
|
-
id: string;
|
|
117
|
-
ipAddress: string | null;
|
|
118
|
-
userAgent: string | null;
|
|
119
|
-
createdAt: string;
|
|
120
|
-
lastActiveAt: string | null;
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Branding & Config
|
|
125
|
-
|
|
126
|
-
#### `BrandingConfig`
|
|
127
|
-
|
|
128
|
-
Visual customization options for the Authon modal.
|
|
129
|
-
|
|
130
|
-
```ts
|
|
131
|
-
interface BrandingConfig {
|
|
132
|
-
logoDataUrl?: string;
|
|
133
|
-
brandName?: string;
|
|
134
|
-
primaryColorStart?: string;
|
|
135
|
-
primaryColorEnd?: string;
|
|
136
|
-
lightBg?: string;
|
|
137
|
-
lightText?: string;
|
|
138
|
-
darkBg?: string;
|
|
139
|
-
darkText?: string;
|
|
140
|
-
borderRadius?: number;
|
|
141
|
-
providerOrder?: string[];
|
|
142
|
-
hiddenProviders?: string[];
|
|
143
|
-
showEmailPassword?: boolean;
|
|
144
|
-
showDivider?: boolean;
|
|
145
|
-
termsUrl?: string;
|
|
146
|
-
privacyUrl?: string;
|
|
147
|
-
customCss?: string;
|
|
148
|
-
locale?: string;
|
|
149
|
-
showSecuredBy?: boolean;
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
#### `SessionConfig`
|
|
154
|
-
|
|
155
|
-
Session lifetime and concurrency settings.
|
|
156
|
-
|
|
157
|
-
```ts
|
|
158
|
-
interface SessionConfig {
|
|
159
|
-
accessTokenTtl?: number; // seconds, default 900 (15 min)
|
|
160
|
-
refreshTokenTtl?: number; // seconds, default 604800 (7 days)
|
|
161
|
-
maxSessions?: number; // default 5
|
|
162
|
-
singleSession?: boolean; // default false
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### MFA
|
|
167
|
-
|
|
168
|
-
#### `MfaSetupResponse`
|
|
169
|
-
|
|
170
|
-
Returned by `setupMfa()`.
|
|
171
|
-
|
|
172
|
-
```ts
|
|
173
|
-
interface MfaSetupResponse {
|
|
174
|
-
secret: string; // TOTP secret
|
|
175
|
-
qrCodeUri: string; // otpauth:// URI
|
|
176
|
-
backupCodes: string[]; // one-time recovery codes
|
|
177
|
-
}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
#### `MfaStatus`
|
|
64
|
+
## Common Tasks
|
|
181
65
|
|
|
182
|
-
|
|
66
|
+
### Import User Type
|
|
183
67
|
|
|
184
68
|
```ts
|
|
185
|
-
|
|
186
|
-
enabled: boolean;
|
|
187
|
-
backupCodesRemaining: number;
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Passkeys
|
|
192
|
-
|
|
193
|
-
#### `PasskeyCredential`
|
|
69
|
+
import type { AuthonUser } from '@authon/shared';
|
|
194
70
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
```ts
|
|
198
|
-
interface PasskeyCredential {
|
|
199
|
-
id: string;
|
|
200
|
-
name: string | null;
|
|
201
|
-
createdAt: string;
|
|
202
|
-
lastUsedAt: string | null;
|
|
71
|
+
function greet(user: AuthonUser) {
|
|
72
|
+
return `Hello, ${user.displayName ?? user.email}`;
|
|
203
73
|
}
|
|
204
74
|
```
|
|
205
75
|
|
|
206
|
-
###
|
|
207
|
-
|
|
208
|
-
#### `Web3Chain`
|
|
76
|
+
### Get Provider Colors for Custom Buttons
|
|
209
77
|
|
|
210
78
|
```ts
|
|
211
|
-
|
|
212
|
-
```
|
|
79
|
+
import { PROVIDER_COLORS, PROVIDER_DISPLAY_NAMES } from '@authon/shared';
|
|
213
80
|
|
|
214
|
-
|
|
81
|
+
const google = PROVIDER_COLORS.google;
|
|
82
|
+
// { bg: '#ffffff', text: '#1f1f1f' }
|
|
215
83
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
| 'metamask'
|
|
219
|
-
| 'pexus'
|
|
220
|
-
| 'walletconnect'
|
|
221
|
-
| 'coinbase'
|
|
222
|
-
| 'phantom'
|
|
223
|
-
| 'trust'
|
|
224
|
-
| 'other';
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
#### `Web3Wallet`
|
|
228
|
-
|
|
229
|
-
A linked Web3 wallet.
|
|
230
|
-
|
|
231
|
-
```ts
|
|
232
|
-
interface Web3Wallet {
|
|
233
|
-
id: string;
|
|
234
|
-
address: string;
|
|
235
|
-
chain: Web3Chain;
|
|
236
|
-
walletType: Web3WalletType;
|
|
237
|
-
chainId: number | null;
|
|
238
|
-
createdAt: string;
|
|
239
|
-
}
|
|
84
|
+
const label = PROVIDER_DISPLAY_NAMES.google;
|
|
85
|
+
// 'Google'
|
|
240
86
|
```
|
|
241
87
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
Returned by `web3GetNonce()`.
|
|
88
|
+
### Check API Key Type
|
|
245
89
|
|
|
246
90
|
```ts
|
|
247
|
-
|
|
248
|
-
message: string; // full message to sign
|
|
249
|
-
nonce: string; // raw nonce embedded in message
|
|
250
|
-
}
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
### Webhooks
|
|
91
|
+
import { API_KEY_PREFIXES } from '@authon/shared';
|
|
254
92
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
Incoming webhook payload from Authon.
|
|
258
|
-
|
|
259
|
-
```ts
|
|
260
|
-
interface WebhookEvent {
|
|
261
|
-
id: string;
|
|
262
|
-
type: string;
|
|
263
|
-
projectId: string;
|
|
264
|
-
timestamp: string;
|
|
265
|
-
data: Record<string, unknown>;
|
|
93
|
+
function isSecretKey(key: string) {
|
|
94
|
+
return key.startsWith(API_KEY_PREFIXES.SECRET_LIVE) || key.startsWith(API_KEY_PREFIXES.SECRET_TEST);
|
|
266
95
|
}
|
|
267
96
|
```
|
|
268
97
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
```ts
|
|
272
|
-
type WebhookEventType =
|
|
273
|
-
| 'user.created'
|
|
274
|
-
| 'user.updated'
|
|
275
|
-
| 'user.deleted'
|
|
276
|
-
| 'user.banned'
|
|
277
|
-
| 'user.unbanned'
|
|
278
|
-
| 'session.created'
|
|
279
|
-
| 'session.ended'
|
|
280
|
-
| 'session.revoked'
|
|
281
|
-
| 'provider.linked'
|
|
282
|
-
| 'provider.unlinked';
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### OAuth
|
|
286
|
-
|
|
287
|
-
#### `OAuthProviderType`
|
|
288
|
-
|
|
289
|
-
```ts
|
|
290
|
-
type OAuthProviderType =
|
|
291
|
-
| 'google'
|
|
292
|
-
| 'apple'
|
|
293
|
-
| 'kakao'
|
|
294
|
-
| 'naver'
|
|
295
|
-
| 'facebook'
|
|
296
|
-
| 'github'
|
|
297
|
-
| 'discord'
|
|
298
|
-
| 'x'
|
|
299
|
-
| 'line'
|
|
300
|
-
| 'microsoft';
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
## Exported Constants
|
|
304
|
-
|
|
305
|
-
### `OAUTH_PROVIDERS`
|
|
306
|
-
|
|
307
|
-
Readonly array of all supported OAuth provider identifiers.
|
|
308
|
-
|
|
309
|
-
```ts
|
|
310
|
-
const OAUTH_PROVIDERS: readonly OAuthProviderType[];
|
|
311
|
-
// ['google', 'apple', 'kakao', 'naver', 'facebook', 'github', 'discord', 'x', 'line', 'microsoft']
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
### `PROVIDER_DISPLAY_NAMES`
|
|
315
|
-
|
|
316
|
-
Human-readable names for each provider.
|
|
317
|
-
|
|
318
|
-
```ts
|
|
319
|
-
const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string>;
|
|
320
|
-
// { google: 'Google', apple: 'Apple', github: 'GitHub', discord: 'Discord', ... }
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### `PROVIDER_COLORS`
|
|
324
|
-
|
|
325
|
-
Official brand colors (background and text) for each provider button.
|
|
326
|
-
|
|
327
|
-
```ts
|
|
328
|
-
const PROVIDER_COLORS: Record<OAuthProviderType, { bg: string; text: string }>;
|
|
329
|
-
// { google: { bg: '#ffffff', text: '#1f1f1f' }, kakao: { bg: '#FEE500', text: '#191919' }, ... }
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### `WEBHOOK_EVENTS`
|
|
333
|
-
|
|
334
|
-
Readonly array of all webhook event type strings.
|
|
335
|
-
|
|
336
|
-
```ts
|
|
337
|
-
const WEBHOOK_EVENTS: readonly WebhookEventType[];
|
|
338
|
-
```
|
|
98
|
+
## Environment Variables
|
|
339
99
|
|
|
340
|
-
|
|
100
|
+
Not applicable -- this is a types-only package. See the framework-specific SDK for environment variable setup.
|
|
341
101
|
|
|
342
|
-
|
|
102
|
+
## API Reference
|
|
343
103
|
|
|
344
|
-
|
|
345
|
-
const API_KEY_PREFIXES: {
|
|
346
|
-
PUBLISHABLE_LIVE: 'pk_live_';
|
|
347
|
-
PUBLISHABLE_TEST: 'pk_test_';
|
|
348
|
-
SECRET_LIVE: 'sk_live_';
|
|
349
|
-
SECRET_TEST: 'sk_test_';
|
|
350
|
-
};
|
|
351
|
-
```
|
|
104
|
+
### Types
|
|
352
105
|
|
|
353
|
-
|
|
106
|
+
| Type | Description |
|
|
107
|
+
|------|-------------|
|
|
108
|
+
| `AuthonUser` | User object (id, email, displayName, avatarUrl, metadata, etc.) |
|
|
109
|
+
| `AuthTokens` | `{ accessToken, refreshToken, expiresIn, user }` |
|
|
110
|
+
| `OAuthProviderType` | `'google' \| 'apple' \| 'github' \| 'discord' \| ... (10 providers)` |
|
|
111
|
+
| `PasskeyCredential` | `{ id, name, createdAt, lastUsedAt }` |
|
|
112
|
+
| `Web3Wallet` | `{ id, address, chain, walletType, chainId }` |
|
|
113
|
+
| `Web3Chain` | `'evm' \| 'solana'` |
|
|
114
|
+
| `Web3WalletType` | `'metamask' \| 'phantom' \| 'walletconnect' \| ...` |
|
|
115
|
+
| `MfaSetupResponse` | `{ secret, qrCodeUri, backupCodes }` |
|
|
116
|
+
| `MfaStatus` | `{ enabled, backupCodesRemaining }` |
|
|
117
|
+
| `SessionInfo` | `{ id, ipAddress, userAgent, createdAt, lastActiveAt }` |
|
|
118
|
+
| `BrandingConfig` | Visual customization for the auth modal |
|
|
119
|
+
| `WebhookEvent` | `{ id, type, projectId, timestamp, data }` |
|
|
120
|
+
| `AuthonOrganization` | Organization with id, name, slug, members |
|
|
354
121
|
|
|
355
|
-
|
|
122
|
+
### Constants
|
|
356
123
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
```ts
|
|
367
|
-
const DEFAULT_SESSION_CONFIG: SessionConfig;
|
|
368
|
-
// { accessTokenTtl: 900, refreshTokenTtl: 604800, maxSessions: 5, singleSession: false }
|
|
369
|
-
```
|
|
124
|
+
| Constant | Value |
|
|
125
|
+
|----------|-------|
|
|
126
|
+
| `OAUTH_PROVIDERS` | `['google', 'apple', 'kakao', 'naver', 'facebook', 'github', 'discord', 'x', 'line', 'microsoft']` |
|
|
127
|
+
| `WEBHOOK_EVENTS` | `['user.created', 'user.updated', 'user.deleted', ...]` |
|
|
128
|
+
| `API_KEY_PREFIXES` | `{ PUBLISHABLE_LIVE: 'pk_live_', SECRET_LIVE: 'sk_live_', ... }` |
|
|
129
|
+
| `DEFAULT_BRANDING` | Default modal theme colors and settings |
|
|
130
|
+
| `DEFAULT_SESSION_CONFIG` | `{ accessTokenTtl: 900, refreshTokenTtl: 604800, maxSessions: 5 }` |
|
|
131
|
+
| `AUDIT_EVENTS` | Audit log event type constants |
|
|
370
132
|
|
|
371
|
-
##
|
|
133
|
+
## Comparison
|
|
372
134
|
|
|
373
|
-
|
|
135
|
+
| Feature | Authon | Clerk | Auth.js |
|
|
136
|
+
|---------|--------|-------|---------|
|
|
137
|
+
| Pricing | Free | $25/mo+ | Free |
|
|
138
|
+
| Shared types package | Yes | Yes | No |
|
|
139
|
+
| OAuth providers | 10+ | 20+ | 80+ |
|
|
374
140
|
|
|
375
141
|
## License
|
|
376
142
|
|
|
377
|
-
|
|
143
|
+
MIT
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ── Types ──\n\nexport interface AuthonUser {\n id: string;\n projectId: string;\n email: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n phone: string | null;\n emailVerified: boolean;\n phoneVerified: boolean;\n isBanned: boolean;\n publicMetadata: Record<string, unknown> | null;\n lastSignInAt: string | null;\n signInCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface AuthonSession {\n id: string;\n userId: string;\n ipAddress: string | null;\n userAgent: string | null;\n deviceName: string | null;\n lastActiveAt: string | null;\n createdAt: string;\n expiresAt: string;\n}\n\nexport interface AuthonProvider {\n provider: string;\n enabled: boolean;\n sortOrder: number;\n configured: boolean;\n}\n\nexport interface BrandingConfig {\n logoDataUrl?: string;\n brandName?: string;\n primaryColorStart?: string;\n primaryColorEnd?: string;\n lightBg?: string;\n lightText?: string;\n darkBg?: string;\n darkText?: string;\n borderRadius?: number;\n providerOrder?: string[];\n hiddenProviders?: string[];\n showEmailPassword?: boolean;\n showDivider?: boolean;\n termsUrl?: string;\n privacyUrl?: string;\n customCss?: string;\n locale?: string;\n showSecuredBy?: boolean;\n}\n\nexport interface SessionConfig {\n accessTokenTtl?: number;\n refreshTokenTtl?: number;\n maxSessions?: number;\n singleSession?: boolean;\n}\n\nexport interface AuthTokens {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n user: AuthonUser;\n}\n\nexport interface WebhookEvent {\n id: string;\n type: string;\n projectId: string;\n timestamp: string;\n data: Record<string, unknown>;\n}\n\n// ── MFA Types ──\n\nexport interface MfaSetupResponse {\n secret: string;\n qrCodeUri: string;\n backupCodes: string[];\n}\n\nexport interface MfaStatus {\n enabled: boolean;\n backupCodesRemaining: number;\n}\n\nexport interface MfaVerifyResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n user: AuthonUser;\n}\n\n// ── Passwordless Types ──\n\nexport interface PasswordlessResult {\n message: string;\n}\n\n// ── Passkey Types ──\n\nexport interface PasskeyCredential {\n id: string;\n name: string | null;\n createdAt: string;\n lastUsedAt: string | null;\n}\n\n// ── Web3 Types ──\n\nexport type Web3Chain = 'evm' | 'solana';\nexport type Web3WalletType =\n | 'metamask'\n | 'pexus'\n | 'walletconnect'\n | 'coinbase'\n | 'phantom'\n | 'trust'\n | 'other';\n\nexport interface Web3Wallet {\n id: string;\n address: string;\n chain: Web3Chain;\n walletType: Web3WalletType;\n chainId: number | null;\n createdAt: string;\n}\n\nexport interface Web3NonceResponse {\n message: string;\n nonce: string;\n}\n\n// ── Session Types ──\n\nexport interface SessionInfo {\n id: string;\n ipAddress: string | null;\n userAgent: string | null;\n createdAt: string;\n lastActiveAt: string | null;\n}\n\n// ── Organization Types ──\n\nexport interface AuthonOrganization {\n id: string;\n projectId: string;\n name: string;\n slug: string;\n logoUrl: string | null;\n metadata: Record<string, any> | null;\n maxMembers: number;\n createdBy: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface OrganizationMember {\n id: string;\n organizationId: string;\n userId: string;\n role: 'owner' | 'admin' | 'member';\n joinedAt: string;\n createdAt: string;\n}\n\nexport interface OrganizationInvitation {\n id: string;\n organizationId: string;\n email: string;\n role: string;\n status: 'pending' | 'accepted' | 'rejected' | 'expired';\n invitedBy: string;\n expiresAt: string;\n createdAt: string;\n}\n\nexport interface CreateOrganizationParams {\n name: string;\n slug?: string;\n logoUrl?: string;\n metadata?: Record<string, any>;\n maxMembers?: number;\n}\n\nexport interface UpdateOrganizationParams {\n name?: string;\n slug?: string;\n logoUrl?: string;\n metadata?: Record<string, any>;\n maxMembers?: number;\n}\n\nexport interface InviteMemberParams {\n email: string;\n role?: 'admin' | 'member';\n}\n\nexport interface OrganizationListResponse {\n data: AuthonOrganization[];\n total: number;\n page: number;\n limit: number;\n}\n\n// ── Audit Log Types ──\n\nexport interface AuditLogEntry {\n id: string;\n projectId: string;\n actorType: 'user' | 'admin' | 'system' | 'api_key';\n actorId: string | null;\n event: string;\n targetType: string | null;\n targetId: string | null;\n metadata: Record<string, any> | null;\n ipAddress: string | null;\n userAgent: string | null;\n createdAt: string;\n}\n\nexport interface AuditLogQueryParams {\n event?: string;\n actorId?: string;\n targetId?: string;\n dateFrom?: string;\n dateTo?: string;\n page?: number;\n limit?: number;\n}\n\nexport interface AuditLogListResponse {\n data: AuditLogEntry[];\n total: number;\n page: number;\n limit: number;\n}\n\nexport interface AuditLogStats {\n [eventType: string]: number;\n}\n\n// ── JWT Template Types ──\n\nexport interface JwtClaimMapping {\n key: string;\n source?: string;\n value?: string;\n}\n\nexport interface JwtTemplate {\n id: string;\n projectId: string;\n name: string;\n isDefault: boolean;\n claims: JwtClaimMapping[];\n allowedLifetime: number | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CreateJwtTemplateParams {\n name: string;\n claims: JwtClaimMapping[];\n allowedLifetime?: number;\n}\n\nexport interface UpdateJwtTemplateParams {\n name?: string;\n claims?: JwtClaimMapping[];\n allowedLifetime?: number | null;\n}\n\nexport interface JwtPreviewResponse {\n token: string;\n decoded: Record<string, any>;\n}\n\n// ── Constants ──\n\nexport const OAUTH_PROVIDERS = [\n 'google',\n 'apple',\n 'kakao',\n 'naver',\n 'facebook',\n 'github',\n 'discord',\n 'x',\n 'line',\n 'microsoft',\n] as const;\n\nexport type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];\n\nexport const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string> = {\n google: 'Google',\n apple: 'Apple',\n kakao: 'Kakao',\n naver: 'Naver',\n facebook: 'Facebook',\n github: 'GitHub',\n discord: 'Discord',\n x: 'X',\n line: 'LINE',\n microsoft: 'Microsoft',\n};\n\nexport const PROVIDER_COLORS: Record<OAuthProviderType, { bg: string; text: string }> = {\n google: { bg: '#ffffff', text: '#1f1f1f' },\n apple: { bg: '#000000', text: '#ffffff' },\n kakao: { bg: '#FEE500', text: '#191919' },\n naver: { bg: '#03C75A', text: '#ffffff' },\n facebook: { bg: '#1877F2', text: '#ffffff' },\n github: { bg: '#24292e', text: '#ffffff' },\n discord: { bg: '#5865F2', text: '#ffffff' },\n x: { bg: '#000000', text: '#ffffff' },\n line: { bg: '#06C755', text: '#ffffff' },\n microsoft: { bg: '#ffffff', text: '#1f1f1f' },\n};\n\nexport const WEBHOOK_EVENTS = [\n 'user.created',\n 'user.updated',\n 'user.deleted',\n 'user.banned',\n 'user.unbanned',\n 'session.created',\n 'session.ended',\n 'session.revoked',\n 'provider.linked',\n 'provider.unlinked',\n] as const;\n\nexport type WebhookEventType = (typeof WEBHOOK_EVENTS)[number];\n\nexport const API_KEY_PREFIXES = {\n PUBLISHABLE_LIVE: 'pk_live_',\n PUBLISHABLE_TEST: 'pk_test_',\n SECRET_LIVE: 'sk_live_',\n SECRET_TEST: 'sk_test_',\n} as const;\n\nexport const DEFAULT_BRANDING: BrandingConfig = {\n primaryColorStart: '#7c3aed',\n primaryColorEnd: '#4f46e5',\n lightBg: '#ffffff',\n lightText: '#111827',\n darkBg: '#0f172a',\n darkText: '#f1f5f9',\n borderRadius: 12,\n showEmailPassword: true,\n showDivider: true,\n showSecuredBy: true,\n locale: 'en',\n};\n\nexport const DEFAULT_SESSION_CONFIG: SessionConfig = {\n accessTokenTtl: 900,\n refreshTokenTtl: 604800,\n maxSessions: 5,\n singleSession: false,\n};\n\nexport const AUDIT_EVENTS = {\n AUTH_SIGNUP: 'auth.signup',\n AUTH_SIGNIN: 'auth.signin',\n AUTH_SIGNIN_FAILED: 'auth.signin.failed',\n AUTH_SIGNOUT: 'auth.signout',\n AUTH_TOKEN_REFRESH: 'auth.token.refresh',\n AUTH_MFA_SETUP: 'auth.mfa.setup',\n AUTH_MFA_VERIFY: 'auth.mfa.verify',\n AUTH_PASSKEY_REGISTER: 'auth.passkey.register',\n AUTH_WEB3_VERIFY: 'auth.web3.verify',\n ADMIN_USER_BANNED: 'admin.user.banned',\n ADMIN_USER_UNBANNED: 'admin.user.unbanned',\n ADMIN_USER_DELETED: 'admin.user.deleted',\n ORG_CREATED: 'org.created',\n ORG_DELETED: 'org.deleted',\n ORG_MEMBER_ADDED: 'org.member.added',\n ORG_MEMBER_REMOVED: 'org.member.removed',\n ORG_MEMBER_ROLE_CHANGED: 'org.member.role_changed',\n ORG_INVITATION_SENT: 'org.invitation.sent',\n ORG_INVITATION_ACCEPTED: 'org.invitation.accepted',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiSO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,yBAA4D;AAAA,EACvE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAA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aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,qBAAqB;AAAA,EACrB,yBAAyB;AAC3B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ── Types ──\n\nexport interface AuthonUser {\n id: string;\n projectId: string;\n email: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n phone: string | null;\n emailVerified: boolean;\n phoneVerified: boolean;\n isBanned: boolean;\n publicMetadata: Record<string, unknown> | null;\n lastSignInAt: string | null;\n signInCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface AuthonSession {\n id: string;\n userId: string;\n ipAddress: string | null;\n userAgent: string | null;\n deviceName: string | null;\n lastActiveAt: string | null;\n createdAt: string;\n expiresAt: string;\n}\n\nexport interface AuthonProvider {\n provider: string;\n enabled: boolean;\n sortOrder: number;\n configured: boolean;\n}\n\nexport interface BrandingConfig {\n logoDataUrl?: string;\n brandName?: string;\n primaryColorStart?: string;\n primaryColorEnd?: string;\n lightBg?: string;\n lightText?: string;\n darkBg?: string;\n darkText?: string;\n borderRadius?: number;\n providerOrder?: string[];\n hiddenProviders?: string[];\n showEmailPassword?: boolean;\n showDivider?: boolean;\n termsUrl?: string;\n privacyUrl?: string;\n customCss?: string;\n locale?: string;\n showSecuredBy?: boolean;\n showWeb3?: boolean;\n showPasswordless?: boolean;\n showPasskey?: boolean;\n passwordlessMethod?: 'magic_link' | 'email_otp' | 'both';\n}\n\nexport interface SessionConfig {\n accessTokenTtl?: number;\n refreshTokenTtl?: number;\n maxSessions?: number;\n singleSession?: boolean;\n}\n\nexport interface AuthTokens {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n user: AuthonUser;\n}\n\nexport interface WebhookEvent {\n id: string;\n type: string;\n projectId: string;\n timestamp: string;\n data: Record<string, unknown>;\n}\n\n// ── MFA Types ──\n\nexport interface MfaSetupResponse {\n secret: string;\n qrCodeUri: string;\n backupCodes: string[];\n}\n\nexport interface MfaStatus {\n enabled: boolean;\n backupCodesRemaining: number;\n}\n\nexport interface MfaVerifyResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n user: AuthonUser;\n}\n\n// ── Passwordless Types ──\n\nexport interface PasswordlessResult {\n message: string;\n}\n\n// ── Passkey Types ──\n\nexport interface PasskeyCredential {\n id: string;\n name: string | null;\n createdAt: string;\n lastUsedAt: string | null;\n}\n\n// ── Web3 Types ──\n\nexport type Web3Chain = 'evm' | 'solana';\nexport type Web3WalletType =\n | 'metamask'\n | 'pexus'\n | 'walletconnect'\n | 'coinbase'\n | 'phantom'\n | 'trust'\n | 'other';\n\nexport interface Web3Wallet {\n id: string;\n address: string;\n chain: Web3Chain;\n walletType: Web3WalletType;\n chainId: number | null;\n createdAt: string;\n}\n\nexport interface Web3NonceResponse {\n message: string;\n nonce: string;\n}\n\n// ── Session Types ──\n\nexport interface SessionInfo {\n id: string;\n ipAddress: string | null;\n userAgent: string | null;\n createdAt: string;\n lastActiveAt: string | null;\n}\n\n// ── Organization Types ──\n\nexport interface AuthonOrganization {\n id: string;\n projectId: string;\n name: string;\n slug: string;\n logoUrl: string | null;\n metadata: Record<string, any> | null;\n maxMembers: number;\n createdBy: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface OrganizationMember {\n id: string;\n organizationId: string;\n userId: string;\n role: 'owner' | 'admin' | 'member';\n joinedAt: string;\n createdAt: string;\n}\n\nexport interface OrganizationInvitation {\n id: string;\n organizationId: string;\n email: string;\n role: string;\n status: 'pending' | 'accepted' | 'rejected' | 'expired';\n invitedBy: string;\n expiresAt: string;\n createdAt: string;\n}\n\nexport interface CreateOrganizationParams {\n name: string;\n slug?: string;\n logoUrl?: string;\n metadata?: Record<string, any>;\n maxMembers?: number;\n}\n\nexport interface UpdateOrganizationParams {\n name?: string;\n slug?: string;\n logoUrl?: string;\n metadata?: Record<string, any>;\n maxMembers?: number;\n}\n\nexport interface InviteMemberParams {\n email: string;\n role?: 'admin' | 'member';\n}\n\nexport interface OrganizationListResponse {\n data: AuthonOrganization[];\n total: number;\n page: number;\n limit: number;\n}\n\n// ── Audit Log Types ──\n\nexport interface AuditLogEntry {\n id: string;\n projectId: string;\n actorType: 'user' | 'admin' | 'system' | 'api_key';\n actorId: string | null;\n event: string;\n targetType: string | null;\n targetId: string | null;\n metadata: Record<string, any> | null;\n ipAddress: string | null;\n userAgent: string | null;\n createdAt: string;\n}\n\nexport interface AuditLogQueryParams {\n event?: string;\n actorId?: string;\n targetId?: string;\n dateFrom?: string;\n dateTo?: string;\n page?: number;\n limit?: number;\n}\n\nexport interface AuditLogListResponse {\n data: AuditLogEntry[];\n total: number;\n page: number;\n limit: number;\n}\n\nexport interface AuditLogStats {\n [eventType: string]: number;\n}\n\n// ── JWT Template Types ──\n\nexport interface JwtClaimMapping {\n key: string;\n source?: string;\n value?: string;\n}\n\nexport interface JwtTemplate {\n id: string;\n projectId: string;\n name: string;\n isDefault: boolean;\n claims: JwtClaimMapping[];\n allowedLifetime: number | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CreateJwtTemplateParams {\n name: string;\n claims: JwtClaimMapping[];\n allowedLifetime?: number;\n}\n\nexport interface UpdateJwtTemplateParams {\n name?: string;\n claims?: JwtClaimMapping[];\n allowedLifetime?: number | null;\n}\n\nexport interface JwtPreviewResponse {\n token: string;\n decoded: Record<string, any>;\n}\n\n// ── Constants ──\n\nexport const OAUTH_PROVIDERS = [\n 'google',\n 'apple',\n 'kakao',\n 'naver',\n 'facebook',\n 'github',\n 'discord',\n 'x',\n 'line',\n 'microsoft',\n] as const;\n\nexport type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];\n\nexport const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string> = {\n google: 'Google',\n apple: 'Apple',\n kakao: 'Kakao',\n naver: 'Naver',\n facebook: 'Facebook',\n github: 'GitHub',\n discord: 'Discord',\n x: 'X',\n line: 'LINE',\n microsoft: 'Microsoft',\n};\n\nexport const PROVIDER_COLORS: Record<OAuthProviderType, { bg: string; text: string }> = {\n google: { bg: '#ffffff', text: '#1f1f1f' },\n apple: { bg: '#000000', text: '#ffffff' },\n kakao: { bg: '#FEE500', text: '#191919' },\n naver: { bg: '#03C75A', text: '#ffffff' },\n facebook: { bg: '#1877F2', text: '#ffffff' },\n github: { bg: '#24292e', text: '#ffffff' },\n discord: { bg: '#5865F2', text: '#ffffff' },\n x: { bg: '#000000', text: '#ffffff' },\n line: { bg: '#06C755', text: '#ffffff' },\n microsoft: { bg: '#ffffff', text: '#1f1f1f' },\n};\n\nexport const WEBHOOK_EVENTS = [\n 'user.created',\n 'user.updated',\n 'user.deleted',\n 'user.banned',\n 'user.unbanned',\n 'session.created',\n 'session.ended',\n 'session.revoked',\n 'provider.linked',\n 'provider.unlinked',\n] as const;\n\nexport type WebhookEventType = (typeof WEBHOOK_EVENTS)[number];\n\nexport const API_KEY_PREFIXES = {\n PUBLISHABLE_LIVE: 'pk_live_',\n PUBLISHABLE_TEST: 'pk_test_',\n SECRET_LIVE: 'sk_live_',\n SECRET_TEST: 'sk_test_',\n} as const;\n\nexport const DEFAULT_BRANDING: BrandingConfig = {\n primaryColorStart: '#7c3aed',\n primaryColorEnd: '#4f46e5',\n lightBg: '#ffffff',\n lightText: '#111827',\n darkBg: '#0f172a',\n darkText: '#f1f5f9',\n borderRadius: 12,\n showEmailPassword: true,\n showDivider: true,\n showSecuredBy: true,\n locale: 'en',\n};\n\nexport const DEFAULT_SESSION_CONFIG: SessionConfig = {\n accessTokenTtl: 900,\n refreshTokenTtl: 604800,\n maxSessions: 5,\n singleSession: false,\n};\n\nexport const AUDIT_EVENTS = {\n AUTH_SIGNUP: 'auth.signup',\n AUTH_SIGNIN: 'auth.signin',\n AUTH_SIGNIN_FAILED: 'auth.signin.failed',\n AUTH_SIGNOUT: 'auth.signout',\n AUTH_TOKEN_REFRESH: 'auth.token.refresh',\n AUTH_MFA_SETUP: 'auth.mfa.setup',\n AUTH_MFA_VERIFY: 'auth.mfa.verify',\n AUTH_PASSKEY_REGISTER: 'auth.passkey.register',\n AUTH_WEB3_VERIFY: 'auth.web3.verify',\n ADMIN_USER_BANNED: 'admin.user.banned',\n ADMIN_USER_UNBANNED: 'admin.user.unbanned',\n ADMIN_USER_DELETED: 'admin.user.deleted',\n ORG_CREATED: 'org.created',\n ORG_DELETED: 'org.deleted',\n ORG_MEMBER_ADDED: 'org.member.added',\n ORG_MEMBER_REMOVED: 'org.member.removed',\n ORG_MEMBER_ROLE_CHANGED: 'org.member.role_changed',\n ORG_INVITATION_SENT: 'org.invitation.sent',\n ORG_INVITATION_ACCEPTED: 'org.invitation.accepted',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqSO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,yBAA4D;AAAA,EACvE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,GAAG;AAAA,EACH,MAAM;AAAA,EACN,WAAW;AACb;AAEO,IAAM,kBAA2E;AAAA,EACtF,QAAQ,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACzC,OAAO,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACxC,OAAO,EAAE,IAA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b,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,qBAAqB;AAAA,EACrB,yBAAyB;AAC3B;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -49,6 +49,10 @@ interface BrandingConfig {
|
|
|
49
49
|
customCss?: string;
|
|
50
50
|
locale?: string;
|
|
51
51
|
showSecuredBy?: boolean;
|
|
52
|
+
showWeb3?: boolean;
|
|
53
|
+
showPasswordless?: boolean;
|
|
54
|
+
showPasskey?: boolean;
|
|
55
|
+
passwordlessMethod?: 'magic_link' | 'email_otp' | 'both';
|
|
52
56
|
}
|
|
53
57
|
interface SessionConfig {
|
|
54
58
|
accessTokenTtl?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ interface BrandingConfig {
|
|
|
49
49
|
customCss?: string;
|
|
50
50
|
locale?: string;
|
|
51
51
|
showSecuredBy?: boolean;
|
|
52
|
+
showWeb3?: boolean;
|
|
53
|
+
showPasswordless?: boolean;
|
|
54
|
+
showPasskey?: boolean;
|
|
55
|
+
passwordlessMethod?: 'magic_link' | 'email_otp' | 'both';
|
|
52
56
|
}
|
|
53
57
|
interface SessionConfig {
|
|
54
58
|
accessTokenTtl?: number;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ── Types ──\n\nexport interface AuthonUser {\n id: string;\n projectId: string;\n email: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n phone: string | null;\n emailVerified: boolean;\n phoneVerified: boolean;\n isBanned: boolean;\n publicMetadata: Record<string, unknown> | null;\n lastSignInAt: string | null;\n signInCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface AuthonSession {\n id: string;\n userId: string;\n ipAddress: string | null;\n userAgent: string | null;\n deviceName: string | null;\n lastActiveAt: string | null;\n createdAt: string;\n expiresAt: string;\n}\n\nexport interface AuthonProvider {\n provider: string;\n enabled: boolean;\n sortOrder: number;\n configured: boolean;\n}\n\nexport interface BrandingConfig {\n logoDataUrl?: string;\n brandName?: string;\n primaryColorStart?: string;\n primaryColorEnd?: string;\n lightBg?: string;\n lightText?: string;\n darkBg?: string;\n darkText?: string;\n borderRadius?: number;\n providerOrder?: string[];\n hiddenProviders?: string[];\n showEmailPassword?: boolean;\n showDivider?: boolean;\n termsUrl?: string;\n privacyUrl?: string;\n customCss?: string;\n locale?: string;\n showSecuredBy?: boolean;\n}\n\nexport interface SessionConfig {\n accessTokenTtl?: number;\n refreshTokenTtl?: number;\n maxSessions?: number;\n singleSession?: boolean;\n}\n\nexport interface AuthTokens {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n user: AuthonUser;\n}\n\nexport interface WebhookEvent {\n id: string;\n type: string;\n projectId: string;\n timestamp: string;\n data: Record<string, unknown>;\n}\n\n// ── MFA Types ──\n\nexport interface MfaSetupResponse {\n secret: string;\n qrCodeUri: string;\n backupCodes: string[];\n}\n\nexport interface MfaStatus {\n enabled: boolean;\n backupCodesRemaining: number;\n}\n\nexport interface MfaVerifyResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n user: AuthonUser;\n}\n\n// ── Passwordless Types ──\n\nexport interface PasswordlessResult {\n message: string;\n}\n\n// ── Passkey Types ──\n\nexport interface PasskeyCredential {\n id: string;\n name: string | null;\n createdAt: string;\n lastUsedAt: string | null;\n}\n\n// ── Web3 Types ──\n\nexport type Web3Chain = 'evm' | 'solana';\nexport type Web3WalletType =\n | 'metamask'\n | 'pexus'\n | 'walletconnect'\n | 'coinbase'\n | 'phantom'\n | 'trust'\n | 'other';\n\nexport interface Web3Wallet {\n id: string;\n address: string;\n chain: Web3Chain;\n walletType: Web3WalletType;\n chainId: number | null;\n createdAt: string;\n}\n\nexport interface Web3NonceResponse {\n message: string;\n nonce: string;\n}\n\n// ── Session Types ──\n\nexport interface SessionInfo {\n id: string;\n ipAddress: string | null;\n userAgent: string | null;\n createdAt: string;\n lastActiveAt: string | null;\n}\n\n// ── Organization Types ──\n\nexport interface AuthonOrganization {\n id: string;\n projectId: string;\n name: string;\n slug: string;\n logoUrl: string | null;\n metadata: Record<string, any> | null;\n maxMembers: number;\n createdBy: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface OrganizationMember {\n id: string;\n organizationId: string;\n userId: string;\n role: 'owner' | 'admin' | 'member';\n joinedAt: string;\n createdAt: string;\n}\n\nexport interface OrganizationInvitation {\n id: string;\n organizationId: string;\n email: string;\n role: string;\n status: 'pending' | 'accepted' | 'rejected' | 'expired';\n invitedBy: string;\n expiresAt: string;\n createdAt: string;\n}\n\nexport interface CreateOrganizationParams {\n name: string;\n slug?: string;\n logoUrl?: string;\n metadata?: Record<string, any>;\n maxMembers?: number;\n}\n\nexport interface UpdateOrganizationParams {\n name?: string;\n slug?: string;\n logoUrl?: string;\n metadata?: Record<string, any>;\n maxMembers?: number;\n}\n\nexport interface InviteMemberParams {\n email: string;\n role?: 'admin' | 'member';\n}\n\nexport interface OrganizationListResponse {\n data: AuthonOrganization[];\n total: number;\n page: number;\n limit: number;\n}\n\n// ── Audit Log Types ──\n\nexport interface AuditLogEntry {\n id: string;\n projectId: string;\n actorType: 'user' | 'admin' | 'system' | 'api_key';\n actorId: string | null;\n event: string;\n targetType: string | null;\n targetId: string | null;\n metadata: Record<string, any> | null;\n ipAddress: string | null;\n userAgent: string | null;\n createdAt: string;\n}\n\nexport interface AuditLogQueryParams {\n event?: string;\n actorId?: string;\n targetId?: string;\n dateFrom?: string;\n dateTo?: string;\n page?: number;\n limit?: number;\n}\n\nexport interface AuditLogListResponse {\n data: AuditLogEntry[];\n total: number;\n page: number;\n limit: number;\n}\n\nexport interface AuditLogStats {\n [eventType: string]: number;\n}\n\n// ── JWT Template Types ──\n\nexport interface JwtClaimMapping {\n key: string;\n source?: string;\n value?: string;\n}\n\nexport interface JwtTemplate {\n id: string;\n projectId: string;\n name: string;\n isDefault: boolean;\n claims: JwtClaimMapping[];\n allowedLifetime: number | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CreateJwtTemplateParams {\n name: string;\n claims: JwtClaimMapping[];\n allowedLifetime?: number;\n}\n\nexport interface UpdateJwtTemplateParams {\n name?: string;\n claims?: JwtClaimMapping[];\n allowedLifetime?: number | null;\n}\n\nexport interface JwtPreviewResponse {\n token: string;\n decoded: Record<string, any>;\n}\n\n// ── Constants ──\n\nexport const OAUTH_PROVIDERS = [\n 'google',\n 'apple',\n 'kakao',\n 'naver',\n 'facebook',\n 'github',\n 'discord',\n 'x',\n 'line',\n 'microsoft',\n] as const;\n\nexport type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];\n\nexport const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string> = {\n google: 'Google',\n apple: 'Apple',\n kakao: 'Kakao',\n naver: 'Naver',\n facebook: 'Facebook',\n github: 'GitHub',\n discord: 'Discord',\n x: 'X',\n line: 'LINE',\n microsoft: 'Microsoft',\n};\n\nexport const PROVIDER_COLORS: Record<OAuthProviderType, { bg: string; text: string }> = {\n google: { bg: '#ffffff', text: '#1f1f1f' },\n apple: { bg: '#000000', text: '#ffffff' },\n kakao: { bg: '#FEE500', text: '#191919' },\n naver: { bg: '#03C75A', text: '#ffffff' },\n facebook: { bg: '#1877F2', text: '#ffffff' },\n github: { bg: '#24292e', text: '#ffffff' },\n discord: { bg: '#5865F2', text: '#ffffff' },\n x: { bg: '#000000', text: '#ffffff' },\n line: { bg: '#06C755', text: '#ffffff' },\n microsoft: { bg: '#ffffff', text: '#1f1f1f' },\n};\n\nexport const WEBHOOK_EVENTS = [\n 'user.created',\n 'user.updated',\n 'user.deleted',\n 'user.banned',\n 'user.unbanned',\n 'session.created',\n 'session.ended',\n 'session.revoked',\n 'provider.linked',\n 'provider.unlinked',\n] as const;\n\nexport type WebhookEventType = (typeof WEBHOOK_EVENTS)[number];\n\nexport const API_KEY_PREFIXES = {\n PUBLISHABLE_LIVE: 'pk_live_',\n PUBLISHABLE_TEST: 'pk_test_',\n SECRET_LIVE: 'sk_live_',\n SECRET_TEST: 'sk_test_',\n} as const;\n\nexport const DEFAULT_BRANDING: BrandingConfig = {\n primaryColorStart: '#7c3aed',\n primaryColorEnd: '#4f46e5',\n lightBg: '#ffffff',\n lightText: '#111827',\n darkBg: '#0f172a',\n darkText: '#f1f5f9',\n borderRadius: 12,\n showEmailPassword: true,\n showDivider: true,\n showSecuredBy: true,\n locale: 'en',\n};\n\nexport const DEFAULT_SESSION_CONFIG: SessionConfig = {\n accessTokenTtl: 900,\n refreshTokenTtl: 604800,\n maxSessions: 5,\n singleSession: false,\n};\n\nexport const AUDIT_EVENTS = {\n AUTH_SIGNUP: 'auth.signup',\n AUTH_SIGNIN: 'auth.signin',\n AUTH_SIGNIN_FAILED: 'auth.signin.failed',\n AUTH_SIGNOUT: 'auth.signout',\n AUTH_TOKEN_REFRESH: 'auth.token.refresh',\n AUTH_MFA_SETUP: 'auth.mfa.setup',\n AUTH_MFA_VERIFY: 'auth.mfa.verify',\n AUTH_PASSKEY_REGISTER: 'auth.passkey.register',\n AUTH_WEB3_VERIFY: 'auth.web3.verify',\n ADMIN_USER_BANNED: 'admin.user.banned',\n ADMIN_USER_UNBANNED: 'admin.user.unbanned',\n ADMIN_USER_DELETED: 'admin.user.deleted',\n ORG_CREATED: 'org.created',\n ORG_DELETED: 'org.deleted',\n ORG_MEMBER_ADDED: 'org.member.added',\n ORG_MEMBER_REMOVED: 'org.member.removed',\n ORG_MEMBER_ROLE_CHANGED: 'org.member.role_changed',\n ORG_INVITATION_SENT: 'org.invitation.sent',\n ORG_INVITATION_ACCEPTED: 'org.invitation.accepted',\n} as const;\n"],"mappings":";AAiSO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,yBAA4D;AAAA,EACvE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;A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B,aAAa;AAAA,EACb,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,qBAAqB;AAAA,EACrB,yBAAyB;AAC3B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ── Types ──\n\nexport interface AuthonUser {\n id: string;\n projectId: string;\n email: string | null;\n displayName: string | null;\n avatarUrl: string | null;\n phone: string | null;\n emailVerified: boolean;\n phoneVerified: boolean;\n isBanned: boolean;\n publicMetadata: Record<string, unknown> | null;\n lastSignInAt: string | null;\n signInCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface AuthonSession {\n id: string;\n userId: string;\n ipAddress: string | null;\n userAgent: string | null;\n deviceName: string | null;\n lastActiveAt: string | null;\n createdAt: string;\n expiresAt: string;\n}\n\nexport interface AuthonProvider {\n provider: string;\n enabled: boolean;\n sortOrder: number;\n configured: boolean;\n}\n\nexport interface BrandingConfig {\n logoDataUrl?: string;\n brandName?: string;\n primaryColorStart?: string;\n primaryColorEnd?: string;\n lightBg?: string;\n lightText?: string;\n darkBg?: string;\n darkText?: string;\n borderRadius?: number;\n providerOrder?: string[];\n hiddenProviders?: string[];\n showEmailPassword?: boolean;\n showDivider?: boolean;\n termsUrl?: string;\n privacyUrl?: string;\n customCss?: string;\n locale?: string;\n showSecuredBy?: boolean;\n showWeb3?: boolean;\n showPasswordless?: boolean;\n showPasskey?: boolean;\n passwordlessMethod?: 'magic_link' | 'email_otp' | 'both';\n}\n\nexport interface SessionConfig {\n accessTokenTtl?: number;\n refreshTokenTtl?: number;\n maxSessions?: number;\n singleSession?: boolean;\n}\n\nexport interface AuthTokens {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n user: AuthonUser;\n}\n\nexport interface WebhookEvent {\n id: string;\n type: string;\n projectId: string;\n timestamp: string;\n data: Record<string, unknown>;\n}\n\n// ── MFA Types ──\n\nexport interface MfaSetupResponse {\n secret: string;\n qrCodeUri: string;\n backupCodes: string[];\n}\n\nexport interface MfaStatus {\n enabled: boolean;\n backupCodesRemaining: number;\n}\n\nexport interface MfaVerifyResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n user: AuthonUser;\n}\n\n// ── Passwordless Types ──\n\nexport interface PasswordlessResult {\n message: string;\n}\n\n// ── Passkey Types ──\n\nexport interface PasskeyCredential {\n id: string;\n name: string | null;\n createdAt: string;\n lastUsedAt: string | null;\n}\n\n// ── Web3 Types ──\n\nexport type Web3Chain = 'evm' | 'solana';\nexport type Web3WalletType =\n | 'metamask'\n | 'pexus'\n | 'walletconnect'\n | 'coinbase'\n | 'phantom'\n | 'trust'\n | 'other';\n\nexport interface Web3Wallet {\n id: string;\n address: string;\n chain: Web3Chain;\n walletType: Web3WalletType;\n chainId: number | null;\n createdAt: string;\n}\n\nexport interface Web3NonceResponse {\n message: string;\n nonce: string;\n}\n\n// ── Session Types ──\n\nexport interface SessionInfo {\n id: string;\n ipAddress: string | null;\n userAgent: string | null;\n createdAt: string;\n lastActiveAt: string | null;\n}\n\n// ── Organization Types ──\n\nexport interface AuthonOrganization {\n id: string;\n projectId: string;\n name: string;\n slug: string;\n logoUrl: string | null;\n metadata: Record<string, any> | null;\n maxMembers: number;\n createdBy: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface OrganizationMember {\n id: string;\n organizationId: string;\n userId: string;\n role: 'owner' | 'admin' | 'member';\n joinedAt: string;\n createdAt: string;\n}\n\nexport interface OrganizationInvitation {\n id: string;\n organizationId: string;\n email: string;\n role: string;\n status: 'pending' | 'accepted' | 'rejected' | 'expired';\n invitedBy: string;\n expiresAt: string;\n createdAt: string;\n}\n\nexport interface CreateOrganizationParams {\n name: string;\n slug?: string;\n logoUrl?: string;\n metadata?: Record<string, any>;\n maxMembers?: number;\n}\n\nexport interface UpdateOrganizationParams {\n name?: string;\n slug?: string;\n logoUrl?: string;\n metadata?: Record<string, any>;\n maxMembers?: number;\n}\n\nexport interface InviteMemberParams {\n email: string;\n role?: 'admin' | 'member';\n}\n\nexport interface OrganizationListResponse {\n data: AuthonOrganization[];\n total: number;\n page: number;\n limit: number;\n}\n\n// ── Audit Log Types ──\n\nexport interface AuditLogEntry {\n id: string;\n projectId: string;\n actorType: 'user' | 'admin' | 'system' | 'api_key';\n actorId: string | null;\n event: string;\n targetType: string | null;\n targetId: string | null;\n metadata: Record<string, any> | null;\n ipAddress: string | null;\n userAgent: string | null;\n createdAt: string;\n}\n\nexport interface AuditLogQueryParams {\n event?: string;\n actorId?: string;\n targetId?: string;\n dateFrom?: string;\n dateTo?: string;\n page?: number;\n limit?: number;\n}\n\nexport interface AuditLogListResponse {\n data: AuditLogEntry[];\n total: number;\n page: number;\n limit: number;\n}\n\nexport interface AuditLogStats {\n [eventType: string]: number;\n}\n\n// ── JWT Template Types ──\n\nexport interface JwtClaimMapping {\n key: string;\n source?: string;\n value?: string;\n}\n\nexport interface JwtTemplate {\n id: string;\n projectId: string;\n name: string;\n isDefault: boolean;\n claims: JwtClaimMapping[];\n allowedLifetime: number | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CreateJwtTemplateParams {\n name: string;\n claims: JwtClaimMapping[];\n allowedLifetime?: number;\n}\n\nexport interface UpdateJwtTemplateParams {\n name?: string;\n claims?: JwtClaimMapping[];\n allowedLifetime?: number | null;\n}\n\nexport interface JwtPreviewResponse {\n token: string;\n decoded: Record<string, any>;\n}\n\n// ── Constants ──\n\nexport const OAUTH_PROVIDERS = [\n 'google',\n 'apple',\n 'kakao',\n 'naver',\n 'facebook',\n 'github',\n 'discord',\n 'x',\n 'line',\n 'microsoft',\n] as const;\n\nexport type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];\n\nexport const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string> = {\n google: 'Google',\n apple: 'Apple',\n kakao: 'Kakao',\n naver: 'Naver',\n facebook: 'Facebook',\n github: 'GitHub',\n discord: 'Discord',\n x: 'X',\n line: 'LINE',\n microsoft: 'Microsoft',\n};\n\nexport const PROVIDER_COLORS: Record<OAuthProviderType, { bg: string; text: string }> = {\n google: { bg: '#ffffff', text: '#1f1f1f' },\n apple: { bg: '#000000', text: '#ffffff' },\n kakao: { bg: '#FEE500', text: '#191919' },\n naver: { bg: '#03C75A', text: '#ffffff' },\n facebook: { bg: '#1877F2', text: '#ffffff' },\n github: { bg: '#24292e', text: '#ffffff' },\n discord: { bg: '#5865F2', text: '#ffffff' },\n x: { bg: '#000000', text: '#ffffff' },\n line: { bg: '#06C755', text: '#ffffff' },\n microsoft: { bg: '#ffffff', text: '#1f1f1f' },\n};\n\nexport const WEBHOOK_EVENTS = [\n 'user.created',\n 'user.updated',\n 'user.deleted',\n 'user.banned',\n 'user.unbanned',\n 'session.created',\n 'session.ended',\n 'session.revoked',\n 'provider.linked',\n 'provider.unlinked',\n] as const;\n\nexport type WebhookEventType = (typeof WEBHOOK_EVENTS)[number];\n\nexport const API_KEY_PREFIXES = {\n PUBLISHABLE_LIVE: 'pk_live_',\n PUBLISHABLE_TEST: 'pk_test_',\n SECRET_LIVE: 'sk_live_',\n SECRET_TEST: 'sk_test_',\n} as const;\n\nexport const DEFAULT_BRANDING: BrandingConfig = {\n primaryColorStart: '#7c3aed',\n primaryColorEnd: '#4f46e5',\n lightBg: '#ffffff',\n lightText: '#111827',\n darkBg: '#0f172a',\n darkText: '#f1f5f9',\n borderRadius: 12,\n showEmailPassword: true,\n showDivider: true,\n showSecuredBy: true,\n locale: 'en',\n};\n\nexport const DEFAULT_SESSION_CONFIG: SessionConfig = {\n accessTokenTtl: 900,\n refreshTokenTtl: 604800,\n maxSessions: 5,\n singleSession: false,\n};\n\nexport const AUDIT_EVENTS = {\n AUTH_SIGNUP: 'auth.signup',\n AUTH_SIGNIN: 'auth.signin',\n AUTH_SIGNIN_FAILED: 'auth.signin.failed',\n AUTH_SIGNOUT: 'auth.signout',\n AUTH_TOKEN_REFRESH: 'auth.token.refresh',\n AUTH_MFA_SETUP: 'auth.mfa.setup',\n AUTH_MFA_VERIFY: 'auth.mfa.verify',\n AUTH_PASSKEY_REGISTER: 'auth.passkey.register',\n AUTH_WEB3_VERIFY: 'auth.web3.verify',\n ADMIN_USER_BANNED: 'admin.user.banned',\n ADMIN_USER_UNBANNED: 'admin.user.unbanned',\n ADMIN_USER_DELETED: 'admin.user.deleted',\n ORG_CREATED: 'org.created',\n ORG_DELETED: 'org.deleted',\n ORG_MEMBER_ADDED: 'org.member.added',\n ORG_MEMBER_REMOVED: 'org.member.removed',\n ORG_MEMBER_ROLE_CHANGED: 'org.member.role_changed',\n ORG_INVITATION_SENT: 'org.invitation.sent',\n ORG_INVITATION_ACCEPTED: 'org.invitation.accepted',\n} as const;\n"],"mappings":";AAqSO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,yBAA4D;AAAA,EACvE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,GAAG;AAAA,EACH,MAAM;AAAA,EACN,WAAW;AACb;AAEO,IAAM,kBAA2E;AAAA,EACtF,QAAQ,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACzC,OAAO,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACxC,OAAO,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACxC,OAAO,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,E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A,EACrB,yBAAyB;AAC3B;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authon/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.16",
|
|
4
4
|
"description": "Shared types and constants for Authon SDKs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsup",
|
|
21
|
-
"dev": "tsup --watch"
|
|
22
|
-
},
|
|
23
19
|
"license": "MIT",
|
|
24
20
|
"repository": {
|
|
25
21
|
"type": "git",
|
|
@@ -40,5 +36,11 @@
|
|
|
40
36
|
"devDependencies": {
|
|
41
37
|
"tsup": "^8.0.0",
|
|
42
38
|
"typescript": "^5.9.3"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup",
|
|
42
|
+
"dev": "tsup --watch",
|
|
43
|
+
"test": "vitest run --root ../.. --passWithNoTests packages/shared",
|
|
44
|
+
"typecheck": "tsc --noEmit"
|
|
43
45
|
}
|
|
44
|
-
}
|
|
46
|
+
}
|