
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@differentialhq/core
Advanced tools
This is the official Differential SDK for Typescript.
npm install @differentialhq/core
yarn add @differentialhq/core
pnpm add @differentialhq/core
Create a file named d.ts which will be used to initialize Differential. This file will export the Differential instance.
// d.ts
import { Differential } from "@differentialhq/core";
// Initialize Differential with your API secret.
// Get yours at https://console.differential.dev.
export const d = new Differential("YOUR_API_SECRET");
In a separate file, create the "Hello World" service. This file will import the Differential instance from d.ts and define the service.
// service.ts
import { d } from "./d";
// Define a simple function that returns "Hello, World!"
const sayHello = async (to: string) => {
return `Hello, ${to}!`;
};
// ...and as many other functions as you want, any async function can be a service operation
const callEndpoint = async () => {
return fetch("https://api.example.com");
};
// Register the function as a service
export const helloWorldService = d.service({
name: "helloWorld",
functions: {
sayHello,
callEndpoint,
},
});
When calling the service, use the typeof generic to ensure type safety. This can be done in any file where you need to call the service, like a test file or another service file.
// service-consumer.ts
import { d } from "./d";
import type { helloWorldService } from "./service";
const client = d.client<typeof helloWorldService>("helloWorld");
async function test() {
const greeting = await client.sayHello("World");
console.log(greeting); // Outputs: Hello, World!
}
test();
To run the service, simply run the file with the service definition. This will start the service and make it available to other services.
tsx service.ts
and then you can invoke the service from another file:
tsx service-consumer.ts
FAQs
Javascript SDK for differential.dev
The npm package @differentialhq/core receives a total of 186 weekly downloads. As such, @differentialhq/core popularity was classified as not popular.
We found that @differentialhq/core 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.