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.
chat-frontend-library
Advanced tools
npm install chat-frontend-library --save
Create Redux store:
import { configureStore } from '@reduxjs/toolkit';
import { chatApi, chatAppSlice, holaApi } from 'chat-frontend-library';
const store = configureStore({
reducer: {
[holaApi.reducerPath]: holaApi.reducer,
[chatApi.reducerPath]: chatApi.reducer,
[chatAppSlice.name]: chatAppSlice.reducer,
...
//Add your reducers if necessary
},
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(holaApi.middleware, chatApi.middleware, ...),
});
export default store;
Wrap your root component file in a Provider:
import store from './store';
import { Provider } from "react-redux";
<Provider store={store}>
<App />
</Provider>
Import the components and constants from the package into the file:
import { Chat, ChatList, LS_TOKEN_KEY } from "chat-frontend-library";
After logging the user into your application, you should set the access token in the local storage of the browser for the chat components:
localStorage.setItem(LS_TOKEN_KEY, access_token)
After calling the function to refresh a token from your app, the new received token must be installed in local storage of the browser under the key LS_TOKEN_KEY
and returned from the function.
import { Chat } from "chat-frontend-library";
<Chat
opponent_id="opponent_id"
user_locale="locale"
isOnlyChat={true}
cbHandleCloseChat={cbCloseChat}
handleRefreshToken={cbRefreshToken}
classHeader="customCSSClass"
classMessages="customCSSClass"
/>
prop | default | type | description |
---|---|---|---|
opponent_id | none | string | User opponent ID |
user_locale | ru/en | string | Chat interface language. The browser language is set by default |
isOnlyChat | none | boolean | true value is set when only the chat close functionality is used. false allows more chat functionality |
cbHandleCloseChat | none | function | A callback function that is called when the user clicks the close chat button |
handleRefreshToken | none | function | An asynchronous callback function that is called if the chat API call returns an error. Takes an axios error as an argument. Should return the new user token |
classHeader | " " | string | Adds a custom style class for the Chat header |
classMessages | " " | string | Adds a custom style class for the box with messages |
import { ChatList } from "chat-frontend-library";
<ChatList
user_locale="locale"
isOnlyChatList={true}
cbHandleCloseChatList={handleCloseList}
handleRefreshToken={handleRefreshToken}
classList="customCSSClass"
cbHandleOpenChat={handleOpenChat}
/>
prop | default | type | description |
---|---|---|---|
user_locale | ru/en | string | ChatList interface language. The browser language is set by default. |
isOnlyChatList | none | boolean | true value is set when only the chat list close functionality is used. false allows more chat list functionality. |
cbHandleCloseChatList | none | function | A callback function that is called when the user clicks the close chat button. |
cbHandleOpenChat | none | function | A callback function that is called when the user clicks on a specific chat in the list. Takes an object as a function argument: {chat_id:string; opponent_id:string} |
handleRefreshToken | none | function | An asynchronous callback function that is called if the chat API call returns an error. Takes an axios error as an argument. Should return the new user token. |
classList | " " | string | Adds a custom style class for the ChatList wrapper |
FAQs
``` npm install chat-frontend-library --save ```
The npm package chat-frontend-library receives a total of 217 weekly downloads. As such, chat-frontend-library popularity was classified as not popular.
We found that chat-frontend-library demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.