
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@openwebf/webf-enterprise-typings
Advanced tools
TypeScript type definitions for WebF, with all types namespaced under webf.*
to avoid global namespace pollution.
npm install @openwebf/webf-enterprise-typings
import '@openwebf/webf-enterprise-typings';
// All WebF types are under the webf namespace
const div: webf.HTMLDivElement = document.createElement('div');
const blob: webf.Blob = await div.toBlob();
const base64: string = await blob.base64();
This package includes React utilities for seamless integration with WebF types.
// Import React utilities
import { toWebF, useWebFRef } from '@openwebf/webf-enterprise-typings/react';
Since React expects standard DOM types in JSX, but WebF provides enhanced functionality, use this pattern:
import React, { useRef, useEffect } from 'react';
import { toWebF } from '@openwebf/webf-enterprise-typings/react';
function MyComponent() {
// 1. Use standard DOM types for refs (React requirement)
const divRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (divRef.current) {
// 2. Cast to WebF type when you need WebF features
const webfDiv = toWebF(divRef.current);
// 3. Now use WebF-specific methods
webfDiv.toBlob().then(async (blob) => {
const base64 = await blob.base64();
console.log('Base64:', base64);
});
}
}, []);
// 4. In JSX, use standard elements
return <div ref={divRef}>Content</div>;
}
For convenience, use the useWebFRef
hook:
import { useWebFRef } from '@openwebf/webf-enterprise-typings/react';
function MyComponent() {
const { ref, webf } = useWebFRef<HTMLDivElement>();
useEffect(() => {
// Direct access to WebF element
webf?.toBlob().then(blob => {
// ...
});
}, [webf]);
return <div ref={ref}>Content</div>;
}
toWebF(element)
Casts a standard DOM element to its WebF equivalent:
isWebFElement(element)
Type guard to check if an element supports WebF features:
if (isWebFElement(element)) {
// element is now typed as webf.Element
element.toBlob();
}
webfEventHandler(handler)
Creates WebF-aware event handlers:
const handleClick = webfEventHandler((event: webf.MouseEvent) => {
console.log(event.clientX, event.clientY);
});
<div onClick={handleClick}>Click me</div>
useWebFRef<T>()
React hook that provides both standard ref and WebF-typed element:
const { ref, webf } = useWebFRef<HTMLCanvasElement>();
// ref: React.RefObject<HTMLCanvasElement>
// webf: webf.HTMLCanvasElement | null
All WebF types are properly namespaced to avoid conflicts with standard DOM types:
// Standard DOM types (from lib.dom.d.ts)
const domDiv: HTMLDivElement = document.createElement('div');
// WebF types (namespaced)
const webfDiv: webf.HTMLDivElement = toWebF(domDiv);
// WebF-specific methods
webfDiv.toBlob(); // ✅ Available on WebF type
domDiv.toBlob(); // ❌ Error: Property 'toBlob' does not exist
See the webf/example/tailwind_react
project for comprehensive examples of all features.
FAQs
TypeScript type definitions for WebF
We found that @openwebf/webf-enterprise-typings 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.