MCPcopy
hub / github.com/mongodb/node-mongodb-native / parsePayload

Function parsePayload

src/cmap/auth/scram.ts:206–215  ·  view source on GitHub ↗
(payload: Binary)

Source from the content-addressed store, hash-verified

204}
205
206function parsePayload(payload: Binary) {
207 const payloadStr = ByteUtils.toUTF8(payload.buffer, 0, payload.position, false);
208 const dict: Document = {};
209 const parts = payloadStr.split(',');
210 for (let i = 0; i < parts.length; i++) {
211 const valueParts = (parts[i].match(/^([^=]*)=(.*)$/) ?? []).slice(1);
212 dict[valueParts[0]] = valueParts[1];
213 }
214 return dict;
215}
216
217function passwordDigest(username: string, password: string) {
218 if (typeof username !== 'string') {

Callers 1

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected