Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Jan 6, 2025
1 parent 6b6a988 commit ebf5bfb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/openauth/src/provider/arctic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export function ArcticProvider(
refreshAccessToken(refreshToken: string): Promise<OAuth2Tokens>
},
config: ArcticProviderOptions,
) {
): Provider<{
tokenset: OAuth2Tokens
}> {
function getClient(c: Context) {
const callback = new URL(c.req.url)
callback.pathname = callback.pathname.replace(/authorize.*$/, "callback")
Expand Down Expand Up @@ -64,7 +66,5 @@ export function ArcticProvider(
})
})
},
} satisfies Provider<{
tokenset: OAuth2Tokens
}>
}
}
4 changes: 2 additions & 2 deletions packages/openauth/src/provider/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export type CodeProviderError =

export function CodeProvider<
Claims extends Record<string, string> = Record<string, string>,
>(config: CodeProviderConfig<Claims>) {
>(config: CodeProviderConfig<Claims>): Provider<{ claims: Claims }> {
const length = config.length || 6
function generate() {
return generateUnbiasedDigits(length)
Expand Down Expand Up @@ -184,7 +184,7 @@ export function CodeProvider<
}
})
},
} satisfies Provider<{ claims: Claims }>
}
}

export type CodeProviderOptions = Parameters<typeof CodeProvider>[0]
4 changes: 2 additions & 2 deletions packages/openauth/src/ui/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export interface CodeUIOptions {
* Creates a UI for the Code provider flow.
* @param props - Configure the UI.
*/
export function CodeUI(props: CodeUIOptions) {
export function CodeUI(props: CodeUIOptions): CodeProviderOptions {
const copy = {
...DEFAULT_COPY,
...props.copy,
Expand Down Expand Up @@ -205,5 +205,5 @@ export function CodeUI(props: CodeUIOptions) {

throw new UnknownStateError()
},
} satisfies CodeProviderOptions
}
}

0 comments on commit ebf5bfb

Please sign in to comment.