Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 884dac6

Browse files
committed
Initial commit
0 parents  commit 884dac6

12 files changed

+255
-0
lines changed

.gitignore

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
*.ldif
2+
*.tar.*
3+
*.tgz
4+
5+
.nova/
6+
7+
# Lock files
8+
pnpm-lock.yaml
9+
shrinkwrap.yaml
10+
package-lock.json
11+
yarn.lock
12+
13+
# Logs
14+
logs
15+
*.log
16+
npm-debug.log*
17+
18+
# Runtime data
19+
pids
20+
*.pid
21+
*.seed
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
29+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# node-waf configuration
33+
.lock-wscript
34+
35+
# Compiled binary addons (http://nodejs.org/api/addons.html)
36+
build/Release
37+
38+
# Dependency directory
39+
node_modules
40+
41+
# Optional npm cache directory
42+
.npm
43+
44+
# Optional REPL history
45+
.node_repl_history
46+
47+
# 0x
48+
.__browserify_string_empty.js
49+
profile-*
50+
*.flamegraph
51+
52+
# tap --cov
53+
.nyc_output/
54+
55+
# JetBrains IntelliJ IDEA
56+
.idea/
57+
*.iml
58+
59+
# VS Code
60+
.vscode/
61+
62+
# xcode
63+
build/*
64+
*.mode1
65+
*.mode1v3
66+
*.mode2v3
67+
*.perspective
68+
*.perspectivev3
69+
*.pbxuser
70+
*.xcworkspace
71+
xcuserdata
72+
73+
# macOS
74+
.DS_Store
75+
76+
# keys
77+
*.pem
78+
*.env.json
79+
*.env

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2011 Mark Cavage, All rights reserved.
4+
Copyright (c) 2022 The LDAPJS Collaborators.
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE

Readme.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# `@ldapjs/protocol`
2+
3+
This package provides a set of constant values and ASN.1 tags that are used
4+
throughout the LDAP protocol. The constants are taken primarily from the
5+
corresponding RFC: https://datatracker.ietf.org/doc/html/rfc4511.

index.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict'
2+
3+
const path = require('path')
4+
const fs = require('fs')
5+
6+
const componentsPath = path.join(__dirname, 'lib')
7+
const components = fs.readdirSync(componentsPath)
8+
9+
const protocol = {}
10+
11+
for (const component of components) {
12+
if (component.endsWith('test.js')) continue
13+
14+
protocol[path.basename(component, '.js')] = Object.freeze(
15+
require(path.join(componentsPath, component))
16+
)
17+
}
18+
19+
module.exports = Object.freeze(protocol)

index.test.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict'
2+
3+
const tap = require('tap')
4+
const protocol = require('./')
5+
6+
tap.test('exports expected object', async t => {
7+
t.equal(Object.isFrozen(protocol), true);
8+
['core', 'operations', 'search'].forEach(component => {
9+
t.ok(protocol[component])
10+
t.equal(Object.isFrozen(protocol[component]), true)
11+
})
12+
})

lib/core.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict'
2+
3+
module.exports = {
4+
LDAP_VERSION_3: 0x03,
5+
LBER_SET: 0x31,
6+
LDAP_CONTROLS: 0xa0
7+
}

lib/core.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict'
2+
3+
const tap = require('tap')
4+
const core = require('./core')
5+
6+
tap.test('exports object', async t => {
7+
t.type(core, 'Object')
8+
})

lib/operations.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict'
2+
3+
module.exports = {
4+
LDAP_REQ_BIND: 0x60,
5+
LDAP_REQ_UNBIND: 0x42,
6+
LDAP_REQ_SEARCH: 0x63,
7+
LDAP_REQ_MODIFY: 0x66,
8+
LDAP_REQ_ADD: 0x68,
9+
LDAP_REQ_DELETE: 0x4a,
10+
LDAP_REQ_MODRDN: 0x6c,
11+
LDAP_REQ_COMPARE: 0x6e,
12+
LDAP_REQ_ABANDON: 0x50,
13+
LDAP_REQ_EXTENSION: 0x77,
14+
15+
LDAP_RES_BIND: 0x61,
16+
LDAP_RES_SEARCH_ENTRY: 0x64,
17+
LDAP_RES_SEARCH_REF: 0x73,
18+
LDAP_RES_SEARCH: 0x65,
19+
LDAP_RES_MODIFY: 0x67,
20+
LDAP_RES_ADD: 0x69,
21+
LDAP_RES_DELETE: 0x6b,
22+
LDAP_RES_MODRDN: 0x6d,
23+
LDAP_RES_COMPARE: 0x6f,
24+
LDAP_RES_EXTENSION: 0x78
25+
}

lib/operations.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict'
2+
3+
const tap = require('tap')
4+
const operations = require('./operations')
5+
6+
tap.test('exports object', async t => {
7+
t.type(operations, 'Object')
8+
})

lib/search.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict'
2+
3+
/**
4+
* Value constants and ASN.1 tags as defined in:
5+
* https://datatracker.ietf.org/doc/html/rfc4511#section-4.5.1
6+
*/
7+
module.exports = {
8+
SCOPE_BASE_OBJECT: 0,
9+
SCOPE_ONE_LEVEL: 1,
10+
SCOPE_SUBTREE: 2,
11+
12+
NEVER_DEREF_ALIASES: 0,
13+
DEREF_IN_SEARCHING: 1,
14+
DEREF_BASE_OBJECT: 2,
15+
DEREF_ALWAYS: 3,
16+
17+
FILTER_AND: 0xa0,
18+
FILTER_OR: 0xa1,
19+
FILTER_NOT: 0xa2,
20+
FILTER_EQUALITY: 0xa3,
21+
FILTER_SUBSTRINGS: 0xa4,
22+
FILTER_GE: 0xa5,
23+
FILTER_LE: 0xa6,
24+
FILTER_PRESENT: 0x87,
25+
FILTER_APPROX: 0xa8,
26+
FILTER_EXT: 0xa9
27+
}

lib/search.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict'
2+
3+
const tap = require('tap')
4+
const search = require('./search')
5+
6+
tap.test('exports object', async t => {
7+
t.type(search, 'Object')
8+
})

package.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "@ldapjs/protocol",
3+
"version": "1.0.0",
4+
"description": "Provides constants for LDAP ASN.1 tags and values.",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "tap --no-cov -R terse",
8+
"test:ci": "tap --coverage-report=lcovonly -R terse",
9+
"test:cov": "tap -R terse",
10+
"test:cov:html": "tap --coverage-report=html -R terse",
11+
"test:watch": "tap -n -w --no-coverage-report -R terse"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+ssh://[email protected]/ldapjs/protocol.git"
16+
},
17+
"keywords": [
18+
"ldapjs"
19+
],
20+
"author": "James Sumners",
21+
"license": "MIT",
22+
"bugs": {
23+
"url": "https://github.com/ldapjs/protocol/issues"
24+
},
25+
"homepage": "https://github.com/ldapjs/protocol#readme",
26+
"devDependencies": {
27+
"@fastify/pre-commit": "^2.0.2",
28+
"eslint": "^8.17.0",
29+
"eslint-config-standard": "^17.0.0",
30+
"eslint-plugin-import": "^2.26.0",
31+
"eslint-plugin-n": "^15.2.1",
32+
"eslint-plugin-promise": "^6.0.0",
33+
"tap": "^16.2.0"
34+
}
35+
}

0 commit comments

Comments
 (0)