2023-11-01 14:05:45 +03:00
|
|
|
# @mtcute/crypto-node
|
|
|
|
|
|
|
|
📖 [API Reference](https://ref.mtcute.dev/modules/_mtcute_crypto_node.html)
|
2022-08-24 23:37:26 +03:00
|
|
|
|
2021-05-01 21:22:20 +03:00
|
|
|
Native extension for NodeJS that improves performance of the most used
|
2023-11-02 19:11:26 +03:00
|
|
|
cryptographic mode in Telegram (IGE), which is not implemented directly by OpenSSL.
|
2021-05-01 21:22:20 +03:00
|
|
|
|
2023-11-02 19:11:26 +03:00
|
|
|
Uses OpenSSL under the hood to provide maximum performance
|
2021-05-01 21:22:20 +03:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
You will need all the pre-requisites for [node-gyp](https://github.com/nodejs/node-gyp#installation).
|
|
|
|
Pre-built packages are currently not available.
|
|
|
|
|
|
|
|
Then, install the package as usual. The native library will be built automatically.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```typescript
|
2024-03-06 21:20:44 +03:00
|
|
|
import { TelegramClient } from '@mtcute/core'
|
2021-08-05 20:38:24 +03:00
|
|
|
import { NodeNativeCryptoProvider } from '@mtcute/crypto-node'
|
2021-05-01 21:22:20 +03:00
|
|
|
|
|
|
|
const tg = new TelegramClient({
|
|
|
|
...,
|
|
|
|
crypto: () => new NodeNativeCryptoProvider()
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
2023-11-01 14:05:45 +03:00
|
|
|
> **Tip**: When using `@mtcute/node`, this will be done automatically for you.
|
|
|
|
|
2023-11-02 19:11:26 +03:00
|
|
|
## Benchmarks
|
|
|
|
|
2024-08-13 04:53:07 +03:00
|
|
|
See https://github.com/mtcute/benchmarks
|