frpc-desktop/electron/utils/desensitize.ts
2025-01-08 12:01:00 +08:00

13 lines
282 B
TypeScript

export const maskSensitiveData = (
obj: Record<string, any>,
keysToMask: string[]
) => {
const maskedObj = JSON.parse(JSON.stringify(obj));
keysToMask.forEach(key => {
if (maskedObj.hasOwnProperty(key)) {
maskedObj[key] = "***";
}
});
return maskedObj;
};