# @lemonldap-ng/crypto

> LemonLDAP::NG crypto class

Latest version **0.9.4** (published 2026-06-20) · GPL-2.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @lemonldap-ng/crypto
pnpm add @lemonldap-ng/crypto
yarn add @lemonldap-ng/crypto
bun add @lemonldap-ng/crypto
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.9.4 |
| Published | 2026-06-20 |
| First published | 2022-06-22 |
| Weekly downloads | 0 |
| License | GPL-2.0-or-later |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 44.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Maintainers | xguimard |
| Keywords | Lemonldap::NG, SSO, SAML, OpenID-Connect, SSOaaS |

## Links

- npm: https://www.npmjs.com/package/@lemonldap-ng/crypto
- Repository: https://github.com/LemonLDAPNG/lemonldap-ng.js
- Homepage: https://lemonldap-ng.org
- Issues: https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues
- npm.io page: https://npm.io/package/@lemonldap-ng/crypto

## Dependencies (3)

- [aes-js](https://npm.io/package/aes-js.md) ^3.1.2
- [sha.js](https://npm.io/package/sha.js.md) ^2.4.11
- [random-bytes](https://npm.io/package/random-bytes.md) ^1.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.9.4 (latest) — 2026-06-20
- 0.9.3 — 2026-01-22
- 0.8.0 — 2025-12-05
- 0.7.0 — 2025-04-09
- 0.6.4 — 2023-07-20
- 0.6.2 — 2022-09-29
- 0.6.1 — 2022-06-28
- 0.6.0 — 2022-06-22

## README

# @lemonldap-ng/crypto

@lemonldap-ng/crypto provide encrypt/decrypt methods used by [LemonLDAP::NG system](https://lemonldap-ng.org).

This library is compatible with LemonLDAP::NG >= 2.0.5.

Usage:

```js
import Crypto from '@lemonldap-ng/crypto`;
import {expect} from 'expect';
// or with expect < 28
import expect from 'expect';

const encrypter = new Crypto(key); // key is an ascii string, the real key is sha256(key)

let encryptedString = encrypter.encrypt(data);

let decryptedString = encrypter.decrypt(encryptedString);

expect(decryptedString).toEqual(data)

```

@lemonldap-ng/conf-cdbi is a component of [lemonldap-ng-handler](https://www.npmjs.com/package/lemonldap-ng-handler),
a Node.js handler for [LemonLDAP::NG WebSSO](https://lemonldap-ng.org).

---
_Source: https://npm.io/package/@lemonldap-ng/crypto · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
