@authon/shared 0.2.0 → 0.3.0

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.ko.md ADDED
@@ -0,0 +1,73 @@
1
+ [English](./README.md) | **한국어**
2
+
3
+ # @authon/shared
4
+
5
+ [Authon](https://authon.dev) SDK용 공유 타입 및 상수 패키지입니다.
6
+
7
+ ## 설치
8
+
9
+ ```bash
10
+ npm install @authon/shared
11
+ # or
12
+ pnpm add @authon/shared
13
+ ```
14
+
15
+ ## 사용법
16
+
17
+ ```ts
18
+ import type {
19
+ AuthonUser,
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';
35
+ ```
36
+
37
+ ## API 참조
38
+
39
+ ### 타입
40
+
41
+ | 타입 | 설명 |
42
+ |------|------|
43
+ | `AuthonUser` | 사용자 객체: id, email, displayName, avatarUrl 등 |
44
+ | `AuthonSession` | 활성 세션: userId, ipAddress, expiresAt |
45
+ | `AuthTokens` | 토큰 응답: accessToken, refreshToken, expiresIn, user |
46
+ | `BrandingConfig` | 시각적 커스터마이징: 색상, 로고, 테두리 반경, 로케일 |
47
+ | `SessionConfig` | TTL 설정, 최대 세션 수, 단일 세션 모드 |
48
+ | `WebhookEvent` | 웹훅 페이로드: id, type, projectId, timestamp, data |
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)
70
+
71
+ ## 라이선스
72
+
73
+ [MIT](../../LICENSE)
package/README.md CHANGED
@@ -1,8 +1,15 @@
1
+ **English** | [한국어](./README.ko.md)
2
+
1
3
  # @authon/shared
2
4
 
