Skip to content

Commit 49dfe25

Browse files
committed
pr feedback:
- avoid throwing by toUTF8 - clarify comments
1 parent 0b72911 commit 49dfe25

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/cmap/auth/scram.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ async function continueScramConversation(
167167
const serverKey = await HMAC(cryptoMethod, saltedPassword, 'Server Key');
168168
const storedKey = await H(cryptoMethod, clientKey);
169169
const firstMessageBytes = clientFirstMessageBare(username, nonce);
170-
const firstMessage = ByteUtils.toUTF8(firstMessageBytes, 0, firstMessageBytes.length, true);
171-
const payloadString = ByteUtils.toUTF8(payload.buffer, 0, payload.position, true);
170+
const firstMessage = ByteUtils.toUTF8(firstMessageBytes, 0, firstMessageBytes.length, false);
171+
const payloadString = ByteUtils.toUTF8(payload.buffer, 0, payload.position, false);
172172
const authMessage = [firstMessage, payloadString, withoutProof].join(',');
173173

174174
const clientSignature = await HMAC(cryptoMethod, storedKey, authMessage);
@@ -204,7 +204,7 @@ async function continueScramConversation(
204204
}
205205

206206
function parsePayload(payload: Binary) {
207-
const payloadStr = ByteUtils.toUTF8(payload.buffer, 0, payload.position, true);
207+
const payloadStr = ByteUtils.toUTF8(payload.buffer, 0, payload.position, false);
208208
const dict: Document = {};
209209
const parts = payloadStr.split(',');
210210
for (let i = 0; i < parts.length; i++) {

test/tools/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,13 @@ export const runtime: Runtime = resolveRuntimeAdapters({});
627627

628628
/**
629629
* Metadata that can be used to skip tests in nodeless environments.
630+
* Use this for tests that rely on Node.js-specific features and cannot be run in nodeless environments like Deno or the browser.
630631
*/
631632
export const runOnlyInNodeMetadata: MongoDBMetadataUI = {
632633
requires: {
633634
predicate: _test => {
634635
if (runNodelessTests) {
635-
return 'Test is not node specific and should be run in nodeless environments';
636+
return 'Test is a node specific test and should be not be run in nodeless environments';
636637
} else {
637638
return true;
638639
}

0 commit comments

Comments
 (0)