
Product
Introducing Socket Scanning for VS Code Marketplace Extensions
Socket now scans VS Code extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.
@walkeros/server-core
Advanced tools
Server core utilities are Node.js-specific functions designed for server-side walkerOS implementations. These utilities handle server communication, cryptographic hashing, and other backend operations.
Import server utilities from the @walkeros/server-core package:
import { sendServer, getHashServer } from '@walkeros/server-core';
sendServer(url: string, data?: SendDataValue, options?: SendServerOptions): Promise<SendResponse>
sends HTTP requests using Node.js built-in modules (http/https).
// Simple POST request
const response = await sendServer('https://api.example.com/events', {
name: 'page view',
data: { url: '/home' },
});
// With custom options
const response = await sendServer(url, data, {
method: 'PUT',
headers: {
Authorization: 'Bearer token',
'Content-Type': 'application/json',
},
timeout: 10000, // 10 seconds
});
if (response.ok) {
console.log('Data sent successfully:', response.data);
} else {
console.error('Send failed:', response.error);
}
interface SendServerOptions {
headers?: Record<string, string>; // Custom HTTP headers
method?: string; // HTTP method (default: 'POST')
timeout?: number; // Request timeout in milliseconds (default: 5000)
}
interface SendResponse {
ok: boolean; // Indicates if the request was successful (2xx status)
data?: unknown; // Parsed response data (if available)
error?: string; // Error message (if request failed)
}
getHashServer(str: string, length?: number): Promise<string> generates SHA-256
hashes using Node.js crypto module.
// Generate full SHA-256 hash
const fullHash = await getHashServer('user123@example.com');
// Returns full 64-character hash
// Generate shortened hash for anonymization
const userFingerprint = await getHashServer(
userAgent + language + ipAddress + date.getDate(),
16,
);
// Returns 16-character hash like '47e0bdd10f04ef13'
// User identification while preserving privacy
const anonymousId = await getHashServer(`${userEmail}${deviceId}${salt}`, 12);
This function is commonly used for:
import { sendServer, getHashServer } from '@walkeros/server-core';
async function processUserEvent(event, userInfo) {
// Anonymize user identification
const anonymousUserId = await getHashServer(
`${userInfo.email}${userInfo.deviceId}`,
16,
);
// Prepare event with anonymized data
const processedEvent = {
...event,
user: {
...event.user,
id: anonymousUserId,
},
};
// Send to analytics service
const result = await sendServer(
'https://analytics.example.com/collect',
processedEvent,
{
headers: {
'X-API-Key': process.env.ANALYTICS_API_KEY,
},
timeout: 8000,
},
);
return result;
}
async function createSessionId(request) {
const fingerprint = [
request.headers['user-agent'],
request.ip.replace(/\.\d+$/, '.0'), // Anonymize IP
new Date().toDateString(), // Daily rotation
].join('|');
return await getHashServer(fingerprint, 20);
}
Server utilities include comprehensive error handling:
try {
const response = await sendServer(url, data, { timeout: 5000 });
if (response.ok) {
// Success - response.data contains the result
console.log('Success:', response.data);
} else {
// Request completed but with error status
console.warn('Request failed:', response.error);
}
} catch (error) {
// Network error, timeout, or other exception
console.error('Network error:', error.message);
}
Configure appropriate timeouts based on your use case:
// Fast analytics endpoint
await sendServer(url, data, { timeout: 2000 });
// Critical business data
await sendServer(url, data, { timeout: 15000 });
For high-volume scenarios, consider batching:
const events = [
/* ... multiple events ... */
];
const response = await sendServer(
'/api/events/batch',
{
events,
timestamp: Date.now(),
},
{
timeout: 10000,
},
);
The underlying Node.js HTTP agent automatically reuses connections for better performance with multiple requests to the same host.
// Good security practices
const apiKey = process.env.ANALYTICS_API_KEY;
const saltedHash = await getHashServer(`${userData}${process.env.HASH_SALT}`);
await sendServer('https://secure-api.example.com/events', data, {
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
timeout: 5000,
});
Server utilities work seamlessly with Core Utilities:
import { getMappingValue, anonymizeIP } from '@walkeros/core';
import { sendServer, getHashServer } from '@walkeros/server-core';
async function processServerSideEvent(rawEvent, clientIP) {
// Use core utilities for data processing
const processedData = await getMappingValue(rawEvent, mappingConfig);
const safeIP = anonymizeIP(clientIP);
// Use server utilities for transmission
const sessionId = await getHashServer(`${safeIP}${userAgent}`, 16);
return await sendServer(endpoint, {
...processedData,
sessionId,
ip: safeIP,
});
}
For platform-agnostic utilities, see Core Utilities.
Feel free to contribute by submitting an issue, starting a discussion, or getting in contact.
This project is licensed under the MIT License.
FAQs
Server-specific utilities for walkerOS
The npm package @walkeros/server-core receives a total of 3,021 weekly downloads. As such, @walkeros/server-core popularity was classified as popular.
We found that @walkeros/server-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket now scans VS Code extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Research
/Security News
Socket uncovered two malicious VS Code themes in a GlassWorm-linked cluster with thousands of installs across VS Code Marketplace and Open VSX.

Security News
/Company News
Capital One is partnering with Socket to proactively secure its open source supply chain.