(feat): add tauth
(fix): formatted
This commit is contained in:
parent
d02bc29be0
commit
fb742bd068
15 changed files with 141 additions and 74 deletions
|
|
@ -1,7 +1,10 @@
|
|||
import { z } from "zod";
|
||||
|
||||
import { legalDocsSchema } from "./features/legal/schema";
|
||||
import { settingsStorageDefaults, type SettingsStorageDefaults } from "./settings";
|
||||
import {
|
||||
settingsStorageDefaults,
|
||||
type SettingsStorageDefaults,
|
||||
} from "./settings";
|
||||
|
||||
const fileFromMessage = z.object({
|
||||
name: z.string(),
|
||||
|
|
@ -155,6 +158,14 @@ export const ttp = {
|
|||
}),
|
||||
},
|
||||
|
||||
load_txt_record: {
|
||||
request: z.object({
|
||||
path: z.string(),
|
||||
}),
|
||||
response: z.object({
|
||||
content: z.string(),
|
||||
}),
|
||||
},
|
||||
authenticate_app: {
|
||||
request: z.object({
|
||||
app_identifier: z.string(),
|
||||
|
|
@ -163,13 +174,12 @@ export const ttp = {
|
|||
challenge: z.base64(),
|
||||
}),
|
||||
},
|
||||
get_app: {
|
||||
create_app: {
|
||||
request: z.object({
|
||||
app_public_key: z.base64(),
|
||||
app_identifier: z.string(),
|
||||
}),
|
||||
response: z.object({
|
||||
app_public_key: z.base64(),
|
||||
}),
|
||||
response: z.object({}),
|
||||
},
|
||||
|
||||
// Calls
|
||||
|
|
|
|||
|
|
@ -49,10 +49,11 @@ type BooleanSettingNames<T extends SettingsSchema> = {
|
|||
export type SettingsStorageKey<T extends SettingsSchema = typeof settings> =
|
||||
`settings.${BooleanSettingNames<T>}`;
|
||||
|
||||
export type SettingsStorageDefaults<T extends SettingsSchema = typeof settings> =
|
||||
{
|
||||
[K in SettingsStorageKey<T>]: boolean;
|
||||
};
|
||||
export type SettingsStorageDefaults<
|
||||
T extends SettingsSchema = typeof settings,
|
||||
> = {
|
||||
[K in SettingsStorageKey<T>]: boolean;
|
||||
};
|
||||
|
||||
function buildSettingsStorageDefaults<T extends SettingsSchema>(
|
||||
schema: T,
|
||||
|
|
@ -62,7 +63,10 @@ function buildSettingsStorageDefaults<T extends SettingsSchema>(
|
|||
for (const category of Object.values(schema)) {
|
||||
for (const page of Object.values(category)) {
|
||||
for (const [settingName, setting] of Object.entries(page)) {
|
||||
if (setting.type === "boolean" && typeof setting.default === "boolean") {
|
||||
if (
|
||||
setting.type === "boolean" &&
|
||||
typeof setting.default === "boolean"
|
||||
) {
|
||||
const key = `settings.${settingName}` as SettingsStorageKey<T>;
|
||||
defaults[key] = setting.default;
|
||||
}
|
||||
|
|
@ -73,4 +77,4 @@ function buildSettingsStorageDefaults<T extends SettingsSchema>(
|
|||
return defaults as SettingsStorageDefaults<T>;
|
||||
}
|
||||
|
||||
export const settingsStorageDefaults = buildSettingsStorageDefaults(settings);
|
||||
export const settingsStorageDefaults = buildSettingsStorageDefaults(settings);
|
||||
|
|
|
|||
Loading…
Reference in a new issue