Skip to content

Commit 747a7c8

Browse files
committed
feat(new tool): Sensitive data masker
Fix CorentinTh#765
1 parent b430bae commit 747a7c8

File tree

6 files changed

+80
-16
lines changed

6 files changed

+80
-16
lines changed

components.d.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,14 @@ declare module '@vue/runtime-core' {
130130
NCode: typeof import('naive-ui')['NCode']
131131
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
132132
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
133-
NDivider: typeof import('naive-ui')['NDivider']
134133
NEllipsis: typeof import('naive-ui')['NEllipsis']
135-
NFormItem: typeof import('naive-ui')['NFormItem']
136-
NGi: typeof import('naive-ui')['NGi']
137-
NGrid: typeof import('naive-ui')['NGrid']
138134
NH1: typeof import('naive-ui')['NH1']
139135
NH3: typeof import('naive-ui')['NH3']
140136
NIcon: typeof import('naive-ui')['NIcon']
141-
NInputNumber: typeof import('naive-ui')['NInputNumber']
142-
NLabel: typeof import('naive-ui')['NLabel']
143137
NLayout: typeof import('naive-ui')['NLayout']
144138
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
145139
NMenu: typeof import('naive-ui')['NMenu']
146140
NScrollbar: typeof import('naive-ui')['NScrollbar']
147-
NSpin: typeof import('naive-ui')['NSpin']
148141
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
149142
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
150143
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
@@ -160,6 +153,7 @@ declare module '@vue/runtime-core' {
160153
RouterView: typeof import('vue-router')['RouterView']
161154
RsaKeyPairGenerator: typeof import('./src/tools/rsa-key-pair-generator/rsa-key-pair-generator.vue')['default']
162155
SafelinkDecoder: typeof import('./src/tools/safelink-decoder/safelink-decoder.vue')['default']
156+
SensitiveDataMasker: typeof import('./src/tools/sensitive-data-masker/sensitive-data-masker.vue')['default']
163157
SlugifyString: typeof import('./src/tools/slugify-string/slugify-string.vue')['default']
164158
SpanCopyable: typeof import('./src/components/SpanCopyable.vue')['default']
165159
SqlPrettify: typeof import('./src/tools/sql-prettify/sql-prettify.vue')['default']

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"libphonenumber-js": "^1.10.28",
7171
"lodash": "^4.17.21",
7272
"marked": "^10.0.0",
73+
"mask-sensitive-data": "^0.11.5",
7374
"mathjs": "^11.9.1",
7475
"mime-types": "^2.1.35",
7576
"monaco-editor": "^0.43.0",

pnpm-lock.yaml

Lines changed: 35 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { tool as asciiTextDrawer } from './ascii-text-drawer';
66

77
import { tool as textToUnicode } from './text-to-unicode';
88
import { tool as safelinkDecoder } from './safelink-decoder';
9+
import { tool as sensitiveDataMasker } from './sensitive-data-masker';
910
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
1011
import { tool as numeronymGenerator } from './numeronym-generator';
1112
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -172,6 +173,7 @@ export const toolsByCategory: ToolCategory[] = [
172173
textDiff,
173174
numeronymGenerator,
174175
asciiTextDrawer,
176+
sensitiveDataMasker,
175177
],
176178
},
177179
{
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { ShieldLock } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'Sensitive data masker',
6+
path: '/sensitive-data-masker',
7+
description: 'Clean sensitive data from textual content (ie logs)',
8+
keywords: ['sensitive', 'data', 'masker', 'obfuscator', 'clean', 'log'],
9+
component: () => import('./sensitive-data-masker.vue'),
10+
icon: ShieldLock,
11+
createdAt: new Date('2024-06-16'),
12+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<script setup lang="ts">
2+
import maskSensitiveData from 'mask-sensitive-data';
3+
import { withDefaultOnError } from '@/utils/defaults';
4+
5+
const defaultValue = `
6+
{
7+
8+
creditCard: '1234 5678 9000 9876',
9+
id: '3f8a43fd-6489-4ec7-bd55-7a1ba172d77b',
10+
name: 'John',
11+
surname: 'Doe',
12+
phone: '+358 40 1234567',
13+
token: 'eyJhbGciOiJIUzI1NiJ9.ew0KICAic3ViIjogIjEyMzQ1Njc4OTAiLA0KICAibmFtZSI6ICJBbGV4IEtvemxvdiIsDQogICJpYXQiOiAxNTE2MjM5MDIyDQp9.PNKysYFTCenU5bekHCmwIxCUXoYG41H_xc3uN3ZF_b8',
14+
}
15+
`;
16+
function transformer(value: string) {
17+
return withDefaultOnError(() => maskSensitiveData(value), '');
18+
}
19+
</script>
20+
21+
<template>
22+
<format-transformer
23+
input-label="Your log/textual data:"
24+
:input-default="defaultValue"
25+
input-placeholder="Paste your log/textual data here..."
26+
output-label="Cleaned version:"
27+
:transformer="transformer"
28+
/>
29+
</template>

0 commit comments

Comments
 (0)