@vates/obfuscate
v0.1.0
Published
<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->
Downloads
240
Maintainers
Keywords
Readme
@vates/obfuscate
Install
Installation of the npm package:
npm install --save @vates/obfuscate
Usage
replace(value, replacement)
Recursively replace sensitive entries with a replacement value.
import { replace } from '@vates/obfuscate'
replace({ username: 'foo', password: 'bar' }, 'obfuscated')
// → { username: 'foo', password: 'obfuscated'}
obfuscate(value)
Recursively replace sensitive entries with a special tag.
import { obfuscate } from '@vates/obfuscate'
obfuscate({ username: 'foo', password: 'bar' })
// → {
// username: 'foo',
// password: 'obfuscated-q3oi6d9X8uenGvdLnHk2',
// }
merge(newValue, oldValue)
Replace entries obfuscated by
obfuscate()
in the new value by entries from the old one.This is especially useful to give an obfuscated value to a client, let them modify it, and then merge modified and unmodified values.
import { obfuscate, merge } from '@vates/obfuscate'
const original = { username: 'foo', password: 'bar', token: 'baz' }
// compute an obfuscated value to send to a client
const obfuscated = obfuscate(original)
// let the client update any entries
obfuscated.token = 'qux'
// merge the updated value with the original one
merge(obfuscated, original)
// → { username: 'foo', password: 'bar', token: 'qux' }
Contributions
Contributions are very welcomed, either on the documentation or on the code.
You may:
- report any issue you've encountered;
- fork and create a pull request.