Updated icons, new identification

This commit is contained in:
Alois 2026-04-06 00:22:30 +02:00
commit 7adb2dee05
34 changed files with 331 additions and 402 deletions

View file

@ -1,7 +1,6 @@
import { z } from "zod";
import { legalDocsSchema } from "./features/legal/schema";
import { community, conversation } from "./features/conversation/schema";
const fileFromMessage = z.object({
name: z.string(),
@ -37,24 +36,38 @@ export const failedUser = {
// TTP
export const ttp = {
identification: {
request: z
.object({
user_id: z.number().optional(),
iota_id: z.number().optional(),
})
.refine(
(value) =>
(typeof value.user_id === "number") !==
(typeof value.iota_id === "number"),
{
message: "Either user_id or iota_id must be provided",
},
),
request: z.object({
version: z.string(),
session_id: z.number(),
user_id: z.number(),
}),
response: z.object({
challenge: z.string(),
public_key: z.base64(),
}),
},
challenge_response: {
request: z.object({
challenge: z.base64(),
}),
response: z.object({
communities: z.array(z.object({})).optional(),
contacts: z.array(
z.object({
calls: z.array(z.uuidv4()).optional(),
last_message_at: z.number(),
user_id: z.number(),
last_message: z
.object({
content: z.base64(),
sender_id: z.number(),
})
.optional(),
messages: z.array(message),
}),
),
}),
},
get_user_data: {
request: z.object({
user_id: z.number(),
@ -85,14 +98,6 @@ export const ttp = {
username: z.string().max(15),
}),
},
challenge_response: {
request: z.object({
challenge: z.base64(),
}),
response: z.object({
accepted: z.boolean(),
}),
},
ping: {
request: z.object({
last_ping: z.number(),
@ -101,18 +106,6 @@ export const ttp = {
ping_iota: z.number(),
}),
},
get_conversations: {
request: z.object({}),
response: z.object({
user_ids: z.array(conversation),
}),
},
get_communities: {
request: z.object({}),
response: z.object({
communities: z.array(community),
}),
},
message_live: {
request: z.object({}),
response: z.object({
@ -166,6 +159,7 @@ export type TTP = typeof ttp;
// Storage
export interface Storage {
session_id: number;
user_id: number;
private_key: string;
ppandtos_done: boolean;
@ -179,6 +173,7 @@ export interface Storage {
}
export const storageDefaults: Storage = {
session_id: 0,
user_id: 0,
private_key: "",
ppandtos_done: false,