3
- Shared types and constants for [Authon](https://authon.dev) SDKs.
5
+ [![npm version](https://img.shields.io/npm/v/@authon/shared?color=6d28d9)](https://www.npmjs.com/package/@authon/shared)
6
+ [![License](https://img.shields.io/badge/license-MIT-blue)](../../LICENSE)
7
+
8
+ Shared types and constants for [Authon](https://authon.dev) SDK packages. This package is consumed internally by `@authon/js`, `@authon/react`, `@authon/node`, and all other Authon SDKs.
4
9
 
5
- ## Install
10
+ > **Note:** This package is not intended for direct use in application code. Install the appropriate framework SDK instead (e.g., `@authon/js`, `@authon/react`, `@authon/node`).
11
+
12
+ ## Installation
6
13
 
7
14
  ```bash
8
15
  npm install @authon/shared
@@ -18,7 +25,18 @@ import type {
18
25
  AuthonSession,
19
26
  AuthTokens,
20
27
  BrandingConfig,
28
+ SessionConfig,
21
29
  WebhookEvent,
30
+ MfaSetupResponse,
31
+ MfaStatus,
32
+ PasskeyCredential,
33
+ Web3Wallet,
34
+ Web3NonceResponse,
35
+ SessionInfo,
36
+ Web3Chain,
37
+ Web3WalletType,
38
+ OAuthProviderType,
39
+ WebhookEventType,
22
40
  } from '@authon/shared';
23
41
 
24
42
  import {
@@ -32,36 +50,327 @@ import {
32
50
  } from '@authon/shared';
33
51
  ```
34
52
 
35
- ## API Reference
53
+ ## Exported Types
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`
181
+
182
+ Returned by `getMfaStatus()`.
183
+
184
+ ```ts
185
+ interface MfaStatus {
186
+ enabled: boolean;
187
+ backupCodesRemaining: number;
188
+ }
189
+ ```
190
+
191
+ ### Passkeys
192
+
193
+ #### `PasskeyCredential`
194
+
195
+ A registered WebAuthn passkey.
196
+
197
+ ```ts
198
+ interface PasskeyCredential {
199
+ id: string;
200
+ name: string | null;
201
+ createdAt: string;
202
+ lastUsedAt: string | null;
203
+ }
204
+ ```
205
+
206
+ ### Web3
207
+
208
+ #### `Web3Chain`
209
+
210
+ ```ts
211
+ type Web3Chain = 'evm' | 'solana';
212
+ ```
213
+
214
+ #### `Web3WalletType`
215
+
216
+ ```ts
217
+ type Web3WalletType =
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
+ }
240
+ ```
241
+
242
+ #### `Web3NonceResponse`
243
+
244
+ Returned by `web3GetNonce()`.
245
+
246
+ ```ts
247
+ interface Web3NonceResponse {
248
+ message: string; // full message to sign
249
+ nonce: string; // raw nonce embedded in message
250
+ }
251
+ ```
252
+
253
+ ### Webhooks
254
+
255
+ #### `WebhookEvent`
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>;
266
+ }
267
+ ```
268
+
269
+ #### `WebhookEventType`
36
270
 
37
- ### Types
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
+ ```
38
284
 
39
- | Type | Description |
40
- |------|-------------|
41
- | `AuthonUser` | User object with id, email, displayName, avatarUrl, etc. |
42
- | `AuthonSession` | Active session with userId, ipAddress, expiresAt |
43
- | `AuthTokens` | Token response: accessToken, refreshToken, expiresIn, user |
44
- | `BrandingConfig` | Visual customization: colors, logo, border radius, locale |
45
- | `SessionConfig` | TTL settings, max sessions, single session mode |
46
- | `WebhookEvent` | Webhook payload: id, type, projectId, timestamp, data |
47
- | `OAuthProviderType` | Union of supported OAuth providers |
48
- | `WebhookEventType` | Union of webhook event types |
285
+ ### OAuth
49
286
 
50
- ### Constants
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
+ ```
51
313
 
52
- | Constant | Description |
53
- |----------|-------------|
54
- | `OAUTH_PROVIDERS` | Array of supported providers: google, apple, kakao, naver, ... |
55
- | `PROVIDER_DISPLAY_NAMES` | Human-readable provider names |
56
- | `PROVIDER_COLORS` | Brand colors (bg, text) per provider |
57
- | `WEBHOOK_EVENTS` | All webhook event types |
58
- | `API_KEY_PREFIXES` | Key prefixes: `pk_live_`, `pk_test_`, `sk_live_`, `sk_test_` |
59
- | `DEFAULT_BRANDING` | Default branding configuration |
60
- | `DEFAULT_SESSION_CONFIG` | Default session settings (15min access, 7d refresh) |
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
+ ```
339
+
340
+ ### `API_KEY_PREFIXES`
341
+
342
+ Prefix strings for Authon API keys.
343
+
344
+ ```ts
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
+ ```
352
+
353
+ ### `DEFAULT_BRANDING`
354
+
355
+ Default branding values applied when no project customization is set.
356
+
357
+ ```ts
358
+ const DEFAULT_BRANDING: BrandingConfig;
359
+ // { primaryColorStart: '#7c3aed', primaryColorEnd: '#4f46e5', borderRadius: 12, ... }
360
+ ```
361
+
362
+ ### `DEFAULT_SESSION_CONFIG`
363
+
364
+ Default session lifetime and concurrency settings.
365
+
366
+ ```ts
367
+ const DEFAULT_SESSION_CONFIG: SessionConfig;
368
+ // { accessTokenTtl: 900, refreshTokenTtl: 604800, maxSessions: 5, singleSession: false }
369
+ ```
61
370
 
62
371
  ## Documentation
63
372
 
64
- [authon.dev/docs](https://authon.dev/docs)
373
+ Full documentation: [docs.authon.dev](https://docs.authon.dev)
65
374
 
66
375
  ## License
67
376
 
package/dist/index.cjs CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  API_KEY_PREFIXES: () => API_KEY_PREFIXES,
24
+ AUDIT_EVENTS: () => AUDIT_EVENTS,
24
25
  DEFAULT_BRANDING: () => DEFAULT_BRANDING,
25
26
  DEFAULT_SESSION_CONFIG: () => DEFAULT_SESSION_CONFIG,
26
27
  OAUTH_PROVIDERS: () => OAUTH_PROVIDERS,
@@ -102,9 +103,31 @@ var DEFAULT_SESSION_CONFIG = {
102
103
  maxSessions: 5,
103
104
  singleSession: false
104
105
  };
106
+ var AUDIT_EVENTS = {
107
+ AUTH_SIGNUP: "auth.signup",
108
+ AUTH_SIGNIN: "auth.signin",
109
+ AUTH_SIGNIN_FAILED: "auth.signin.failed",
110
+ AUTH_SIGNOUT: "auth.signout",
111
+ AUTH_TOKEN_REFRESH: "auth.token.refresh",
112
+ AUTH_MFA_SETUP: "auth.mfa.setup",
113
+ AUTH_MFA_VERIFY: "auth.mfa.verify",
114
+ AUTH_PASSKEY_REGISTER: "auth.passkey.register",
115
+ AUTH_WEB3_VERIFY: "auth.web3.verify",
116
+ ADMIN_USER_BANNED: "admin.user.banned",
117
+ ADMIN_USER_UNBANNED: "admin.user.unbanned",
118
+ ADMIN_USER_DELETED: "admin.user.deleted",
119
+ ORG_CREATED: "org.created",
120
+ ORG_DELETED: "org.deleted",
121
+ ORG_MEMBER_ADDED: "org.member.added",
122
+ ORG_MEMBER_REMOVED: "org.member.removed",
123
+ ORG_MEMBER_ROLE_CHANGED: "org.member.role_changed",
124
+ ORG_INVITATION_SENT: "org.invitation.sent",
125
+ ORG_INVITATION_ACCEPTED: "org.invitation.accepted"
126
+ };
105
127
  // Annotate the CommonJS export names for ESM import in node:
106
128
  0 && (module.exports = {
107
129
  API_KEY_PREFIXES,
130
+ AUDIT_EVENTS,
108
131
  DEFAULT_BRANDING,
109
132
  DEFAULT_SESSION_CONFIG,
110
133
  OAUTH_PROVIDERS,
@@ -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// ── 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkFO,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,EACxC,UAAU,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EAC3C,QAAQ,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACzC,SAAS,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EAC1C,GAAG,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACpC,MAAM,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACvC,WAAW,EAAE,IAAI,WAAW,MAAM,UAAU;AAC9C;AAEO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,mBAAmB;AAAA,EAC9B,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,aAAa;AACf;AAEO,IAAM,mBAAmC;AAAA,EAC9C,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,QAAQ;AACV;AAEO,IAAM,yBAAwC;AAAA,EACnD,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,eAAe;AACjB;","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}\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;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,EACxC,UAAU,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EAC3C,QAAQ,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACzC,SAAS,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EAC1C,GAAG,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACpC,MAAM,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACvC,WAAW,EAAE,IAAI,WAAW,MAAM,UAAU;AAC9C;AAEO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,mBAAmB;AAAA,EAC9B,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,aAAa;AACf;AAEO,IAAM,mBAAmC;AAAA,EAC9C,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,QAAQ;AACV;AAEO,IAAM,yBAAwC;AAAA,EACnD,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,eAAe;AACjB;AAEO,IAAM,eAAe;AAAA,EAC1B,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":[]}
package/dist/index.d.cts CHANGED
@@ -69,6 +69,165 @@ interface WebhookEvent {
69
69
  timestamp: string;
70
70
  data: Record<string, unknown>;
71
71
  }
72
+ interface MfaSetupResponse {
73
+ secret: string;
74
+ qrCodeUri: string;
75
+ backupCodes: string[];
76
+ }
77
+ interface MfaStatus {
78
+ enabled: boolean;
79
+ backupCodesRemaining: number;
80
+ }
81
+ interface MfaVerifyResponse {
82
+ accessToken: string;
83
+ refreshToken: string;
84
+ expiresIn: number;
85
+ user: AuthonUser;
86
+ }
87
+ interface PasswordlessResult {
88
+ message: string;
89
+ }
90
+ interface PasskeyCredential {
91
+ id: string;
92
+ name: string | null;
93
+ createdAt: string;
94
+ lastUsedAt: string | null;
95
+ }
96
+ type Web3Chain = 'evm' | 'solana';
97
+ type Web3WalletType = 'metamask' | 'pexus' | 'walletconnect' | 'coinbase' | 'phantom' | 'trust' | 'other';
98
+ interface Web3Wallet {
99
+ id: string;
100
+ address: string;
101
+ chain: Web3Chain;
102
+ walletType: Web3WalletType;
103
+ chainId: number | null;
104
+ createdAt: string;
105
+ }
106
+ interface Web3NonceResponse {
107
+ message: string;
108
+ nonce: string;
109
+ }
110
+ interface SessionInfo {
111
+ id: string;
112
+ ipAddress: string | null;
113
+ userAgent: string | null;
114
+ createdAt: string;
115
+ lastActiveAt: string | null;
116
+ }
117
+ interface AuthonOrganization {
118
+ id: string;
119
+ projectId: string;
120
+ name: string;
121
+ slug: string;
122
+ logoUrl: string | null;
123
+ metadata: Record<string, any> | null;
124
+ maxMembers: number;
125
+ createdBy: string;
126
+ createdAt: string;
127
+ updatedAt: string;
128
+ }
129
+ interface OrganizationMember {
130
+ id: string;
131
+ organizationId: string;
132
+ userId: string;
133
+ role: 'owner' | 'admin' | 'member';
134
+ joinedAt: string;
135
+ createdAt: string;
136
+ }
137
+ interface OrganizationInvitation {
138
+ id: string;
139
+ organizationId: string;
140
+ email: string;
141
+ role: string;
142
+ status: 'pending' | 'accepted' | 'rejected' | 'expired';
143
+ invitedBy: string;
144
+ expiresAt: string;
145
+ createdAt: string;
146
+ }
147
+ interface CreateOrganizationParams {
148
+ name: string;
149
+ slug?: string;
150
+ logoUrl?: string;
151
+ metadata?: Record<string, any>;
152
+ maxMembers?: number;
153
+ }
154
+ interface UpdateOrganizationParams {
155
+ name?: string;
156
+ slug?: string;
157
+ logoUrl?: string;
158
+ metadata?: Record<string, any>;
159
+ maxMembers?: number;
160
+ }
161
+ interface InviteMemberParams {
162
+ email: string;
163
+ role?: 'admin' | 'member';
164
+ }
165
+ interface OrganizationListResponse {
166
+ data: AuthonOrganization[];
167
+ total: number;
168
+ page: number;
169
+ limit: number;
170
+ }
171
+ interface AuditLogEntry {
172
+ id: string;
173
+ projectId: string;
174
+ actorType: 'user' | 'admin' | 'system' | 'api_key';
175
+ actorId: string | null;
176
+ event: string;
177
+ targetType: string | null;
178
+ targetId: string | null;
179
+ metadata: Record<string, any> | null;
180
+ ipAddress: string | null;
181
+ userAgent: string | null;
182
+ createdAt: string;
183
+ }
184
+ interface AuditLogQueryParams {
185
+ event?: string;
186
+ actorId?: string;
187
+ targetId?: string;
188
+ dateFrom?: string;
189
+ dateTo?: string;
190
+ page?: number;
191
+ limit?: number;
192
+ }
193
+ interface AuditLogListResponse {
194
+ data: AuditLogEntry[];
195
+ total: number;
196
+ page: number;
197
+ limit: number;
198
+ }
199
+ interface AuditLogStats {
200
+ [eventType: string]: number;
201
+ }
202
+ interface JwtClaimMapping {
203
+ key: string;
204
+ source?: string;
205
+ value?: string;
206
+ }
207
+ interface JwtTemplate {
208
+ id: string;
209
+ projectId: string;
210
+ name: string;
211
+ isDefault: boolean;
212
+ claims: JwtClaimMapping[];
213
+ allowedLifetime: number | null;
214
+ createdAt: string;
215
+ updatedAt: string;
216
+ }
217
+ interface CreateJwtTemplateParams {
218
+ name: string;
219
+ claims: JwtClaimMapping[];
220
+ allowedLifetime?: number;
221
+ }
222
+ interface UpdateJwtTemplateParams {
223
+ name?: string;
224
+ claims?: JwtClaimMapping[];
225
+ allowedLifetime?: number | null;
226
+ }
227
+ interface JwtPreviewResponse {
228
+ token: string;
229
+ decoded: Record<string, any>;
230
+ }
72
231
  declare const OAUTH_PROVIDERS: readonly ["google", "apple", "kakao", "naver", "facebook", "github", "discord", "x", "line", "microsoft"];
73
232
  type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];
74
233
  declare const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string>;
@@ -86,5 +245,26 @@ declare const API_KEY_PREFIXES: {
86
245
  };
87
246
  declare const DEFAULT_BRANDING: BrandingConfig;
88
247
  declare const DEFAULT_SESSION_CONFIG: SessionConfig;
248
+ declare const AUDIT_EVENTS: {
249
+ readonly AUTH_SIGNUP: "auth.signup";
250
+ readonly AUTH_SIGNIN: "auth.signin";
251
+ readonly AUTH_SIGNIN_FAILED: "auth.signin.failed";
252
+ readonly AUTH_SIGNOUT: "auth.signout";
253
+ readonly AUTH_TOKEN_REFRESH: "auth.token.refresh";
254
+ readonly AUTH_MFA_SETUP: "auth.mfa.setup";
255
+ readonly AUTH_MFA_VERIFY: "auth.mfa.verify";
256
+ readonly AUTH_PASSKEY_REGISTER: "auth.passkey.register";
257
+ readonly AUTH_WEB3_VERIFY: "auth.web3.verify";
258
+ readonly ADMIN_USER_BANNED: "admin.user.banned";
259
+ readonly ADMIN_USER_UNBANNED: "admin.user.unbanned";
260
+ readonly ADMIN_USER_DELETED: "admin.user.deleted";
261
+ readonly ORG_CREATED: "org.created";
262
+ readonly ORG_DELETED: "org.deleted";
263
+ readonly ORG_MEMBER_ADDED: "org.member.added";
264
+ readonly ORG_MEMBER_REMOVED: "org.member.removed";
265
+ readonly ORG_MEMBER_ROLE_CHANGED: "org.member.role_changed";
266
+ readonly ORG_INVITATION_SENT: "org.invitation.sent";
267
+ readonly ORG_INVITATION_ACCEPTED: "org.invitation.accepted";
268
+ };
89
269
 
90
- export { API_KEY_PREFIXES, type AuthTokens, type AuthonProvider, type AuthonSession, type AuthonUser, type BrandingConfig, DEFAULT_BRANDING, DEFAULT_SESSION_CONFIG, OAUTH_PROVIDERS, type OAuthProviderType, PROVIDER_COLORS, PROVIDER_DISPLAY_NAMES, type SessionConfig, WEBHOOK_EVENTS, type WebhookEvent, type WebhookEventType };
270
+ export { API_KEY_PREFIXES, AUDIT_EVENTS, type AuditLogEntry, type AuditLogListResponse, type AuditLogQueryParams, type AuditLogStats, type AuthTokens, type AuthonOrganization, type AuthonProvider, type AuthonSession, type AuthonUser, type BrandingConfig, type CreateJwtTemplateParams, type CreateOrganizationParams, DEFAULT_BRANDING, DEFAULT_SESSION_CONFIG, type InviteMemberParams, type JwtClaimMapping, type JwtPreviewResponse, type JwtTemplate, type MfaSetupResponse, type MfaStatus, type MfaVerifyResponse, OAUTH_PROVIDERS, type OAuthProviderType, type OrganizationInvitation, type OrganizationListResponse, type OrganizationMember, PROVIDER_COLORS, PROVIDER_DISPLAY_NAMES, type PasskeyCredential, type PasswordlessResult, type SessionConfig, type SessionInfo, type UpdateJwtTemplateParams, type UpdateOrganizationParams, WEBHOOK_EVENTS, type Web3Chain, type Web3NonceResponse, type Web3Wallet, type Web3WalletType, type WebhookEvent, type WebhookEventType };
package/dist/index.d.ts CHANGED
@@ -69,6 +69,165 @@ interface WebhookEvent {
69
69
  timestamp: string;
70
70
  data: Record<string, unknown>;
71
71
  }
72
+ interface MfaSetupResponse {
73
+ secret: string;
74
+ qrCodeUri: string;
75
+ backupCodes: string[];
76
+ }
77
+ interface MfaStatus {
78
+ enabled: boolean;
79
+ backupCodesRemaining: number;
80
+ }
81
+ interface MfaVerifyResponse {
82
+ accessToken: string;
83
+ refreshToken: string;
84
+ expiresIn: number;
85
+ user: AuthonUser;
86
+ }
87
+ interface PasswordlessResult {
88
+ message: string;
89
+ }
90
+ interface PasskeyCredential {
91
+ id: string;
92
+ name: string | null;
93
+ createdAt: string;
94
+ lastUsedAt: string | null;
95
+ }
96
+ type Web3Chain = 'evm' | 'solana';
97
+ type Web3WalletType = 'metamask' | 'pexus' | 'walletconnect' | 'coinbase' | 'phantom' | 'trust' | 'other';
98
+ interface Web3Wallet {
99
+ id: string;
100
+ address: string;
101
+ chain: Web3Chain;
102
+ walletType: Web3WalletType;
103
+ chainId: number | null;
104
+ createdAt: string;
105
+ }
106
+ interface Web3NonceResponse {
107
+ message: string;
108
+ nonce: string;
109
+ }
110
+ interface SessionInfo {
111
+ id: string;
112
+ ipAddress: string | null;
113
+ userAgent: string | null;
114
+ createdAt: string;
115
+ lastActiveAt: string | null;
116
+ }
117
+ interface AuthonOrganization {
118
+ id: string;
119
+ projectId: string;
120
+ name: string;
121
+ slug: string;
122
+ logoUrl: string | null;
123
+ metadata: Record<string, any> | null;
124
+ maxMembers: number;
125
+ createdBy: string;
126
+ createdAt: string;
127
+ updatedAt: string;
128
+ }
129
+ interface OrganizationMember {
130
+ id: string;
131
+ organizationId: string;
132
+ userId: string;
133
+ role: 'owner' | 'admin' | 'member';
134
+ joinedAt: string;
135
+ createdAt: string;
136
+ }
137
+ interface OrganizationInvitation {
138
+ id: string;
139
+ organizationId: string;
140
+ email: string;
141
+ role: string;
142
+ status: 'pending' | 'accepted' | 'rejected' | 'expired';
143
+ invitedBy: string;
144
+ expiresAt: string;
145
+ createdAt: string;
146
+ }
147
+ interface CreateOrganizationParams {
148
+ name: string;
149
+ slug?: string;
150
+ logoUrl?: string;
151
+ metadata?: Record<string, any>;
152
+ maxMembers?: number;
153
+ }
154
+ interface UpdateOrganizationParams {
155
+ name?: string;
156
+ slug?: string;
157
+ logoUrl?: string;
158
+ metadata?: Record<string, any>;
159
+ maxMembers?: number;
160
+ }
161
+ interface InviteMemberParams {
162
+ email: string;
163
+ role?: 'admin' | 'member';
164
+ }
165
+ interface OrganizationListResponse {
166
+ data: AuthonOrganization[];
167
+ total: number;
168
+ page: number;
169
+ limit: number;
170
+ }
171
+ interface AuditLogEntry {
172
+ id: string;
173
+ projectId: string;
174
+ actorType: 'user' | 'admin' | 'system' | 'api_key';
175
+ actorId: string | null;
176
+ event: string;
177
+ targetType: string | null;
178
+ targetId: string | null;
179
+ metadata: Record<string, any> | null;
180
+ ipAddress: string | null;
181
+ userAgent: string | null;
182
+ createdAt: string;
183
+ }
184
+ interface AuditLogQueryParams {
185
+ event?: string;
186
+ actorId?: string;
187
+ targetId?: string;
188
+ dateFrom?: string;
189
+ dateTo?: string;
190
+ page?: number;
191
+ limit?: number;
192
+ }
193
+ interface AuditLogListResponse {
194
+ data: AuditLogEntry[];
195
+ total: number;
196
+ page: number;
197
+ limit: number;
198
+ }
199
+ interface AuditLogStats {
200
+ [eventType: string]: number;
201
+ }
202
+ interface JwtClaimMapping {
203
+ key: string;
204
+ source?: string;
205
+ value?: string;
206
+ }
207
+ interface JwtTemplate {
208
+ id: string;
209
+ projectId: string;
210
+ name: string;
211
+ isDefault: boolean;
212
+ claims: JwtClaimMapping[];
213
+ allowedLifetime: number | null;
214
+ createdAt: string;
215
+ updatedAt: string;
216
+ }
217
+ interface CreateJwtTemplateParams {
218
+ name: string;
219
+ claims: JwtClaimMapping[];
220
+ allowedLifetime?: number;
221
+ }
222
+ interface UpdateJwtTemplateParams {
223
+ name?: string;
224
+ claims?: JwtClaimMapping[];
225
+ allowedLifetime?: number | null;
226
+ }
227
+ interface JwtPreviewResponse {
228
+ token: string;
229
+ decoded: Record<string, any>;
230
+ }
72
231
  declare const OAUTH_PROVIDERS: readonly ["google", "apple", "kakao", "naver", "facebook", "github", "discord", "x", "line", "microsoft"];
73
232
  type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];
74
233
  declare const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string>;
@@ -86,5 +245,26 @@ declare const API_KEY_PREFIXES: {
86
245
  };
87
246
  declare const DEFAULT_BRANDING: BrandingConfig;
88
247
  declare const DEFAULT_SESSION_CONFIG: SessionConfig;
248
+ declare const AUDIT_EVENTS: {
249
+ readonly AUTH_SIGNUP: "auth.signup";
250
+ readonly AUTH_SIGNIN: "auth.signin";
251
+ readonly AUTH_SIGNIN_FAILED: "auth.signin.failed";
252
+ readonly AUTH_SIGNOUT: "auth.signout";
253
+ readonly AUTH_TOKEN_REFRESH: "auth.token.refresh";
254
+ readonly AUTH_MFA_SETUP: "auth.mfa.setup";
255
+ readonly AUTH_MFA_VERIFY: "auth.mfa.verify";
256
+ readonly AUTH_PASSKEY_REGISTER: "auth.passkey.register";
257
+ readonly AUTH_WEB3_VERIFY: "auth.web3.verify";
258
+ readonly ADMIN_USER_BANNED: "admin.user.banned";
259
+ readonly ADMIN_USER_UNBANNED: "admin.user.unbanned";
260
+ readonly ADMIN_USER_DELETED: "admin.user.deleted";
261
+ readonly ORG_CREATED: "org.created";
262
+ readonly ORG_DELETED: "org.deleted";
263
+ readonly ORG_MEMBER_ADDED: "org.member.added";
264
+ readonly ORG_MEMBER_REMOVED: "org.member.removed";
265
+ readonly ORG_MEMBER_ROLE_CHANGED: "org.member.role_changed";
266
+ readonly ORG_INVITATION_SENT: "org.invitation.sent";
267
+ readonly ORG_INVITATION_ACCEPTED: "org.invitation.accepted";
268
+ };
89
269
 
90
- export { API_KEY_PREFIXES, type AuthTokens, type AuthonProvider, type AuthonSession, type AuthonUser, type BrandingConfig, DEFAULT_BRANDING, DEFAULT_SESSION_CONFIG, OAUTH_PROVIDERS, type OAuthProviderType, PROVIDER_COLORS, PROVIDER_DISPLAY_NAMES, type SessionConfig, WEBHOOK_EVENTS, type WebhookEvent, type WebhookEventType };
270
+ export { API_KEY_PREFIXES, AUDIT_EVENTS, type AuditLogEntry, type AuditLogListResponse, type AuditLogQueryParams, type AuditLogStats, type AuthTokens, type AuthonOrganization, type AuthonProvider, type AuthonSession, type AuthonUser, type BrandingConfig, type CreateJwtTemplateParams, type CreateOrganizationParams, DEFAULT_BRANDING, DEFAULT_SESSION_CONFIG, type InviteMemberParams, type JwtClaimMapping, type JwtPreviewResponse, type JwtTemplate, type MfaSetupResponse, type MfaStatus, type MfaVerifyResponse, OAUTH_PROVIDERS, type OAuthProviderType, type OrganizationInvitation, type OrganizationListResponse, type OrganizationMember, PROVIDER_COLORS, PROVIDER_DISPLAY_NAMES, type PasskeyCredential, type PasswordlessResult, type SessionConfig, type SessionInfo, type UpdateJwtTemplateParams, type UpdateOrganizationParams, WEBHOOK_EVENTS, type Web3Chain, type Web3NonceResponse, type Web3Wallet, type Web3WalletType, type WebhookEvent, type WebhookEventType };
package/dist/index.js CHANGED
@@ -72,8 +72,30 @@ var DEFAULT_SESSION_CONFIG = {
72
72
  maxSessions: 5,
73
73
  singleSession: false
74
74
  };
75
+ var AUDIT_EVENTS = {
76
+ AUTH_SIGNUP: "auth.signup",
77
+ AUTH_SIGNIN: "auth.signin",
78
+ AUTH_SIGNIN_FAILED: "auth.signin.failed",
79
+ AUTH_SIGNOUT: "auth.signout",
80
+ AUTH_TOKEN_REFRESH: "auth.token.refresh",
81
+ AUTH_MFA_SETUP: "auth.mfa.setup",
82
+ AUTH_MFA_VERIFY: "auth.mfa.verify",
83
+ AUTH_PASSKEY_REGISTER: "auth.passkey.register",
84
+ AUTH_WEB3_VERIFY: "auth.web3.verify",
85
+ ADMIN_USER_BANNED: "admin.user.banned",
86
+ ADMIN_USER_UNBANNED: "admin.user.unbanned",
87
+ ADMIN_USER_DELETED: "admin.user.deleted",
88
+ ORG_CREATED: "org.created",
89
+ ORG_DELETED: "org.deleted",
90
+ ORG_MEMBER_ADDED: "org.member.added",
91
+ ORG_MEMBER_REMOVED: "org.member.removed",
92
+ ORG_MEMBER_ROLE_CHANGED: "org.member.role_changed",
93
+ ORG_INVITATION_SENT: "org.invitation.sent",
94
+ ORG_INVITATION_ACCEPTED: "org.invitation.accepted"
95
+ };
75
96
  export {
76
97
  API_KEY_PREFIXES,
98
+ AUDIT_EVENTS,
77
99
  DEFAULT_BRANDING,
78
100
  DEFAULT_SESSION_CONFIG,
79
101
  OAUTH_PROVIDERS,
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// ── 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"],"mappings":";AAkFO,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,EACxC,UAAU,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EAC3C,QAAQ,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACzC,SAAS,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EAC1C,GAAG,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACpC,MAAM,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACvC,WAAW,EAAE,IAAI,WAAW,MAAM,UAAU;AAC9C;AAEO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,mBAAmB;AAAA,EAC9B,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,aAAa;AACf;AAEO,IAAM,mBAAmC;AAAA,EAC9C,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,QAAQ;AACV;AAEO,IAAM,yBAAwC;AAAA,EACnD,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,eAAe;AACjB;","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}\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;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,EACxC,UAAU,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EAC3C,QAAQ,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACzC,SAAS,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EAC1C,GAAG,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACpC,MAAM,EAAE,IAAI,WAAW,MAAM,UAAU;AAAA,EACvC,WAAW,EAAE,IAAI,WAAW,MAAM,UAAU;AAC9C;AAEO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,mBAAmB;AAAA,EAC9B,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,aAAa;AACf;AAEO,IAAM,mBAAmC;AAAA,EAC9C,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,QAAQ;AACV;AAEO,IAAM,yBAAwC;AAAA,EACnD,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,eAAe;AACjB;AAEO,IAAM,eAAe;AAAA,EAC1B,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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authon/shared",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Shared types and constants for Authon SDKs",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",