mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-26 00:46:23 +02:00
add connected accounts (oauth) feature
This commit is contained in:
parent
47ab50bfe7
commit
dfe940d0ba
17 changed files with 1084 additions and 24 deletions
15
apps/x/packages/shared/src/auth.ts
Normal file
15
apps/x/packages/shared/src/auth.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* OAuth 2.0 tokens structure
|
||||
*/
|
||||
export const OAuthTokens = z.object({
|
||||
access_token: z.string(),
|
||||
refresh_token: z.string().nullable(),
|
||||
expires_at: z.number(), // Unix timestamp
|
||||
token_type: z.literal('Bearer').optional(),
|
||||
scopes: z.array(z.string()).optional(), // Granted scopes from OAuth response
|
||||
});
|
||||
|
||||
export type OAuthTokens = z.infer<typeof OAuthTokens>;
|
||||
|
||||
|
|
@ -3,4 +3,5 @@ import { PrefixLogger } from './prefix-logger.js';
|
|||
export * as ipc from './ipc.js';
|
||||
export * as workspace from './workspace.js';
|
||||
export * as mcp from './mcp.js';
|
||||
export * as auth from './auth.js';
|
||||
export { PrefixLogger };
|
||||
|
|
@ -159,7 +159,44 @@ const ipcSchemas = {
|
|||
'runs:events': {
|
||||
req: z.null(),
|
||||
res: z.null(),
|
||||
}
|
||||
},
|
||||
'oauth:connect': {
|
||||
req: z.object({
|
||||
provider: z.string(),
|
||||
}),
|
||||
res: z.object({
|
||||
success: z.boolean(),
|
||||
error: z.string().optional(),
|
||||
}),
|
||||
},
|
||||
'oauth:disconnect': {
|
||||
req: z.object({
|
||||
provider: z.string(),
|
||||
}),
|
||||
res: z.object({
|
||||
success: z.boolean(),
|
||||
}),
|
||||
},
|
||||
'oauth:is-connected': {
|
||||
req: z.object({
|
||||
provider: z.string(),
|
||||
}),
|
||||
res: z.object({
|
||||
isConnected: z.boolean(),
|
||||
}),
|
||||
},
|
||||
'oauth:list-providers': {
|
||||
req: z.null(),
|
||||
res: z.object({
|
||||
providers: z.array(z.string()),
|
||||
}),
|
||||
},
|
||||
'oauth:get-connected-providers': {
|
||||
req: z.null(),
|
||||
res: z.object({
|
||||
providers: z.array(z.string()),
|
||||
}),
|
||||
},
|
||||
} as const;
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue