MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / verifyChannelPrivacyForWrite

Function verifyChannelPrivacyForWrite

server/src/slack/client.ts:493–510  ·  view source on GitHub ↗
(
  channelId: string,
  expected: 'private' | 'public',
)

Source from the content-addressed store, hash-verified

491 * an admin picking the wrong channel).
492 */
493export async function verifyChannelPrivacyForWrite(
494 channelId: string,
495 expected: 'private' | 'public',
496): Promise<ChannelPrivacyCheckResult> {
497 const info = await getChannelInfo(channelId);
498 if (!info) {
499 logger.warn(
500 { channelId, expected, event: 'channel_privacy_verify_write_null' },
501 'Could not verify Slack channel privacy at write time — refusing with cannot_verify',
502 );
503 return { ok: false, reason: 'cannot_verify' };
504 }
505 const actual: 'private' | 'public' = info.is_private === true ? 'private' : 'public';
506 if (actual !== expected) {
507 return { ok: false, reason: 'wrong_privacy', actual, expected };
508 }
509 return { ok: true };
510}
511
512/**
513 * Reasons a `sendChannelMessage` call may refuse to post. Left as a

Callers 2

requireChannelPrivacyFunction · 0.85

Calls 2

getChannelInfoFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected