Skip to content

Commit ad7a87b

Browse files
Copilothotlong
andcommitted
Refactor: Rename to auth.zod.ts with shorter AuthConfig names and add driver field
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent b3a909e commit ad7a87b

File tree

10 files changed

+1375
-43
lines changed

10 files changed

+1375
-43
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: AuthenticationConfig
3+
description: AuthenticationConfig Schema Reference
4+
---
5+
6+
## Properties
7+
8+
| Property | Type | Required | Description |
9+
| :--- | :--- | :--- | :--- |
10+
| **name** | `string` || Configuration name (snake_case) |
11+
| **label** | `string` || Display label |
12+
| **strategies** | `Enum<'email_password' \| 'magic_link' \| 'oauth' \| 'passkey' \| 'otp' \| 'anonymous'>[]` || Enabled authentication strategies |
13+
| **baseUrl** | `string` || Application base URL |
14+
| **secret** | `string` || Secret key for signing (min 32 chars) |
15+
| **emailPassword** | `object` | optional | |
16+
| **magicLink** | `object` | optional | |
17+
| **passkey** | `object` | optional | |
18+
| **oauth** | `object` | optional | |
19+
| **session** | `object` | optional | |
20+
| **rateLimit** | `object` | optional | |
21+
| **csrf** | `object` | optional | |
22+
| **accountLinking** | `object` | optional | |
23+
| **twoFactor** | `object` | optional | |
24+
| **userFieldMapping** | `object` | optional | |
25+
| **database** | `object` | optional | |
26+
| **plugins** | `object[]` | optional | |
27+
| **hooks** | `object` | optional | Authentication lifecycle hooks |
28+
| **security** | `object` | optional | Advanced security settings |
29+
| **email** | `object` | optional | Email configuration |
30+
| **ui** | `object` | optional | UI customization |
31+
| **active** | `boolean` | optional | Whether this provider is active |
32+
| **allowRegistration** | `boolean` | optional | Allow new user registration |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: AuthenticationProvider
3+
description: AuthenticationProvider Schema Reference
4+
---
5+
6+
## Properties
7+
8+
| Property | Type | Required | Description |
9+
| :--- | :--- | :--- | :--- |
10+
| **type** | `string` || Provider type identifier |
11+
| **config** | `object` || Authentication configuration |
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: AuthConfig
3+
description: AuthConfig Schema Reference
4+
---
5+
6+
## Properties
7+
8+
| Property | Type | Required | Description |
9+
| :--- | :--- | :--- | :--- |
10+
| **name** | `string` || Configuration name (snake_case) |
11+
| **label** | `string` || Display label |
12+
| **driver** | `string` | optional | The underlying authentication implementation driver |
13+
| **strategies** | `Enum<'email_password' \| 'magic_link' \| 'oauth' \| 'passkey' \| 'otp' \| 'anonymous'>[]` || Enabled authentication strategies |
14+
| **baseUrl** | `string` || Application base URL |
15+
| **secret** | `string` || Secret key for signing (min 32 chars) |
16+
| **emailPassword** | `object` | optional | |
17+
| **magicLink** | `object` | optional | |
18+
| **passkey** | `object` | optional | |
19+
| **oauth** | `object` | optional | |
20+
| **session** | `object` | optional | |
21+
| **rateLimit** | `object` | optional | |
22+
| **csrf** | `object` | optional | |
23+
| **accountLinking** | `object` | optional | |
24+
| **twoFactor** | `object` | optional | |
25+
| **userFieldMapping** | `object` | optional | |
26+
| **database** | `object` | optional | |
27+
| **plugins** | `object[]` | optional | |
28+
| **hooks** | `object` | optional | Authentication lifecycle hooks |
29+
| **security** | `object` | optional | Advanced security settings |
30+
| **email** | `object` | optional | Email configuration |
31+
| **ui** | `object` | optional | UI customization |
32+
| **active** | `boolean` | optional | Whether this provider is active |
33+
| **allowRegistration** | `boolean` | optional | Allow new user registration |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: StandardAuthProvider
3+
description: StandardAuthProvider Schema Reference
4+
---
5+
6+
## Properties
7+
8+
| Property | Type | Required | Description |
9+
| :--- | :--- | :--- | :--- |
10+
| **type** | `string` || Provider type identifier |
11+
| **config** | `object` || Standard authentication configuration |
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
# Authentication Protocol
1+
# ObjectStack Authentication Standard
22

3-
A comprehensive authentication specification for the ObjectStack ecosystem.
3+
The standard authentication protocol specification for the ObjectStack ecosystem.
44

55
## Overview
66

7-
This specification defines the standard authentication protocol for ObjectStack applications. It supports multiple authentication strategies, session management, and comprehensive security features.
7+
This document defines the **ObjectStack Authentication Standard**, a comprehensive, framework-agnostic authentication protocol for ObjectStack applications. This standard supports multiple authentication strategies, session management, and comprehensive security features.
88

9-
The specification is framework-agnostic and can be implemented with any authentication library (better-auth, Auth.js, Passport, etc.)
9+
The specification is designed as an **interface** that can be implemented by any authentication library. **better-auth** serves as the **Reference Implementation** (default driver) for this standard.
10+
11+
### Implementation Drivers
12+
13+
The authentication standard can be implemented using various drivers:
14+
- **better-auth** (default/reference implementation)
15+
- Auth.js
16+
- Passport
17+
- Custom implementations
1018

1119
## Features
1220

@@ -54,11 +62,12 @@ pnpm add @objectstack/plugin-better-auth
5462
### Basic Example
5563

5664
```typescript
57-
import type { AuthenticationConfig } from '@objectstack/spec';
65+
import type { AuthConfig } from '@objectstack/spec';
5866

59-
const authConfig: AuthenticationConfig = {
67+
const authConfig: AuthConfig = {
6068
name: 'main_auth',
6169
label: 'Main Authentication',
70+
driver: 'better-auth', // Optional, defaults to 'better-auth'
6271
strategies: ['email_password'],
6372
baseUrl: 'https://app.example.com',
6473
secret: process.env.AUTH_SECRET!,

0 commit comments

Comments
 (0)