diff --git a/src/services/aliases/aliases.class.ts b/src/services/aliases/aliases.class.ts index ad6bf3f..9d5bbdc 100644 --- a/src/services/aliases/aliases.class.ts +++ b/src/services/aliases/aliases.class.ts @@ -125,9 +125,12 @@ export class AliasesService } sanitizeAliasResponse(alias: WildDuckAddress): AliasApiResponse { + // Prevent the user from deleting their main address or any address that does not end with the preferred domain + const isRemovable = !alias.main && alias.address.endsWith(config.get('wildDuck.domain')); + // Hide the id if the alias is not removable return { - id: alias.main ? null : alias.id, + id: isRemovable ? alias.id : null, address: alias.address, tags: alias.tags, created: alias.created,