
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Generates Gravatar URLs using sha256 hashes with support for various options.
gravi
generates Gravatar URLs using sha256 hashes with support for various options.
It has no dependencies and works in node.js and the browser.
npm install gravi
For a basic Gravatar URL, you only need to provide an email address.
import { generateGravatarUrl } from 'gravi';
const email = 'user@example.com';
const url = await generateGravatarUrl(email);
console.log(url); // Default URL: https://www.gravatar.com/avatar/b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514
You can customize the Gravatar URL with various options like size, default image, rating, forced default image, file extension, protocol, and base URL.
import { generateGravatarUrl, GenerateGravatarUrlOptions } from 'gravi';
const email = 'user@example.com';
const options: GenerateGravatarUrlOptions = {
size: 200,
default: 'identicon',
rating: 'pg',
forcedefault: 'y',
extension: 'jpg',
protocol: 'http',
baseUrl: 'http://custom.gravatar.com/avatar/',
};
const url = await generateGravatarUrl(email, options);
console.log(url); // Custom URL: http://custom.gravatar.com/avatar/b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514.jpg?s=200&d=identicon&r=pg&f=y
If the email is null
, undefined
, or not a string, the function will use a default hash.
import { generateGravatarUrl } from 'gravi';
const undefinedEmail = undefined;
const url = await generateGravatarUrl(undefinedEmail);
console.log(url); // Default hash URL: https://www.gravatar.com/avatar/000000000000000000000000000000000000000000000000000000
You can combine various options to create highly customized Gravatar URLs.
import { generateGravatarUrl, GenerateGravatarUrlOptions } from 'gravi';
const email = 'user@example.com';
const options: GenerateGravatarUrlOptions = {
size: 150,
default: 'retro',
rating: 'g',
forcedefault: 'n',
extension: 'png',
protocol: 'https',
baseUrl: 'https://secure.gravatar.com/avatar/',
};
const url = await generateGravatarUrl(email, options);
console.log(url); // Custom URL: https://secure.gravatar.com/avatar/b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514.png?s=150&d=retro&r=g&f=n
generateGravatarUrl(email: string, options: GenerateGravatarUrlOptions = {})
email
(string | null | undefined): The email address for which to generate the Gravatar URL.options
(GenerateGravatarUrlOptions
): An optional object containing Gravatar options.GenerateGravatarUrlOptions
size
(number): The size of the Gravatar image.default
(string): URL or one of the built-in defaults (404
, mp
, identicon
, monsterid
, wavatar
, retro
, robohash
, blank
).rating
('g' | 'pg' | 'r' | 'x'): The rating of the Gravatar image.forcedefault
('y' | 'n'): Force the default Gravatar image to always be used.extension
('jpg' | 'png' | 'gif'): File extension for the Gravatar image.protocol
('http' | 'https'): The protocol to use. Default is https
.baseUrl
(string): The base URL for the Gravatar service. Default is <protocol>://www.gravatar.com/avatar/
.A Promise<string>
that resolves to the generated Gravatar URL. If the email is null
, undefined
, or not a string,
a default hash is used.
FAQs
Generates Gravatar URLs using sha256 hashes with support for various options.
The npm package gravi receives a total of 3,831 weekly downloads. As such, gravi popularity was classified as popular.
We found that gravi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.