@authon/shared 0.1.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.md ADDED
@@ -0,0 +1,68 @@
1
+ # @authon/shared
2
+
3
+ Shared types and constants for [Authon](https://authon.dev) SDKs.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @authon/shared
9
+ # or
10
+ pnpm add @authon/shared
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import type {
17
+ AuthonUser,
18
+ AuthonSession,
19
+ AuthTokens,
20
+ BrandingConfig,
21
+ WebhookEvent,
22
+ } from '@authon/shared';
23
+
24
+ import {
25
+ OAUTH_PROVIDERS,
26
+ PROVIDER_DISPLAY_NAMES,
27
+ PROVIDER_COLORS,
28
+ WEBHOOK_EVENTS,
29
+ API_KEY_PREFIXES,
30
+ DEFAULT_BRANDING,
31
+ DEFAULT_SESSION_CONFIG,
32
+ } from '@authon/shared';
33
+ ```
34
+
35
+ ## API Reference
36
+
37
+ ### Types
38
+
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 |
49
+
50
+ ### Constants
51
+
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) |
61
+
62
+ ## Documentation
63
+
64
+ [authon.dev/docs](https://authon.dev/docs)
65
+
66
+ ## License
67
+
68
+ [MIT](../../LICENSE)
package/dist/index.cjs ADDED
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ API_KEY_PREFIXES: () => API_KEY_PREFIXES,
24
+ DEFAULT_BRANDING: () => DEFAULT_BRANDING,
25
+ DEFAULT_SESSION_CONFIG: () => DEFAULT_SESSION_CONFIG,
26
+ OAUTH_PROVIDERS: () => OAUTH_PROVIDERS,
27
+ PROVIDER_COLORS: () => PROVIDER_COLORS,
28
+ PROVIDER_DISPLAY_NAMES: () => PROVIDER_DISPLAY_NAMES,
29
+ WEBHOOK_EVENTS: () => WEBHOOK_EVENTS
30
+ });
31
+ module.exports = __toCommonJS(index_exports);
32
+ var OAUTH_PROVIDERS = [
33
+ "google",
34
+ "apple",
35
+ "kakao",
36
+ "naver",
37
+ "facebook",
38
+ "github",
39
+ "discord",
40
+ "x",
41
+ "line",
42
+ "microsoft"
43
+ ];
44
+ var PROVIDER_DISPLAY_NAMES = {
45
+ google: "Google",
46
+ apple: "Apple",
47
+ kakao: "Kakao",
48
+ naver: "Naver",
49
+ facebook: "Facebook",
50
+ github: "GitHub",
51
+ discord: "Discord",
52
+ x: "X",
53
+ line: "LINE",
54
+ microsoft: "Microsoft"
55
+ };
56
+ var PROVIDER_COLORS = {
57
+ google: { bg: "#ffffff", text: "#1f1f1f" },
58
+ apple: { bg: "#000000", text: "#ffffff" },
59
+ kakao: { bg: "#FEE500", text: "#191919" },
60
+ naver: { bg: "#03C75A", text: "#ffffff" },
61
+ facebook: { bg: "#1877F2", text: "#ffffff" },
62
+ github: { bg: "#24292e", text: "#ffffff" },
63
+ discord: { bg: "#5865F2", text: "#ffffff" },
64
+ x: { bg: "#000000", text: "#ffffff" },
65
+ line: { bg: "#06C755", text: "#ffffff" },
66
+ microsoft: { bg: "#ffffff", text: "#1f1f1f" }
67
+ };
68
+ var WEBHOOK_EVENTS = [
69
+ "user.created",
70
+ "user.updated",
71
+ "user.deleted",
72
+ "user.banned",
73
+ "user.unbanned",
74
+ "session.created",
75
+ "session.ended",
76
+ "session.revoked",
77
+ "provider.linked",
78
+ "provider.unlinked"
79
+ ];
80
+ var API_KEY_PREFIXES = {
81
+ PUBLISHABLE_LIVE: "pk_live_",
82
+ PUBLISHABLE_TEST: "pk_test_",
83
+ SECRET_LIVE: "sk_live_",
84
+ SECRET_TEST: "sk_test_"
85
+ };
86
+ var DEFAULT_BRANDING = {
87
+ primaryColorStart: "#7c3aed",
88
+ primaryColorEnd: "#4f46e5",
89
+ lightBg: "#ffffff",
90
+ lightText: "#111827",
91
+ darkBg: "#0f172a",
92
+ darkText: "#f1f5f9",
93
+ borderRadius: 12,
94
+ showEmailPassword: true,
95
+ showDivider: true,
96
+ locale: "en"
97
+ };
98
+ var DEFAULT_SESSION_CONFIG = {
99
+ accessTokenTtl: 900,
100
+ refreshTokenTtl: 604800,
101
+ maxSessions: 5,
102
+ singleSession: false
103
+ };
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ API_KEY_PREFIXES,
107
+ DEFAULT_BRANDING,
108
+ DEFAULT_SESSION_CONFIG,
109
+ OAUTH_PROVIDERS,
110
+ PROVIDER_COLORS,
111
+ PROVIDER_DISPLAY_NAMES,
112
+ WEBHOOK_EVENTS
113
+ });
114
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +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}\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: WebhookEventType;\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 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;AAiFO,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,QAAQ;AACV;AAEO,IAAM,yBAAwC;AAAA,EACnD,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,eAAe;AACjB;","names":[]}
@@ -0,0 +1,89 @@
1
+ interface AuthonUser {
2
+ id: string;
3
+ projectId: string;
4
+ email: string | null;
5
+ displayName: string | null;
6
+ avatarUrl: string | null;
7
+ phone: string | null;
8
+ emailVerified: boolean;
9
+ phoneVerified: boolean;
10
+ isBanned: boolean;
11
+ publicMetadata: Record<string, unknown> | null;
12
+ lastSignInAt: string | null;
13
+ signInCount: number;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ }
17
+ interface AuthonSession {
18
+ id: string;
19
+ userId: string;
20
+ ipAddress: string | null;
21
+ userAgent: string | null;
22
+ deviceName: string | null;
23
+ lastActiveAt: string | null;
24
+ createdAt: string;
25
+ expiresAt: string;
26
+ }
27
+ interface AuthonProvider {
28
+ provider: string;
29
+ enabled: boolean;
30
+ sortOrder: number;
31
+ configured: boolean;
32
+ }
33
+ interface BrandingConfig {
34
+ logoDataUrl?: string;
35
+ brandName?: string;
36
+ primaryColorStart?: string;
37
+ primaryColorEnd?: string;
38
+ lightBg?: string;
39
+ lightText?: string;
40
+ darkBg?: string;
41
+ darkText?: string;
42
+ borderRadius?: number;
43
+ providerOrder?: string[];
44
+ hiddenProviders?: string[];
45
+ showEmailPassword?: boolean;
46
+ showDivider?: boolean;
47
+ termsUrl?: string;
48
+ privacyUrl?: string;
49
+ customCss?: string;
50
+ locale?: string;
51
+ }
52
+ interface SessionConfig {
53
+ accessTokenTtl?: number;
54
+ refreshTokenTtl?: number;
55
+ maxSessions?: number;
56
+ singleSession?: boolean;
57
+ }
58
+ interface AuthTokens {
59
+ accessToken: string;
60
+ refreshToken: string;
61
+ expiresIn: number;
62
+ user: AuthonUser;
63
+ }
64
+ interface WebhookEvent {
65
+ id: string;
66
+ type: WebhookEventType;
67
+ projectId: string;
68
+ timestamp: string;
69
+ data: Record<string, unknown>;
70
+ }
71
+ declare const OAUTH_PROVIDERS: readonly ["google", "apple", "kakao", "naver", "facebook", "github", "discord", "x", "line", "microsoft"];
72
+ type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];
73
+ declare const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string>;
74
+ declare const PROVIDER_COLORS: Record<OAuthProviderType, {
75
+ bg: string;
76
+ text: string;
77
+ }>;
78
+ declare const WEBHOOK_EVENTS: readonly ["user.created", "user.updated", "user.deleted", "user.banned", "user.unbanned", "session.created", "session.ended", "session.revoked", "provider.linked", "provider.unlinked"];
79
+ type WebhookEventType = (typeof WEBHOOK_EVENTS)[number];
80
+ declare const API_KEY_PREFIXES: {
81
+ readonly PUBLISHABLE_LIVE: "pk_live_";
82
+ readonly PUBLISHABLE_TEST: "pk_test_";
83
+ readonly SECRET_LIVE: "sk_live_";
84
+ readonly SECRET_TEST: "sk_test_";
85
+ };
86
+ declare const DEFAULT_BRANDING: BrandingConfig;
87
+ declare const DEFAULT_SESSION_CONFIG: SessionConfig;
88
+
89
+ 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 };
@@ -0,0 +1,89 @@
1
+ interface AuthonUser {
2
+ id: string;
3
+ projectId: string;
4
+ email: string | null;
5
+ displayName: string | null;
6
+ avatarUrl: string | null;
7
+ phone: string | null;
8
+ emailVerified: boolean;
9
+ phoneVerified: boolean;
10
+ isBanned: boolean;
11
+ publicMetadata: Record<string, unknown> | null;
12
+ lastSignInAt: string | null;
13
+ signInCount: number;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ }
17
+ interface AuthonSession {
18
+ id: string;
19
+ userId: string;
20
+ ipAddress: string | null;
21
+ userAgent: string | null;
22
+ deviceName: string | null;
23
+ lastActiveAt: string | null;
24
+ createdAt: string;
25
+ expiresAt: string;
26
+ }
27
+ interface AuthonProvider {
28
+ provider: string;
29
+ enabled: boolean;
30
+ sortOrder: number;
31
+ configured: boolean;
32
+ }
33
+ interface BrandingConfig {
34
+ logoDataUrl?: string;
35
+ brandName?: string;
36
+ primaryColorStart?: string;
37
+ primaryColorEnd?: string;
38
+ lightBg?: string;
39
+ lightText?: string;
40
+ darkBg?: string;
41
+ darkText?: string;
42
+ borderRadius?: number;
43
+ providerOrder?: string[];
44
+ hiddenProviders?: string[];
45
+ showEmailPassword?: boolean;
46
+ showDivider?: boolean;
47
+ termsUrl?: string;
48
+ privacyUrl?: string;
49
+ customCss?: string;
50
+ locale?: string;
51
+ }
52
+ interface SessionConfig {
53
+ accessTokenTtl?: number;
54
+ refreshTokenTtl?: number;
55
+ maxSessions?: number;
56
+ singleSession?: boolean;
57
+ }
58
+ interface AuthTokens {
59
+ accessToken: string;
60
+ refreshToken: string;
61
+ expiresIn: number;
62
+ user: AuthonUser;
63
+ }
64
+ interface WebhookEvent {
65
+ id: string;
66
+ type: WebhookEventType;
67
+ projectId: string;
68
+ timestamp: string;
69
+ data: Record<string, unknown>;
70
+ }
71
+ declare const OAUTH_PROVIDERS: readonly ["google", "apple", "kakao", "naver", "facebook", "github", "discord", "x", "line", "microsoft"];
72
+ type OAuthProviderType = (typeof OAUTH_PROVIDERS)[number];
73
+ declare const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string>;
74
+ declare const PROVIDER_COLORS: Record<OAuthProviderType, {
75
+ bg: string;
76
+ text: string;
77
+ }>;
78
+ declare const WEBHOOK_EVENTS: readonly ["user.created", "user.updated", "user.deleted", "user.banned", "user.unbanned", "session.created", "session.ended", "session.revoked", "provider.linked", "provider.unlinked"];
79
+ type WebhookEventType = (typeof WEBHOOK_EVENTS)[number];
80
+ declare const API_KEY_PREFIXES: {
81
+ readonly PUBLISHABLE_LIVE: "pk_live_";
82
+ readonly PUBLISHABLE_TEST: "pk_test_";
83
+ readonly SECRET_LIVE: "sk_live_";
84
+ readonly SECRET_TEST: "sk_test_";
85
+ };
86
+ declare const DEFAULT_BRANDING: BrandingConfig;
87
+ declare const DEFAULT_SESSION_CONFIG: SessionConfig;
88
+
89
+ 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 };
package/dist/index.js ADDED
@@ -0,0 +1,83 @@
1
+ // src/index.ts
2
+ var OAUTH_PROVIDERS = [
3
+ "google",
4
+ "apple",
5
+ "kakao",
6
+ "naver",
7
+ "facebook",
8
+ "github",
9
+ "discord",
10
+ "x",
11
+ "line",
12
+ "microsoft"
13
+ ];
14
+ var PROVIDER_DISPLAY_NAMES = {
15
+ google: "Google",
16
+ apple: "Apple",
17
+ kakao: "Kakao",
18
+ naver: "Naver",
19
+ facebook: "Facebook",
20
+ github: "GitHub",
21
+ discord: "Discord",
22
+ x: "X",
23
+ line: "LINE",
24
+ microsoft: "Microsoft"
25
+ };
26
+ var PROVIDER_COLORS = {
27
+ google: { bg: "#ffffff", text: "#1f1f1f" },
28
+ apple: { bg: "#000000", text: "#ffffff" },
29
+ kakao: { bg: "#FEE500", text: "#191919" },
30
+ naver: { bg: "#03C75A", text: "#ffffff" },
31
+ facebook: { bg: "#1877F2", text: "#ffffff" },
32
+ github: { bg: "#24292e", text: "#ffffff" },
33
+ discord: { bg: "#5865F2", text: "#ffffff" },
34
+ x: { bg: "#000000", text: "#ffffff" },
35
+ line: { bg: "#06C755", text: "#ffffff" },
36
+ microsoft: { bg: "#ffffff", text: "#1f1f1f" }
37
+ };
38
+ var WEBHOOK_EVENTS = [
39
+ "user.created",
40
+ "user.updated",
41
+ "user.deleted",
42
+ "user.banned",
43
+ "user.unbanned",
44
+ "session.created",
45
+ "session.ended",
46
+ "session.revoked",
47
+ "provider.linked",
48
+ "provider.unlinked"
49
+ ];
50
+ var API_KEY_PREFIXES = {
51
+ PUBLISHABLE_LIVE: "pk_live_",
52
+ PUBLISHABLE_TEST: "pk_test_",
53
+ SECRET_LIVE: "sk_live_",
54
+ SECRET_TEST: "sk_test_"
55
+ };
56
+ var DEFAULT_BRANDING = {
57
+ primaryColorStart: "#7c3aed",
58
+ primaryColorEnd: "#4f46e5",
59
+ lightBg: "#ffffff",
60
+ lightText: "#111827",
61
+ darkBg: "#0f172a",
62
+ darkText: "#f1f5f9",
63
+ borderRadius: 12,
64
+ showEmailPassword: true,
65
+ showDivider: true,
66
+ locale: "en"
67
+ };
68
+ var DEFAULT_SESSION_CONFIG = {
69
+ accessTokenTtl: 900,
70
+ refreshTokenTtl: 604800,
71
+ maxSessions: 5,
72
+ singleSession: false
73
+ };
74
+ export {
75
+ API_KEY_PREFIXES,
76
+ DEFAULT_BRANDING,
77
+ DEFAULT_SESSION_CONFIG,
78
+ OAUTH_PROVIDERS,
79
+ PROVIDER_COLORS,
80
+ PROVIDER_DISPLAY_NAMES,
81
+ WEBHOOK_EVENTS
82
+ };
83
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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}\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: WebhookEventType;\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 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":";AAiFO,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,QAAQ;AACV;AAEO,IAAM,yBAAwC;AAAA,EACnD,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,eAAe;AACjB;","names":[]}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@authon/shared",
3
+ "version": "0.1.0",
4
+ "description": "Shared types and constants for Authon SDKs",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": ["dist"],
17
+ "scripts": {
18
+ "build": "tsup",
19
+ "dev": "tsup --watch"
20
+ },
21
+ "license": "MIT",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/mikusnuz/authon-sdk.git",
25
+ "directory": "packages/shared"
26
+ },
27
+ "homepage": "https://github.com/mikusnuz/authon-sdk/tree/main/packages/shared",
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "keywords": ["authon", "auth", "authentication", "types", "sdk"],
32
+ "devDependencies": {
33
+ "tsup": "^8.0.0",
34
+ "typescript": "^5.9.3"
35
+ }
36
+ }