Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ldapts

ldapts483.2kMIT8.0.0TypeScript support: included

LDAP client

ldap, active, directory

readme

LDAPts

NPM version node version Known Vulnerabilities

Providing an API to access LDAP directory servers from Node.js programs.

Table of Contents

API details

Create a client

The code to create a new client looks like:

import { Client } from 'ldapts';

const client = new Client({
  url: 'ldaps://ldap.jumpcloud.com',
  timeout: 0,
  connectTimeout: 0,
  tlsOptions: {
    minVersion: 'TLSv1.2',
  },
  strictDN: true,
});

You can use ldap:// or ldaps://; the latter would connect over SSL (note that this will not use the LDAP TLS extended operation, but literally an SSL connection to port 636, as in LDAP v2). The full set of options to create a client is:

Attribute Description
url A valid LDAP URL (proto/host/port only)
timeout Milliseconds client should let operations live for before timing out (Default: Infinity)
connectTimeout Milliseconds client should wait before timing out on TCP connections (Default: OS default)
tlsOptions TLS connect() options
strictDN Force strict DN parsing for client methods (Default is true)

Specifying Controls

Single or an array of Control objects can be added to various operations like the following:

import { Control } from 'ldapts/controls';

const { searchEntries, searchReferences } = await client.search(
  searchDN,
  {
    filter: '(mail=peter.parker@marvel.com)',
  },
  new Control('1.2.840.113556.1.4.417'),
);

You can also subclass Control for finer control over how data is parsed and written. Look at PagedResultsControl for an example.

bind

bind(dnOrSaslMechanism, [password], [controls])

Performs a bind operation against the LDAP server.

Arguments:

Argument Description
dnOrSaslMechanism (string) The name (DN) of the directory object that the client wishes to bind as or the SASL mechanism (PLAIN, EXTERNAL)
[password] (string) Password for the target bind DN. For SASL this is instead an optional set of encoded SASL credentials.
[controls] (Control|Control[]) Optional Control object or array of Control objects

Simple Example:

await client.bind('cn=root', 'secret');

SASL Example:

// No credentials
await client.bind('EXTERNAL');

// With credentials
const credentials = '...foo...';
await client.bind('PLAIN', credentials);

startTLS

startTLS(options, [controls])

Performs a StartTLS extended operation against the LDAP server to initiate a TLS-secured communication channel over an otherwise clear-text connection.

Arguments:

Argument Description
options (object) TLS connect() options
[controls] (Control|Control[]) Optional Control object or array of Control objects

Example:

await client.startTLS({
  ca: [fs.readFileSync('mycacert.pem')],
});

add

add(dn, entry, [controls])

Performs an add operation against the LDAP server.

Allows you to add an entry (as a js object or array of Attributes), and as always, controls are optional.

Arguments:

Argument Description
dn (string) The DN of the entry to add
entry (object|Attribute[]) The set of attributes to include in that entry
[controls] (Control|Control[]) Optional Control object or array of Control objects

Example:

var entry = {
  cn: 'foo',
  sn: 'bar',
  email: ['foo@bar.com', 'foo1@bar.com'],
  objectclass: 'fooPerson',
};
await client.add('cn=foo, o=example', entry);

compare

compare(dn, attribute, value, [controls])

Performs an LDAP compare operation with the given attribute and value against the entry referenced by dn.

Arguments:

Argument Description
dn (string) The DN of the entry in which the comparison is to be made
attribute (string) The Name of the attribute in which the comparison is to be made
value (string) The Attribute Value Assertion to try to find in the specified attribute
[controls] (Control|Control[]) Optional Control object or array of Control objects

Returns: (boolean): Returns true if the target entry exists and does contain the specified attribute value; otherwise false

Example:

const hasValue = await client.compare('cn=foo, o=example', 'sn', 'bar');

del

del(dn, [controls])

Deletes an entry from the LDAP server.

Arguments:

