Skip to content

Commit 51a8eb8

Browse files
Wack FXWack FX
authored andcommitted
fix: postgres SASL
1 parent 12dcdaf commit 51a8eb8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

cf/polyfills.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,8 @@ if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
439439
*/
440440

441441
const sha256 = (x) => {
442-
return Crypto.subtle.digest("SHA-256", textEncoder.encode(x)).then((digest) =>
443-
Array.from(new Uint8Array(digest))
444-
.map((b) => b.toString(16).padStart(2, "0"))
445-
.join("")
446-
)
442+
let message = x
443+
if (!(x instanceof Uint8Array))
444+
message = textEncoder.encode(x)
445+
return Crypto.subtle.digest("SHA-256", message)
447446
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@
5656
"pg",
5757
"database"
5858
]
59-
}
59+
}

0 commit comments

Comments
 (0)