Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
obfuscate-mail
Advanced tools
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
We found that obfuscate-mail demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.