Argument Description
dn (string) The DN of the entry to delete
[controls] (Control|Control[]) Optional Control object or array of Control objects

Example:

await client.del('cn=foo, o=example');

exop

exop(oid, [value], [controls])

Performs an LDAP extended operation against an LDAP server.

Arguments:

Argument Description
oid (string) Object identifier representing the type of request
[value] (string) Optional value - based on the type of operation
[controls] (Control|Control[]) Optional Control object or array of Control objects

Example (performs an LDAP 'whoami' extended op):

const { value } = await client.exop('1.3.6.1.4.1.4203.1.11.3');

modify

modify(name, changes, [controls])

Performs an LDAP modify operation against the LDAP server. This API requires you to pass in a Change object, which is described below. Note that you can pass in a single Change or an array of Change objects.

Arguments:

Argument Description
dn (string) The DN of the entry to modify
changes (Change|Change[]) The set of changes to make to the entry
[controls] (Control|Control[]) Optional Control object or array of Control objects

Example (update multiple attributes):

import { Attribute, Change } from 'ldapts';

await client.modify('cn=foo, o=example', [
  new Change({ operation: 'replace', modification: new Attribute({ type: 'title', values: ['web tester'] }) }),
  new Change({ operation: 'replace', modification: new Attribute({ type: 'displayName', values: ['John W Doe'] }) }),
]);

Example (update binary attribute):

import { Attribute, Change } from 'ldapts';

const thumbnailPhotoBuffer = await fs.readFile(path.join(__dirname, './groot_100.jpg'));

var change = new Change({
  operation: 'replace',
  modification: new Attribute({
    type: 'thumbnailPhoto;binary',
    values: [thumbnailPhotoBuffer],
  }),
});

await client.modify('cn=foo, o=example', change);

Change

Change({ operation, modification })

A Change object maps to the LDAP protocol of a modify change, and requires you to set the operation and modification.

Arguments:

Argument Description
operation (replace|add|delete) See table below
modification (Attribute) Attribute details to add, remove, or update

Operations:

Value Description
replace Replaces the attribute referenced in modification. If the modification has no values, it is equivalent to a delete.
add Adds the attribute value(s) referenced in modification. The attribute may or may not already exist.
delete Deletes the attribute (and all values) referenced in modification.

modifyDN

modifyDN(dn, newDN, [controls])

Performs an LDAP modifyDN (rename) operation against an entry in the LDAP server. A couple points with this client API:

  • There is no ability to set "keep old dn." It's always going to flag the old dn to be purged.
  • The client code will automatically figure out if the request is a "new superior" request ("new superior" means move to a different part of the tree, as opposed to just renaming the leaf).

Arguments:

Argument Description
dn (string) The DN of the entry to rename
newDN (string) The new RDN to use assign to the entry. It may be the same as the current RDN if you only intend to move the entry beneath a new parent. If the new RDN includes any attribute values that aren’t already in the entry, the entry will be updated to include them.
[controls] (Control|Control[]) Optional Control object or array of Control objects

Example:

await client.modifyDN('cn=foo, o=example', 'cn=bar');

search(baseDN, options, [controls])

Performs a search operation against the LDAP server.

The search operation is more complex than the other operations, so this one takes an options object for all the parameters.

Arguments:

Argument Description
baseDN (string) The base of the subtree in which the search is to be constrained
options (object) See table below
[controls] (Control|Control[]) Optional Control object or array of Control objects

Options:

Attribute Description
[scope=sub] (string)
  • base - Indicates that only the entry specified as the search base should be considered. None of its subordinates will be considered.
  • one - Indicates that only the immediate children of the entry specified as the search base should be considered. The base entry itself should not be considered, nor any descendants of the immediate children of the base entry.
  • sub - Indicates that the entry specified as the search base, and all of its subordinates to any depth, should be considered.
  • children - Indicates that the entry specified by the search base should not be considered, but all of its subordinates to any depth should be considered.
