LibreChat/api/server/services/ChannelAuthority.js
Dustin Healy 1081a92f02
👤 feat: Link and Revoke Personal Channel Accounts (#17615)
* 👤 feat: Link and Revoke Personal Channel Accounts

* fix: Own Channel Link Lifetimes and Complete Channel Entry Points

* fix(channels): activate trusted link URLs with account page

* fix: Preserve Personal Consent for Channel Managers

* test: preserve channel fixture in upstream agent selection cases
2026-11-10 21:04:04 -08:00

41 lines
1.4 KiB
JavaScript

const {
createChannelApplicationAuthority,
createChannelApplicationPolicy,
encryptCredential,
decryptCredential,
} = require('@librechat/api');
const {
createChannelIdentityStorage,
createChannelRunStorage,
createResponseStorage,
} = require('@librechat/data-schemas');
const mongoose = require('mongoose');
const { getAppConfig } = require('./Config');
const { getEffectivePermissions } = require('./PermissionService');
const db = require('~/models');
module.exports = createChannelApplicationAuthority({
storage: createChannelRunStorage(mongoose),
policy: createChannelApplicationPolicy({
readAppConfig: getAppConfig,
findUser: db.findUser,
isPrincipalActive: db.isAgentTriggerPrincipalActive,
}),
channels: db,
identityStorage: createChannelIdentityStorage(mongoose),
findUser: (id) => db.findUser({ _id: id }),
getRole: db.getRoleByName,
isPrincipalActive: db.isAgentTriggerPrincipalActive,
publicBaseUrl: process.env.DOMAIN_CLIENT || 'http://localhost:3080',
access: { getAgent: db.getAgent, getEffectivePermissions },
credentials: {
encrypt: encryptCredential,
decrypt: decryptCredential,
responses: createResponseStorage(mongoose, {
getMCPAppMessageBudget: db.getMCPAppMessageBudget,
}),
createKey: db.createAgentApiKey,
getKey: db.getAgentApiKeyById,
deleteKey: db.deleteAgentApiKey,
},
});