MCPcopy Index your code
hub / github.com/PaystackOSS/paystack-mcp-server / redactCardObject

Function redactCardObject

src/logger.ts:34–54  ·  view source on GitHub ↗

* Redact sensitive fields in card objects * Only redacts cvv and number, keeps other fields visible

(card: any)

Source from the content-addressed store, hash-verified

32 * Only redacts cvv and number, keeps other fields visible
33 */
34function redactCardObject(card: any): any {
35 if (Array.isArray(card)) {
36 return card.map(redactCardObject);
37 }
38
39 if (typeof card === 'object' && card !== null) {
40 const redactedCard: any = {};
41 for (const [key, value] of Object.entries(card)) {
42 // Only redact cvv and number fields in card object
43 if (key === 'cvv' || key === 'number') {
44 redactedCard[key] = '[REDACTED]';
45 } else {
46 // Keep other card fields but recursively redact if they're objects
47 redactedCard[key] = redactSensitiveData(value);
48 }
49 }
50 return redactedCard;
51 }
52
53 return card;
54}
55
56function redactSensitiveData(obj: any): any {
57 if (obj === null || obj === undefined) {

Callers 1

redactSensitiveDataFunction · 0.85

Calls 1

redactSensitiveDataFunction · 0.85

Tested by

no test coverage detected