[filter=(objectclass=*)] (string|Filter) The filter of the search request. It must conform to the LDAP filter syntax specified in RFC4515
[derefAliases=never] (string)
  • never - Never dereferences entries, returns alias objects instead. The alias contains the reference to the real entry.
  • always - Always returns the referenced entries, not the alias object.
  • search - While searching subordinates of the base object, dereferences any alias within the search scope. Dereferenced objects become the bases of further search scopes where the Search operation is also applied by the server. The server should eliminate duplicate entries that arise due to alias dereferencing while searching.
  • find - Dereferences aliases in locating the base object of the search, but not when searching subordinates of the base object.
[returnAttributeValues=true] (boolean) If true, attribute values should be included in the entries that are returned; otherwise entries that match the search criteria should be returned containing only the attribute descriptions for the attributes contained in that entry but should not include the values for those attributes.
[sizeLimit=0] (number) The maximum number of entries that should be returned from the search. A value of zero indicates no limit. Note that the server may also impose a size limit for the search operation, and in that case the smaller of the client-requested and server-imposed size limits will be enforced.
[timeLimit=10] (number) The maximum length of time, in seconds, that the server should spend processing the search. A value of zero indicates no limit. Note that the server may also impose a time limit for the search operation, and in that case the smaller of the client-requested and server-imposed time limits will be enforced.
[paged=false] (boolean|SearchPageOptions) Used to allow paging and specify the page size. Note that even with paged options the result will contain all of the search results. If you need to paginate over results have a look at to searchPaginated method.
[attributes=] (string[]) A set of attributes to request for inclusion in entries that match the search criteria and are returned to the client. If a specific set of attribute descriptions are listed, then only those attributes should be included in matching entries. The special value “” indicates that all user attributes should be included in matching entries. The special value “+” indicates that all operational attributes should be included in matching entries. The special value “1.1” indicates that no attributes should be included in matching entries. Some servers may also support the ability to use the “@” symbol followed by an object class name (e.g., “@inetOrgPerson”) to request all attributes associated with that object class. If the set of attributes to request is empty, then the server should behave as if the value “” was specified to request that all user attributes be included in entries that are returned.
[explicitBufferAttributes=] (string[]) List of explicit attribute names to return as Buffer objects

Example:

const { searchEntries, searchReferences } = await client.search(searchDN, {
  filter: '(mail=peter.parker@marvel.com)',
});

Please see Client tests for more search examples

searchPaginated

search(baseDN, options, [controls])

Performs a search operation against the LDAP server and retrieve results in a paginated way.

The searchPagination the same options with search method but returns an iterator.

Example:

const paginator = client.searchPaginated('o=5be4c382c583e54de6a3ff52,dc=jumpcloud,dc=com', {
  filter: 'objectclass=*',
  paged: {
    pageSize: 10,
  },
});

let total = 0;
for await (const searchResult of paginator) {
  total += searchResult.searchEntries.length;
  console.log(searchResult.searchEntries);
}

console.log(`total results: ${total}`);

Filter Strings

The easiest way to write search filters is to write them compliant with RFC2254, which is "The string representation of LDAP search filters."

Assuming you don't really want to read the RFC, search filters in LDAP are basically are a "tree" of attribute/value assertions, with the tree specified in prefix notation. For example, let's start simple, and build up a complicated filter. The most basic filter is equality, so let's assume you want to search for an attribute email with a value of `foo@bar.com`. The syntax would be:

const filter = `(email=foo@bar.com)`;

ldapts requires all filters to be surrounded by '()' blocks. Ok, that was easy. Let's now assume that you want to find all records where the email is actually just anything in the "@bar.com" domain and the location attribute is set to Seattle:

const filter = `(&(email=*@bar.com)(l=Seattle))`;

Now our filter is actually three LDAP filters. We have an and filter (single amp &), an equality filter (the l=Seattle), and a substring filter. Substrings are wildcard filters. They use * as the wildcard. You can put more than one wildcard for a given string. For example you could do (email=*@*bar.com) to match any email of @bar.com or its subdomains like "example@foo.bar.com".

