A collection of functions to parse raw buffers from LDAPJS
ObjectCoerce 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)
NumberParse an LDAP Interger8 buffer into a Number
StringParse 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)
BufferParse a base 64 encoded certificate string into a buffer representing an LDAP OctetString.
DateParse an LDAP GeneralizedDate buffer into a javascript Date object
StringConvert 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)
DateParse an LDAP IntegerDate buffer into a javascript Date object
StringConvert 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)
DateParse an LDAP IntegerDate buffer into a javascript Date object
StringParse an LDAP ObjectSID buffer into a string
BufferConvert an objectSID string into an LDAP ObjectSID buffer
StringParse an LDAP ObjectGUID buffer into a string
BufferConvert an ObjectGUID string into an LDAP ObjectGUID buffer
BooleanParse an LDAP Boolean buffer into a javascript Boolean
StringConvert a javascript Boolean into a string representation of an LDAP Boolean
StringParse an LDAP UnicodeString buffer into a javascript String
ObjectParse an LDAP UserAccountControl buffer into a javascript Object
ObjectParse an LDAP SAMAccountType buffer into a javascript Object
ObjectKind: 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 |
NumberKind: global function
Returns: Number - A Number
| Param | Type | Description |
| --- | --- | --- |
| buffer | Buffer | A buffer representing an attribute of type Integer8. |
StringKind: global function
Returns: String - A Base64 string
| Param | Type | Description |
| --- | --- | --- |
| buffer | Buffer | A buffer representing an LDAP attribute of type OctetString |
BufferKind: global function
Returns: Buffer - A buffer representing an LDAP attribute of type OctetString.
| Param | Type | Description |
| --- | --- | --- |
| str | String | A Base64 string |
DateKind: global function
Returns: Date - A Date object
| Param | Type | Description |
| --- | --- | --- |
| buffer | Buffer | A buffer representing an LDAP GeneralizedDate attribute. |
StringKind: global function
Returns: String - - A String in the format "YYYYMMDDHHMMSS.mmmZ" eg."20211225070000.000Z"
| Param | Type | Description |
| --- | --- | --- |
| date | Date | A Date object |
DateKind: global function
Returns: Date - A Date object
| Param | Type | Description |
| --- | --- | --- |
| buffer | Buffer | A buffer representing an LDAP IntegerDate attribute. |
StringKind: global function
Returns: String - - A string representation of an integer
| Param | Type | Description |
| --- | --- | --- |
| date | Date | A Date object |
DateKind: 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. |
StringKind: 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. |
BufferKind: 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 |
StringKind: 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. |
BufferKind: 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 |
BooleanKind: global function
Returns: Boolean - A javascript Boolean
| Param | Type | Description |
| --- | --- | --- |
| buffer | Buffer | A buffer representing an LDAP Boolean attribute. |
StringKind: 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 |
StringKind: global function
Returns: String - A javascript String
| Param | Type | Description |
| --- | --- | --- |
| buffer | Buffer | A buffer representing an LDAP UnicodeString attribute |
ObjectKind: 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 |
ObjectKind: 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 |