mirror of https://github.com/wg-easy/wg-easy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
export type OneTimeLink = {
|
|
oneTimeLink: string;
|
|
/** ISO String */
|
|
expiresAt: string;
|
|
};
|
|
|
|
export type Client = {
|
|
id: string;
|
|
name: string;
|
|
address4: string;
|
|
address6: string;
|
|
privateKey: string;
|
|
publicKey: string;
|
|
preSharedKey: string;
|
|
/** ISO String */
|
|
expiresAt: string | null;
|
|
endpoint: string | null;
|
|
allowedIPs: string[];
|
|
oneTimeLink: OneTimeLink | null;
|
|
/** ISO String */
|
|
createdAt: string;
|
|
/** ISO String */
|
|
updatedAt: string;
|
|
enabled: boolean;
|
|
persistentKeepalive: number;
|
|
};
|
|
|
|
export type NewClient = Omit<Client, 'createdAt' | 'updatedAt'>;
|
|
|
|
/**
|
|
* Interface for client-related database operations.
|
|
* This interface provides methods for managing client data.
|
|
*/
|
|
export interface ClientRepository {
|
|
getClients(): Promise<Record<string, Client>>;
|
|
getClient(id: string): Promise<Client | undefined>;
|
|
createClient(client: NewClient): Promise<void>;
|
|
deleteClient(id: string): Promise<void>;
|
|
toggleClient(id: string, enable: boolean): Promise<void>;
|
|
updateClientName(id: string, name: string): Promise<void>;
|
|
updateClientAddress4(id: string, address4: string): Promise<void>;
|
|
updateClientExpirationDate(
|
|
id: string,
|
|
expirationDate: string | null
|
|
): Promise<void>;
|
|
deleteOneTimeLink(id: string): Promise<void>;
|
|
createOneTimeLink(id: string, oneTimeLink: OneTimeLink): Promise<void>;
|
|
}
|
|
|