refactor(api): ♻️ Rewrite full authentication code to go OpenID-only

This commit is contained in:
Jesse Wierzbinski 2025-08-21 00:45:58 +02:00
parent 4eae4cd062
commit 1bfc5fb013
No known key found for this signature in database
39 changed files with 3076 additions and 2009 deletions

View file

@ -15,7 +15,7 @@ import { BaseInterface } from "./base.ts";
import { User } from "./user.ts";
type TokenType = InferSelectModel<typeof Tokens> & {
application: typeof Application.$type | null;
client: typeof Application.$type;
};
export class Token extends BaseInterface<typeof Tokens, TokenType> {
@ -51,7 +51,7 @@ export class Token extends BaseInterface<typeof Tokens, TokenType> {
where: sql,
orderBy,
with: {
application: true,
client: true,
},
});
@ -74,7 +74,7 @@ export class Token extends BaseInterface<typeof Tokens, TokenType> {
limit,
offset,
with: {
application: true,
client: true,
...extra?.with,
},
});
@ -159,7 +159,7 @@ export class Token extends BaseInterface<typeof Tokens, TokenType> {
return {
access_token: this.data.accessToken,
token_type: "Bearer",
scope: this.data.scope,
scope: this.data.scopes.join(" "),
created_at: Math.floor(
new Date(this.data.createdAt).getTime() / 1000,
),