ldapjs-type-parsers

0.1.5 • Public • Published

Functions

coerceEntry(entry)Object

Coerce an ldapjs entry into an object with keys (using entry.object as a base) (This uses module.attributeTransforms to map attribute names to type parsers. Many of the names present are Active-Directory-LDAP specific and I don't honestly know how well it works on other instances)

parseInteger8(buffer)Number

Parse an LDAP Interger8 buffer into a Number

bufferToPEMCertString(buffer)String

Parse an LDAP OctetString buffer into a base 64 encoded certificate string with line breaks every 64 characters. (this should match the content in a .pem certificate file)

PEMCertStringToBuffer(str)Buffer

Parse a base 64 encoded certificate string into a buffer representing an LDAP OctetString.

parseGeneralizedDate(buffer)Date

Parse an LDAP GeneralizedDate buffer into a javascript Date object

toGeneralizedDateString(date)String

Convert a javascript Date object into an LDAP GeneralizedDate string (Can be converted to a buffer with Buffer.from(str, 'utf8) but the most common use-case is in ldapjs filters, which take a string)

parseIntegerDate(buffer)Date

Parse an LDAP IntegerDate buffer into a javascript Date object

toIntegerDateString(date)String

Convert a javascript Date object into an LDAP IntegerDate string (Can be converted to a buffer with Buffer.from(str, 'utf8) but the most common use-case is in ldapjs filters, which take a string)

parseLargeInteger(buffer, NumberType)Date

Parse an LDAP IntegerDate buffer into a javascript Date object

parseObjectSID(buffer)String

Parse an LDAP ObjectSID buffer into a string

toObjectSIDBuffer(str)Buffer

Convert an objectSID string into an LDAP ObjectSID buffer

parseObjectGUID(buffer)String

Parse an LDAP ObjectGUID buffer into a string

toObjectGUIDBuffer(str)Buffer

Convert an ObjectGUID string into an LDAP ObjectGUID buffer

parseBoolean(buffer)Boolean

Parse an LDAP Boolean buffer into a javascript Boolean

toBooleanString(buffer)String

Convert a javascript Boolean into a string representation of an LDAP Boolean

parseUnicodeString(buffer)String

Parse an LDAP UnicodeString buffer into a javascript String

parseUserAccountControl(buffer)Object

Parse an LDAP UserAccountControl buffer into a javascript Object

parseSAMAccountType(buffer)Object

Parse an LDAP SAMAccountType buffer into a javascript Object

coerceEntry(entry) ⇒ Object

Coerce an ldapjs entry into an object with keys (using entry.object as a base) (This uses module.attributeTransforms to map attribute names to type parsers. Many of the names present are Active-Directory-LDAP specific and I don't honestly know how well it works on other instances)

Kind: global function
Returns: Object - An object in the form { sAMAccountName: 'PickleRick', objectSid: 'S-1-5-21-3231561394-915883793-4011936924-6446' }

Param Type Description
entry Object An entry object retuend from ldapjs

parseInteger8(buffer) ⇒ Number

Parse an LDAP Interger8 buffer into a Number

Kind: global function
Returns: Number - A Number

Param Type Description
buffer Buffer A buffer representing an attribute of type Integer8.

bufferToPEMCertString(buffer) ⇒ String

Parse an LDAP OctetString buffer into a base 64 encoded certificate string with line breaks every 64 characters. (this should match the content in a .pem certificate file)

Kind: global function
Returns: String - A Base64 string

Param Type Description
buffer Buffer A buffer representing an LDAP attribute of type OctetString

PEMCertStringToBuffer(str) ⇒ Buffer

Parse a base 64 encoded certificate string into a buffer representing an LDAP OctetString.

Kind: global function
Returns: Buffer - A buffer representing an LDAP attribute of type OctetString.

Param Type Description
str String A Base64 string

parseGeneralizedDate(buffer) ⇒ Date

Parse an LDAP GeneralizedDate buffer into a javascript Date object

Kind: global function
Returns: Date - A Date object

Param Type Description
buffer Buffer A buffer representing an LDAP GeneralizedDate attribute.

toGeneralizedDateString(date) ⇒ String

Convert a javascript Date object into an LDAP GeneralizedDate string (Can be converted to a buffer with Buffer.from(str, 'utf8) but the most common use-case is in ldapjs filters, which take a string)

Kind: global function
Returns: String - - A String in the format "YYYYMMDDHHMMSS.mmmZ" eg."20211225070000.000Z"

Param Type Description
date Date A Date object

parseIntegerDate(buffer) ⇒ Date

Parse an LDAP IntegerDate buffer into a javascript Date object

Kind: global function
Returns: Date - A Date object

Param Type Description
buffer Buffer A buffer representing an LDAP IntegerDate attribute.

toIntegerDateString(date) ⇒ String

Convert a javascript Date object into an LDAP IntegerDate string (Can be converted to a buffer with Buffer.from(str, 'utf8) but the most common use-case is in ldapjs filters, which take a string)

Kind: global function
Returns: String - - A string representation of an integer

Param Type Description
date Date A Date object

parseLargeInteger(buffer, NumberType) ⇒ Date

Parse an LDAP IntegerDate buffer into a javascript Date object

Kind: global function
Returns: Date - A Date object

Param Type Description
buffer Buffer A buffer representing an LDAP IntegerDate attribute.
NumberType function A constructor for the Type of Number you want returned (defaults to String). You can supply "BigInt" here, if your environment supports it.

parseObjectSID(buffer) ⇒ String

Parse an LDAP ObjectSID buffer into a string

Kind: global function
Returns: String - An ObjectSID string eg S-1-5-21-3231561394-915883793-4011936924-6446

Param Type Description
buffer Buffer A buffer representing an LDAP ObjectSID attribute.

toObjectSIDBuffer(str) ⇒ Buffer

Convert an objectSID string into an LDAP ObjectSID buffer

Kind: global function
Returns: Buffer - A buffer representing an LDAP ObjectSID

Param Type Description
str String An ObjectSID string eg. S-1-5-21-3231561394-915883793-4011936924-6446

parseObjectGUID(buffer) ⇒ String

Parse an LDAP ObjectGUID buffer into a string

Kind: global function
Returns: String - An ObjectSID string eg S-1-5-21-3231561394-915883793-4011936924-6446

Param Type Description
buffer Buffer A buffer representing an LDAP ObjectGUID attribute.

toObjectGUIDBuffer(str) ⇒ Buffer

Convert an ObjectGUID string into an LDAP ObjectGUID buffer

Kind: global function
Returns: Buffer - A buffer representing an LDAP ObjectGUID attribute

Param Type Description
str String An ObjectGUID string eg. 1E633E26-741B-4D0E-94C7-64D8DED0791F

parseBoolean(buffer) ⇒ Boolean

Parse an LDAP Boolean buffer into a javascript Boolean

Kind: global function
Returns: Boolean - A javascript Boolean

Param Type Description
buffer Buffer A buffer representing an LDAP Boolean attribute.

toBooleanString(buffer) ⇒ String

Convert a javascript Boolean into a string representation of an LDAP Boolean

Kind: global function
Returns: String - An upper case javascript string. Either "TRUE" or "FALSE"

Param Type Description
buffer Boolean A buffer representing an LDAP Boolean attribute

parseUnicodeString(buffer) ⇒ String

Parse an LDAP UnicodeString buffer into a javascript String

Kind: global function
Returns: String - A javascript String

Param Type Description
buffer Buffer A buffer representing an LDAP UnicodeString attribute

parseUserAccountControl(buffer) ⇒ Object

Parse an LDAP UserAccountControl buffer into a javascript Object

Kind: global function
Returns: Object - A javascript Object with Boolean properties representing each possible flag in a UserAccountControl bitmask eg: { accountDisabled: true, lockedOut: false, ...}

Param Type Description
buffer Buffer A buffer representing an LDAP UserAccountControl attribute

parseSAMAccountType(buffer) ⇒ Object

Parse an LDAP SAMAccountType buffer into a javascript Object

Kind: global function
Returns: Object - A javascript Object with Boolean properties representing each possible flag in a SAMAccountType bitmask eg: { userObject: true, normalUserAccount: true, ...}

Param Type Description
buffer Buffer A buffer representing an LDAP SAMAccountType attribute

Package Sidebar

Install

npm i ldapjs-type-parsers

Weekly Downloads

21

Version

0.1.5

License

MIT

Unpacked Size

31.3 kB

Total Files

5

Last publish

Collaborators

  • houldsg