@liuhange/dsh-data-masking 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ import type { AdvancedMaskingConfig } from '@liuhange/dsh-data-asset-shared';
2
+ import type { AdvancedMaskingResult, AdvancedMaskingAlgorithm } from './algorithms/types.js';
3
+ export declare class AdvancedMaskingExecutor {
4
+ private fpeAlgorithm;
5
+ private kAnonymityAlgorithm;
6
+ private differentialPrivacyAlgorithm;
7
+ private hashAlgorithm;
8
+ execute(data: string, algorithm: AdvancedMaskingAlgorithm, fieldName: string | undefined, config: AdvancedMaskingConfig): AdvancedMaskingResult;
9
+ private executeFpe;
10
+ private executeKAnonymity;
11
+ private executeDifferentialPrivacy;
12
+ private executeHash;
13
+ private resolveEnvVar;
14
+ }
15
+ //# sourceMappingURL=advancedMaskingExecutor.d.ts.map
@@ -0,0 +1,7 @@
1
+ import type { BudgetTracker } from '../budgetTracker.js';
2
+ export declare class DifferentialPrivacyAlgorithm {
3
+ addNoise(trueValue: number, epsilon: number, sensitivity: number, budgetTracker: BudgetTracker, totalBudget: number): number;
4
+ private generateLaplaceNoise;
5
+ private generateSecureUniform;
6
+ }
7
+ //# sourceMappingURL=differentialPrivacyAlgorithm.d.ts.map
@@ -0,0 +1,7 @@
1
+ export declare class FpeAlgorithm {
2
+ encrypt(plaintext: string, key: string): string;
3
+ decrypt(ciphertext: string, key: string): string;
4
+ private encryptGeneric;
5
+ private decryptGeneric;
6
+ }
7
+ //# sourceMappingURL=fpeAlgorithm.d.ts.map
@@ -0,0 +1,8 @@
1
+ export declare class HashAlgorithm {
2
+ hash(plaintext: string, hashAlgorithm: 'SHA-256' | 'SHA-512', salt?: string): {
3
+ digest: string;
4
+ salted: boolean;
5
+ digestLength: number;
6
+ };
7
+ }
8
+ //# sourceMappingURL=hashAlgorithm.d.ts.map
@@ -0,0 +1,10 @@
1
+ export declare class KAnonymityAlgorithm {
2
+ anonymize(records: Record<string, unknown>[], kValue: number, quasiIdentifiers: string[]): {
3
+ anonymizedRecords: Record<string, unknown>[];
4
+ actualMinEquivalenceClass: number;
5
+ suppressedCount: number;
6
+ };
7
+ private groupByQuasiIdentifiers;
8
+ private generalize;
9
+ }
10
+ //# sourceMappingURL=kAnonymityAlgorithm.d.ts.map
@@ -0,0 +1,35 @@
1
+ export type AdvancedMaskingAlgorithm = 'FPE' | 'k-anonymity' | 'differential-privacy' | 'hash';
2
+ export interface MaskSensitiveDataParamsV2 {
3
+ filePath: string;
4
+ strategy?: string;
5
+ algorithm?: AdvancedMaskingAlgorithm;
6
+ fieldName?: string;
7
+ }
8
+ export interface AlgorithmDetails {
9
+ algorithm: string;
10
+ reversible?: boolean;
11
+ kValue?: number;
12
+ actualMinEquivalenceClass?: number;
13
+ suppressedCount?: number;
14
+ epsilon?: number;
15
+ budgetConsumed?: number;
16
+ budgetRemaining?: number;
17
+ hashAlgorithm?: string;
18
+ salted?: boolean;
19
+ digestLength?: number;
20
+ }
21
+ export interface AdvancedMaskingResult {
22
+ maskedData: string | Record<string, unknown>[];
23
+ algorithm: string;
24
+ details: AlgorithmDetails;
25
+ }
26
+ export interface BudgetTrackerState {
27
+ totalBudget: number;
28
+ consumed: number;
29
+ remaining: number;
30
+ queryCount: number;
31
+ }
32
+ export interface FieldAlgorithmConfig {
33
+ algorithm: string;
34
+ }
35
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { BudgetTrackerState } from './algorithms/types.js';
2
+ export declare class BudgetTracker {
3
+ private consumed;
4
+ private queryCount;
5
+ private readonly totalBudget;
6
+ constructor(totalBudget: number);
7
+ consume(epsilon: number): void;
8
+ canConsume(epsilon: number, totalBudget: number): boolean;
9
+ getState(): BudgetTrackerState;
10
+ }
11
+ //# sourceMappingURL=budgetTracker.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { AdvancedMaskingConfig } from '@liuhange/dsh-data-asset-shared';
2
+ export declare const defaultAdvancedMaskingConfig: AdvancedMaskingConfig;
3
+ //# sourceMappingURL=defaultAdvancedMaskingConfig.d.ts.map
package/package.json CHANGED
@@ -1,23 +1,39 @@
1
- {
2
- "name": "@liuhange/dsh-data-masking",
3
- "description": "Data masking plugin: sensitive field identification and graded masking (FULL/PARTIAL/GENERALIZE)",
4
- "version": "1.0.0",
5
- "publishConfig": { "access": "public" },
6
- "repository": { "type": "git", "url": "git+https://github.com/deepseek-ai/deepseek-harness.git", "directory": "packages/data-asset/data-masking" },
7
- "type": "module",
8
- "main": "lib/index.js",
9
- "types": "lib/types/index.d.ts",
10
- "exports": {
11
- ".": { "types": "./lib/types/index.d.ts", "default": "./lib/index.js" },
12
- "./invariant": { "types": "./lib/types/invariant.d.ts", "default": "./lib/invariant.js" },
13
- "./src/*": "./src/*",
14
- "./package.json": "./package.json"
15
- },
16
- "files": ["lib/index.js", "lib/invariant.js", "lib/types/**/*.d.ts"],
17
- "license": "MIT",
18
- "peerDependencies": {
19
- "@deepseek-ai/cordis": "^0.1.0",
20
- "@deepseek-ai/dsh-tools": "^0.1.0",
21
- "@liuhange/dsh-data-asset-shared": "^1.0.0"
22
- }
1
+ {
2
+ "name": "@liuhange/dsh-data-masking",
3
+ "description": "Data masking plugin: sensitive field identification and graded masking (FULL/PARTIAL/GENERALIZE)",
4
+ "version": "2.0.0",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/data-asset/data-masking"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./invariant": {
22
+ "types": "./lib/types/invariant.d.ts",
23
+ "default": "./lib/invariant.js"
24
+ },
25
+ "./src/*": "./src/*",
26
+ "./package.json": "./package.json"
27
+ },
28
+ "files": [
29
+ "lib/index.js",
30
+ "lib/invariant.js",
31
+ "lib/types/**/*.d.ts"
32
+ ],
33
+ "license": "MIT",
34
+ "peerDependencies": {
35
+ "@deepseek-ai/cordis": "^0.1.0",
36
+ "@deepseek-ai/dsh-tools": "^0.1.0",
37
+ "@liuhange/dsh-data-asset-shared": "^2.0.0"
38
+ }
23
39
  }