Now, let's say we also want to set our filter to include a specification that either the employeeType not be a manager nor a secretary:

const filter = `(&(email=*@bar.com)(l=Seattle)(!(|(employeeType=manager)(employeeType=secretary))))`;

The not character is represented as a !, the or as a single pipe |. It gets a little bit complicated, but it's actually quite powerful, and lets you find almost anything you're looking for.

Return buffer for specific attribute

Sometimes you may want to get a buffer back instead of a string for an attribute value. Depending on the server software, you may be able to append ;binary (the binary attribute subtype) to the attribute name, to have the value returned as a Buffer.

const searchResults = await ldapClient.search('ou=Users,o=5be4c382c583e54de6a3ff52,dc=jumpcloud,dc=com', {
  filter: '(mail=peter.parker@marvel.com)',
  attributes: ['jpegPhoto;binary'],
});

However, some servers are very strict when it comes to the binary attribute subtype and will only acknowledge it if there is an associated AN.1 type or valid BER encoding. In those cases, you can tell ldapts to explicitly return a Buffer for an attribute:

const searchResult = await client.search('ou=Users,o=5be4c382c583e54de6a3ff52,dc=jumpcloud,dc=com', {
  filter: '(mail=peter.parker@marvel.com)',
  explicitBufferAttributes: ['jpegPhoto'],
});

unbind

unbind()

Used to indicate that the client wants to close the connection to the directory server.

Example:

await client.unbind();

Usage Examples

Authenticate example

const { Client } = require('ldapts');

const url = 'ldap://ldap.forumsys.com:389';
const bindDN = 'cn=read-only-admin,dc=example,dc=com';
const password = 'password';

const client = new Client({
  url,
});

let isAuthenticated;
try {
  await client.bind(bindDN, password);
  isAuthenticated = true;
} catch (ex) {
  isAuthenticated = false;
} finally {
  await client.unbind();
}

Search example

const { Client } = require('ldapts');

const url = 'ldaps://ldap.jumpcloud.com';
const bindDN = 'uid=tony.stark,ou=Users,o=5be4c382c583e54de6a3ff52,dc=jumpcloud,dc=com';
const password = 'MyRedSuitKeepsMeWarm';
const searchDN = 'ou=Users,o=5be4c382c583e54de6a3ff52,dc=jumpcloud,dc=com';

const client = new Client({
  url,
  tlsOptions: {
    rejectUnauthorized: args.rejectUnauthorized,
  },
});

try {
  await client.bind(bindDN, password);

  const { searchEntries, searchReferences } = await client.search(searchDN, {
    scope: 'sub',
    filter: '(mail=peter.parker@marvel.com)',
  });
} catch (ex) {
  throw ex;
} finally {
  await client.unbind();
}

Delete Active Directory entry example

const { Client } = require('ldapts');

const url = 'ldap://127.0.0.1:1389';
const bindDN = 'uid=foo,dc=example,dc=com';
const password = 'bar';
const dnToDelete = 'uid=foobar,dc=example,dc=com';

const client = new Client({
  url,
});

try {
  await client.bind(bindDN, password);

  await client.del(dnToDelete);
} catch (ex) {
  if (ex instanceof InvalidCredentialsError) {
    // Handle authentication specifically
  }

  throw ex;
} finally {
  await client.unbind();
}

using declaration with Typescript

For more details look have a look at using Declarations and Explicit Resource Management

{
  await using client = new Client({
    url: 'ldap://127.0.0.1:1389',
  });
  await client.bind(bindDN, password);
}
// unbind is called

Configuring Secure Connections

When configuring secure connections in ldapts, it is important to choose the appropriate TLS method (via the Client constructor or client.startTLS) based on your LDAP server's requirements. Prefer connecting securely from the Client constructor if the server supports LDAP over SSL. If that's not available but the connection can be upgraded to a secure connection, then connect insecurely and call startTLS to upgrade the connection to be secure.

