
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.
mezon-sdk
Advanced tools
JavaScript client for Mezon server written in TypeScript. For browser and React Native projects.
This client implements the full API for interacting with Mezon server. It's written in TypeScript with minimal dependencies to be compatible with all modern browsers and React Native.
Full documentation is online - https://mezon.ai/docs/javascript-client-guide
You'll need access to an instance of the Mezon server before you can connect with the client.
npm install mezon-sdk
You'll now see the code in the "node_modules" folder and package listed in your "package.json".
import { MezonClient } from "mezon-sdk";
const client = new MezonClient({ botId: BOT_ID, token: BOT_MEZON_TOKEN });
// Login to initialize session
await client.login();
The client object has many method to execute various features in the server.
To authenticate with the Mezon server you must provide an identifier for the user.
const appId = "<AppId>";
const botId = "<BotId>";
async authenticate(botId, apiKey) {
return this.apiClient
.mezonAuthenticate(apiKey, "", {
account: {
appid: botId,
token: apiKey,
},
})
.then(async (apiSession: ApiSession) => {
this.session = new Session(apiSession);
return this.session;
});
}
When authenticated the server responds with an auth token (JWT) which contains useful properties and gets deserialized into a Session object.
console.info(session.token); // raw JWT token
console.info(session.refreshToken); // refresh token
console.info("Session has expired?", session.isexpired(Date.now() / 1000));
const expiresAt = session.expires_at;
console.warn(
"Session will expire at:",
new Date(expiresAt * 1000).toISOString()
);
### Requests
The client includes lots of builtin APIs for various features of the Mezon server. These can be accessed with the methods which return Promise objects.
Most requests are sent with a session object which authorizes the client.
```js
const flags = await client.getFlags(session);
console.info("Flags:", flags);
The mezon-sdk supports secure token transfers using the Mezon Money Network (MMN) with zero-knowledge proofs for enhanced privacy and security.
Generate Ephemeral Key Pair
const keyPair = await client.getEphemeralKeyPair();
// Returns: { publicKey: string, privateKey: string }
Get Recipient Wallet Address
const address = await client.getAddress(senderId);
// Returns: string (wallet address)
Fetch Current Nonce
const nonce = await client.getCurrentNonce(senderId, "pending");
// Returns: number (transaction sequence)
Generate Zero-Knowledge Proof
const session = client.login();
const zkProofs = await client.getZkProofs({
user_id: senderId,
jwt: session.token,
address: address,
ephemeral_public_key: keyPair.publicKey,
});
// Returns: { zkProof: string, zkPub: string }
Execute Token Transfer
const sendTokenData: APISentTokenRequest = {
sender_id: client.clientId,
sender_name: BOT_NAME,
receiver_id: receiver_id,
amount: amount,
}
const result = await client.sendToken(sendTokenData);
// Returns: { tx_hash: string, ok: boolean, error: string }
import { MezonClient } from "mezon-sdk";
const client = new MezonClient({ botId: BOT_ID, token: BOT_MEZON_TOKEN });
// Login to initialize session
await client.login();
The development roadmap is managed as GitHub issues and pull requests are welcome. If you're interested in enhancing the code please open an issue to discuss the changes or drop in and discuss it in the community forum.
Ensure you are using Node v18>.
The codebase is multi-package monorepo written in TypeScript and can be built with esbuild. All dependencies are managed with Yarn.
To build from source, install dependencies and build the mezon-sdk package:
npm install --workspace=mezon-sdk && npm run build --workspace=mezon-sdk
To run tests you will need access to an instance of the Mezon server.
Tests are run against each workspace bundle; if you have made source code changes, you should npm run build --workspace=<workspace> prior to running tests.
npm run test --workspace=mezon-sdk-test
To release onto NPM if you have access to the "@mezon" organization you can use NPM.
npm run build --workspace=<workspace> && npm publish --access=public --workspace=<workspace>
API docs are generated with typedoc and deployed to GitHub pages.
To run typedoc:
npm install && npm run docs
This project is licensed under the Apache-2 License.
FAQs
Mezon typescript SDK.
The npm package mezon-sdk receives a total of 170 weekly downloads. As such, mezon-sdk popularity was classified as not popular.
We found that mezon-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

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.