Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@lightbase/lightbot
Advanced tools
Lightbot.js is a client javascript SDK
It allows the developer to easily communicate with any lightbot agent.
import { LightbotMessenger } from "lightbot";
const lightbotMessenger = new LightbotMessenger({
hostURL: "http://localhost:9000",
agentId: "agent-id",
});
lightbotMessenger.toggleMessenger();
lightbotMessenger.sendMessage({
type: "plain",
sender: "human",
label: "Hello, I need some help!",
});
Property | Description | Type |
---|---|---|
messages | Message history | Message |
sendMessage | Sends a message to the bot | Function(message: Message): void |
toggleMessenger | Toggles messenger open state | Function() |
isMessengerOpen | Current open state | Boolean |
onChange | Called when any primitive property gets updated | Function(): void |
resetAgent | Resets all in memory and local storage data related to the bot agent. e.g.: messages, agent data, etc. | Function(): void |
Property | Description | Value |
---|---|---|
sender | Message sender identification | "bot" | "human" |
type | Type of message | "plain" | "link" | "jump" |
when type: "plain"
:
Property | Description | Type |
---|---|---|
label | Plain text message | string |
when type: "link"
:
Property | Description | Type |
---|---|---|
label | Representative link label | string |
link | link | string |
when type: "jump"
:
Property | Description | Type |
---|---|---|
label | Representative jump label | string |
jumps | link | Array<{ label: string; event: string; }> |
withLightbotMessenger
HOCLightbot.js provides a React HOC which can be used to provide a communication interface to your React components.
withLightbotMessenger<ComponentProps>(options: { agentId: string; hostURL: string; })(Component)
React components are exported from lib/lightbot-react
.
import {
LightbotMessage,
LightbotMessengerDecoratedProps,
withLightbotMessenger
} from "lightbot/lib/lightbot-react";
type AppProps = LightbotMessengerDecoratedProps & {
children: any;
}
class AppDisconnected extends Component<AppProps, {}> {
public render() {
const { messages, isMessengerOpen, toggleMessenger } = this.props;
return (
<>
{
isMessengerOpen ?
(<ChatWindow
messages={messages}
onMessageSend={this.sendMessage}
/>) :
null
}
<button onClick={toggleMessenger}>
{isMessengerOpen ? "close" : "open"}
</button>
</>
);
}
private sendMessage = (message: string) => {
this.props.sendMessage({ type: "plain", label: message });
}
}
export const App = withLightbotMessenger<AppProps>({
hostURL: "https://localhost:9000",
agentId: "agent-id"
})(AppDisconnected);
withLightbotMessenger
injects the same props as the one defined by the Lightbot API except the onChange is implemented in order to update your React components when any update is available.
FAQs
Javascript Client for Lightbot API
The npm package @lightbase/lightbot receives a total of 0 weekly downloads. As such, @lightbase/lightbot popularity was classified as not popular.
We found that @lightbase/lightbot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.