Use Client Constructor for LDAPS

If the LDAP server requires ldaps:// (LDAP over SSL), specify ldaps:// in the url and provide tlsOptions to the Client constructor to handle certificate validation. This will establish a secure connection to the LDAP server over TLS from the moment the LDAP client is instantiated.

Example:

import { Client } from 'ldapts';
import fs from 'fs';
const client = new Client({
  url: 'ldaps://ldap.example.com',
  tlsOptions: {
    ca: [fs.readFileSync('/path/to/ca-cert.pem')],
  },
});

Use client.startTLS for STARTTLS

If the server is unable to support LDAP over SSL but supports STARTTLS, the connection can be upgraded to a secure connection. Connect to the server using ldap:// and call client.startTLS() to upgrade to a secure connection.

Example:

import { Client } from 'ldapts';
import fs from 'fs';
const client = new Client({ url: 'ldap://ldap.example.com' });
async function connectWithStartTLS() {
  await client.startTLS({
    ca: [fs.readFileSync('/path/to/ca-cert.pem')],
  });
}

Common Errors

Client network socket disconnected before secure TLS connection was established

Cause: There is a mismatch between the LDAP protocol being used by the client and server. For example, The server expects an ldaps:// connection, but the client uses ldap:// without upgrading to TLS. Alternatively, the client is configured to use LDAP over SSL, but is connecting to the server using the ldap:// protocol.

Solution: Review the configuration options above and ensure that the client and server are configured to use the same protocol. If connecting to a ldap:// address, call startTLS() to upgrade the connection. If connecting to an ldaps:// protocol, provide the TLS options in the Client constructor.

UNABLE_TO_VERIFY_LEAF_SIGNATURE

Cause: The LDAP server's certificate is untrusted, often due to a self-signed certificate or an incomplete certificate chain.

Solution(s):

  • Provide the CA certificate to establish trust:

    import fs from 'fs';
    
    const client = new Client({
      url: 'ldaps://ldap.example.com',
      tlsOptions: {
        ca: [fs.readFileSync('/path/to/ca-cert.pem')],
      },
    });
  • Allow self-signed certificates (not recommended for production):

    const client = new Client({
      url: 'ldaps://ldap.example.com',
      tlsOptions: {
        rejectUnauthorized: false, // Allow untrusted certificates
      },
    });

ECONNREFUSED

Cause: The LDAP server is not reachable at the specified host and port, or the server is not listening on the expected protocol.

Solution:

  • Verify the server address, port, and protocol in the url.
  • Ensure the server is running and accessible.
  • Check firewall rules to allow connections on the required port (636 for ldaps, 389 for ldap).

Handshake inactivity timeout

Cause: The server takes too long to respond to the TLS handshake due to network latency or misconfiguration.

Solution:

  • Check the LDAP server's performance.
  • Verify TLS configuration (e.g., ciphers and protocols) on both client and server.
  • Increase the timeout if necessary:

    const client = new Client({
      url: 'ldaps://ldap.example.com',
      timeout: 30000, // 30 seconds
    });

Self signed certificate in certificate chain

Cause: The server uses a certificate signed by an untrusted CA.

Solution: Provide the CA certificate:

import fs from 'fs';

const client = new Client({
  url: 'ldaps://ldap.example.com',
  tlsOptions: {
    ca: [fs.readFileSync('/path/to/ca-cert.pem')],
  },
});

DEPTH_ZERO_SELF_SIGNED_CERT

Cause: The LDAP server is using a self-signed certificate without an intermediate CA.

Solution(s):

  • Use the server's certificate as the trusted CA:

    import fs from 'fs';
    
    const client = new Client({
      url: 'ldaps://ldap.example.com',
      tlsOptions: {
        ca: [fs.readFileSync('/path/to/server-cert.pem')],
      },
    });
  • Allow self-signed certificates (not recommended for production):

    const client = new Client({
      url: 'ldaps://ldap.example.com',
      tlsOptions: {
        rejectUnauthorized: false, // Allow self-signed certificates
      },
    });

