
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A powerful session recording and user behavior analytics SDK built for simplicity and privacy.
A powerful session recording and user behavior analytics SDK built for simplicity and privacy.
npm install @swing/sdk
import { SwingProvider } from '@swing/sdk';
// Wrap your app
function App() {
return (
<SwingProvider apiKey="your-api-key">
<YourApp />
</SwingProvider>
);
}
// Use in components
import { useSwingSDK } from '@swing/sdk';
function LoginComponent() {
const { identifyUser, sendCustomEvent } = useSwingSDK();
const handleLogin = (user) => {
identifyUser(user.id, { email: user.email });
sendCustomEvent('user_login', { method: 'email' });
};
}
// Initialize with redaction
<SwingProvider
apiKey="your-key"
options={{
redactFields: [
'input[type="password"]', // All password fields
'input[type="email"]', // All email fields
'.sensitive-data', // Any element with this class
'#credit-card-number', // Specific element ID
'[data-private]' // Any element with data-private attribute
]
}}
>
<App />
</SwingProvider>
// Update redaction dynamically
const { setRedactedFields, getRedactedFields } = useSwingSDK();
// Add more fields to redact
setRedactedFields([
...getRedactedFields(),
'.payment-info',
'#social-security'
]);
<!-- These will be redacted -->
<input type="password" name="password" />
<input type="email" class="sensitive-data" />
<div data-private>Secret content</div>
<span class="credit-card">4111 1111 1111 1111</span>
<!-- These will be recorded normally -->
<input type="text" name="username" />
<button>Submit</button>
<div>Public content</div>
interface SwingSDKProviderProps {
apiKey: string; // Your Swing API key
children: ReactNode;
options?: {
userId?: string; // Initial user ID
sessionId?: string; // Custom session ID
redactFields?: string[]; // CSS selectors to redact
};
}
const {
// User Management
setUser, // (user: SwingUser) => void
identifyUser, // (userId: string, properties?) => void
clearUser, // () => void
// Custom Events
sendCustomEvent, // (name: string, properties?) => void
// Privacy Controls
setRedactedFields, // (selectors: string[]) => void
getRedactedFields, // () => string[]
// Status
isInitialized // boolean
} = useSwingSDK();
const { sendCustomEvent } = useSwingSDK();
// Track business events
sendCustomEvent('purchase_completed', {
amount: 99.99,
currency: 'USD',
items: ['product_1', 'product_2']
});
// Track feature usage
sendCustomEvent('feature_used', {
feature: 'dark_mode',
enabled: true
});
const { identifyUser, setUser, clearUser } = useSwingSDK();
// Simple identification
identifyUser('user_123');
// With properties
identifyUser('user_123', {
email: 'john@example.com',
plan: 'premium',
signupDate: '2024-01-15'
});
// Full user object
setUser({
id: 'user_123',
email: 'john@example.com',
name: 'John Doe',
properties: {
plan: 'premium',
lastSeen: new Date()
}
});
// Clear user (logout)
clearUser();
const { setRedactedFields, getRedactedFields } = useSwingSDK();
// Get current redacted fields
const current = getRedactedFields();
console.log(current); // ['input[type="password"]']
// Add more fields
setRedactedFields([
...current,
'.sensitive',
'#secret-div',
'input[name="ssn"]'
]);
// Replace all fields
setRedactedFields([
'input[type="password"]',
'input[type="email"]',
'.payment-form input'
]);
console.log(), console.error(), console.warn(), console.info()// Redact PII fields
setRedactedFields([
'input[type="email"]',
'input[name*="name"]',
'input[name*="phone"]',
'.pii-data',
'[data-sensitive]'
]);
<SwingProvider
apiKey={process.env.SWING_API_KEY}
options={{
redactFields: [
// Always redact these in production
'input[type="password"]',
'input[type="email"]',
'.payment-info',
'.personal-data',
'[data-private]'
]
}}
>
The SDK sends data to your Swing backend at /upload. See the Backend Documentation for setup instructions.
Check out the Fitia demo app for complete examples of:
FAQs
A powerful session recording and user behavior analytics SDK built for simplicity and privacy.
The npm package swing-sdk receives a total of 1 weekly downloads. As such, swing-sdk popularity was classified as not popular.
We found that swing-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.