Socket
Socket
Sign inDemoInstall

ldapts

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldapts - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

### 1.4.0
* Support binary attribute values (Fix #11)
### 1.3.0

@@ -2,0 +6,0 @@

6

dist/Attribute.d.ts

@@ -0,12 +1,14 @@

/// <reference types="node" />
import { BerReader, BerWriter } from 'asn1';
export interface AttributeOptions {
type?: string;
values?: string[];
values?: string[] | Buffer[];
}
export declare class Attribute {
type: string;
values: string[];
values: string[] | Buffer[];
constructor(options?: AttributeOptions);
write(writer: BerWriter): void;
parse(reader: BerReader): void;
private _isBinaryType;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const asn1_1 = require("asn1");
const ProtocolOperation_1 = require("./ProtocolOperation");

@@ -11,7 +12,18 @@ class Attribute {

writer.startSequence();
writer.writeString(this.type);
let type = this.type;
const isBinaryType = this._isBinaryType();
// If the value is a buffer and the type does not end in ;binary, append it
if (!isBinaryType && this.values.length && Buffer.isBuffer(this.values[0])) {
type += ';binary';
}
writer.writeString(type);
writer.startSequence(ProtocolOperation_1.ProtocolOperation.LBER_SET);
if (this.values.length) {
for (const value of this.values) {
writer.writeString(value);
if (Buffer.isBuffer(value)) {
writer.writeBuffer(value, asn1_1.Ber.OctetString);
}
else {
writer.writeString(value);
}
}

@@ -28,2 +40,3 @@ }

this.type = reader.readString();
const isBinaryType = this._isBinaryType();
if (reader.peek() === ProtocolOperation_1.ProtocolOperation.LBER_SET) {

@@ -33,3 +46,8 @@ if (reader.readSequence(ProtocolOperation_1.ProtocolOperation.LBER_SET)) {

while (reader.offset < end) {
this.values.push(reader.readString());
if (isBinaryType) {
this.values.push(reader.readString(asn1_1.Ber.OctetString, true) || Buffer.alloc(0));
}
else {
this.values.push(reader.readString());
}
}

@@ -39,4 +57,7 @@ }

}
_isBinaryType() {
return /;binary$/.test(this.type);
}
}
exports.Attribute = Attribute;
//# sourceMappingURL=Attribute.js.map

@@ -0,1 +1,2 @@

/// <reference types="node" />
import { BerReader } from 'asn1';

@@ -11,3 +12,3 @@ import { MessageResponse, MessageResponseOptions } from './MessageResponse';

dn: string;
[index: string]: string | string[];
[index: string]: string | string[] | Buffer | Buffer[];
}

@@ -14,0 +15,0 @@ export declare class SearchEntry extends MessageResponse {

{
"name": "ldapts",
"version": "1.3.0",
"version": "1.4.0",
"description": "LDAP client",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc