mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-26 18:52:41 +00:00
Compare commits
4 Commits
msg-delive
...
888f5f8bb6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
888f5f8bb6 | ||
|
|
9114dd5992 | ||
|
|
a126494c12 | ||
|
|
e2cbe11a5f |
@@ -77,6 +77,8 @@ COPY ./cli/wrapper.sh /usr/local/bin/pangctl
|
|||||||
RUN chmod +x /usr/local/bin/pangctl ./dist/cli.mjs
|
RUN chmod +x /usr/local/bin/pangctl ./dist/cli.mjs
|
||||||
|
|
||||||
COPY server/db/names.json ./dist/names.json
|
COPY server/db/names.json ./dist/names.json
|
||||||
|
COPY server/db/ios_models.json ./dist/ios_models.json
|
||||||
|
COPY server/db/mac_models.json ./dist/mac_models.json
|
||||||
COPY public ./public
|
COPY public ./public
|
||||||
|
|
||||||
# OCI Image Labels
|
# OCI Image Labels
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import logger from "@server/logger";
|
|||||||
import { sendTerminateClient } from "@server/routers/client/terminate";
|
import { sendTerminateClient } from "@server/routers/client/terminate";
|
||||||
import { and, eq, notInArray, type InferInsertModel } from "drizzle-orm";
|
import { and, eq, notInArray, type InferInsertModel } from "drizzle-orm";
|
||||||
import { rebuildClientAssociationsFromClient } from "./rebuildClientAssociations";
|
import { rebuildClientAssociationsFromClient } from "./rebuildClientAssociations";
|
||||||
|
import { OlmErrorCodes } from "@server/routers/olm/error";
|
||||||
|
|
||||||
export async function calculateUserClientsForOrgs(
|
export async function calculateUserClientsForOrgs(
|
||||||
userId: string,
|
userId: string,
|
||||||
@@ -305,6 +306,8 @@ async function cleanupOrphanedClients(
|
|||||||
if (deletedClient.olmId) {
|
if (deletedClient.olmId) {
|
||||||
await sendTerminateClient(
|
await sendTerminateClient(
|
||||||
deletedClient.clientId,
|
deletedClient.clientId,
|
||||||
|
OlmErrorCodes.TERMINATED_DELETED,
|
||||||
|
"Deleted",
|
||||||
deletedClient.olmId
|
deletedClient.olmId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { hashPassword } from "@server/auth/password";
|
import { hashPassword } from "@server/auth/password";
|
||||||
import { disconnectClient, sendToClient } from "#private/routers/ws";
|
import { disconnectClient, sendToClient } from "#private/routers/ws";
|
||||||
|
import { OlmErrorCodes, sendOlmError } from "@server/routers/olm/error";
|
||||||
|
|
||||||
const reGenerateSecretParamsSchema = z.strictObject({
|
const reGenerateSecretParamsSchema = z.strictObject({
|
||||||
clientId: z.string().transform(Number).pipe(z.int().positive())
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
@@ -119,7 +120,10 @@ export async function reGenerateClientSecret(
|
|||||||
if (disconnect) {
|
if (disconnect) {
|
||||||
const payload = {
|
const payload = {
|
||||||
type: `olm/terminate`,
|
type: `olm/terminate`,
|
||||||
data: {}
|
data: {
|
||||||
|
code: OlmErrorCodes.TERMINATED_REKEYED,
|
||||||
|
message: "Client secret has been regenerated"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// Don't await this to prevent blocking the response
|
// Don't await this to prevent blocking the response
|
||||||
sendToClient(existingOlms[0].olmId, payload).catch((error) => {
|
sendToClient(existingOlms[0].olmId, payload).catch((error) => {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAssociations";
|
import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAssociations";
|
||||||
import { sendTerminateClient } from "./terminate";
|
import { sendTerminateClient } from "./terminate";
|
||||||
|
import { OlmErrorCodes } from "../olm/error";
|
||||||
|
|
||||||
const archiveClientSchema = z.strictObject({
|
const archiveClientSchema = z.strictObject({
|
||||||
clientId: z.string().transform(Number).pipe(z.int().positive())
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
@@ -79,11 +80,6 @@ export async function archiveClient(
|
|||||||
|
|
||||||
// Rebuild associations to clean up related data
|
// Rebuild associations to clean up related data
|
||||||
await rebuildClientAssociationsFromClient(client, trx);
|
await rebuildClientAssociationsFromClient(client, trx);
|
||||||
|
|
||||||
// Send terminate signal if there's an associated OLM
|
|
||||||
if (client.olmId) {
|
|
||||||
await sendTerminateClient(client.clientId, client.olmId);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return response(res, {
|
return response(res, {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import logger from "@server/logger";
|
|||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { sendTerminateClient } from "./terminate";
|
import { sendTerminateClient } from "./terminate";
|
||||||
|
import { OlmErrorCodes } from "../olm/error";
|
||||||
|
|
||||||
const blockClientSchema = z.strictObject({
|
const blockClientSchema = z.strictObject({
|
||||||
clientId: z.string().transform(Number).pipe(z.int().positive())
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
@@ -78,7 +79,7 @@ export async function blockClient(
|
|||||||
|
|
||||||
// Send terminate signal if there's an associated OLM and it's connected
|
// Send terminate signal if there's an associated OLM and it's connected
|
||||||
if (client.olmId && client.online) {
|
if (client.olmId && client.online) {
|
||||||
await sendTerminateClient(client.clientId, client.olmId);
|
await sendTerminateClient(client.clientId, OlmErrorCodes.TERMINATED_BLOCKED, "Blocked", client.olmId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAssociations";
|
import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAssociations";
|
||||||
import { sendTerminateClient } from "./terminate";
|
import { sendTerminateClient } from "./terminate";
|
||||||
|
import { OlmErrorCodes } from "../olm/error";
|
||||||
|
|
||||||
const deleteClientSchema = z.strictObject({
|
const deleteClientSchema = z.strictObject({
|
||||||
clientId: z.string().transform(Number).pipe(z.int().positive())
|
clientId: z.string().transform(Number).pipe(z.int().positive())
|
||||||
@@ -91,7 +92,7 @@ export async function deleteClient(
|
|||||||
await rebuildClientAssociationsFromClient(deletedClient, trx);
|
await rebuildClientAssociationsFromClient(deletedClient, trx);
|
||||||
|
|
||||||
if (olm) {
|
if (olm) {
|
||||||
await sendTerminateClient(deletedClient.clientId, olm.olmId); // the olmId needs to be provided because it cant look it up after deletion
|
await sendTerminateClient(deletedClient.clientId, OlmErrorCodes.TERMINATED_DELETED, "Deleted", olm.olmId); // the olmId needs to be provided because it cant look it up after deletion
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import { sendToClient } from "#dynamic/routers/ws";
|
import { sendToClient } from "#dynamic/routers/ws";
|
||||||
import { db, olms } from "@server/db";
|
import { db, olms } from "@server/db";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
|
import { OlmErrorCodes } from "../olm/error";
|
||||||
|
|
||||||
export async function sendTerminateClient(
|
export async function sendTerminateClient(
|
||||||
clientId: number,
|
clientId: number,
|
||||||
|
code: (typeof OlmErrorCodes)[keyof typeof OlmErrorCodes],
|
||||||
|
message: string,
|
||||||
olmId?: string | null
|
olmId?: string | null
|
||||||
) {
|
) {
|
||||||
if (!olmId) {
|
if (!olmId) {
|
||||||
@@ -20,6 +23,9 @@ export async function sendTerminateClient(
|
|||||||
|
|
||||||
await sendToClient(olmId, {
|
await sendToClient(olmId, {
|
||||||
type: `olm/terminate`,
|
type: `olm/terminate`,
|
||||||
data: {}
|
data: {
|
||||||
|
code,
|
||||||
|
message
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAssociations";
|
import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAssociations";
|
||||||
import { sendTerminateClient } from "../client/terminate";
|
import { sendTerminateClient } from "../client/terminate";
|
||||||
|
import { OlmErrorCodes } from "./error";
|
||||||
|
|
||||||
const paramsSchema = z
|
const paramsSchema = z
|
||||||
.object({
|
.object({
|
||||||
@@ -52,7 +53,7 @@ export async function archiveUserOlm(
|
|||||||
.where(eq(clients.clientId, client.clientId));
|
.where(eq(clients.clientId, client.clientId));
|
||||||
|
|
||||||
await rebuildClientAssociationsFromClient(client, trx);
|
await rebuildClientAssociationsFromClient(client, trx);
|
||||||
await sendTerminateClient(client.clientId, olmId);
|
await sendTerminateClient(client.clientId, OlmErrorCodes.TERMINATED_ARCHIVED, "Archived", olmId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Archive the OLM (set archived to true)
|
// Archive the OLM (set archived to true)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import logger from "@server/logger";
|
|||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAssociations";
|
import { rebuildClientAssociationsFromClient } from "@server/lib/rebuildClientAssociations";
|
||||||
import { sendTerminateClient } from "../client/terminate";
|
import { sendTerminateClient } from "../client/terminate";
|
||||||
|
import { OlmErrorCodes } from "./error";
|
||||||
|
|
||||||
const paramsSchema = z
|
const paramsSchema = z
|
||||||
.object({
|
.object({
|
||||||
@@ -76,6 +77,8 @@ export async function deleteUserOlm(
|
|||||||
if (olm) {
|
if (olm) {
|
||||||
await sendTerminateClient(
|
await sendTerminateClient(
|
||||||
deletedClient.clientId,
|
deletedClient.clientId,
|
||||||
|
OlmErrorCodes.TERMINATED_DELETED,
|
||||||
|
"Deleted",
|
||||||
olm.olmId
|
olm.olmId
|
||||||
); // the olmId needs to be provided because it cant look it up after deletion
|
); // the olmId needs to be provided because it cant look it up after deletion
|
||||||
}
|
}
|
||||||
|
|||||||
35
server/routers/olm/error.ts
Normal file
35
server/routers/olm/error.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { sendToClient } from "#dynamic/routers/ws";
|
||||||
|
// Error codes for registration failures
|
||||||
|
export const OlmErrorCodes = {
|
||||||
|
OLM_NOT_FOUND: "OLM_NOT_FOUND",
|
||||||
|
CLIENT_ID_NOT_FOUND: "CLIENT_ID_NOT_FOUND",
|
||||||
|
CLIENT_NOT_FOUND: "CLIENT_NOT_FOUND",
|
||||||
|
CLIENT_BLOCKED: "CLIENT_BLOCKED",
|
||||||
|
CLIENT_PENDING: "CLIENT_PENDING",
|
||||||
|
ORG_NOT_FOUND: "ORG_NOT_FOUND",
|
||||||
|
USER_ID_NOT_FOUND: "USER_ID_NOT_FOUND",
|
||||||
|
INVALID_USER_SESSION: "INVALID_USER_SESSION",
|
||||||
|
USER_ID_MISMATCH: "USER_ID_MISMATCH",
|
||||||
|
ACCESS_POLICY_DENIED: "ACCESS_POLICY_DENIED",
|
||||||
|
TERMINATED_REKEYED: "TERMINATED_REKEYED",
|
||||||
|
TERMINATED_ORG_DELETED: "TERMINATED_ORG_DELETED",
|
||||||
|
TERMINATED_INACTIVITY: "TERMINATED_INACTIVITY",
|
||||||
|
TERMINATED_DELETED: "TERMINATED_DELETED",
|
||||||
|
TERMINATED_ARCHIVED: "TERMINATED_ARCHIVED",
|
||||||
|
TERMINATED_BLOCKED: "TERMINATED_BLOCKED"
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// Helper function to send registration error
|
||||||
|
export async function sendOlmError(
|
||||||
|
code: string,
|
||||||
|
errorMessage: string,
|
||||||
|
olmId: string
|
||||||
|
) {
|
||||||
|
sendToClient(olmId, {
|
||||||
|
type: "olm/error",
|
||||||
|
data: {
|
||||||
|
code,
|
||||||
|
message: errorMessage
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -8,8 +8,8 @@ import response from "@server/lib/response";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
|
||||||
import { getUserDeviceName } from "@server/db/names";
|
import { getUserDeviceName } from "@server/db/names";
|
||||||
|
// import { OpenAPITags, registry } from "@server/openApi";
|
||||||
|
|
||||||
const paramsSchema = z
|
const paramsSchema = z
|
||||||
.object({
|
.object({
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { sendTerminateClient } from "../client/terminate";
|
|||||||
import { encodeHexLowerCase } from "@oslojs/encoding";
|
import { encodeHexLowerCase } from "@oslojs/encoding";
|
||||||
import { sha256 } from "@oslojs/crypto/sha2";
|
import { sha256 } from "@oslojs/crypto/sha2";
|
||||||
import { sendOlmSyncMessage } from "./sync";
|
import { sendOlmSyncMessage } from "./sync";
|
||||||
|
import { OlmErrorCodes } from "./error";
|
||||||
|
|
||||||
// Track if the offline checker interval is running
|
// Track if the offline checker interval is running
|
||||||
let offlineCheckerInterval: NodeJS.Timeout | null = null;
|
let offlineCheckerInterval: NodeJS.Timeout | null = null;
|
||||||
@@ -64,6 +65,8 @@ export const startOlmOfflineChecker = (): void => {
|
|||||||
try {
|
try {
|
||||||
await sendTerminateClient(
|
await sendTerminateClient(
|
||||||
offlineClient.clientId,
|
offlineClient.clientId,
|
||||||
|
OlmErrorCodes.TERMINATED_INACTIVITY,
|
||||||
|
"Client terminated due to inactivity",
|
||||||
offlineClient.olmId
|
offlineClient.olmId
|
||||||
); // terminate first
|
); // terminate first
|
||||||
// wait a moment to ensure the message is sent
|
// wait a moment to ensure the message is sent
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import config from "@server/lib/config";
|
|||||||
import { encodeHexLowerCase } from "@oslojs/encoding";
|
import { encodeHexLowerCase } from "@oslojs/encoding";
|
||||||
import { sha256 } from "@oslojs/crypto/sha2";
|
import { sha256 } from "@oslojs/crypto/sha2";
|
||||||
import { buildSiteConfigurationForOlmClient } from "./buildConfiguration";
|
import { buildSiteConfigurationForOlmClient } from "./buildConfiguration";
|
||||||
|
import { OlmErrorCodes, sendOlmError } from "./error";
|
||||||
|
|
||||||
export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
||||||
logger.info("Handling register olm message!");
|
logger.info("Handling register olm message!");
|
||||||
@@ -53,6 +54,11 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
|
|
||||||
if (!olm.clientId) {
|
if (!olm.clientId) {
|
||||||
logger.warn("Olm client ID not found");
|
logger.warn("Olm client ID not found");
|
||||||
|
sendOlmError(
|
||||||
|
OlmErrorCodes.CLIENT_ID_NOT_FOUND,
|
||||||
|
"Olm client ID not found",
|
||||||
|
olm.olmId
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,11 +70,35 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
|
|
||||||
if (!client) {
|
if (!client) {
|
||||||
logger.warn("Client ID not found");
|
logger.warn("Client ID not found");
|
||||||
|
sendOlmError(
|
||||||
|
OlmErrorCodes.CLIENT_NOT_FOUND,
|
||||||
|
"Client not found in organization",
|
||||||
|
olm.olmId
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.blocked) {
|
if (client.blocked) {
|
||||||
logger.debug(`Client ${client.clientId} is blocked. Ignoring register.`);
|
logger.debug(
|
||||||
|
`Client ${client.clientId} is blocked. Ignoring register.`
|
||||||
|
);
|
||||||
|
sendOlmError(
|
||||||
|
OlmErrorCodes.CLIENT_BLOCKED,
|
||||||
|
"Client is blocked",
|
||||||
|
olm.olmId
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client.approvalState == "pending") {
|
||||||
|
logger.debug(
|
||||||
|
`Client ${client.clientId} approval is pending. Ignoring register.`
|
||||||
|
);
|
||||||
|
sendOlmError(
|
||||||
|
OlmErrorCodes.CLIENT_PENDING,
|
||||||
|
"Client approval is pending",
|
||||||
|
olm.olmId
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,12 +110,22 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
|
|
||||||
if (!org) {
|
if (!org) {
|
||||||
logger.warn("Org not found");
|
logger.warn("Org not found");
|
||||||
|
sendOlmError(
|
||||||
|
OlmErrorCodes.ORG_NOT_FOUND,
|
||||||
|
"Organization not found",
|
||||||
|
olm.olmId
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orgId) {
|
if (orgId) {
|
||||||
if (!olm.userId) {
|
if (!olm.userId) {
|
||||||
logger.warn("Olm has no user ID");
|
logger.warn("Olm has no user ID");
|
||||||
|
sendOlmError(
|
||||||
|
OlmErrorCodes.USER_ID_NOT_FOUND,
|
||||||
|
"User ID not found for this client",
|
||||||
|
olm.olmId
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,10 +133,20 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
await validateSessionToken(userToken);
|
await validateSessionToken(userToken);
|
||||||
if (!userSession || !user) {
|
if (!userSession || !user) {
|
||||||
logger.warn("Invalid user session for olm register");
|
logger.warn("Invalid user session for olm register");
|
||||||
return; // by returning here we just ignore the ping and the setInterval will force it to disconnect
|
sendOlmError(
|
||||||
|
OlmErrorCodes.INVALID_USER_SESSION,
|
||||||
|
"Invalid or expired user session token",
|
||||||
|
olm.olmId
|
||||||
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (user.userId !== olm.userId) {
|
if (user.userId !== olm.userId) {
|
||||||
logger.warn("User ID mismatch for olm register");
|
logger.warn("User ID mismatch for olm register");
|
||||||
|
sendOlmError(
|
||||||
|
OlmErrorCodes.USER_ID_MISMATCH,
|
||||||
|
"User ID does not match the authenticated session",
|
||||||
|
olm.olmId
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +164,11 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
logger.warn(
|
logger.warn(
|
||||||
`Olm user ${olm.userId} does not pass access policies for org ${orgId}: ${policyCheck.error}`
|
`Olm user ${olm.userId} does not pass access policies for org ${orgId}: ${policyCheck.error}`
|
||||||
);
|
);
|
||||||
|
sendOlmError(
|
||||||
|
OlmErrorCodes.ACCESS_POLICY_DENIED,
|
||||||
|
`Access policy denied: ${policyCheck.error}`,
|
||||||
|
olm.olmId
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,7 +206,7 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
.update(clients)
|
.update(clients)
|
||||||
.set({
|
.set({
|
||||||
pubKey: publicKey,
|
pubKey: publicKey,
|
||||||
archived: false,
|
archived: false
|
||||||
})
|
})
|
||||||
.where(eq(clients.clientId, client.clientId));
|
.where(eq(clients.clientId, client.clientId));
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { fromError } from "zod-validation-error";
|
|||||||
import { sendToClient } from "#dynamic/routers/ws";
|
import { sendToClient } from "#dynamic/routers/ws";
|
||||||
import { deletePeer } from "../gerbil/peers";
|
import { deletePeer } from "../gerbil/peers";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
|
import { OlmErrorCodes } from "../olm/error";
|
||||||
|
|
||||||
const deleteOrgSchema = z.strictObject({
|
const deleteOrgSchema = z.strictObject({
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
@@ -208,7 +209,10 @@ export async function deleteOrg(
|
|||||||
for (const olmId of olmsToTerminate) {
|
for (const olmId of olmsToTerminate) {
|
||||||
sendToClient(olmId, {
|
sendToClient(olmId, {
|
||||||
type: "olm/terminate",
|
type: "olm/terminate",
|
||||||
data: {}
|
data: {
|
||||||
|
code: OlmErrorCodes.TERMINATED_REKEYED,
|
||||||
|
message: "Organization has been deleted"
|
||||||
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
logger.error(
|
logger.error(
|
||||||
"Failed to send termination message to olm:",
|
"Failed to send termination message to olm:",
|
||||||
|
|||||||
Reference in New Issue
Block a user