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

Function getSigner

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

Source from the content-addressed store, hash-verified

68}
69
70function getSigner(): LocalSigner {
71 if (cachedSigner) return cachedSigner;
72 const certB64 = process.env.C2PA_CERT_PEM_B64;
73 const keyB64 = process.env.C2PA_PRIVATE_KEY_PEM_B64;
74 if (!certB64 || !keyB64) {
75 throw new Error('C2PA_CERT_PEM_B64 and C2PA_PRIVATE_KEY_PEM_B64 must be set');
76 }
77 const certBuf = Buffer.from(certB64, 'base64');
78 const keyBuf = Buffer.from(keyB64, 'base64');
79 const tsaUrl = process.env.C2PA_TSA_URL || undefined;
80 cachedSigner = LocalSigner.newSigner(certBuf, keyBuf, 'es256', tsaUrl);
81 return cachedSigner;
82}
83
84/** Clears the cached signer. Tests use this to swap keys between cases. */
85export function resetC2PASignerCache(): void {

Callers 1

signC2PAFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected