Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
obfuscate-mail
Advanced tools
Readme
Email addresses should never been displayed by an api unless specifically requested by a recently authentified user.
This node.js library gives the options to obfuscate email addresses will leaving them more or less identifiable.
npm install obfuscate-mail
yarn add obfuscate-mail
const obfuscate = require('obfuscate-mail');
import obfuscate from 'obfuscate-mail';
obfuscate('example.example@example.com', {
// asterisksLength: 6,
// minimumNameObfuscationLength: 4,
// visibleCharactersStartLength: 3,
// visibleCharactersMiddleLength: 2,
// visibleCharactersEndLength: 2,
// showDomainName: false,
// showDomainExtension: true,
// invalidEmailValue: '*********@****.**',
});
=> exa***.e***le@***.com
asterisksLength
- default 6
minimumNameObfuscationLength
- default 4
visibleCharactersStartLength
- default 3
visibleCharactersMiddleLength
- default 2
visibleCharactersEndLength
- default 2
showDomainName
- default false
showDomainExtension
- default true
invalidEmailValue
- default *********@****.**
curl -o obfuscate.wasm https://raw.githubusercontent.com/rawpixel-vincent/obfuscate-mail/main/dist/bundle.wasm
echo '{ "email": "example.example@example.com", "options": {} }' | wasmtime obfuscate.wasm
=> "exa***.e***le@***.com"%
const result = obfuscate('example@example.com');
expect(result).equal('exa******@***.com');
const result = obfuscate('example.example@example.com');
expect(result).equal('exa***.e***le@***.com');
const result = obfuscate('e@example.com');
expect(result).equal('******@***.com');
const result = obfuscate('exa@example.com');
expect(result).equal('******@***.com');
const result = obfuscate('examp@example.com');
expect(result).equal('e******@***.com');
const result = obfuscate('example@example.com', {
showDomainName: true,
});
expect(result).equal('exa******@example.com');
const result = obfuscate('example.company+test@example.com', {
asterisksLength: 12,
});
expect(result).equal('exa******mp******st@*********.com');
const result = obfuscate('example@example.com', {
showDomainName: true,
showDomainExtension: false,
});
expect(result).equal('exa******@example.***');
const result = obfuscate('company.name@test.com', {
asterisksLength: 8,
visibleCharactersStartLength: 2,
visibleCharactersEndLength: 3,
showDomainName: false,
});
expect(result).equal('co****ny****ame@*****.com');
const result = obfuscate('company.name@test.com', {
visibleCharactersStartLength: 4,
visibleCharactersEndLength: 1,
minimumNameObfuscationLength: 6,
});
expect(result).equal('comp***.***e@***.com');
const result = obfuscate('company.name@test.com', {
visibleCharactersStartLength: 3,
visibleCharactersEndLength: 2,
minimumNameObfuscationLength: 6,
});
expect(result).equal('com***y***me@***.com');
const result = obfuscate('company.example@test.com', {
visibleCharactersStartLength: 2,
visibleCharactersMiddleLength: 3,
visibleCharactersEndLength: 2,
minimumNameObfuscationLength: 6,
});
expect(result).equal('co***y.e***le@***.com');
const result = obfuscate('company.name@test.com', {
visibleCharactersStartLength: 3,
visibleCharactersEndLength: 2,
minimumNameObfuscationLength: 10,
});
expect(result).equal('co******@***.com');
const result = obfuscate('company.name@test.com', {
visibleCharactersStartLength: 0,
visibleCharactersEndLength: 4,
});
expect(result).equal('***pa***name@***.com');
const result = obfuscate('email.without@domain-extension');
expect(result).equal('ema***wi***ut@***.***');
const result = obfuscate('abcdefgh.ijklmno@domain.com', {
visibleCharactersStartLength: 4,
visibleCharactersMiddleLength: 4,
visibleCharactersEndLength: 4,
});
expect(result).equal('abcd***gh.i***lmno@***.com');
const result = obfuscate('invalid email');
expect(result).equal('*********@****.**');
const result = obfuscate(null, { invalidEmailValue: 'invalid email' });
expect(result).equal('invalid email');
FAQs
Obfuscate email
The npm package obfuscate-mail receives a total of 597 weekly downloads. As such, obfuscate-mail popularity was classified as not popular.
We found that obfuscate-mail demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.