mongodb 6.9.0-dev.20240913.sha.8b0f3541 → 6.9.0-dev.20240918.sha.643a8755
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/beta.d.ts +45 -7
- package/lib/cmap/auth/mongo_credentials.js +2 -7
- package/lib/cmap/auth/mongo_credentials.js.map +1 -1
- package/lib/cmap/commands.js +3 -1
- package/lib/cmap/commands.js.map +1 -1
- package/lib/cmap/connection.js +6 -2
- package/lib/cmap/connection.js.map +1 -1
- package/lib/cmap/wire_protocol/constants.js +2 -2
- package/lib/cursor/aggregation_cursor.js.map +1 -1
- package/lib/cursor/find_cursor.js.map +1 -1
- package/lib/db.js +1 -1
- package/lib/explain.js +6 -6
- package/lib/explain.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/mongo_client_auth_providers.js +6 -2
- package/lib/mongo_client_auth_providers.js.map +1 -1
- package/lib/utils.js +5 -3
- package/lib/utils.js.map +1 -1
- package/lib/write_concern.js.map +1 -1
- package/mongodb.d.ts +45 -7
- package/package.json +1 -1
- package/src/cmap/auth/mongo_credentials.ts +2 -8
- package/src/cmap/commands.ts +18 -8
- package/src/cmap/connection.ts +6 -2
- package/src/cmap/wire_protocol/constants.ts +2 -2
- package/src/cursor/aggregation_cursor.ts +2 -2
- package/src/cursor/find_cursor.ts +2 -2
- package/src/db.ts +1 -1
- package/src/explain.ts +47 -11
- package/src/index.ts +6 -1
- package/src/mongo_client_auth_providers.ts +8 -2
- package/src/utils.ts +16 -5
- package/src/write_concern.ts +4 -1
- package/lib/cmap/auth/mongocr.js +0 -35
- package/lib/cmap/auth/mongocr.js.map +0 -1
- package/src/cmap/auth/mongocr.ts +0 -38
package/src/cmap/auth/mongocr.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as crypto from 'crypto';
|
|
2
|
-
|
|
3
|
-
import { MongoMissingCredentialsError } from '../../error';
|
|
4
|
-
import { ns } from '../../utils';
|
|
5
|
-
import { type AuthContext, AuthProvider } from './auth_provider';
|
|
6
|
-
|
|
7
|
-
export class MongoCR extends AuthProvider {
|
|
8
|
-
override async auth(authContext: AuthContext): Promise<void> {
|
|
9
|
-
const { connection, credentials } = authContext;
|
|
10
|
-
if (!credentials) {
|
|
11
|
-
throw new MongoMissingCredentialsError('AuthContext must provide credentials.');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const { username, password, source } = credentials;
|
|
15
|
-
|
|
16
|
-
const { nonce } = await connection.command(ns(`${source}.$cmd`), { getnonce: 1 }, undefined);
|
|
17
|
-
|
|
18
|
-
const hashPassword = crypto
|
|
19
|
-
.createHash('md5')
|
|
20
|
-
.update(`${username}:mongo:${password}`, 'utf8')
|
|
21
|
-
.digest('hex');
|
|
22
|
-
|
|
23
|
-
// Final key
|
|
24
|
-
const key = crypto
|
|
25
|
-
.createHash('md5')
|
|
26
|
-
.update(`${nonce}${username}${hashPassword}`, 'utf8')
|
|
27
|
-
.digest('hex');
|
|
28
|
-
|
|
29
|
-
const authenticateCommand = {
|
|
30
|
-
authenticate: 1,
|
|
31
|
-
user: username,
|
|
32
|
-
nonce,
|
|
33
|
-
key
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
await connection.command(ns(`${source}.$cmd`), authenticateCommand, undefined);
|
|
37
|
-
}
|
|
38
|
-
}
|