@authon/shared 0.2.0 → 0.7.15
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 +33 -0
- package/README.md +100 -25
- package/dist/index.cjs +23 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +185 -1
- package/dist/index.d.ts +185 -1
- package/dist/index.js +22 -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
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[English](./README.md) | **한국어**
|
|
2
|
+
|
|
3
|
+
# @authon/shared
|
|
4
|
+
|
|
5
|
+
> Authon SDK 공유 타입 및 상수 -- 직접 사용하지 않고 프레임워크별 SDK를 설치하세요
|
|
6
|
+
|
|
7
|
+
## 설치
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @authon/shared
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 사용법
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import type { AuthonUser, AuthTokens, OAuthProviderType } from '@authon/shared';
|
|
17
|
+
import { OAUTH_PROVIDERS, DEFAULT_BRANDING, AUDIT_EVENTS } from '@authon/shared';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 주요 타입
|
|
21
|
+
|
|
22
|
+
| 타입 | 설명 |
|
|
23
|
+
|------|------|
|
|
24
|
+
| `AuthonUser` | 사용자 (id, email, displayName, avatarUrl 등) |
|
|
25
|
+
| `AuthTokens` | 토큰 쌍 (accessToken, refreshToken, expiresIn) |
|
|
26
|
+
| `OAuthProviderType` | OAuth 프로바이더 |
|
|
27
|
+
| `PasskeyCredential` | 패스키 자격증명 |
|
|
28
|
+
| `Web3Wallet` | Web3 지갑 |
|
|
29
|
+
| `BrandingConfig` | 모달 브랜딩 설정 |
|
|
30
|
+
|
|
31
|
+
## 라이선스
|
|
32
|
+
|
|
33
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,24 +1,52 @@
|
|
|
1
|
+
**English** | [한국어](./README.ko.md)
|
|
2
|
+
|
|
1
3
|
# @authon/shared
|
|
2
4
|
|
|
3
|
-
Shared types and constants for
|
|
5
|
+
> Shared types and constants for all Authon SDKs
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@authon/shared)
|
|
8
|
+
[](../../LICENSE)
|
|
9
|
+
|
|
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.)
|
|
19
|
+
|
|
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
|
|
23
|
+
|
|
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.
|
|
4
29
|
|
|
5
30
|
## Install
|
|
6
31
|
|
|
7
32
|
```bash
|
|
8
33
|
npm install @authon/shared
|
|
9
|
-
# or
|
|
10
|
-
pnpm add @authon/shared
|
|
11
34
|
```
|
|
12
35
|
|
|
13
|
-
##
|
|
36
|
+
## Quick Start
|
|
14
37
|
|
|
15
38
|
```ts
|
|
16
39
|
import type {
|
|
17
40
|
AuthonUser,
|
|
18
|
-
AuthonSession,
|
|
19
41
|
AuthTokens,
|
|
42
|
+
OAuthProviderType,
|
|
43
|
+
PasskeyCredential,
|
|
44
|
+
Web3Wallet,
|
|
45
|
+
MfaSetupResponse,
|
|
46
|
+
SessionInfo,
|
|
20
47
|
BrandingConfig,
|
|
21
48
|
WebhookEvent,
|
|
49
|
+
AuthonOrganization,
|
|
22
50
|
} from '@authon/shared';
|
|
23
51
|
|
|
24
52
|
import {
|
|
@@ -29,40 +57,87 @@ import {
|
|
|
29
57
|
API_KEY_PREFIXES,
|
|
30
58
|
DEFAULT_BRANDING,
|
|
31
59
|
DEFAULT_SESSION_CONFIG,
|
|
60
|
+
AUDIT_EVENTS,
|
|
32
61
|
} from '@authon/shared';
|
|
33
62
|
```
|
|
34
63
|
|
|
64
|
+
## Common Tasks
|
|
65
|
+
|
|
66
|
+
### Import User Type
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import type { AuthonUser } from '@authon/shared';
|
|
70
|
+
|
|
71
|
+
function greet(user: AuthonUser) {
|
|
72
|
+
return `Hello, ${user.displayName ?? user.email}`;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Get Provider Colors for Custom Buttons
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { PROVIDER_COLORS, PROVIDER_DISPLAY_NAMES } from '@authon/shared';
|
|
80
|
+
|
|
81
|
+
const google = PROVIDER_COLORS.google;
|
|
82
|
+
// { bg: '#ffffff', text: '#1f1f1f' }
|
|
83
|
+
|
|
84
|
+
const label = PROVIDER_DISPLAY_NAMES.google;
|
|
85
|
+
// 'Google'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Check API Key Type
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import { API_KEY_PREFIXES } from '@authon/shared';
|
|
92
|
+
|
|
93
|
+
function isSecretKey(key: string) {
|
|
94
|
+
return key.startsWith(API_KEY_PREFIXES.SECRET_LIVE) || key.startsWith(API_KEY_PREFIXES.SECRET_TEST);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Environment Variables
|
|
99
|
+
|
|
100
|
+
Not applicable -- this is a types-only package. See the framework-specific SDK for environment variable setup.
|
|
101
|
+
|
|
35
102
|
## API Reference
|
|
36
103
|
|
|
37
104
|
### Types
|
|
38
105
|
|
|
39
106
|
| Type | Description |
|
|
40
107
|
|------|-------------|
|
|
41
|
-
| `AuthonUser` | User object
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
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 |
|
|
49
121
|
|
|
50
122
|
### Constants
|
|
51
123
|
|
|
52
|
-
| Constant |
|
|
53
|
-
|
|
54
|
-
| `OAUTH_PROVIDERS` |
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `DEFAULT_SESSION_CONFIG` | Default session settings (15min access, 7d refresh) |
|
|
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 |
|
|
61
132
|
|
|
62
|
-
##
|
|
133
|
+
## Comparison
|
|
63
134
|
|
|
64
|
-
|
|
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+ |
|
|
65
140
|
|
|
66
141
|
## License
|
|
67
142
|
|
|
68
|
-
|
|
143
|
+
MIT
|
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,
|
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// ── 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 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,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
|
@@ -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;
|
|
@@ -69,6 +73,165 @@ interface WebhookEvent {
|
|
|
69
73
|
timestamp: string;
|
|
70
74
|
data: Record<string, unknown>;
|
|
71
75
|
}
|
|
76
|
+
interface MfaSetupResponse {
|
|
77
|
+
secret: string;
|
|
78
|
+
qrCodeUri: string;
|
|
79
|
+
backupCodes: string[];
|
|
80
|
+
}
|
|
81
|
+
interface MfaStatus {
|
|
82
|
+
enabled: boolean;
|
|
83
|
+
backupCodesRemaining: number;
|
|
84
|
+
}
|
|
85
|
+
interface MfaVerifyResponse {
|
|
86
|
+
accessToken: string;
|
|
87
|
+
refreshToken: string;
|
|
88
|
+
expiresIn: number;
|
|
89
|
+
user: AuthonUser;
|
|
90
|
+
}
|
|
91
|
+
interface PasswordlessResult {
|
|
92
|
+
message: string;
|
|
93
|
+
}
|
|
94
|
+
interface PasskeyCredential {
|
|
95
|
+
id: string;
|
|
96
|
+
name: string | null;
|
|
97
|
+
createdAt: string;
|
|
98
|
+
lastUsedAt: string | null;
|
|
99
|
+
}
|
|
100
|
+
type Web3Chain = 'evm' | 'solana';
|
|
101
|
+
type Web3WalletType = 'metamask' | 'pexus' | 'walletconnect' | 'coinbase' | 'phantom' | 'trust' | 'other';
|
|
102
|
+
interface Web3Wallet {
|
|
103
|
+
id: string;
|
|
104
|
+
address: string;
|
|
105
|
+
chain: Web3Chain;
|
|
106
|
+
walletType: Web3WalletType;
|
|
107
|
+
chainId: number | null;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
}
|
|
110
|
+
interface Web3NonceResponse {
|
|
111
|
+
message: string;
|
|
112
|
+
nonce: string;
|
|
113
|
+
}
|
|
114
|
+
interface SessionInfo {
|
|
115
|
+
id: string;
|
|
116
|
+
ipAddress: string | null;
|
|
117
|
+
userAgent: string | null;
|
|
118
|
+
createdAt: string;
|
|
119
|
+
lastActiveAt: string | null;
|
|
120
|
+
}
|
|
121
|
+
interface AuthonOrganization {
|
|
122
|
+
id: string;
|
|
123
|
+
projectId: string;
|
|
124
|
+
name: string;
|
|
125
|
+
slug: string;
|
|
126
|
+
logoUrl: string | null;
|
|
127
|
+
metadata: Record<string, any> | null;
|
|
128
|
+
maxMembers: number;
|
|
129
|
+
createdBy: string;
|
|
130
|
+
createdAt: string;
|
|
131
|
+
updatedAt: string;
|
|
132
|
+
}
|
|
133
|
+
interface OrganizationMember {
|
|
134
|
+
id: string;
|
|
135
|
+
organizationId: string;
|
|
136
|
+
userId: string;
|
|
137
|
+
role: 'owner' | 'admin' | 'member';
|
|
138
|
+
joinedAt: string;
|
|
139
|
+
createdAt: string;
|
|
140
|
+
}
|
|
141
|
+
interface OrganizationInvitation {
|
|
142
|
+
id: string;
|
|
143
|
+
organizationId: string;
|
|
144
|
+
email: string;
|
|
145
|
+
role: string;
|
|
146
|
+
status: 'pending' | 'accepted' | 'rejected' | 'expired';
|
|
147
|
+
invitedBy: string;
|
|
148
|
+
expiresAt: string;
|
|
149
|
+
createdAt: string;
|
|
150
|
+
}
|
|
151
|
+
interface CreateOrganizationParams {
|
|
152
|
+
name: string;
|
|
153
|
+
slug?: string;
|
|
154
|
+
logoUrl?: string;
|
|
155
|
+
metadata?: Record<string, any>;
|
|
156
|
+
maxMembers?: number;
|
|
157
|
+
}
|
|
158
|
+
interface UpdateOrganizationParams {
|
|
159
|
+
name?: string;
|
|
160
|
+
slug?: string;
|
|
161
|
+
logoUrl?: string;
|
|
162
|
+
metadata?: Record<string, any>;
|
|
163
|
+
maxMembers?: number;
|
|
164
|
+
}
|
|
165
|
+
interface InviteMemberParams {
|
|
166
|
+
email: string;
|
|
167
|
+
role?: 'admin' | 'member';
|
|
168
|
+
}
|
|
169
|
+
interface OrganizationListResponse {
|
|
170
|
+
data: AuthonOrganization[];
|
|
171
|
+
total: number;
|
|
172
|
+
page: number;
|
|
173
|
+
limit: number;
|
|
174
|
+
}
|
|
175
|
+
interface AuditLogEntry {
|
|
176
|
+
id: string;
|
|
177
|
+
projectId: string;
|
|
178
|
+
actorType: 'user' | 'admin' | 'system' | 'api_key';
|
|
179
|
+
actorId: string | null;
|
|
180
|
+
event: string;
|
|
181
|
+
targetType: string | null;
|
|
182
|
+
targetId: string | null;
|
|
183
|
+
metadata: Record<string, any> | null;
|
|
184
|
+
ipAddress: string | null;
|
|
185
|
+
userAgent: string | null;
|
|
186
|
+
createdAt: string;
|
|
187
|
+
}
|
|
188
|
+
interface AuditLogQueryParams {
|
|
189
|
+
event?: string;
|
|
190
|
+
actorId?: string;
|
|
191
|
+
targetId?: string;
|
|
192
|
+
dateFrom?: string;
|
|
193
|
+
dateTo?: string;
|
|
194
|
+
page?: number;
|
|
195
|
+
limit?: number;
|
|
196
|
+
}
|
|
197
|
+
interface AuditLogListResponse {
|
|
198
|
+
data: AuditLogEntry[];
|
|
199
|
+
total: number;
|
|
200
|
+
page: number;
|
|
201
|
+
limit: number;
|
|
202
|
+
}
|
|
203
|
+
interface AuditLogStats {
|
|
204
|
+
[eventType: string]: number;
|
|
205
|
+
}
|
|
206
|
+
interface JwtClaimMapping {
|
|
207
|
+
key: string;
|
|
208
|
+
source?: string;
|
|
209
|
+
value?: string;
|
|
210
|
+
}
|
|
211
|
+
interface JwtTemplate {
|
|
212
|
+
id: string;
|
|
213
|
+
projectId: string;
|
|
214
|
+
name: string;
|
|
215
|
+
isDefault: boolean;
|
|
216
|
+
claims: JwtClaimMapping[];
|
|
217
|
+
allowedLifetime: number | null;
|
|
218
|
+
createdAt: string;
|
|
219
|
+
updatedAt: string;
|
|
220
|
+
}
|
|
221
|
+
interface CreateJwtTemplateParams {
|
|
222
|
+
name: string;
|
|
223
|
+
claims: JwtClaimMapping[];
|
|
224
|
+
allowedLifetime?: number;
|
|
225
|
+
}
|
|
226
|
+
interface UpdateJwtTemplateParams {
|
|
227
|
+
name?: string;
|
|
228
|
+
claims?: JwtClaimMapping[];
|
|
229
|
+
allowedLifetime?: number | null;
|
|
230
|
+
}
|
|
231
|
+
interface JwtPreviewResponse {
|
|
232
|
+
token: string;
|
|
233
|
+
decoded: Record<string, any>;
|
|
234
|
+
}
|
|
72
235
|
declare const OAUTH_PROVIDERS: readonly ["google", "apple", "kakao", "naver", "facebook", "github", "discord", "x", "line", "microsoft"];
|
|
73
236
|
type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];
|
|
74
237
|
declare const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string>;
|
|
@@ -86,5 +249,26 @@ declare const API_KEY_PREFIXES: {
|
|
|
86
249
|
};
|
|
87
250
|
declare const DEFAULT_BRANDING: BrandingConfig;
|
|
88
251
|
declare const DEFAULT_SESSION_CONFIG: SessionConfig;
|
|
252
|
+
declare const AUDIT_EVENTS: {
|
|
253
|
+
readonly AUTH_SIGNUP: "auth.signup";
|
|
254
|
+
readonly AUTH_SIGNIN: "auth.signin";
|
|
255
|
+
readonly AUTH_SIGNIN_FAILED: "auth.signin.failed";
|
|
256
|
+
readonly AUTH_SIGNOUT: "auth.signout";
|
|
257
|
+
readonly AUTH_TOKEN_REFRESH: "auth.token.refresh";
|
|
258
|
+
readonly AUTH_MFA_SETUP: "auth.mfa.setup";
|
|
259
|
+
readonly AUTH_MFA_VERIFY: "auth.mfa.verify";
|
|
260
|
+
readonly AUTH_PASSKEY_REGISTER: "auth.passkey.register";
|
|
261
|
+
readonly AUTH_WEB3_VERIFY: "auth.web3.verify";
|
|
262
|
+
readonly ADMIN_USER_BANNED: "admin.user.banned";
|
|
263
|
+
readonly ADMIN_USER_UNBANNED: "admin.user.unbanned";
|
|
264
|
+
readonly ADMIN_USER_DELETED: "admin.user.deleted";
|
|
265
|
+
readonly ORG_CREATED: "org.created";
|
|
266
|
+
readonly ORG_DELETED: "org.deleted";
|
|
267
|
+
readonly ORG_MEMBER_ADDED: "org.member.added";
|
|
268
|
+
readonly ORG_MEMBER_REMOVED: "org.member.removed";
|
|
269
|
+
readonly ORG_MEMBER_ROLE_CHANGED: "org.member.role_changed";
|
|
270
|
+
readonly ORG_INVITATION_SENT: "org.invitation.sent";
|
|
271
|
+
readonly ORG_INVITATION_ACCEPTED: "org.invitation.accepted";
|
|
272
|
+
};
|
|
89
273
|
|
|
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 };
|
|
274
|
+
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
|
@@ -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;
|
|
@@ -69,6 +73,165 @@ interface WebhookEvent {
|
|
|
69
73
|
timestamp: string;
|
|
70
74
|
data: Record<string, unknown>;
|
|
71
75
|
}
|
|
76
|
+
interface MfaSetupResponse {
|
|
77
|
+
secret: string;
|
|
78
|
+
qrCodeUri: string;
|
|
79
|
+
backupCodes: string[];
|
|
80
|
+
}
|
|
81
|
+
interface MfaStatus {
|
|
82
|
+
enabled: boolean;
|
|
83
|
+
backupCodesRemaining: number;
|
|
84
|
+
}
|
|
85
|
+
interface MfaVerifyResponse {
|
|
86
|
+
accessToken: string;
|
|
87
|
+
refreshToken: string;
|
|
88
|
+
expiresIn: number;
|
|
89
|
+
user: AuthonUser;
|
|
90
|
+
}
|
|
91
|
+
interface PasswordlessResult {
|
|
92
|
+
message: string;
|
|
93
|
+
}
|
|
94
|
+
interface PasskeyCredential {
|
|
95
|
+
id: string;
|
|
96
|
+
name: string | null;
|
|
97
|
+
createdAt: string;
|
|
98
|
+
lastUsedAt: string | null;
|
|
99
|
+
}
|
|
100
|
+
type Web3Chain = 'evm' | 'solana';
|
|
101
|
+
type Web3WalletType = 'metamask' | 'pexus' | 'walletconnect' | 'coinbase' | 'phantom' | 'trust' | 'other';
|
|
102
|
+
interface Web3Wallet {
|
|
103
|
+
id: string;
|
|
104
|
+
address: string;
|
|
105
|
+
chain: Web3Chain;
|
|
106
|
+
walletType: Web3WalletType;
|
|
107
|
+
chainId: number | null;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
}
|
|
110
|
+
interface Web3NonceResponse {
|
|
111
|
+
message: string;
|
|
112
|
+
nonce: string;
|
|
113
|
+
}
|
|
114
|
+
interface SessionInfo {
|
|
115
|
+
id: string;
|
|
116
|
+
ipAddress: string | null;
|
|
117
|
+
userAgent: string | null;
|
|
118
|
+
createdAt: string;
|
|
119
|
+
lastActiveAt: string | null;
|
|
120
|
+
}
|
|
121
|
+
interface AuthonOrganization {
|
|
122
|
+
id: string;
|
|
123
|
+
projectId: string;
|
|
124
|
+
name: string;
|
|
125
|
+
slug: string;
|
|
126
|
+
logoUrl: string | null;
|
|
127
|
+
metadata: Record<string, any> | null;
|
|
128
|
+
maxMembers: number;
|
|
129
|
+
createdBy: string;
|
|
130
|
+
createdAt: string;
|
|
131
|
+
updatedAt: string;
|
|
132
|
+
}
|
|
133
|
+
interface OrganizationMember {
|
|
134
|
+
id: string;
|
|
135
|
+
organizationId: string;
|
|
136
|
+
userId: string;
|
|
137
|
+
role: 'owner' | 'admin' | 'member';
|
|
138
|
+
joinedAt: string;
|
|
139
|
+
createdAt: string;
|
|
140
|
+
}
|
|
141
|
+
interface OrganizationInvitation {
|
|
142
|
+
id: string;
|
|
143
|
+
organizationId: string;
|
|
144
|
+
email: string;
|
|
145
|
+
role: string;
|
|
146
|
+
status: 'pending' | 'accepted' | 'rejected' | 'expired';
|
|
147
|
+
invitedBy: string;
|
|
148
|
+
expiresAt: string;
|
|
149
|
+
createdAt: string;
|
|
150
|
+
}
|
|
151
|
+
interface CreateOrganizationParams {
|
|
152
|
+
name: string;
|
|
153
|
+
slug?: string;
|
|
154
|
+
logoUrl?: string;
|
|
155
|
+
metadata?: Record<string, any>;
|
|
156
|
+
maxMembers?: number;
|
|
157
|
+
}
|
|
158
|
+
interface UpdateOrganizationParams {
|
|
159
|
+
name?: string;
|
|
160
|
+
slug?: string;
|
|
161
|
+
logoUrl?: string;
|
|
162
|
+
metadata?: Record<string, any>;
|
|
163
|
+
maxMembers?: number;
|
|
164
|
+
}
|
|
165
|
+
interface InviteMemberParams {
|
|
166
|
+
email: string;
|
|
167
|
+
role?: 'admin' | 'member';
|
|
168
|
+
}
|
|
169
|
+
interface OrganizationListResponse {
|
|
170
|
+
data: AuthonOrganization[];
|
|
171
|
+
total: number;
|
|
172
|
+
page: number;
|
|
173
|
+
limit: number;
|
|
174
|
+
}
|
|
175
|
+
interface AuditLogEntry {
|
|
176
|
+
id: string;
|
|
177
|
+
projectId: string;
|
|
178
|
+
actorType: 'user' | 'admin' | 'system' | 'api_key';
|
|
179
|
+
actorId: string | null;
|
|
180
|
+
event: string;
|
|
181
|
+
targetType: string | null;
|
|
182
|
+
targetId: string | null;
|
|
183
|
+
metadata: Record<string, any> | null;
|
|
184
|
+
ipAddress: string | null;
|
|
185
|
+
userAgent: string | null;
|
|
186
|
+
createdAt: string;
|
|
187
|
+
}
|
|
188
|
+
interface AuditLogQueryParams {
|
|
189
|
+
event?: string;
|
|
190
|
+
actorId?: string;
|
|
191
|
+
targetId?: string;
|
|
192
|
+
dateFrom?: string;
|
|
193
|
+
dateTo?: string;
|
|
194
|
+
page?: number;
|
|
195
|
+
limit?: number;
|
|
196
|
+
}
|
|
197
|
+
interface AuditLogListResponse {
|
|
198
|
+
data: AuditLogEntry[];
|
|
199
|
+
total: number;
|
|
200
|
+
page: number;
|
|
201
|
+
limit: number;
|
|
202
|
+
}
|
|
203
|
+
interface AuditLogStats {
|
|
204
|
+
[eventType: string]: number;
|
|
205
|
+
}
|
|
206
|
+
interface JwtClaimMapping {
|
|
207
|
+
key: string;
|
|
208
|
+
source?: string;
|
|
209
|
+
value?: string;
|
|
210
|
+
}
|
|
211
|
+
interface JwtTemplate {
|
|
212
|
+
id: string;
|
|
213
|
+
projectId: string;
|
|
214
|
+
name: string;
|
|
215
|
+
isDefault: boolean;
|
|
216
|
+
claims: JwtClaimMapping[];
|
|
217
|
+
allowedLifetime: number | null;
|
|
218
|
+
createdAt: string;
|
|
219
|
+
updatedAt: string;
|
|
220
|
+
}
|
|
221
|
+
interface CreateJwtTemplateParams {
|
|
222
|
+
name: string;
|
|
223
|
+
claims: JwtClaimMapping[];
|
|
224
|
+
allowedLifetime?: number;
|
|
225
|
+
}
|
|
226
|
+
interface UpdateJwtTemplateParams {
|
|
227
|
+
name?: string;
|
|
228
|
+
claims?: JwtClaimMapping[];
|
|
229
|
+
allowedLifetime?: number | null;
|
|
230
|
+
}
|
|
231
|
+
interface JwtPreviewResponse {
|
|
232
|
+
token: string;
|
|
233
|
+
decoded: Record<string, any>;
|
|
234
|
+
}
|
|
72
235
|
declare const OAUTH_PROVIDERS: readonly ["google", "apple", "kakao", "naver", "facebook", "github", "discord", "x", "line", "microsoft"];
|
|
73
236
|
type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];
|
|
74
237
|
declare const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string>;
|
|
@@ -86,5 +249,26 @@ declare const API_KEY_PREFIXES: {
|
|
|
86
249
|
};
|
|
87
250
|
declare const DEFAULT_BRANDING: BrandingConfig;
|
|
88
251
|
declare const DEFAULT_SESSION_CONFIG: SessionConfig;
|
|
252
|
+
declare const AUDIT_EVENTS: {
|
|
253
|
+
readonly AUTH_SIGNUP: "auth.signup";
|
|
254
|
+
readonly AUTH_SIGNIN: "auth.signin";
|
|
255
|
+
readonly AUTH_SIGNIN_FAILED: "auth.signin.failed";
|
|
256
|
+
readonly AUTH_SIGNOUT: "auth.signout";
|
|
257
|
+
readonly AUTH_TOKEN_REFRESH: "auth.token.refresh";
|
|
258
|
+
readonly AUTH_MFA_SETUP: "auth.mfa.setup";
|
|
259
|
+
readonly AUTH_MFA_VERIFY: "auth.mfa.verify";
|
|
260
|
+
readonly AUTH_PASSKEY_REGISTER: "auth.passkey.register";
|
|
261
|
+
readonly AUTH_WEB3_VERIFY: "auth.web3.verify";
|
|
262
|
+
readonly ADMIN_USER_BANNED: "admin.user.banned";
|
|
263
|
+
readonly ADMIN_USER_UNBANNED: "admin.user.unbanned";
|
|
264
|
+
readonly ADMIN_USER_DELETED: "admin.user.deleted";
|
|
265
|
+
readonly ORG_CREATED: "org.created";
|
|
266
|
+
readonly ORG_DELETED: "org.deleted";
|
|
267
|
+
readonly ORG_MEMBER_ADDED: "org.member.added";
|
|
268
|
+
readonly ORG_MEMBER_REMOVED: "org.member.removed";
|
|
269
|
+
readonly ORG_MEMBER_ROLE_CHANGED: "org.member.role_changed";
|
|
270
|
+
readonly ORG_INVITATION_SENT: "org.invitation.sent";
|
|
271
|
+
readonly ORG_INVITATION_ACCEPTED: "org.invitation.accepted";
|
|
272
|
+
};
|
|
89
273
|
|
|
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 };
|
|
274
|
+
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 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,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.
|
|
3
|
+
"version": "0.7.15",
|
|
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
|
+
}
|