0.1.3 • Published 2 years ago

@gallofeliz/obfuscator v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Obfuscator

npm.io

Note: This module is part of @gallofeliz/js-libs that is a personal project. It is not developed nor tested for applications that need high security or scalability.

Obfuscate sensible data:

  • direct obfuscate() call
  • instanciate Obfuscator for regular calls
  • built-in obfuscations or yours (based on helpers or free callback obfuscators)
  • See To improve builder (or Rule object/fn)
    • builder.ifPathContains('request.body').stringifyJsonByKey('password') ...
    • Rule { conditions: Condition[], obfuscations?: Function } and/or ?
    • Jsonata or MongoLike Condition { path: { $regex: /request.body/ } }
import {
    obfuscate,
    rulesBuilder
} from "@gallofeliz/obfuscator"

const obfuscated = obfuscate(
    {
        url: 'https://root:root@gmail.com',
        user: 'root',
        password: 'root',
        email: 'root@localhost',
        age: 42
    },
    {
        rules: [
            rulesBuilder.pathMatchs(/age$/),
            rulesBuilder.urlEncodedMatchsCredentials('response.body'),
            rulesBuilder.jsonStringifiedMatchsCredentials('response.body2'),
            rulesBuilder.cookieMatchsCredentials(/headers.Cookie*/)
        ]
    }
)

/*
    {
        url: 'https://root:(obfucated)@gmail.com',
        user: 'root',
        password: '(obfucated)',
        email: '(obfucated)',
        age: 42
    }
*/
0.1.2

2 years ago

0.1.3

2 years ago

0.1.1

2 years ago