-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(saslprep): add package COMPASS-6996 (#145)
This is the current source of https://github.com/reklatsmasters/saslprep, with only the necessary modifications to align this package with the other devtools-shared repository (which does include moving it to TypeScript and switching from jest to mocha/chai).
- Loading branch information
Showing
21 changed files
with
1,604 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ignores: | ||
- '@mongodb-js/prettier-config-devtools' | ||
- '@mongodb-js/tsconfig-devtools' | ||
- '@types/chai' | ||
- '@types/sinon-chai' | ||
- 'sinon' | ||
ignore-patterns: | ||
- 'dist' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.nyc-output | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['@mongodb-js/eslint-config-devtools'], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: ['./tsconfig-lint.json'], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@mongodb-js/mocha-config-devtools'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.nyc_output | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"@mongodb-js/prettier-config-devtools" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Change Log | ||
|
||
All notable changes to the "saslprep" package will be documented in this file. | ||
|
||
## [1.0.3] - 2019-05-01 | ||
|
||
- Correctly get code points >U+FFFF ([#5](https://github.com/reklatsmasters/saslprep/pull/5)) | ||
- Fix perfomance downgrades from [#5](https://github.com/reklatsmasters/saslprep/pull/5). | ||
|
||
## [1.0.2] - 2018-09-13 | ||
|
||
- Reduced initialization time ([#3](https://github.com/reklatsmasters/saslprep/issues/3)) | ||
|
||
## [1.0.1] - 2018-06-20 | ||
|
||
- Reduced stack overhead of range creation ([#2](https://github.com/reklatsmasters/saslprep/pull/2)) | ||
|
||
## [1.0.0] - 2017-06-21 | ||
|
||
- First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2014 Dmitry Tsvettsikh | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"name": "@mongodb-js/saslprep", | ||
"description": "SASLprep: Stringprep Profile for User Names and Passwords, rfc4013", | ||
"keywords": [ | ||
"sasl", | ||
"saslprep", | ||
"stringprep", | ||
"rfc4013", | ||
"4013" | ||
], | ||
"author": "Dmitry Tsvettsikh <me@reklatsmasters.com>", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "dist/index.js", | ||
"bugs": { | ||
"url": "https://jira.mongodb.org/projects/COMPASS/issues", | ||
"email": "compass@mongodb.com" | ||
}, | ||
"homepage": "https://github.com/mongodb-js/devtools-shared/tree/main/packages/saslprep", | ||
"version": "1.0.3", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mongodb-js/devtools-shared.git" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"license": "MIT", | ||
"exports": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/.esm-wrapper.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"gen-code-points": "ts-node src/generate-code-points.ts > src/code-points-data.ts", | ||
"bootstrap": "npm run compile", | ||
"prepublishOnly": "npm run compile", | ||
"compile": "npm run gen-code-points && tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs", | ||
"typecheck": "tsc --noEmit", | ||
"eslint": "eslint", | ||
"prettier": "prettier", | ||
"lint": "npm run eslint . && npm run prettier -- --check .", | ||
"depcheck": "depcheck", | ||
"check": "npm run typecheck && npm run lint && npm run depcheck", | ||
"check-ci": "npm run check", | ||
"test": "mocha", | ||
"test-cov": "nyc -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test", | ||
"test-watch": "npm run test -- --watch", | ||
"test-ci": "npm run test-cov", | ||
"reformat": "npm run prettier -- --write ." | ||
}, | ||
"dependencies": { | ||
"sparse-bitfield": "^3.0.3" | ||
}, | ||
"devDependencies": { | ||
"@mongodb-js/eslint-config-devtools": "0.9.10", | ||
"@mongodb-js/mocha-config-devtools": "^1.0.1", | ||
"@mongodb-js/prettier-config-devtools": "^1.0.1", | ||
"@mongodb-js/tsconfig-devtools": "^1.0.1", | ||
"@types/chai": "^4.2.21", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^17.0.35", | ||
"@types/sinon-chai": "^3.2.5", | ||
"@types/sparse-bitfield": "^3.0.1", | ||
"chai": "^4.3.6", | ||
"depcheck": "^1.4.1", | ||
"eslint": "^7.25.0", | ||
"gen-esm-wrapper": "^1.1.0", | ||
"mocha": "^8.4.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.3.2", | ||
"sinon": "^9.2.3", | ||
"typescript": "^5.0.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# saslprep | ||
|
||
_Note: This is a fork of the original [`saslprep`](https://www.npmjs.com/package/saslprep) npm package | ||
and provides equivalent functionality._ | ||
|
||
Stringprep Profile for User Names and Passwords, [rfc4013](https://tools.ietf.org/html/rfc4013) | ||
|
||
### Usage | ||
|
||
```js | ||
const saslprep = require('@mongodb-js/saslprep'); | ||
|
||
saslprep('password\u00AD'); // password | ||
saslprep('password\u0007'); // Error: prohibited character | ||
``` | ||
|
||
### API | ||
|
||
##### `saslprep(input: String, opts: Options): String` | ||
|
||
Normalize user name or password. | ||
|
||
##### `Options.allowUnassigned: bool` | ||
|
||
A special behavior for unassigned code points, see https://tools.ietf.org/html/rfc4013#section-2.5. Disabled by default. | ||
|
||
## License | ||
|
||
MIT, 2017-2019 (c) Dmitriy Tsvettsikh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { gunzipSync } from 'zlib'; | ||
|
||
export default gunzipSync( | ||
Buffer.from( | ||
'H4sIAAAAAAACA+3dTYgcWR0A8FfTnekQ47aCkBxiZpYV8RhwYQM7bA/ksoLgSRD0IOSiePAkLrowvWSF4CkHEW856MlTQHA9RKZ1ZJODsEcVcTOyhxUEbXdXtpPp1PNVV39Uz4czEyaTVOb3G6a7XtWrr/devX49/+qekG2Go7Aa2jHGyozG+Dmrzi2mP/xb/zMhLI+WlRm2byubm2h0ivVi7BYzusVjuNkt1l9uFWsutWL8OP4rzV9KeXdsKx1HFhbSc6vIG0fKBZ14UNfLFS6FRrGRtXh98ZvphL/x4uLV/IOzaat/vlikv/TixavxR8PQitfPpKNbffXSwgtr8fV07GX+L1967urwg5W0/t0LV37y/oWFlQtX8ping7reXE3LT680r9y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