
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.
attheme-preview
Advanced tools
A JavaScript package for generating previews of .attheme's, created by @AlexStrNik & @SnejUgal.
$npm i attheme-preview
import Attheme from "attheme-js";
import Preview from "attheme-preview";
import {
randomWallpaperHandler,
chatWallpaperHandler,
} from "attheme-preview/handlers";
import defaultTemplate from "attheme-preview/default-template";
import { writeFile } from "fs";
const theme = new Attheme(`
windowBackgroundWhite=-328966
`);
const preview = new Preview();
preview.setVariableHandler(Attheme.IMAGE_KEY, randomWallpaperHandler);
preview.addCustomHandler(chatWallpaperHandler);
preview.createPreview(theme, defaultTemplate)
.then(async (previewBuffer) => {
await fs.writeFile(`./preview.png`, previewBuffer);
console.log(`Done!`);
});
Not implented yet..
Params.sharp.density: number = 150
Density the preview should be rendered with.
Params.sharp.extension: "jpeg" | "png" | "webp" | "tiff" = "png"
The image type the rendered preview should be of.
Params.sharp.imageOptions: WebpOptions | JpegOptions | PngOptions | TiffOptions = {}
The rendering params that are passed to sharp
directly.
import { JSDOM } from "jsdom";
import { JpegOptions, PngOptions, TiffOptions, WebpOptions } from "sharp";
const IMAGE_KEY = Symbol.for(`image`);
type RawTheme = Theme | Buffer | string;
type Template = JSDOM | string;
interface SharpParams {
density?: number;
extension?: "jpeg" | "png" | "webp" | "tiff";
imageOptions?: WebpOptions | JpegOptions | PngOptions | TiffOptions;
}
interface Params {
sharp?: SharpParams;
}
interface Color {
red: number;
green: number;
blue: number;
alpha: number;
}
interface Theme {
[key: string]: Color;
[IMAGE_KEY]?: string;
}
interface VariableHandler {
(theme: Theme, params: Params): Color;
}
interface ClassHandler {
(element: SVGElement, theme: Theme, params: Params): void;
}
interface CustomHandler {
(preview: JSDOM, theme: Theme, params: Params): void;
}
new Preview()
Creates a new instance of Preview
.
preview.setVariableHandler(variable: string | IMAGE_KEY, handler: VariableHandler)
Registers a new getter for variable
. It isn't a usual property getter; it receives the theme and the passed params from preview.createPreview
.
preview.setClassHandler(className: string, handler: ClassHandler)
Registers a new handler for elements with className
class. After it's dome with coloring the template, attheme-preview
calls registered handlers for each element of the className
class. For example, if you register a handler for divider
, and there are six elements with class="divider"
, then the handler is called six times, receiving another class="divider"
element each time.
It is run after attheme-preview
filled the preview template with colors, but before custom ones.
preview.addCustomHandler(handler: CunstomHandler)
Registers a new handler that's run after the class ones. It receives the whole colored template tree.
preview.createPreview(theme: RawTheme, template: Template, params?: Params): Promise<Buffer>
Generates a new preview, and returns a buffer of a .png image (by Default).
The params
argument isn't used by this method, but it is passed to the handlers.
<path class="className"/>
or rect
or circle
Sets the fill
attribute to preview.getVariable(className, ...)
.
<image class="IMG" width="width" height="height"/>
@deprecatedSets the xlink:href
attribute to preview.getVariable(Attheme.IMAGE_KEY, ...)
.
The handler require(`attheme-preview/handlers/chatWallpaperHandler.js`)
must be added to make it work.
e.g: xlink:href
check puggo:cairo
bindings
e.g: gradient
support, text
support
implent RORO
everewhere
FAQs
.attheme preview module
We found that attheme-preview demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.