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

Function isC2PASigningEnabled

server/src/services/c2pa.ts:53–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51 * unsigned.
52 */
53export function isC2PASigningEnabled(): boolean {
54 if (process.env.C2PA_SIGNING_ENABLED !== 'true') return false;
55 const certPresent =
56 typeof process.env.C2PA_CERT_PEM_B64 === 'string' && process.env.C2PA_CERT_PEM_B64.length > 0;
57 const keyPresent =
58 typeof process.env.C2PA_PRIVATE_KEY_PEM_B64 === 'string' &&
59 process.env.C2PA_PRIVATE_KEY_PEM_B64.length > 0;
60 if ((!certPresent || !keyPresent) && !misconfigWarned) {
61 misconfigWarned = true;
62 logger.warn(
63 { certPresent, keyPresent },
64 'C2PA_SIGNING_ENABLED is true but cert/key secret is missing — signing will be skipped',
65 );
66 }
67 return certPresent && keyPresent;
68}
69
70function getSigner(): LocalSigner {
71 if (cachedSigner) return cachedSigner;

Callers 5

signStoryboardIfEnabledFunction · 0.85
mainFunction · 0.85
finalizePortraitFunction · 0.85
attachC2PAIfEnabledFunction · 0.85
c2pa.test.tsFile · 0.85

Calls 1

warnMethod · 0.80

Tested by

no test coverage detected