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

Function getHexSha256

src/cmap/auth/aws4.ts:31–36  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

29 * @returns Hexadecimal representation of the hash.
30 */
31const getHexSha256 = async (str: string): Promise<string> => {
32 const data = stringToBuffer(str);
33 const hashBuffer = await crypto.subtle.digest('SHA-256', data);
34 const hashHex = ByteUtils.toHex(new Uint8Array(hashBuffer));
35 return hashHex;
36};
37
38/**
39 * Calculates the HMAC-SHA256 of a string using the provided key.

Callers 1

aws4SignFunction · 0.85

Calls 1

stringToBufferFunction · 0.85

Tested by

no test coverage detected