Development

Generate certificates

Run generate-certs.js

node tests/data/generate-certs.mjs

Start test OpenLDAP server

docker compose up -d

Close test OpenLDAP server

docker compose down

changelog

8.0.0 (2025-05-05)

Bug Fixes

BREAKING CHANGES

  • Drop support for Node.js v18. Minimum required version is now Node.js v20.

  • Updated engines field in package.json

  • Updated CI configuration to test on supported versions only

  • Run CI jobs for PRs targeting main

7.4.0 (2025-04-07)

Features

  • ensure socket is destroyed after unbind and connection errors (#180) (bcf433c)

7.3.3 - 2024-03-24

7.3.2 - 2024-03-10

  • Update npms

7.3.1 - 2024-01-08

  • Include Filter type definition. Fix #164. Thank you @ddequidt!
  • Update npms

7.3.0 - 2024-12-17

  • Update npms
  • Use node protocol for built-in modules. #163 Than you @ayZagen!

7.2.2 - 2024-11-29

  • Fix modifyDN newSuperior not working with the long form. #162 Thank you @Oh-suki!
  • Update npms

7.2.1 - 2024-09-30

  • Fix Property 'asyncDispose' does not exist on type 'SymbolConstructor'. #158 Thank you @ayZagen!
  • Update npms

7.2.0 - 2024-09-10

  • Make Client disposable. #155 Thank you @ayZagen!
  • Allow search to be paginated via searchPaginated. #156 Thank you @ayZagen!
  • Allow subordinates to be used as search scope. #157 Thank you @ayZagen!
  • Update npms

7.1.1 - 2024-08-26

  • Update npms
  • Replace deprecated parse from url module with parseURL from whatwg-url
  • Replace deprecated string#substr and buffer#slice usage

7.1.0 - 2024-07-09

  • Ensure errors have name and prototype set
  • Update npms
  • Update eslint to use flat config

7.0.12 - 2024-05-13

  • Update npms

7.0.11 - 2024-04-08

  • Fix DN clone method when RDNs array is not empty. Fix #149
  • Update npms

7.0.10 - 2024-03-11

  • Update npms

7.0.9 - 2024-02-07

  • Update npms

7.0.8 - 2024-01-05

  • Update npms

7.0.7 - 2023-11-28

  • Update npms

7.0.6 - 2023-10-27

  • Update npms

7.0.5 - 2023-10-10

  • Fix CommonJS package issues. NOTE: All exports are at the root level now. For example: import { Control } from 'ldapts/controls'; is now import { Control } from 'ldapts';
  • Include src in npm package

7.0.4 - 2023-10-09

  • Fix toString output for OrFilter and NotFilter

7.0.3 - 2023-10-06

  • Fix asn1 import statements

7.0.2 - 2023-10-06

  • Update some missing import/export statements to include extensions
  • Enable allowSyntheticDefaultImports to fix asn1 import statements

7.0.1 - 2023-10-05

  • Update import/export statements to include extensions

7.0.0 - 2023-10-05

  • Drop Node.js 16 support
  • Updated to ES module
  • Changed mocha test runner to use tsx instead of ts-node
  • Update npms

6.0.0 - 2023-07-24

  • Update npms
  • Fix lots of lint issues
  • Change Client.messageDetailsByMessageId to be a map
  • Fix Client._send signature to return undefined
  • Change MessageResponseStatus, ProtocolOperation, and SearchFilter from enum to a const
  • Enforce toString() definition for filters

5.0.0 - 2023-07-18

  • Drop Node.js 14 support
  • Update npms
  • Add OpenLDAP test server! Fix #135 Thanks @tsaarni!
  • Allow for optional password by setting a default empty string. Fix #134 Thanks @wattry, @TimoHocker, and @thernstig!
  • Fix reading controls from responses. Fix #106

4.2.6 - 2023-04-28

  • Update npms

4.2.5 - 2023-04-17

  • Update npms

4.2.4 - 2023-02-21

  • Check for socket if short-circuiting _connect()

4.2.3 - 2023-02-20

  • Update npms
  • Fix socket connection not established error. Fix #127 Thanks @Templum!

4.2.2 - 2023-01-03

  • Update npms
  • Enable noUncheckedIndexedAccess compiler option

4.2.1 - 2022-10-11

  • Update npms

4.2.0 - 2022-09-14

  • Add DIGEST-MD5 and SCRAM-SHA-1 SASL mechanisms (PR #120). Thanks @TimoHocker!
  • Update npms

4.1.1 - 2022-08-30

  • Update npms

4.1.0 - 2022-06-24

  • Remove automatically appending ;binary to attributes. Fix #114
  • Update npms

4.0.0 - 2022-05-23

  • Drop Node.js 12 support
  • Update npms

3.2.4 - 2022-04-13

  • Update npms

3.2.3 - 2022-03-22

  • Update npms

3.2.2 - 2022-02-22

  • Update npms
  • Update husky to support Apple silicon homebrew package links

3.2.1 - 2021-12-30

  • Update npms
  • Expand type definition version constraints. Fix #108

3.2.0 - 2021-12-21

  • Fix SASL authentication. Thanks @wattry!
  • Update npms

3.1.2 - 2021-11-16

  • Update npms

3.1.1 - 2021-10-29

  • Update npms
  • Format markdown files

3.1.0 - 2021-09-20

  • Allow EqualityFilter to accept Buffer as a value

3.0.7 - 2021-09-14

  • Update npms

3.0.6

  • Update npms

3.0.5

  • Add documentation for explicitBufferAttributes
  • Format and lint markdown files

3.0.4

  • Fix relative path in source maps. Fixes #102. Thanks @stevenhair!

3.0.3

  • Update npms

3.0.2

  • Update npms

3.0.1

3.0.0

  • Drop Node.js 10 support
  • Add Node.js v16 to CI tests
  • Update npms
  • Allow timeLimit: 0 in search options. Fix #97. Thanks @liudonghua123!

2.12.0

  • Export error classes. Fix #93
  • Redact password field from debug logging during send(). Fix #94
  • Update npms
  • Enable package-lock.json to speed up CI builds

2.11.1

  • Update npms

2.11.0

  • Update npms
  • Sort union/intersection members
  • Revert remove sequence identifier for SASL authentication

2.10.1

  • Update npms
  • Fix documentation for SASL authentication
  • Remove sequence identifier for SASL authentication

2.10.0

  • Add support for PLAIN and EXTERNAL SASL authentication to bind request

2.9.1

  • Simplify control import directives

2.9.0

  • Update npms
  • Improve Control usability and provide example test for search with a custom Control. Fix #91

2.8.1

  • Fix null/undefined values for attributes when calling add(). Fix #88

2.8.0

  • Fix modifyDN to ignore escaped commas when determining NewSuperior. PR #87 Thanks @hasegawa-jun!
  • Add tests for modifyDN
  • Update npms
  • Format code with prettier

2.7.0

  • Support NewSuperior with modifyDN. PR #84 Thanks @IsraelFrid!
  • Update npms

2.6.1

  • Added documentation for explicitBufferAttributes attribute

2.6.0

  • Update npms
  • Expose parsedBuffers on Attribute and added explicitBufferAttributes to search options. Fix #72 and Fix #82

2.5.1

  • Update npms

2.5.0

  • Update @types/node npm to latest version. Fix #73
  • Add mocharc file

2.4.0

  • Add Buffer as value type for client.exop(). Fixes #74

2.3.0

  • Update npms
  • Update Typescript to v3.9

2.2.1

  • Update npms

2.2.0

  • Support startTLS for upgrading an existing connection to be encrypted. Fix #71
  • Fix type of tlsOptions to tls.ConnectionOptions in Client constructor options
  • Fix sending exop with empty/undefined value
  • Add .id to internal socket to allow cleanup when unbinding after startTLS

2.1.0

  • Use secure connection if tlsOptions is specified or if url starts with ldaps: when constructing a client. Fix #71

2.0.3

  • Update npms
  • Make typescript lint rules more strict

2.0.2

  • Ignore case when determining if attribute is binary. Fix #11

2.0.1

  • Documentation updates

2.0.0

  • Drop support for nodejs v8
  • Update to Typescript 3.7
  • Fix exop response overwriting status and error message. Fixes #52
  • Update npms
  • Improve documentation. Lots of :heart: for ldapjs docs, ldapwiki, and ldap.com docs. Fix #31

1.10.0

  • Include original error message with exceptions. Fix #36
  • Include all requested attributes with search results. Fix #22
  • Add isConnected to Client. Fix #25
  • Try to fix socket ending and reference handling issues. Thanks @december1981! Fix #24
  • Update npms

1.9.0

  • Export Change and Attribute classes. Thanks @willmcenaney!
  • Parse search filter before sending partial request. Thanks @markhatchell!

1.8.0

  • Remove "dist" folder from published npm
  • Include type definitions as "dependencies" instead of "devDependencies"
  • Update npms

1.7.0

  • Add DN class as alternate option for specifying DNs. Thanks @adrianplavka!
  • Update npms

1.6.0

  • Fix incorrectly escaping search filter names/values. Fix #18

1.5.1

  • Do not throw "Size limit exceeded" error if sizeLimit is defined and the server responds with 4 (Size limit exceeded).

    • Note: It seems that items are returned even though the return status is 4 (Size limit exceeded).

      I'm not really sure what to do in that case. At this time, I decided against throwing an error and instead just returning the results returned thus far. That approach works with JumpCloud and forumsys' ldap servers

1.5.0

  • Update dependencies
  • Only include PagedResultsControl if searchOptions.paged is specified. Fixes #17
  • Make Filter.escape() public. Thanks @stiller-leser!
  • Fix FilterParser parsing of ExtensibleFilters to include attribute type. Hopefully fixes #16

1.4.2

  • Update dependencies
  • Add documentation for search options

1.4.1

  • Fix 'Socket connection not established' when server closes the connection (Fix #13). Thanks @trevh3!

1.4.0

  • Support binary attribute values (Fix #11)

1.3.0

  • Add Entry interface for SearchEntry. Thanks @hikaru7719!

1.2.3

  • Move asn1 type definitions to DefinitelyTyped

1.2.2

  • Fix error message for InvalidCredentialsError

1.2.1

  • Provide exports for public classes: errors, filters, and messages (Fix #4)

1.2.0

  • Fix escaping filter attribute names and values

1.1.4

  • Fix Add and Modify to handle the response from the server. Thanks @adrianplavka!

1.1.3

  • Update dev dependencies

1.1.2

  • Fix ECONNRESET issue connecting to non-secure endpoint
  • Throw an error for each message on socket error

1.1.1

  • Add original string to error message when parsing filters
  • Adjust parsing & and | in filters
  • Add more filter parsing tests

1.1.0

  • Add client.add() and client.modify()

1.0.6

  • Use hex for message type code in closed message error message
  • Add additional test for calling unbind() multiple times

1.0.5

  • Add message name to error message when socket is closed before message response

1.0.4

  • Add type definitions for asn1
  • Add message type id to error when cleaning pending messages.
  • Force protocolOperation to be defined for Message types

1.0.3

  • Verify the socket exists before sending unbind message

1.0.2

  • Setup prepublish to always build.
  • Push fix from 1.0.1

1.0.1

  • Fix search to return attribute values by default

1.0.0

  • Initial release