@checkstack/auth-github-backend 0.0.2
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/CHANGELOG.md +86 -0
- package/package.json +22 -0
- package/src/index.ts +70 -0
- package/src/plugin-metadata.ts +9 -0
- package/tsconfig.json +3 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# @checkstack/auth-github-backend
|
|
2
|
+
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d20d274: Initial release of all @checkstack packages. Rebranded from Checkmate to Checkstack with new npm organization @checkstack and domain checkstack.dev.
|
|
8
|
+
- Updated dependencies [d20d274]
|
|
9
|
+
- @checkstack/auth-backend@0.0.2
|
|
10
|
+
- @checkstack/backend-api@0.0.2
|
|
11
|
+
- @checkstack/common@0.0.2
|
|
12
|
+
|
|
13
|
+
## 0.0.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- a65e002: Add compile-time type safety for Lucide icon names
|
|
18
|
+
|
|
19
|
+
- Add `LucideIconName` type and `lucideIconSchema` Zod schema to `@checkstack/common`
|
|
20
|
+
- Update backend interfaces (`AuthStrategy`, `NotificationStrategy`, `IntegrationProvider`, `CommandDefinition`) to use `LucideIconName`
|
|
21
|
+
- Update RPC contracts to use `lucideIconSchema` for proper type inference across RPC boundaries
|
|
22
|
+
- Simplify `SocialProviderButton` to use `DynamicIcon` directly (removes 30+ lines of pascalCase conversion)
|
|
23
|
+
- Replace static `iconMap` in `SearchDialog` with `DynamicIcon` for dynamic icon rendering
|
|
24
|
+
- Add fallback handling in `DynamicIcon` when icon name isn't found
|
|
25
|
+
- Fix legacy kebab-case icon names to PascalCase: `mail`→`Mail`, `send`→`Send`, `github`→`Github`, `key-round`→`KeyRound`, `network`→`Network`, `AlertCircle`→`CircleAlert`
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [b4eb432]
|
|
28
|
+
- Updated dependencies [a65e002]
|
|
29
|
+
- Updated dependencies [a65e002]
|
|
30
|
+
- @checkstack/backend-api@1.1.0
|
|
31
|
+
- @checkstack/common@0.2.0
|
|
32
|
+
- @checkstack/auth-backend@1.1.0
|
|
33
|
+
|
|
34
|
+
## 0.0.3
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- @checkstack/auth-backend@1.0.1
|
|
39
|
+
|
|
40
|
+
## 0.0.2
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- b354ab3: # Strategy Instructions Support & Telegram Notification Plugin
|
|
45
|
+
|
|
46
|
+
## Strategy Instructions Interface
|
|
47
|
+
|
|
48
|
+
Added `adminInstructions` and `userInstructions` optional fields to the `NotificationStrategy` interface. These allow strategies to export markdown-formatted setup guides that are displayed in the configuration UI:
|
|
49
|
+
|
|
50
|
+
- **`adminInstructions`**: Shown when admins configure platform-wide strategy settings (e.g., how to create API keys)
|
|
51
|
+
- **`userInstructions`**: Shown when users configure their personal settings (e.g., how to link their account)
|
|
52
|
+
|
|
53
|
+
### Updated Components
|
|
54
|
+
|
|
55
|
+
- `StrategyConfigCard` now accepts an `instructions` prop and renders it before config sections
|
|
56
|
+
- `StrategyCard` passes `adminInstructions` to `StrategyConfigCard`
|
|
57
|
+
- `UserChannelCard` renders `userInstructions` when users need to connect
|
|
58
|
+
|
|
59
|
+
## New Telegram Notification Plugin
|
|
60
|
+
|
|
61
|
+
Added `@checkstack/notification-telegram-backend` plugin for sending notifications via Telegram:
|
|
62
|
+
|
|
63
|
+
- Uses [grammY](https://grammy.dev/) framework for Telegram Bot API integration
|
|
64
|
+
- Sends messages with MarkdownV2 formatting and inline keyboard buttons for actions
|
|
65
|
+
- Includes comprehensive admin instructions for bot setup via @BotFather
|
|
66
|
+
- Includes user instructions for account linking
|
|
67
|
+
|
|
68
|
+
### Configuration
|
|
69
|
+
|
|
70
|
+
Admins need to configure a Telegram Bot Token obtained from @BotFather.
|
|
71
|
+
|
|
72
|
+
### User Linking
|
|
73
|
+
|
|
74
|
+
The strategy uses `contactResolution: { type: "custom" }` for Telegram Login Widget integration. Full frontend integration for the Login Widget is pending future work.
|
|
75
|
+
|
|
76
|
+
- Updated dependencies [ffc28f6]
|
|
77
|
+
- Updated dependencies [71275dd]
|
|
78
|
+
- Updated dependencies [ae19ff6]
|
|
79
|
+
- Updated dependencies [32f2535]
|
|
80
|
+
- Updated dependencies [b55fae6]
|
|
81
|
+
- Updated dependencies [b354ab3]
|
|
82
|
+
- Updated dependencies [8e889b4]
|
|
83
|
+
- Updated dependencies [81f3f85]
|
|
84
|
+
- @checkstack/common@0.1.0
|
|
85
|
+
- @checkstack/backend-api@1.0.0
|
|
86
|
+
- @checkstack/auth-backend@1.0.0
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@checkstack/auth-github-backend",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"typecheck": "tsc --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@checkstack/backend-api": "workspace:*",
|
|
14
|
+
"@checkstack/auth-backend": "workspace:*",
|
|
15
|
+
"@checkstack/common": "workspace:*",
|
|
16
|
+
"zod": "^4.2.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@checkstack/tsconfig": "workspace:*",
|
|
20
|
+
"typescript": "^5.9.3"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBackendPlugin,
|
|
3
|
+
type AuthStrategy,
|
|
4
|
+
configString,
|
|
5
|
+
} from "@checkstack/backend-api";
|
|
6
|
+
import { betterAuthExtensionPoint } from "@checkstack/auth-backend";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { pluginMetadata } from "./plugin-metadata";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* GitHub OAuth configuration schema.
|
|
12
|
+
* Follows better-auth GitHub provider requirements.
|
|
13
|
+
*/
|
|
14
|
+
const _githubConfigV1 = z.object({
|
|
15
|
+
enabled: z.boolean().default(false),
|
|
16
|
+
clientId: configString({ "x-secret": true })
|
|
17
|
+
.describe("GitHub OAuth App Client ID")
|
|
18
|
+
.optional(),
|
|
19
|
+
clientSecret: configString({ "x-secret": true })
|
|
20
|
+
.describe("GitHub OAuth App Client Secret")
|
|
21
|
+
.optional(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const githubConfigV2 = z.object({
|
|
25
|
+
clientId: configString({ "x-secret": true })
|
|
26
|
+
.describe("GitHub OAuth App Client ID")
|
|
27
|
+
.optional(),
|
|
28
|
+
clientSecret: configString({ "x-secret": true })
|
|
29
|
+
.describe("GitHub OAuth App Client Secret")
|
|
30
|
+
.optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const githubStrategy: AuthStrategy<z.infer<typeof githubConfigV2>> = {
|
|
34
|
+
id: "github",
|
|
35
|
+
displayName: "GitHub",
|
|
36
|
+
description: "Sign in with GitHub",
|
|
37
|
+
icon: "Github",
|
|
38
|
+
configVersion: 2,
|
|
39
|
+
configSchema: githubConfigV2,
|
|
40
|
+
requiresManualRegistration: false,
|
|
41
|
+
adminInstructions: `
|
|
42
|
+
## GitHub OAuth App Setup
|
|
43
|
+
|
|
44
|
+
1. Go to [GitHub Developer Settings](https://github.com/settings/developers)
|
|
45
|
+
2. Click **New OAuth App**
|
|
46
|
+
3. Set **Homepage URL** to your Checkstack instance URL
|
|
47
|
+
4. Set **Authorization callback URL** to \`https://yourdomain.com/api/auth/callback/github\`
|
|
48
|
+
5. Copy the **Client ID** and generate a **Client Secret**
|
|
49
|
+
`.trim(),
|
|
50
|
+
migrations: [
|
|
51
|
+
{
|
|
52
|
+
fromVersion: 1,
|
|
53
|
+
toVersion: 2,
|
|
54
|
+
description: "Remove 'enabled' field from config (moved to meta config)",
|
|
55
|
+
migrate: (oldConfig: z.infer<typeof _githubConfigV1>) => {
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
57
|
+
const { enabled, ...rest } = oldConfig;
|
|
58
|
+
return rest;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default createBackendPlugin({
|
|
65
|
+
metadata: pluginMetadata,
|
|
66
|
+
register(env) {
|
|
67
|
+
const extensionPoint = env.getExtensionPoint(betterAuthExtensionPoint);
|
|
68
|
+
extensionPoint.addStrategy(githubStrategy);
|
|
69
|
+
},
|
|
70
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { definePluginMetadata } from "@checkstack/common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin metadata for the Auth GitHub backend.
|
|
5
|
+
* This is the single source of truth for the plugin ID.
|
|
6
|
+
*/
|
|
7
|
+
export const pluginMetadata = definePluginMetadata({
|
|
8
|
+
pluginId: "auth-github",
|
|
9
|
+
});
|
package/tsconfig.json
ADDED